@visactor/vtable 0.10.2 → 0.10.3-alpha.1

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.
Files changed (67) hide show
  1. package/cjs/PivotChart.js +26 -25
  2. package/cjs/PivotChart.js.map +1 -1
  3. package/cjs/PivotTable.js +8 -8
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/components/axis/linear-scale.js.map +1 -1
  6. package/cjs/components/title/title.js +2 -1
  7. package/cjs/components/title/title.js.map +1 -1
  8. package/cjs/core/BaseTable.js +4 -4
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/dataset/dataset-pivot-table.js.map +1 -1
  11. package/cjs/dataset/dataset.js +4 -5
  12. package/cjs/dataset/dataset.js.map +1 -1
  13. package/cjs/dataset/flatDataToObject.js +2 -1
  14. package/cjs/dataset/flatDataToObject.js.map +1 -1
  15. package/cjs/header-helper/header-helper.js +1 -0
  16. package/cjs/header-helper/header-helper.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/layout/chart-helper/get-axis-config.d.ts +4 -1
  21. package/cjs/layout/chart-helper/get-axis-config.js +30 -20
  22. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  23. package/cjs/layout/chart-helper/get-chart-spec.js +11 -11
  24. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  25. package/cjs/layout/pivot-header-layout.js +21 -19
  26. package/cjs/layout/pivot-header-layout.js.map +1 -1
  27. package/cjs/layout/pivot-layout.js +9 -7
  28. package/cjs/layout/pivot-layout.js.map +1 -1
  29. package/cjs/scenegraph/layout/frozen.js +18 -4
  30. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  31. package/cjs/state/spark-line/index.js +3 -2
  32. package/cjs/state/spark-line/index.js.map +1 -1
  33. package/dist/vtable.js +203 -98
  34. package/dist/vtable.min.js +2 -2
  35. package/es/PivotChart.js +26 -25
  36. package/es/PivotChart.js.map +1 -1
  37. package/es/PivotTable.js +8 -8
  38. package/es/PivotTable.js.map +1 -1
  39. package/es/components/axis/linear-scale.js.map +1 -1
  40. package/es/components/title/title.js +2 -1
  41. package/es/components/title/title.js.map +1 -1
  42. package/es/core/BaseTable.js +4 -4
  43. package/es/core/BaseTable.js.map +1 -1
  44. package/es/dataset/dataset-pivot-table.js.map +1 -1
  45. package/es/dataset/dataset.js +4 -4
  46. package/es/dataset/dataset.js.map +1 -1
  47. package/es/dataset/flatDataToObject.js +2 -1
  48. package/es/dataset/flatDataToObject.js.map +1 -1
  49. package/es/header-helper/header-helper.js +1 -0
  50. package/es/header-helper/header-helper.js.map +1 -1
  51. package/es/index.d.ts +1 -1
  52. package/es/index.js +1 -1
  53. package/es/index.js.map +1 -1
  54. package/es/layout/chart-helper/get-axis-config.d.ts +4 -1
  55. package/es/layout/chart-helper/get-axis-config.js +30 -20
  56. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  57. package/es/layout/chart-helper/get-chart-spec.js +11 -11
  58. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  59. package/es/layout/pivot-header-layout.js +21 -19
  60. package/es/layout/pivot-header-layout.js.map +1 -1
  61. package/es/layout/pivot-layout.js +9 -7
  62. package/es/layout/pivot-layout.js.map +1 -1
  63. package/es/scenegraph/layout/frozen.js +18 -4
  64. package/es/scenegraph/layout/frozen.js.map +1 -1
  65. package/es/state/spark-line/index.js +3 -2
  66. package/es/state/spark-line/index.js.map +1 -1
  67. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VTable={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var r=function(t){return t&&t.Math==Math&&t},o=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),s={},a=function(t){try{return!!t()}catch(t){return!0}},l=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),h=!a((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),c=h,u=Function.prototype.call,d=c?u.bind(u):function(){return u.apply(u,arguments)},p={},f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,m=g&&!f.call({1:2},1);p.f=m?function(t){var e=g(this,t);return!!e&&e.enumerable}:f;var y,b,v=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},w=h,C=Function.prototype,x=C.call,_=w&&C.bind.bind(x,x),S=w?_:function(t){return function(){return x.apply(t,arguments)}},A=S,T=A({}.toString),B=A("".slice),M=function(t){return B(T(t),8,-1)},R=a,P=M,E=Object,H=S("".split),L=R((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==P(t)?H(t,""):E(t)}:E,k=function(t){return null==t},I=k,O=TypeError,D=function(t){if(I(t))throw O("Can't call method on "+t);return t},F=L,z=D,W=function(t){return F(z(t))},j="object"==typeof document&&document.all,N={all:j,IS_HTMLDDA:void 0===j&&void 0!==j},G=N.all,V=N.IS_HTMLDDA?function(t){return"function"==typeof t||t===G}:function(t){return"function"==typeof t},U=V,K=N.all,$=N.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:U(t)||t===K}:function(t){return"object"==typeof t?null!==t:U(t)},X=o,Y=V,q=function(t,e){return arguments.length<2?(i=X[t],Y(i)?i:void 0):X[t]&&X[t][e];var i},Z=S({}.isPrototypeOf),J=o,Q="undefined"!=typeof navigator&&String(navigator.userAgent)||"",et=J.process,it=J.Deno,nt=et&&et.versions||it&&it.version,rt=nt&&nt.v8;rt&&(b=(y=rt.split("."))[0]>0&&y[0]<4?1:+(y[0]+y[1])),!b&&Q&&(!(y=Q.match(/Edge\/(\d+)/))||y[1]>=74)&&(y=Q.match(/Chrome\/(\d+)/))&&(b=+y[1]);var ot=b,st=a,at=o.String,lt=!!Object.getOwnPropertySymbols&&!st((function(){var t=Symbol();return!at(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&ot&&ot<41})),ht=lt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ct=q,ut=V,dt=Z,pt=Object,ft=ht?function(t){return"symbol"==typeof t}:function(t){var e=ct("Symbol");return ut(e)&&dt(e.prototype,pt(t))},gt=String,mt=function(t){try{return gt(t)}catch(t){return"Object"}},yt=V,bt=mt,vt=TypeError,wt=function(t){if(yt(t))return t;throw vt(bt(t)+" is not a function")},Ct=wt,xt=k,_t=function(t,e){var i=t[e];return xt(i)?void 0:Ct(i)},St=d,At=V,Tt=$,Bt=TypeError,Mt={exports:{}},Rt=o,Pt=Object.defineProperty,Et=function(t,e){try{Pt(Rt,t,{value:e,configurable:!0,writable:!0})}catch(i){Rt[t]=e}return e},Ht=Et,Lt="__core-js_shared__",kt=o[Lt]||Ht(Lt,{}),It=kt;(Mt.exports=function(t,e){return It[t]||(It[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ot=Mt.exports,Dt=D,Ft=Object,zt=function(t){return Ft(Dt(t))},Wt=zt,jt=S({}.hasOwnProperty),Nt=Object.hasOwn||function(t,e){return jt(Wt(t),e)},Gt=S,Vt=0,Ut=Math.random(),Kt=Gt(1..toString),$t=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Kt(++Vt+Ut,36)},Xt=Ot,Yt=Nt,qt=$t,Zt=lt,Jt=ht,Qt=o.Symbol,te=Xt("wks"),ee=Jt?Qt.for||Qt:Qt&&Qt.withoutSetter||qt,ie=function(t){return Yt(te,t)||(te[t]=Zt&&Yt(Qt,t)?Qt[t]:ee("Symbol."+t)),te[t]},ne=d,re=$,oe=ft,se=_t,ae=function(t,e){var i,n;if("string"===e&&At(i=t.toString)&&!Tt(n=St(i,t)))return n;if(At(i=t.valueOf)&&!Tt(n=St(i,t)))return n;if("string"!==e&&At(i=t.toString)&&!Tt(n=St(i,t)))return n;throw Bt("Can't convert object to primitive value")},le=TypeError,he=ie("toPrimitive"),ce=function(t,e){if(!re(t)||oe(t))return t;var i,n=se(t,he);if(n){if(void 0===e&&(e="default"),i=ne(n,t,e),!re(i)||oe(i))return i;throw le("Can't convert object to primitive value")}return void 0===e&&(e="number"),ae(t,e)},ue=ft,de=function(t){var e=ce(t,"string");return ue(e)?e:e+""},pe=$,fe=o.document,ge=pe(fe)&&pe(fe.createElement),me=function(t){return ge?fe.createElement(t):{}},ye=me,be=!l&&!a((function(){return 7!=Object.defineProperty(ye("div"),"a",{get:function(){return 7}}).a})),ve=l,we=d,Ce=p,xe=v,_e=W,Se=de,Ae=Nt,Te=be,Be=Object.getOwnPropertyDescriptor;s.f=ve?Be:function(t,e){if(t=_e(t),e=Se(e),Te)try{return Be(t,e)}catch(t){}if(Ae(t,e))return xe(!we(Ce.f,t,e),t[e])};var Me={},Re=l&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Pe=$,Ee=String,He=TypeError,Le=function(t){if(Pe(t))return t;throw He(Ee(t)+" is not an object")},ke=l,Ie=be,Oe=Re,De=Le,Fe=de,ze=TypeError,We=Object.defineProperty,je=Object.getOwnPropertyDescriptor,Ne="enumerable",Ge="configurable",Ve="writable";Me.f=ke?Oe?function(t,e,i){if(De(t),e=Fe(e),De(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Ve in i&&!i[Ve]){var n=je(t,e);n&&n[Ve]&&(t[e]=i.value,i={configurable:Ge in i?i[Ge]:n[Ge],enumerable:Ne in i?i[Ne]:n[Ne],writable:!1})}return We(t,e,i)}:We:function(t,e,i){if(De(t),e=Fe(e),De(i),Ie)try{return We(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ze("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Ue=Me,Ke=v,$e=l?function(t,e,i){return Ue.f(t,e,Ke(1,i))}:function(t,e,i){return t[e]=i,t},Xe={exports:{}},Ye=l,qe=Nt,Ze=Function.prototype,Je=Ye&&Object.getOwnPropertyDescriptor,Qe=qe(Ze,"name"),ti={EXISTS:Qe,PROPER:Qe&&"something"===function(){}.name,CONFIGURABLE:Qe&&(!Ye||Ye&&Je(Ze,"name").configurable)},ei=V,ii=kt,ni=S(Function.toString);ei(ii.inspectSource)||(ii.inspectSource=function(t){return ni(t)});var ri,oi,si,ai=ii.inspectSource,li=V,hi=o.WeakMap,ci=li(hi)&&/native code/.test(String(hi)),ui=$t,di=Ot("keys"),pi=function(t){return di[t]||(di[t]=ui(t))},fi={},gi=ci,mi=o,yi=$,bi=$e,vi=Nt,wi=kt,Ci=pi,xi=fi,_i="Object already initialized",Si=mi.TypeError,Ai=mi.WeakMap;if(gi||wi.state){var Ti=wi.state||(wi.state=new Ai);Ti.get=Ti.get,Ti.has=Ti.has,Ti.set=Ti.set,ri=function(t,e){if(Ti.has(t))throw Si(_i);return e.facade=t,Ti.set(t,e),e},oi=function(t){return Ti.get(t)||{}},si=function(t){return Ti.has(t)}}else{var Bi=Ci("state");xi[Bi]=!0,ri=function(t,e){if(vi(t,Bi))throw Si(_i);return e.facade=t,bi(t,Bi,e),e},oi=function(t){return vi(t,Bi)?t[Bi]:{}},si=function(t){return vi(t,Bi)}}var Mi={set:ri,get:oi,has:si,enforce:function(t){return si(t)?oi(t):ri(t,{})},getterFor:function(t){return function(e){var i;if(!yi(e)||(i=oi(e)).type!==t)throw Si("Incompatible receiver, "+t+" required");return i}}},Ri=S,Pi=a,Ei=V,Hi=Nt,Li=l,ki=ti.CONFIGURABLE,Ii=ai,Oi=Mi.enforce,Di=Mi.get,Fi=String,zi=Object.defineProperty,Wi=Ri("".slice),ji=Ri("".replace),Ni=Ri([].join),Gi=Li&&!Pi((function(){return 8!==zi((function(){}),"length",{value:8}).length})),Vi=String(String).split("String"),Ui=Xe.exports=function(t,e,i){"Symbol("===Wi(Fi(e),0,7)&&(e="["+ji(Fi(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Hi(t,"name")||ki&&t.name!==e)&&(Li?zi(t,"name",{value:e,configurable:!0}):t.name=e),Gi&&i&&Hi(i,"arity")&&t.length!==i.arity&&zi(t,"length",{value:i.arity});try{i&&Hi(i,"constructor")&&i.constructor?Li&&zi(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Oi(t);return Hi(n,"source")||(n.source=Ni(Vi,"string"==typeof e?e:"")),t};Function.prototype.toString=Ui((function(){return Ei(this)&&Di(this).source||Ii(this)}),"toString");var Ki=Xe.exports,$i=V,Xi=Me,Yi=Ki,qi=Et,Zi=function(t,e,i,n){n||(n={});var r=n.enumerable,o=void 0!==n.name?n.name:e;if($i(i)&&Yi(i,o,n),n.global)r?t[e]=i:qi(e,i);else{try{n.unsafe?t[e]&&(r=!0):delete t[e]}catch(t){}r?t[e]=i:Xi.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Ji={},Qi=Math.ceil,tn=Math.floor,en=Math.trunc||function(t){var e=+t;return(e>0?tn:Qi)(e)},nn=function(t){var e=+t;return e!=e||0===e?0:en(e)},rn=nn,on=Math.max,sn=Math.min,an=function(t,e){var i=rn(t);return i<0?on(i+e,0):sn(i,e)},ln=nn,hn=Math.min,cn=function(t){return t>0?hn(ln(t),9007199254740991):0},un=function(t){return cn(t.length)},dn=W,pn=an,fn=un,gn=function(t){return function(e,i,n){var r,o=dn(e),s=fn(o),a=pn(n,s);if(t&&i!=i){for(;s>a;)if((r=o[a++])!=r)return!0}else for(;s>a;a++)if((t||a in o)&&o[a]===i)return t||a||0;return!t&&-1}},mn={includes:gn(!0),indexOf:gn(!1)},yn=Nt,bn=W,vn=mn.indexOf,wn=fi,Cn=S([].push),xn=function(t,e){var i,n=bn(t),r=0,o=[];for(i in n)!yn(wn,i)&&yn(n,i)&&Cn(o,i);for(;e.length>r;)yn(n,i=e[r++])&&(~vn(o,i)||Cn(o,i));return o},_n=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Sn=xn,An=_n.concat("length","prototype");Ji.f=Object.getOwnPropertyNames||function(t){return Sn(t,An)};var Tn={};Tn.f=Object.getOwnPropertySymbols;var Bn=q,Mn=Ji,Rn=Tn,Pn=Le,En=S([].concat),Hn=Bn("Reflect","ownKeys")||function(t){var e=Mn.f(Pn(t)),i=Rn.f;return i?En(e,i(t)):e},Ln=Nt,kn=Hn,In=s,On=Me,Dn=a,Fn=V,zn=/#|\.prototype\./,Wn=function(t,e){var i=Nn[jn(t)];return i==Vn||i!=Gn&&(Fn(e)?Dn(e):!!e)},jn=Wn.normalize=function(t){return String(t).replace(zn,".").toLowerCase()},Nn=Wn.data={},Gn=Wn.NATIVE="N",Vn=Wn.POLYFILL="P",Un=Wn,Kn=o,$n=s.f,Xn=$e,Yn=Zi,qn=Et,Zn=function(t,e,i){for(var n=kn(e),r=On.f,o=In.f,s=0;s<n.length;s++){var a=n[s];Ln(t,a)||i&&Ln(i,a)||r(t,a,o(e,a))}},Jn=Un,Qn=function(t,e){var i,n,r,o,s,a=t.target,l=t.global,h=t.stat;if(i=l?Kn:h?Kn[a]||qn(a,{}):(Kn[a]||{}).prototype)for(n in e){if(o=e[n],r=t.dontCallGetSet?(s=$n(i,n))&&s.value:i[n],!Jn(l?n:a+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;Zn(o,r)}(t.sham||r&&r.sham)&&Xn(o,"sham",!0),Yn(i,n,o,t)}},tr={exports:{}},er={},ir=de,nr=Me,rr=v,or=an,sr=un,ar=function(t,e,i){var n=ir(e);n in t?nr.f(t,n,rr(0,i)):t[n]=i},lr=Array,hr=Math.max,cr=M,ur=W,dr=Ji.f,pr=function(t,e,i){for(var n=sr(t),r=or(e,n),o=or(void 0===i?n:i,n),s=lr(hr(o-r,0)),a=0;r<o;r++,a++)ar(s,a,t[r]);return s.length=a,s},fr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];er.f=function(t){return fr&&"Window"==cr(t)?function(t){try{return dr(t)}catch(t){return pr(fr)}}(t):dr(ur(t))};var gr=a((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),mr=a,yr=$,br=M,vr=gr,wr=Object.isExtensible,Cr=mr((function(){wr(1)}))||vr?function(t){return!!yr(t)&&((!vr||"ArrayBuffer"!=br(t))&&(!wr||wr(t)))}:wr,xr=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),_r=Qn,Sr=S,Ar=fi,Tr=$,Br=Nt,Mr=Me.f,Rr=Ji,Pr=er,Er=Cr,Hr=xr,Lr=!1,kr=$t("meta"),Ir=0,Or=function(t){Mr(t,kr,{value:{objectID:"O"+Ir++,weakData:{}}})},Dr=tr.exports={enable:function(){Dr.enable=function(){},Lr=!0;var t=Rr.f,e=Sr([].splice),i={};i[kr]=1,t(i).length&&(Rr.f=function(i){for(var n=t(i),r=0,o=n.length;r<o;r++)if(n[r]===kr){e(n,r,1);break}return n},_r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Pr.f}))},fastKey:function(t,e){if(!Tr(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Br(t,kr)){if(!Er(t))return"F";if(!e)return"E";Or(t)}return t[kr].objectID},getWeakData:function(t,e){if(!Br(t,kr)){if(!Er(t))return!0;if(!e)return!1;Or(t)}return t[kr].weakData},onFreeze:function(t){return Hr&&Lr&&Er(t)&&!Br(t,kr)&&Or(t),t}};Ar[kr]=!0;var Fr=tr.exports,zr=M,Wr=S,jr=function(t){if("Function"===zr(t))return Wr(t)},Nr=wt,Gr=h,Vr=jr(jr.bind),Ur=function(t,e){return Nr(t),void 0===e?t:Gr?Vr(t,e):function(){return t.apply(e,arguments)}},Kr={},$r=Kr,Xr=ie("iterator"),Yr=Array.prototype,qr={};qr[ie("toStringTag")]="z";var Zr="[object z]"===String(qr),Jr=V,Qr=M,to=ie("toStringTag"),eo=Object,io="Arguments"==Qr(function(){return arguments}()),no=Zr?Qr:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=eo(t),to))?i:io?Qr(e):"Object"==(n=Qr(e))&&Jr(e.callee)?"Arguments":n},ro=no,oo=_t,so=k,ao=Kr,lo=ie("iterator"),ho=function(t){if(!so(t))return oo(t,lo)||oo(t,"@@iterator")||ao[ro(t)]},co=d,uo=wt,po=Le,fo=mt,go=ho,mo=TypeError,yo=d,bo=Le,vo=_t,wo=Ur,Co=d,xo=Le,_o=mt,So=function(t){return void 0!==t&&($r.Array===t||Yr[Xr]===t)},Ao=un,To=Z,Bo=function(t,e){var i=arguments.length<2?go(t):e;if(uo(i))return po(co(i,t));throw mo(fo(t)+" is not iterable")},Mo=ho,Ro=function(t,e,i){var n,r;bo(t);try{if(!(n=vo(t,"return"))){if("throw"===e)throw i;return i}n=yo(n,t)}catch(t){r=!0,n=t}if("throw"===e)throw i;if(r)throw n;return bo(n),i},Po=TypeError,Eo=function(t,e){this.stopped=t,this.result=e},Ho=Eo.prototype,Lo=function(t,e,i){var n,r,o,s,a,l,h,c=i&&i.that,u=!(!i||!i.AS_ENTRIES),d=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),g=wo(e,c),m=function(t){return n&&Ro(n,"normal",t),new Eo(!0,t)},y=function(t){return u?(xo(t),f?g(t[0],t[1],m):g(t[0],t[1])):f?g(t,m):g(t)};if(d)n=t.iterator;else if(p)n=t;else{if(!(r=Mo(t)))throw Po(_o(t)+" is not iterable");if(So(r)){for(o=0,s=Ao(t);s>o;o++)if((a=y(t[o]))&&To(Ho,a))return a;return new Eo(!1)}n=Bo(t,r)}for(l=d?t.next:n.next;!(h=Co(l,n)).done;){try{a=y(h.value)}catch(t){Ro(n,"throw",t)}if("object"==typeof a&&a&&To(Ho,a))return a}return new Eo(!1)},ko=Z,Io=TypeError,Oo=function(t,e){if(ko(e,t))return t;throw Io("Incorrect invocation")},Do=ie("iterator"),Fo=!1;try{var zo=0,Wo={next:function(){return{done:!!zo++}},return:function(){Fo=!0}};Wo[Do]=function(){return this},Array.from(Wo,(function(){throw 2}))}catch(t){}var jo=Me.f,No=Nt,Go=ie("toStringTag"),Vo=function(t,e,i){t&&!i&&(t=t.prototype),t&&!No(t,Go)&&jo(t,Go,{configurable:!0,value:e})},Uo=S,Ko=wt,$o=V,Xo=String,Yo=TypeError,qo=function(t,e,i){try{return Uo(Ko(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Zo=Le,Jo=function(t){if("object"==typeof t||$o(t))return t;throw Yo("Can't set "+Xo(t)+" as a prototype")},Qo=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=qo(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Zo(i),Jo(n),e?t(i,n):i.__proto__=n,i}}():void 0),ts=V,es=$,is=Qo,ns=Qn,rs=o,os=S,ss=Un,as=Zi,ls=Fr,hs=Lo,cs=Oo,us=V,ds=k,ps=$,fs=a,gs=function(t,e){if(!e&&!Fo)return!1;var i=!1;try{var n={};n[Do]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},ms=Vo,ys=function(t,e,i){var n,r;return is&&ts(n=e.constructor)&&n!==i&&es(r=n.prototype)&&r!==i.prototype&&is(t,r),t},bs=function(t,e,i){var n=-1!==t.indexOf("Map"),r=-1!==t.indexOf("Weak"),o=n?"set":"add",s=rs[t],a=s&&s.prototype,l=s,h={},c=function(t){var e=os(a[t]);as(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(r&&!ps(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return r&&!ps(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!ps(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ss(t,!us(s)||!(r||a.forEach&&!fs((function(){(new s).entries().next()})))))l=i.getConstructor(e,t,n,o),ls.enable();else if(ss(t,!0)){var u=new l,d=u[o](r?{}:-0,1)!=u,p=fs((function(){u.has(1)})),f=gs((function(t){new s(t)})),g=!r&&fs((function(){for(var t=new s,e=5;e--;)t[o](e,e);return!t.has(-0)}));f||((l=e((function(t,e){cs(t,a);var i=ys(new s,t,l);return ds(e)||hs(e,i[o],{that:i,AS_ENTRIES:n}),i}))).prototype=a,a.constructor=l),(p||g)&&(c("delete"),c("has"),n&&c("get")),(g||d)&&c(o),r&&a.clear&&delete a.clear}return h[t]=l,ns({global:!0,constructor:!0,forced:l!=s},h),ms(l,t),r||i.setStrong(l,t,n),l},vs={},ws=xn,Cs=_n,xs=Object.keys||function(t){return ws(t,Cs)},_s=l,Ss=Re,As=Me,Ts=Le,Bs=W,Ms=xs;vs.f=_s&&!Ss?Object.defineProperties:function(t,e){Ts(t);for(var i,n=Bs(e),r=Ms(e),o=r.length,s=0;o>s;)As.f(t,i=r[s++],n[i]);return t};var Rs,Ps=q("document","documentElement"),Es=Le,Hs=vs,Ls=_n,ks=fi,Is=Ps,Os=me,Ds="prototype",Fs="script",zs=pi("IE_PROTO"),Ws=function(){},js=function(t){return"<"+Fs+">"+t+"</"+Fs+">"},Ns=function(t){t.write(js("")),t.close();var e=t.parentWindow.Object;return t=null,e},Gs=function(){try{Rs=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Gs="undefined"!=typeof document?document.domain&&Rs?Ns(Rs):(e=Os("iframe"),i="java"+Fs+":",e.style.display="none",Is.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(js("document.F=Object")),t.close(),t.F):Ns(Rs);for(var n=Ls.length;n--;)delete Gs[Ds][Ls[n]];return Gs()};ks[zs]=!0;var Vs,Us,Ks,$s=Object.create||function(t,e){var i;return null!==t?(Ws[Ds]=Es(t),i=new Ws,Ws[Ds]=null,i[zs]=t):i=Gs(),void 0===e?i:Hs.f(i,e)},Xs=Ki,Ys=Me,qs=function(t,e,i){return i.get&&Xs(i.get,e,{getter:!0}),i.set&&Xs(i.set,e,{setter:!0}),Ys.f(t,e,i)},Zs=Zi,Js=function(t,e,i){for(var n in e)Zs(t,n,e[n],i);return t},Qs=!a((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),ta=Nt,ea=V,ia=zt,na=Qs,ra=pi("IE_PROTO"),oa=Object,sa=oa.prototype,aa=na?oa.getPrototypeOf:function(t){var e=ia(t);if(ta(e,ra))return e[ra];var i=e.constructor;return ea(i)&&e instanceof i?i.prototype:e instanceof oa?sa:null},la=a,ha=V,ca=$,ua=aa,da=Zi,pa=ie("iterator"),fa=!1;[].keys&&("next"in(Ks=[].keys())?(Us=ua(ua(Ks)))!==Object.prototype&&(Vs=Us):fa=!0);var ga=!ca(Vs)||la((function(){var t={};return Vs[pa].call(t)!==t}));ga&&(Vs={}),ha(Vs[pa])||da(Vs,pa,(function(){return this}));var ma={IteratorPrototype:Vs,BUGGY_SAFARI_ITERATORS:fa},ya=ma.IteratorPrototype,ba=$s,va=v,wa=Vo,Ca=Kr,xa=function(){return this},_a=Qn,Sa=d,Aa=V,Ta=function(t,e,i,n){var r=e+" Iterator";return t.prototype=ba(ya,{next:va(+!n,i)}),wa(t,r,!1),Ca[r]=xa,t},Ba=aa,Ma=Qo,Ra=Vo,Pa=$e,Ea=Zi,Ha=Kr,La=ti.PROPER,ka=ti.CONFIGURABLE,Ia=ma.IteratorPrototype,Oa=ma.BUGGY_SAFARI_ITERATORS,Da=ie("iterator"),Fa="keys",za="values",Wa="entries",ja=function(){return this},Na=q,Ga=qs,Va=l,Ua=ie("species"),Ka=$s,$a=qs,Xa=Js,Ya=Ur,qa=Oo,Za=k,Ja=Lo,Qa=function(t,e,i,n,r,o,s){Ta(i,e,n);var a,l,h,c=function(t){if(t===r&&g)return g;if(!Oa&&t in p)return p[t];switch(t){case Fa:case za:case Wa:return function(){return new i(this,t)}}return function(){return new i(this)}},u=e+" Iterator",d=!1,p=t.prototype,f=p[Da]||p["@@iterator"]||r&&p[r],g=!Oa&&f||c(r),m="Array"==e&&p.entries||f;if(m&&(a=Ba(m.call(new t)))!==Object.prototype&&a.next&&(Ba(a)!==Ia&&(Ma?Ma(a,Ia):Aa(a[Da])||Ea(a,Da,ja)),Ra(a,u,!0)),La&&r==za&&f&&f.name!==za&&(ka?Pa(p,"name",za):(d=!0,g=function(){return Sa(f,this)})),r)if(l={values:c(za),keys:o?g:c(Fa),entries:c(Wa)},s)for(h in l)(Oa||d||!(h in p))&&Ea(p,h,l[h]);else _a({target:e,proto:!0,forced:Oa||d},l);return p[Da]!==g&&Ea(p,Da,g,{name:r}),Ha[e]=g,l},tl=function(t,e){return{value:t,done:e}},el=function(t){var e=Na(t);Va&&e&&!e[Ua]&&Ga(e,Ua,{configurable:!0,get:function(){return this}})},il=l,nl=Fr.fastKey,rl=Mi.set,ol=Mi.getterFor,sl={getConstructor:function(t,e,i,n){var r=t((function(t,r){qa(t,o),rl(t,{type:e,index:Ka(null),first:void 0,last:void 0,size:0}),il||(t.size=0),Za(r)||Ja(r,t[n],{that:t,AS_ENTRIES:i})})),o=r.prototype,s=ol(e),a=function(t,e,i){var n,r,o=s(t),a=l(t,e);return a?a.value=i:(o.last=a={index:r=nl(e,!0),key:e,value:i,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),il?o.size++:t.size++,"F"!==r&&(o.index[r]=a)),t},l=function(t,e){var i,n=s(t),r=nl(e);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==e)return i};return Xa(o,{clear:function(){for(var t=s(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,il?t.size=0:this.size=0},delete:function(t){var e=this,i=s(e),n=l(e,t);if(n){var r=n.next,o=n.previous;delete i.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),i.first==n&&(i.first=r),i.last==n&&(i.last=o),il?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=s(this),n=Ya(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),Xa(o,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return a(this,0===t?0:t,e)}}:{add:function(t){return a(this,t=0===t?0:t,t)}}),il&&$a(o,"size",{configurable:!0,get:function(){return s(this).size}}),r},setStrong:function(t,e,i){var n=e+" Iterator",r=ol(e),o=ol(n);Qa(t,e,(function(t,e){rl(this,{type:n,target:t,state:r(t),kind:e,last:void 0})}),(function(){for(var t=o(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?tl("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,tl(void 0,!0))}),i?"entries":"values",!i,!0),el(e)}};bs("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),sl);var al=M,ll=Array.isArray||function(t){return"Array"==al(t)},hl=S,cl=a,ul=V,dl=no,pl=ai,fl=function(){},gl=[],ml=q("Reflect","construct"),yl=/^\s*(?:class|function)\b/,bl=hl(yl.exec),vl=!yl.exec(fl),wl=function(t){if(!ul(t))return!1;try{return ml(fl,gl,t),!0}catch(t){return!1}},Cl=function(t){if(!ul(t))return!1;switch(dl(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return vl||!!bl(yl,pl(t))}catch(t){return!0}};Cl.sham=!0;var xl=!ml||cl((function(){var t;return wl(wl.call)||!wl(Object)||!wl((function(){t=!0}))||t}))?Cl:wl,_l=ll,Sl=xl,Al=$,Tl=ie("species"),Bl=Array,Ml=function(t){var e;return _l(t)&&(e=t.constructor,(Sl(e)&&(e===Bl||_l(e.prototype))||Al(e)&&null===(e=e[Tl]))&&(e=void 0)),void 0===e?Bl:e},Rl=Ur,Pl=L,El=zt,Hl=un,Ll=function(t,e){return new(Ml(t))(0===e?0:e)},kl=S([].push),Il=function(t){var e=1==t,i=2==t,n=3==t,r=4==t,o=6==t,s=7==t,a=5==t||o;return function(l,h,c,u){for(var d,p,f=El(l),g=Pl(f),m=Rl(h,c),y=Hl(g),b=0,v=u||Ll,w=e?v(l,y):i||s?v(l,0):void 0;y>b;b++)if((a||b in g)&&(p=m(d=g[b],b,f),t))if(e)w[b]=p;else if(p)switch(t){case 3:return!0;case 5:return d;case 6:return b;case 2:kl(w,d)}else switch(t){case 4:return!1;case 7:kl(w,d)}return o?-1:n||r?r:w}},Ol={forEach:Il(0),map:Il(1),filter:Il(2),some:Il(3),every:Il(4),find:Il(5),findIndex:Il(6),filterReject:Il(7)},Dl=S,Fl=Js,zl=Fr.getWeakData,Wl=Oo,jl=Le,Nl=k,Gl=$,Vl=Lo,Ul=Nt,Kl=Mi.set,$l=Mi.getterFor,Xl=Ol.find,Yl=Ol.findIndex,ql=Dl([].splice),Zl=0,Jl=function(t){return t.frozen||(t.frozen=new Ql)},Ql=function(){this.entries=[]},th=function(t,e){return Xl(t.entries,(function(t){return t[0]===e}))};Ql.prototype={get:function(t){var e=th(this,t);if(e)return e[1]},has:function(t){return!!th(this,t)},set:function(t,e){var i=th(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Yl(this.entries,(function(e){return e[0]===t}));return~e&&ql(this.entries,e,1),!!~e}};var eh,ih={getConstructor:function(t,e,i,n){var r=t((function(t,r){Wl(t,o),Kl(t,{type:e,id:Zl++,frozen:void 0}),Nl(r)||Vl(r,t[n],{that:t,AS_ENTRIES:i})})),o=r.prototype,s=$l(e),a=function(t,e,i){var n=s(t),r=zl(jl(e),!0);return!0===r?Jl(n).set(e,i):r[n.id]=i,t};return Fl(o,{delete:function(t){var e=s(this);if(!Gl(t))return!1;var i=zl(t);return!0===i?Jl(e).delete(t):i&&Ul(i,e.id)&&delete i[e.id]},has:function(t){var e=s(this);if(!Gl(t))return!1;var i=zl(t);return!0===i?Jl(e).has(t):i&&Ul(i,e.id)}}),Fl(o,i?{get:function(t){var e=s(this);if(Gl(t)){var i=zl(t);return!0===i?Jl(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return a(this,t,e)}}:{add:function(t){return a(this,t,!0)}}),r}},nh=xr,rh=o,oh=S,sh=Js,ah=Fr,lh=bs,hh=ih,ch=$,uh=Mi.enforce,dh=a,ph=ci,fh=Object,gh=Array.isArray,mh=fh.isExtensible,yh=fh.isFrozen,bh=fh.isSealed,vh=fh.freeze,wh=fh.seal,Ch={},xh={},_h=!rh.ActiveXObject&&"ActiveXObject"in rh,Sh=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Ah=lh("WeakMap",Sh,hh),Th=Ah.prototype,Bh=oh(Th.set);if(ph)if(_h){eh=hh.getConstructor(Sh,"WeakMap",!0),ah.enable();var Mh=oh(Th.delete),Rh=oh(Th.has),Ph=oh(Th.get);sh(Th,{delete:function(t){if(ch(t)&&!mh(t)){var e=uh(this);return e.frozen||(e.frozen=new eh),Mh(this,t)||e.frozen.delete(t)}return Mh(this,t)},has:function(t){if(ch(t)&&!mh(t)){var e=uh(this);return e.frozen||(e.frozen=new eh),Rh(this,t)||e.frozen.has(t)}return Rh(this,t)},get:function(t){if(ch(t)&&!mh(t)){var e=uh(this);return e.frozen||(e.frozen=new eh),Rh(this,t)?Ph(this,t):e.frozen.get(t)}return Ph(this,t)},set:function(t,e){if(ch(t)&&!mh(t)){var i=uh(this);i.frozen||(i.frozen=new eh),Rh(this,t)?Bh(this,t,e):i.frozen.set(t,e)}else Bh(this,t,e);return this}})}else nh&&dh((function(){var t=vh([]);return Bh(new Ah,t,1),!yh(t)}))&&sh(Th,{set:function(t,e){var i;return gh(t)&&(yh(t)?i=Ch:bh(t)&&(i=xh)),Bh(this,t,e),i==Ch&&vh(t),i==xh&&wh(t),this}});var Eh=q,Hh=S,Lh=Ot,kh=Eh("Map"),Ih=Eh("WeakMap"),Oh=Hh([].push),Dh=Lh("metadata"),Fh=Dh.store||(Dh.store=new Ih),zh=function(t,e,i){var n=Fh.get(t);if(!n){if(!i)return;Fh.set(t,n=new kh)}var r=n.get(e);if(!r){if(!i)return;n.set(e,r=new kh)}return r},Wh={store:Fh,getMap:zh,has:function(t,e,i){var n=zh(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=zh(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){zh(i,n,!0).set(t,e)},keys:function(t,e){var i=zh(t,e,!1),n=[];return i&&i.forEach((function(t,e){Oh(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},jh=Le,Nh=Wh.toKey,Gh=Wh.set;Qn({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Nh(arguments[3]);Gh(t,e,jh(i),n)}});var Vh=Le,Uh=Wh.toKey,Kh=Wh.getMap,$h=Wh.store;Qn({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Uh(arguments[2]),n=Kh(Vh(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var r=$h.get(e);return r.delete(i),!!r.size||$h.delete(e)}});var Xh=Le,Yh=aa,qh=Wh.has,Zh=Wh.get,Jh=Wh.toKey,Qh=function(t,e,i){if(qh(t,e,i))return Zh(t,e,i);var n=Yh(e);return null!==n?Qh(t,n,i):void 0};Qn({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Jh(arguments[2]);return Qh(t,Xh(e),i)}});var tc=S,ec=Map.prototype,ic={Map:Map,set:tc(ec.set),get:tc(ec.get),has:tc(ec.has),remove:tc(ec.delete),proto:ec},nc=d,rc=S,oc=function(t,e,i){for(var n,r,o=i||t.next;!(n=nc(o,t)).done;)if(void 0!==(r=e(n.value)))return r},sc=ic.Map,ac=ic.proto,lc=rc(ac.forEach),hc=rc(ac.entries),cc=hc(new sc).next,uc=wt,dc=k,pc=un,fc=zt,gc=function(t,e,i){return i?oc(hc(t),(function(t){return e(t[1],t[0])}),cc):lc(t,e)},mc=ic.Map,yc=ic.has,bc=ic.set,vc=S([].push),wc=Qn,Cc=S,xc=Wh,_c=Le,Sc=aa,Ac=function(t){var e,i,n,r=fc(this),o=pc(r),s=[],a=new mc,l=dc(t)?function(t){return t}:uc(t);for(e=0;e<o;e++)n=l(i=r[e]),yc(a,n)||bc(a,n,i);return gc(a,(function(t){vc(s,t)})),s},Tc=Cc(Ac),Bc=Cc([].concat),Mc=xc.keys,Rc=xc.toKey,Pc=function(t,e){var i=Mc(t,e),n=Sc(t);if(null===n)return i;var r=Pc(n,e);return r.length?i.length?Tc(Bc(i,r)):r:i};wc({target:"Reflect",stat:!0},{getMetadataKeys:function(t){var e=arguments.length<2?void 0:Rc(arguments[1]);return Pc(_c(t),e)}});var Ec=Le,Hc=Wh.get,Lc=Wh.toKey;Qn({target:"Reflect",stat:!0},{getOwnMetadata:function(t,e){var i=arguments.length<3?void 0:Lc(arguments[2]);return Hc(t,Ec(e),i)}});var kc=Le,Ic=Wh.keys,Oc=Wh.toKey;Qn({target:"Reflect",stat:!0},{getOwnMetadataKeys:function(t){var e=arguments.length<2?void 0:Oc(arguments[1]);return Ic(kc(t),e)}});var Dc=Le,Fc=aa,zc=Wh.has,Wc=Wh.toKey,jc=function(t,e,i){if(zc(t,e,i))return!0;var n=Fc(e);return null!==n&&jc(t,n,i)};Qn({target:"Reflect",stat:!0},{hasMetadata:function(t,e){var i=arguments.length<3?void 0:Wc(arguments[2]);return jc(t,Dc(e),i)}});var Nc=Le,Gc=Wh.has,Vc=Wh.toKey;Qn({target:"Reflect",stat:!0},{hasOwnMetadata:function(t,e){var i=arguments.length<3?void 0:Vc(arguments[2]);return Gc(t,Nc(e),i)}});var Uc,Kc,$c,Xc,Yc,qc,Zc,Jc,Qc,tu=Le,eu=Wh.toKey,iu=Wh.set;Qn({target:"Reflect",stat:!0},{metadata:function(t,e){return function(i,n){iu(t,e,tu(i),eu(n))}}}),function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(Uc||(Uc={})),function(t){t.single="single",t.column="column",t.row="row",t.cross="cross",t.none="none"}(Kc||(Kc={})),function(t){t.top="top",t.bottom="bottom",t.left="left",t.right="right"}($c||($c={})),function(t){t.expand="expand",t.collapse="collapse",t.none="none"}(Xc||(Xc={})),function(t){t.RECORD="RECORD",t.SUM="SUM",t.MIN="MIN",t.MAX="MAX",t.AVG="AVG",t.COUNT="COUNT"}(Yc||(Yc={})),function(t){t.ASC="ASC",t.DESC="DESC"}(qc||(qc={})),function(t){t.inlineFront="inlineFront",t.inlineEnd="inlineEnd",t.left="left",t.right="right",t.absoluteRight="absoluteRight",t.contentLeft="contentLeft",t.contentRight="contentRight",t.absolute="absolute"}(Zc||(Zc={})),function(t){t.frozen="frozen",t.sort="sort",t.dropDown="dropDown",t.dropDownState="dropDownState",t.play="play",t.damagePic="damagePic",t.expand="expand",t.collapse="collapse",t.drillDown="drillDown",t.drillUp="drillUp"}(Jc||(Jc={})),function(t){t.upwardIconName="sort_upward",t.downwardIconName="sort_downward",t.normalIconName="sort_normal",t.freezeIconName="freeze",t.frozenIconName="frozen",t.frozenCurrentIconName="frozenCurrent",t.dropdownIconName="dropdownIcon",t.expandIconName="expand",t.collapseIconName="collapse"}(Qc||(Qc={}));var nu=Object.freeze({__proto__:null,get AggregationType(){return Yc},get HierarchyState(){return Xc},get HighlightScope(){return Kc},get IconFuncTypeEnum(){return Jc},get IconPosition(){return Zc},get InteractionState(){return Uc},get InternalIconName(){return Qc},get Placement(){return $c},get SortType(){return qc}});const ru=(t,e)=>(t=>{switch(Object.prototype.toString.call(t)){case"[object Object]":return"object";case"[object Function]":return"function";case"[object Array]":return"array";case"[object String]":return"string";case"[object Number]":return"number";case"[object RegExp]":return"regExp";case"[object Boolean]":return"boolean";case"[object Symbol]":return"symbol";case"[object Date]":return"date";case"[object Undefined]":return"undefined";case"[object Null]":return"null";case"[object Error]":return"error";case"[object HTMLDocument]":return"document";case"[object global]":return"global";default:return null}})(t)===e,ou=t=>ru(t,"object"),su=t=>ru(t,"function"),au=t=>ru(t,"string"),lu=t=>ru(t,"number"),hu=t=>ru(t,"undefined"),cu=t=>ru(t,"null");function uu(t,...e){if(!e.length)return t||{};const i=e.shift();if(ou(t)&&ou(i))for(const e in i)ou(i[e])?(t[e]||Object.assign(t,{[e]:{}}),ou(t[e])||Object.assign(t,{[e]:i[e]}),uu(t[e],i[e])):null!==i[e]&&void 0!==i[e]&&Object.assign(t,{[e]:i[e]});return uu(t,...e)}function du(t){if(!t)return t;let e;if([Number,String,Boolean].forEach((function(i){t instanceof i&&(e=i(t))})),void 0===e)if("[object Array]"===Object.prototype.toString.call(t))e=[],t.forEach((function(t,i){e[i]=du(t)}));else if("object"==typeof t)if(t.nodeType&&"function"==typeof t.cloneNode)e=t.cloneNode(!0);else if(t.prototype)e=t.constructor?new t.constructor:t;else if(t instanceof Date)e=new Date(t);else if(t.clone)e=t.clone();else{e={};for(const i in t)e[i]=du(t[i])}else e=t;return e}function pu(t){return"function"==typeof t&&(t=t()),bu(t)?`${t}`:""}function fu(t){if(t?.length<=0)return t;const e=t.length,i=t[0].length,n=new Array(i);for(let r=0;r<e;r++)for(let o=0;o<i;o++)n[o]||(n[o]=new Array(e)),n[o][r]=t[r][o];return n}function gu(t,e){let i=null;return function(...n){i||(t.apply(this,n),i=setTimeout((()=>{i=null}),e)),console.log("throttle")}}function mu(t,e){for(t=`${t}`;t.length<e;)t="0"+t;return t}function yu(t,e,i){t=(t=t.replace(/^\s*|\s*$/,"")).replace(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,"#$1$1$2$2$3$3");const n=Math.round(256*e)*(i?-1:1),r=t.match(new RegExp("^rgba?\\(\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])(?:\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$","i")),o=r&&bu(r[4])?r[4]:null,s=r?[r[1],r[2],r[3]]:t.replace(/^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,(function(){return`${parseInt(arguments[1],16)},${parseInt(arguments[2],16)},${parseInt(arguments[3],16)}`})).split(/,/);return r?`rgb${null!==o?"a":""}(${Math[i?"max":"min"](parseInt(s[0],10)+n,i?0:255)}, ${Math[i?"max":"min"](parseInt(s[1],10)+n,i?0:255)}, ${Math[i?"max":"min"](parseInt(s[2],10)+n,i?0:255)}${null!==o?`, ${o}`:""})`:["#",mu(Math[i?"max":"min"](parseInt(s[0],10)+n,i?0:255).toString(16),2),mu(Math[i?"max":"min"](parseInt(s[1],10)+n,i?0:255).toString(16),2),mu(Math[i?"max":"min"](parseInt(s[2],10)+n,i?0:255).toString(16),2)].join("")}function bu(t){return!hu(t)&&!cu(t)}function vu(t){return hu(t)||cu(t)?"":t.toString()}function wu(){return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}function Cu(t,e,i){return"desc"!==i?t===e?0:t>e?1:-1:t===e?0:t<e?1:-1}let xu,_u=1,Su=class{listenersData={listeners:{},listenerData:{}};on(t,e){const i=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);i.push(e);const n=_u++;return this.listenersData.listenerData[n]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[n];const r=i.indexOf(e);i.splice(r,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},n}off(t){this.listenersData&&this.listenersData.listenerData[t].remove()}addEventListener(t,e,i){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const i in this.listenersData.listenerData){const n=this.listenersData.listenerData[i];n.type===t&&n.listener===e&&this.off(i)}}hasListeners(t){return!!this.listenersData&&!!this.listenersData.listeners[t]}fireListeners(t,e){if(!this.listenersData)return[];const i=this.listenersData.listeners[t];return i?i.map((t=>t.call(this,e))).filter((t=>bu(t))):[]}release(){delete this.listenersData}};const Au={CHANGE_STYLE:"change_style"};let Tu,Bu,Mu,Ru=class t extends Su{_color;_fontSize;_fontFamily;_fontWeight;_fontVariant;_fontStyle;_padding;_defaultPadding=[10,16,10,16];_textStick;_textOverflow;_textAlign;_textBaseline;_bgColor;_borderColor;_lineHeight;_underline;_underlineColor;_underlineDash;_lineThrough;_lineThroughColor;_lineThroughDash;_linkColor;_cursor;_borderLineWidth;_borderLineDash;_marked;static get EVENT_TYPE(){return Au}static get DEFAULT(){return xu||(xu=new t)}constructor(t={},e={}){super(),this._textAlign=t?.textAlign??e?.textAlign,this._textBaseline=t?.textBaseline??e?.textBaseline,this._color=t?.color??e?.color,this._fontSize=t.fontSize??e?.fontSize,this._fontFamily=t.fontFamily??e?.fontFamily,this._fontWeight=t.fontWeight??e?.fontWeight,this._fontVariant=t.fontVariant??e?.fontVariant,this._fontStyle=t.fontStyle??e?.fontStyle,this._padding=t?.padding??e?.padding??this._defaultPadding,this._borderColor=t?.borderColor??e?.borderColor,this._textOverflow=t?.textOverflow??e?.textOverflow,this._textStick=t.textStick??e?.textStick??!1,this._bgColor=t?.bgColor??e?.bgColor,this._lineHeight=t?.lineHeight??e?.lineHeight,this._underline=t?.underline??e?.underline,this._underlineColor=t?.underlineColor??e?.underlineColor,this._underlineDash=t?.underlineDash??e?.underlineDash,this._lineThrough=t?.lineThrough??e?.lineThrough,this._lineThroughColor=t?.lineThroughColor??e?.lineThroughColor,this._lineThroughDash=t?.lineThroughDash??e?.lineThroughDash,this._linkColor=t?.linkColor??e?.linkColor,this._cursor=t.cursor??e?.cursor,this._borderLineWidth=t.borderLineWidth??e?.borderLineWidth,this._borderLineDash=t.borderLineDash??e?.borderLineDash,this._marked=t.marked??e?.marked}get color(){return this._color}set color(t){this._color=t}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t}get padding(){return this._padding}set padding(t){this._padding=t}get textOverflow(){return this._textOverflow}set textOverflow(t){this._textOverflow=t}get bgColor(){return this._bgColor}set bgColor(t){this._bgColor=t}get borderColor(){return this._borderColor}set borderColor(t){this._borderColor=t}get textStick(){return this._textStick}set textStick(t){this._textStick=t}get textAlign(){return this._textAlign}set textAlign(t){this._textAlign=t}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t}get underline(){return this._underline}set underline(t){this._underline=t}get underlineColor(){return this._underlineColor}set underlineColor(t){this._underlineColor=t}get underlineDash(){return this._underlineDash}set underlineDash(t){this._underlineDash=t}get lineThrough(){return this._lineThrough}set lineThrough(t){this._lineThrough=t}get lineThroughColor(){return this._lineThroughColor}set lineThroughColor(t){this._lineThroughColor=t}get lineThroughDash(){return this._lineThroughDash}set lineThroughDash(t){this._lineThroughDash=t}get linkColor(){return this._linkColor}set linkColor(t){this._linkColor=t}get cursor(){return this._cursor}set cursor(t){this._cursor=t}get borderLineWidth(){return this._borderLineWidth}set borderLineWidth(t){this._borderLineWidth=t}get borderLineDash(){return this._borderLineDash}set borderLineDash(t){this._borderLineDash=t}get marked(){return this._marked}set marked(t){this._marked=t}clone(){return new t(this,null)}},Pu=class t extends Ru{static get DEFAULT(){return Tu||(Tu=new t)}constructor(t={},e={}){super(t,e)}clone(){return new t(this,null)}};class Eu extends Ru{_autoWrapText;_lineClamp;static get DEFAULT(){return Bu||(Bu=new Eu)}constructor(t={},e={}){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new Eu(this,null)}get lineClamp(){return this._lineClamp}set lineClamp(t){this._lineClamp=t}get autoWrapText(){return this._autoWrapText}set autoWrapText(t){this._autoWrapText=t}}function Hu(t,e,i,n=Ru,r){return t||e?t instanceof Ru?t:"function"==typeof t?Hu(t(i),e,i,n,r):(t||(t={}),r&&!bu(t.autoWrapText)&&(t.autoWrapText=!0),new n(t??{},e??{})):n.DEFAULT}const Lu={CHANGE_STYLE:"change_style"};class ku extends Su{_color;_fontSize;_fontFamily;_fontWeight;_fontVariant;_fontStyle;_textOverflow;_padding;_defaultPadding=[10,16,10,16];_textStick;_marked;_textAlign;_textBaseline;_bgColor;_borderColor;_lineHeight;_underline;_underlineColor;_underlineDash;_lineThrough;_lineThroughColor;_lineThroughDash;_linkColor;_cursor;_borderLineWidth;_borderLineDash;static get EVENT_TYPE(){return Lu}static get DEFAULT(){return Mu||(Mu=new ku)}constructor(t={},e={}){super(),this._color=t.color??e?.color,this._fontSize=t.fontSize??e?.fontSize,this._fontFamily=t.fontFamily??e?.fontFamily,this._fontWeight=t.fontWeight??e?.fontWeight,this._fontVariant=t.fontVariant??e?.fontVariant,this._fontStyle=t.fontStyle??e?.fontStyle,this._textOverflow=(t.textOverflow??e?.textOverflow)||"ellipsis",this._textStick=t.textStick??e?.textStick??!1,this._marked=t.marked??e?.marked??!1,this._textAlign=(t.textAlign??e?.textAlign)||"left",this._textBaseline=(t.textBaseline??e?.textBaseline)||"middle",this._bgColor=t.bgColor??e?.bgColor,this._padding=t.padding??e?.padding??this._defaultPadding,this._borderColor=t.borderColor??e?.borderColor,this._lineHeight=t.lineHeight??e?.lineHeight,this._underline=t.underline??e?.underline,this._underlineColor=t.underlineColor??e?.underlineColor,this._underlineDash=t.underlineDash??e?.underlineDash,this._lineThrough=t.lineThrough??e?.lineThrough,this._lineThroughColor=t.lineThroughColor??e?.lineThroughColor,this._lineThroughDash=t.lineThroughDash??e?.lineThroughDash,this._linkColor=t.linkColor??e?.linkColor,this._cursor=t.cursor??e?.cursor,this._borderLineWidth=t.borderLineWidth??e?.borderLineWidth,this._borderLineDash=t.borderLineDash??e?.borderLineDash}get bgColor(){return this._bgColor}set bgColor(t){this._bgColor=t}get color(){return this._color}set color(t){this._color=t}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t}get textOverflow(){return this._textOverflow}set textOverflow(t){this._textOverflow=t}get padding(){return this._padding??this._defaultPadding}set padding(t){this._padding=t}get borderColor(){return this._borderColor}set borderColor(t){this._borderColor=t}get textStick(){return this._textStick}set textStick(t){this._textStick=t}get marked(){return this._marked}set marked(t){this._marked=t}get textAlign(){return this._textAlign}set textAlign(t){this._textAlign=t}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t}get underline(){return this._underline}set underline(t){this._underline=t}get underlineColor(){return this._underlineColor}set underlineColor(t){this._underlineColor=t}get underlineDash(){return this._underlineDash}set underlineDash(t){this._underlineDash=t}get lineThrough(){return this._lineThrough}set lineThrough(t){this._lineThrough=t}get lineThroughColor(){return this._lineThroughColor}set lineThroughColor(t){this._lineThroughColor=t}get lineThroughDash(){return this._lineThroughDash}set lineThroughDash(t){this._lineThroughDash=t}get linkColor(){return this._linkColor}set linkColor(t){this._linkColor=t}get cursor(){return this._cursor}set cursor(t){this._cursor=t}get borderLineWidth(){return this._borderLineWidth}set borderLineWidth(t){this._borderLineWidth=t}get borderLineDash(){return this._borderLineDash}set borderLineDash(t){this._borderLineDash=t}clone(){return new ku(this)}}let Iu;class Ou extends ku{_autoWrapText;_lineClamp;static get DEFAULT(){return Iu||(Iu=new Ou)}constructor(t={},e=null){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new Ou(this,null)}get lineClamp(){return this._lineClamp}set lineClamp(t){this._lineClamp=t}get autoWrapText(){return this._autoWrapText}set autoWrapText(t){this._autoWrapText=t}}function Du(t,e,i,n,r){return t||e?t instanceof ku?t:"function"==typeof t?Du(t(i),e,i,n,r):(t||(t={}),r&&!bu(t.autoWrapText)&&(t.autoWrapText=!0),new n(t??{},e??{})):n.DEFAULT}function Fu(t){return t?.hoverOn||"none"===t?.visible?0:t?.width??7}var zu={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,o||t,s),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,s=new Array(o);r<o;r++)s[r]=n[r].fn;return s},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,r,o,s){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,o),!0;case 6:return c.fn.call(c.context,e,n,r,o,s),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,r);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,r){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||s(this,o);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||r&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[o]=1===h.length?h[0]:h:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(zu);var Wu=i(zu.exports);const ju=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,Nu=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||ju(t,"Boolean")},Gu=t=>"function"==typeof t,Vu=t=>null==t,Uu=t=>null!=t,Ku=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},$u=function(t){if(!(t=>"object"==typeof t&&null!==t)(t)||!ju(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},Xu=t=>void 0===t,Yu=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||ju(t,"String")},qu=t=>Array.isArray?Array.isArray(t):ju(t,"Array"),Zu=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},Ju=t=>ju(t,"Date"),Qu=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||ju(t,"Number")},td=t=>Qu(t)&&Number.isFinite(t),ed=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),id=Object.prototype,nd=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||id)},rd=Object.prototype.hasOwnProperty;function od(t){if(Vu(t))return!0;if(Zu(t))return!t.length;const e=ed(t);if("Map"===e||"Set"===e)return!t.size;if(nd(t))return!Object.keys(t).length;for(const e in t)if(rd.call(t,e))return!1;return!0}const sd=(t,e,i)=>{const n=Yu(e)?e.split("."):e;for(let e=0;e<n.length;e++)t=t?t[n[e]]:void 0;return void 0===t?i:t},ad=Object.prototype.hasOwnProperty,ld=(t,e)=>null!=t&&ad.call(t,e);function hd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const r=[],o=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,s){if(null===i)return null;if(0===s)return i;let a;if("object"!=typeof i)return i;if(qu(i)?a=[]:ju(i,"RegExp")?(a=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(a.lastIndex=i.lastIndex)):a=Ju(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=r.indexOf(i);if(-1!==t)return o[t];r.push(i),o.push(a)}for(const e in i)a[e]=t(i[e],s-1);return a}(t,i)}function cd(t){let e;if(!Uu(t)||"object"!=typeof t)return t;const i=qu(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:Nu(t)||Qu(t)||Yu(t)?t:Ju(t)?new Date(+t):void 0;const r=i?void 0:Object.keys(Object(t));let o=-1;if(e)for(;++o<(r||t).length;){const i=r?r[o]:o,n=t[i];e[i]=cd(n)}return e}function ud(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(Uu(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:o}=r,s=-1;for(;o--;){const o=r[++s];Uu(n[o])&&"object"==typeof n[o]?dd(t,e,o,i):pd(t,o,n[o])}}}}function dd(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=t[i],o=e[i];let s=e[i],a=!0;if(qu(o)){if(n)s=[];else if(qu(r))s=r;else if(Zu(r)){s=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)s[t]=r[t]}}else $u(o)?(s=r,"function"!=typeof r&&"object"==typeof r||(s={})):a=!1;a&&ud(s,o,n),pd(t,i,s)}function pd(t,e,i){(void 0!==i&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function fd(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)ud(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function gd(t){return Object.prototype.toString.call(t)}function md(t){return Object.keys(t)}function yd(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(gd(t)!==gd(e))return!1;if(Gu(t))return!1;if("object"!=typeof t)return!1;if(qu(t)){if(t.length!==e.length)return!1;for(let i=t.length-1;i>=0;i--)if(!yd(t[i],e[i]))return!1;return!0}if(!$u(t))return!1;const i=md(t),n=md(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const r=i[n];if(!yd(t[r],e[r]))return!1}return!0}function bd(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let r=0;r<n.length;r++){const o=n[r];(i?null!=e[o]:null==t[o])&&(t[o]=e[o])}return t}function vd(t){if(Zu(t))return t[t.length-1]}function wd(t,e){if(!qu(t)||!qu(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Cd(t,e,i){Uu(e)||(e=t,t=0),Uu(i)||(i=1);let n=-1;const r=0|Math.max(0,Math.ceil((e-t)/i)),o=new Array(r);for(;++n<r;)o[n]=t+n*i;return o}function xd(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function _d(t){return Number(t)}const Sd=1e-10,Ad=1e-10;function Td(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Sd,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ad)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function Bd(t,e,i,n){return t>e&&!Td(t,e,i,n)}function Md(t,e,i,n){return t<e&&!Td(t,e,i,n)}const Rd=t=>{let e=null,i=null;return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e&&r.every(((t,i)=>t===e[i]))||(e=r,i=t(...r)),i}},Pd=function(t,e,i){return t<e?e:t>i?i:t},Ed=(t,e,i)=>{let[n,r]=t;r<n&&(n=t[1],r=t[0]);const o=r-n;return o>=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-o),[n,n+o])};function Hd(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let Ld=!1;try{Ld="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Ld=!1}function kd(t,e){return i=>t*(1-i)+e*i}function Id(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}Ld=!1;const Od=1e-12,Dd=Math.PI,Fd=Dd/2,zd=2*Dd,Wd=2*Math.PI,jd=Math.abs,Nd=Math.atan2,Gd=Math.cos,Vd=Math.max,Ud=Math.min,Kd=Math.sin,$d=Math.sqrt,Xd=Math.pow;function Yd(t){return t>1?0:t<-1?Dd:Math.acos(t)}function qd(t){return t>=1?Fd:t<=-1?-Fd:Math.asin(t)}function Zd(t,e,i,n,r){let o,s;return"number"==typeof t&&"number"==typeof i&&(o=(1-r)*t+r*i),"number"==typeof e&&"number"==typeof n&&(s=(1-r)*e+r*n),{x:o,y:s}}class Jd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Jd(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 Qu(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return Qu(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 Qd{static distancePP(t,e){return $d(Xd(t.x-e.x,2)+Xd(t.y-e.y,2))}static distanceNN(t,e,i,n){return $d(Xd(t-i,2)+Xd(e-n,2))}static distancePN(t,e,i){return $d(Xd(e-t.x,2)+Xd(i-t.y,2))}static pointAtPP(t,e,i){return new Jd((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function tp(t,e,i){const{x1:n,y1:r,x2:o,y2:s}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*r+i.e,i.b*n+i.d*r+i.f),t.add(i.a*o+i.c*r+i.e,i.b*o+i.d*r+i.f),t.add(i.a*o+i.c*s+i.e,i.b*o+i.d*s+i.f),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),e)}class ep{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new ep(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return qu(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const r=this.scalePoints(t,e,i,n);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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return tp(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:r,x2:o,y2:s}=this,a=Math.cos(t),l=Math.sin(t),h=e-e*a+i*l,c=i-e*l-i*a;return[a*n-l*r+h,l*n+a*r+c,a*n-l*s+h,l*n+a*s+c,a*o-l*r+h,l*o+a*r+c,a*o-l*s+h,l*o+a*s+c]}scalePoints(t,e,i,n){const{x1:r,y1:o,x2:s,y2:a}=this;return[t*r+(1-t)*i,e*o+(1-e)*n,t*s+(1-t)*i,e*a+(1-e)*n]}}class ip extends ep{}function np(t){return t*(Math.PI/180)}const rp=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-zd;)t+=zd;else if(t>0)for(;t>zd;)t-=zd;return t};class op{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=r,this.f=o}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,r,o){return!(this.e!==r||this.f!==o||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,r,o){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=r,this.f=o,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,r=this.e,o=this.f,s=new op,a=t*n-e*i;return s.a=n/a,s.b=-e/a,s.c=-i/a,s.d=t/a,s.e=(i*o-n*r)/a,s.f=-(t*o-e*r)/a,s}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,r=this.b*e+this.d*i,o=this.a*-i+this.c*e,s=this.b*-i+this.d*e;return this.a=n,this.b=r,this.c=o,this.d=s,this}rotateByCenter(t,e,i){const n=Math.cos(t),r=Math.sin(t),o=(1-n)*e+r*i,s=(1-n)*i-r*e,a=n*this.a-r*this.b,l=r*this.a+n*this.b,h=n*this.c-r*this.d,c=r*this.c+n*this.d,u=n*this.e-r*this.f+o,d=r*this.e+n*this.f+s;return this.a=a,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,r,o){return this.multiply(t,e,i,n,r,o),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:r,f:o}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=o,this.f=r,this}multiply(t,e,i,n,r,o){const s=this.a,a=this.b,l=this.c,h=this.d,c=s*t+l*e,u=a*t+h*e,d=s*i+l*n,p=a*i+h*n,f=s*r+l*o+this.e,g=a*r+h*o+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=g,this}interpolate(t,e){const i=new op;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:r,d:o,e:s,f:a}=this,l=i*o-n*r,h=o/l,c=-n/l,u=-r/l,d=i/l,p=(r*a-o*s)/l,f=-(i*a-n*s)/l,{x:g,y:m}=t;e.x=g*h+m*u+p,e.y=g*c+m*d+f}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new op(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,r=t*n-e*i,o={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);o.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),o.scaleX=s,o.scaleY=r/s,o.skewX=(t*i+e*n)/r,o.skewY=0}else if(0!==i||0!==n){const s=Math.sqrt(i*i+n*n);o.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/s):-Math.acos(i/s)),o.scaleX=r/s,o.scaleY=s,o.skewX=0,o.skewY=(t*i+e*n)/r}return o.rotateDeg=180*o.rotateDeg/Math.PI,o}}function sp(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,r=n*(1-Math.abs(t/60%2-1)),o=i-n/2;let s=0,a=0,l=0;return 0<=t&&t<60?(s=n,a=r,l=0):60<=t&&t<120?(s=r,a=n,l=0):120<=t&&t<180?(s=0,a=n,l=r):180<=t&&t<240?(s=0,a=r,l=n):240<=t&&t<300?(s=r,a=0,l=n):300<=t&&t<360&&(s=n,a=0,l=r),s=Math.round(255*(s+o)),a=Math.round(255*(a+o)),l=Math.round(255*(l+o)),{r:s,g:a,b:l}}function ap(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n;let s=0,a=0,l=0;return s=0===o?0:r===t?(e-i)/o%6:r===e?(i-t)/o+2:(t-e)/o+4,s=Math.round(60*s),s<0&&(s+=360),l=(r+n)/2,a=0===o?0:o/(1-Math.abs(2*l-1)),a=+(100*a).toFixed(1),l=+(100*l).toFixed(1),{h:s,s:a,l:l}}const lp=/^#([0-9a-f]{3,8})$/,hp={transparent:4294967040},cp={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 up(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function dp(t){return Qu(t)?new fp(t>>16,t>>8&255,255&t,1):qu(t)?new fp(t[0],t[1],t[2]):new fp(255,255,255)}class pp{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new pp(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new pp(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof pp?t:new pp(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(Uu(hp[t]))return function(t){return Qu(t)?new fp(t>>>24,t>>>16&255,t>>>8&255,255&t):qu(t)?new fp(t[0],t[1],t[2],t[3]):new fp(255,255,255,1)}(hp[t]);if(Uu(cp[t]))return dp(cp[t]);const e=`${t}`.trim().toLowerCase(),i=lp.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new fp((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?dp(t):8===e?new fp(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new fp(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=sp(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new fp(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=pp.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new fp(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,r=ap(this.color.r,this.color.g,this.color.b),o=sp(Vu(t)?r.h:Pd(t,0,360),Vu(e)?r.s:e>=0&&e<=1?100*e:e,Vu(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new fp(o.r,o.g,o.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}}class fp{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),Uu(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${up(this.r)+up(this.g)+up(this.b)+(1===this.opacity?"":up(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=ap(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}var gp=Object.freeze({__proto__:null,Color:pp,DEFAULT_COLORS:cp,RGB:fp,hexToRgb:function(t){let e="",i="",n="";const r="#"===t[0]?1:0;for(let o=r;o<t.length;o++)"#"!==t[o]&&(o<r+2?e+=t[o]:o<r+4?i+=t[o]:o<r+6&&(n+=t[o]));return[parseInt(e,16),parseInt(i,16),parseInt(n,16)]},hslToRgb:sp,interpolateRgb:function(t,e){const i=t.r,n=e.r,r=t.g,o=e.g,s=t.b,a=e.b,l=t.opacity,h=e.opacity;return t=>{const e=Math.round(i*(1-t)+n*t),c=Math.round(r*(1-t)+o*t),u=Math.round(s*(1-t)+a*t);return new fp(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ap});let mp,yp,bp,vp,wp,Cp,xp,_p;function Sp(t,e,i){return null===t?e:null===e?t:(mp=t.x1,yp=t.x2,bp=t.y1,vp=t.y2,wp=e.x1,Cp=e.x2,xp=e.y1,_p=e.y2,i&&(mp>yp&&([mp,yp]=[yp,mp]),bp>vp&&([bp,vp]=[vp,bp]),wp>Cp&&([wp,Cp]=[Cp,wp]),xp>_p&&([xp,_p]=[_p,xp])),mp>=Cp||yp<=wp||bp>=_p||vp<=xp?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(mp,wp),y1:Math.max(bp,xp),x2:Math.min(yp,Cp),y2:Math.min(vp,_p)})}var Ap;function Tp(t,e,i){return!(t&&e&&(i?(mp=t.x1,yp=t.x2,bp=t.y1,vp=t.y2,wp=e.x1,Cp=e.x2,xp=e.y1,_p=e.y2,mp>yp&&([mp,yp]=[yp,mp]),bp>vp&&([bp,vp]=[vp,bp]),wp>Cp&&([wp,Cp]=[Cp,wp]),xp>_p&&([xp,_p]=[_p,xp]),mp>Cp||yp<wp||bp>_p||vp<xp):t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1))}function Bp(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Mp(t,e){let{x:i,y:n}=t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-r.x)*Math.cos(e)+(n-r.y)*Math.sin(e)+r.x,y:(i-r.x)*Math.sin(e)+(r.y-n)*Math.cos(e)+r.y}}function Rp(t){return t/180*Math.PI}function Pp(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ep(t,e){const i=e?t.angle:Rp(t.angle),n=Pp(t);return[Mp({x:t.x1,y:t.y1},i,n),Mp({x:t.x2,y:t.y1},i,n),Mp({x:t.x2,y:t.y2},i,n),Mp({x:t.x1,y:t.y2},i,n)]}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Ap||(Ap={}));const Hp=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class Lp{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),Uu(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Uu(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Vu(this._canvas)&&(Uu(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Vu(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&Uu(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Vu(this._context)&&Uu(this._canvas)){const t=this._canvas.getContext("2d");Uu(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:o=e.fontSize,fontFamily:s=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(r?r+" ":"")+o+"px "+(s||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!Vu(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:r=n.fontStyle,fontVariant:o=n.fontVariant,fontWeight:s=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:a=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:f,lineHeight:g=a}=this._userSpec;return{fontStyle:r,fontVariant:o,fontFamily:l,fontSize:a,fontWeight:s,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:g}}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(Vu(t))return{width:0,height:0};if(Vu(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:o,ellipsis:s,limit:a,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:o,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const n=t[i];let r=this._measureSpecialChar(n);Vu(r)&&Lp.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),Vu(r)&&["F","W"].includes(Hp(n))&&(r=this._measureFullSizeChar()),Vu(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){const e={width:0,height:0},{fontSize:i,lineHeight:n}=this.textSpec;for(let n=0;n<t.length;n++){const r=t[n],o=["F","W"].includes(Hp(r))?1:.53;e.width+=o*i}return e.height=null!=n?n:i,e}_measureReduce(t,e){const{fontSize:i,lineHeight:n}=this.textSpec,r={width:0,height:0};if(Vu(t))return r;if(qu(t)){const o=t.filter(Uu).map((t=>t.toString()));return 0===o.length?r:1===o.length?e(o[0]):{width:o.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:o.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Vu(this._numberCharSize)){const t=this._standardMethod(Lp.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Lp.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return Vu(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Lp.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Vu(this._letterCharSize)){const t=this._standardMethod(Lp.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Lp.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return Uu(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Uu(this._canvas)&&(this._canvas=null),Uu(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}var kp;function Ip(t){if(td(t))return[t,t,t,t];if(qu(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(Ku(t)){const{top:e=0,right:i=0,bottom:n=0,left:r=0}=t;return[e,i,n,r]}return[0,0,0,0]}Lp.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Lp.NUMBERS_CHAR_SET="0123456789",Lp.FULL_SIZE_CHAR="字",function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(kp||(kp={}));const Op="undefined"==typeof window||void 0===window.window;let Dp,Fp;const zp={get find(){return Dp||(Dp=Array.prototype.find?(t,e)=>Array.prototype.find.call(t,e):(t,e)=>{const i=zp.findIndex(t,e);return i>=0?t[i]:void 0},Dp)},get findIndex(){return Fp||(Fp=Array.prototype.findIndex?(t,e)=>Array.prototype.findIndex.call(t,e):(t,e)=>{const{length:i}=t;for(let n=0;n<i;n++){if(e(t[n],n,t))return n}return-1},Fp)}};const{IE:Wp,Chrome:jp,Firefox:Np,Edge:Gp,Safari:Vp}=function(){if(Op)return{IE:!1,Edge:!1,Chrome:!1,Firefox:!1,Safari:!1};const t=window.navigator.userAgent.toLowerCase();return{IE:!!/(msie|trident)/.exec(t),Edge:t.indexOf("edge")>-1,Chrome:t.indexOf("chrome")>-1&&-1===t.indexOf("edge"),Firefox:t.indexOf("firefox")>-1,Safari:t.indexOf("safari")>-1&&-1===t.indexOf("edge")}}();function Up(...t){const e={};return t.forEach((t=>{for(const i in t)Object.defineProperty(e,i,{get:()=>t[i],set(e){t[i]=e},configurable:!0,enumerable:!0})})),e}function Kp(t,e,...i){let n=t;for(let t=0;t<i.length&&null!=n;t++)n=e(n,i[t]);return n}function $p(t,...e){return Kp(t,((t,e)=>t[e]),...e)}function Xp(t,...e){return"function"==typeof t?t(...e):t}function Yp(t){return Boolean(t&&"function"==typeof t.then)}function qp(t,e,i){return t.start.col<=e&&e<=t.end.col&&t.start.row<=i&&i<=t.end.row||t.end.col<=e&&e<=t.start.col&&t.end.row<=i&&i<=t.start.row}function Zp(t){return{start:{col:Math.min(t.start.col,t.end.col),row:Math.min(t.start.row,t.end.row)},end:{col:Math.max(t.start.col,t.end.col),row:Math.max(t.start.row,t.end.row)}}}function Jp(t,e){const i=Zp(t),n=Zp(e);if(Math.max(i.start.col,n.start.col)<=Math.min(i.end.col,n.end.col)){if(Math.max(i.start.row,n.start.row)<=Math.min(i.end.row,n.end.row))return!0}return!1}const Qp=Wp,tf={isObject:function(t){return t===Object(t)}},ef={endsWith:function(t,e,i){const n=vu(t);("number"!=typeof i||!isFinite(i)||Math.floor(i)!==i||i>n.length)&&(i=n.length),i-=e.length;const r=n.lastIndexOf(e,i);return-1!==r&&r===i}},nf={isTouchEvent:function(t){return!!t.changedTouches}},rf={toBoxArray:function(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],t[1]]:2===t.length?[t[0],t[1],t[0],t[1]]:1===t.length?[t[0],t[0],t[0],t[0]]:[t[0],t[1],t[2],t[3]]:[t,t,t,t]}},of=Function.prototype,sf={CLICK_CELL:"click_cell",DBLCLICK_CELL:"dblclick_cell",MOUSEDOWN_CELL:"mousedown_cell",MOUSEUP_CELL:"mouseup_cell",SELECTED_CELL:"selected_cell",KEYDOWN:"keydown",MOUSEENTER_TABLE:"mouseenter_table",MOUSELEAVE_TABLE:"mouseleave_table",MOUSEMOVE_CELL:"mousemove_cell",MOUSEENTER_CELL:"mouseenter_cell",MOUSELEAVE_CELL:"mouseleave_cell",CONTEXTMENU_CELL:"contextmenu_cell",RESIZE_COLUMN:"resize_column",RESIZE_COLUMN_END:"resize_column_end",CHANGE_HEADER_POSITION:"change_header_position",SORT_CLICK:"sort_click",FREEZE_CLICK:"freeze_click",SCROLL:"scroll",DROPDOWNMENU_CLICK:"dropdownmenu_click",MOUSEOVER_CHART_SYMBOL:"mouseover_chart_symbol",DRAG_SELECT_END:"drag_select_end",DROPDOWN_ICON_CLICK:"dropdown_icon_click",DROPDOWN_MENU_CLEAR:"dropdown_menu_clear",TREE_HIERARCHY_STATE_CHANGE:"tree_hierarchy_state_change",SHOW_MENU:"show_menu",HIDE_MENU:"hide_menu",ICON_CLICK:"icon_click",LEGEND_ITEM_CLICK:"legend_item_click",LEGEND_ITEM_HOVER:"legend_item_hover",LEGEND_ITEM_UNHOVER:"legend_item_unHover",LEGEND_CHANGE:"legend_change",MOUSEENTER_AXIS:"mouseenter_axis",MOUSELEAVE_AXIS:"mouseleave_axis"},af=(t,e)=>(t=>{switch(Object.prototype.toString.call(t)){case"[object Object]":return"object";case"[object Function]":return"function";case"[object Array]":return"array";case"[object String]":return"string";case"[object Number]":return"number";case"[object RegExp]":return"regExp";case"[object Boolean]":return"boolean";case"[object Symbol]":return"symbol";case"[object Date]":return"date";case"[object Undefined]":return"undefined";case"[object Null]":return"null";case"[object Error]":return"error";case"[object HTMLDocument]":return"document";case"[object global]":return"global";default:return null}})(t)===e;function lf(t,e,i){let n,r,o,s,a,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,o=r;return r=void 0,n=void 0,h=e,s=t.apply(o,i),s}function g(t,e){return p?requestAnimationFrame(t):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||c&&t-h>=o}function y(){const t=Date.now();if(m(t))return function(t){return a=void 0,d&&n?f(t):(r=void 0,n=void 0,s)}(t);a=g(y,function(t){const i=t-h,n=e&&-(t-l);return c?Math.min(n,o-i):n}(t))}return e=+e||0,af(i,"object")&&(u=!!i.leading,c="maxWait"in i,c&&(o=Math.max(+i.maxWait||0,e)),d="trailing"in i?!!i.trailing:d),function(...t){const i=Date.now(),o=m(i);if(n=t,r=this,l=i,o){if(void 0===a)return function(t){return h=t,a=g(y,e),u?f(t):s}(l);if(c)return a=g(y,e),f(l)}return void 0===a&&(a=g(y,e)),s}}class hf{static _mode;static get mode(){return hf._mode||(hf._mode=function(){let t="browser";try{"node"===window.type?t="node":"undefined"==typeof window||window.performance?"undefined"==typeof window&&(t="node"):t="miniApp"}catch(e){t="node"}return t}()),hf._mode}static set mode(t){hf._mode=t}static dpr=0;static CreateCanvas;static LoadImage;static RequestAnimationFrame;static CancelAnimationFrame;static RegisterCreateCanvas(t){hf.CreateCanvas=t}static RegisterLoadImage(t){hf.LoadImage=t}static GetCreateCanvasFunc(){return hf.CreateCanvas?hf.CreateCanvas:"worker"===hf.mode?(t=200,e=200)=>new OffscreenCanvas(t,e):void 0}static RegisterRequestAnimationFrame(t){hf.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if(hf.RequestAnimationFrame)return hf.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){hf.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if(hf.CancelAnimationFrame)return hf.CancelAnimationFrame}}let cf=1;class uf{resizeTime=100;element;cb;observer;lastSize={width:0,height:0};callBackDebounce;constructor(t,e,i){if(this.element=t,this.cb=e,this.lastSize=this.getSize(),i&&(this.resizeTime=Math.max(i,16)),this.callBackDebounce=lf(this.callBack,this.resizeTime),window?.addEventListener("resize",this.onResize),"ResizeObserver"in window){const t=window.ResizeObserver;this.observer=new t(this.mutationResize),this.observer?.observe(this.element)}else"MutationObserver"in window&&(this.observer=new MutationObserver(this.mutationResize),this.observer.observe(this.element,{attributes:!0,attributeFilter:["style"]}))}mutationResize=()=>{this.onResize()};disConnect(){window.removeEventListener("resize",this.onResize),this.observer&&(this.observer.disconnect(),this.observer=void 0)}callBack=()=>{const t=this.getSize();t.width===this.lastSize.width&&t.height===this.lastSize.height||(this.lastSize=t,this.cb&&this.cb({...this.lastSize}))};setSize(t){this.lastSize=t}onResize=()=>{this.checkSize()&&this.callBackDebounce()};checkSize(){const t=this.getSize();return t.width!==this.lastSize.width||t.height!==this.lastSize.height}getSize(){return this.element?{width:Math.floor(this.element.clientWidth),height:Math.floor(this.element.clientHeight)}:{...this.lastSize}}}class df{listeners={};reseizeListeners={};on(t,e,i,...n){if("node"===hf.mode)return-1;const r=cf++;if(t?.addEventListener)if("resize"!==e||t===window)t?.addEventListener(e,i,...n);else{const e=new uf(t,i);this.reseizeListeners[r]=e}const o={target:t,type:e,listener:i,options:n};return this.listeners[r]=o,r}once(t,e,i,...n){if("node"===hf.mode)return-1;const r=this.on(t,e,((...t)=>{this.off(r),i(...t)}),...n);return r}off(t){if("node"===hf.mode)return;if(null==t)return;const e=this.listeners[t];e&&(delete this.listeners[t],e.target.removeEventListener&&e.target.removeEventListener(e.type,e.listener,...e.options))}fire(t,e,...i){if("node"!==hf.mode)for(const n in this.listeners){const r=this.listeners[n];r.target===t&&r.type===e&&r.listener.call(r.target,...i)}}hasListener(t,e){if("node"===hf.mode)return!1;let i=!1;for(const n in this.listeners){const r=this.listeners[n];r.target===t&&r.type===e&&(i=!0)}return i}clear(){if("node"!==hf.mode){for(const t in this.listeners){const e=this.listeners[t];e.target.removeEventListener&&e.target.removeEventListener(e.type,e.listener,...e.options)}this.listeners={}}}release(){"node"!==hf.mode&&(this.clear(),this.listeners=null)}}const pf=(t,e)=>{let i=0,n=t.length-1;for(;i<=n;){const r=Math.floor((i+n)/2);if(t[r]===e)return r;t[r]>e?n=r-1:i=r+1}return n<0?0:n};class ff{_keys=[];_vals={};_sorted=!1;count(){return this._keys.length}values(){return this._vals}valueArr(){return Object.values(this._vals)}adjustOrder(t,e,i){const{_keys:n}=this;if(this._sorted||(n.sort(((t,e)=>t<e?-1:t>e?1:0)),this._sorted=!0),t>e){const r=[];for(let o=pf(n,t+i-1);o>=0;o--){const s=n[o];if(s>=t)r.push(this.get(s));else if(e<=s&&s<t)this.put(s+i,this.get(s));else if(s<e)break}for(let t=0;t<i;t++)this.put(e+t,r[i-1-t])}const{length:r}=n;if(t<e){const o=[];for(let s=pf(n,t);s<r;s++){const r=n[s];if(r>=t&&r<t+i)o.push(this.get(r));else if(t+i<=r&&r<=e)this.put(r-i,this.get(r));else if(r>e)break}for(let t=0;t<i;t++)this.put(e+t,o[t])}}put(t,e){t in this._vals||(this._keys.push(t),this._sorted=!1),this._vals[t]=e}get(t){return this._vals[t]}has(t){return bu(this._vals[t])}contain(t){return Object.values(this._vals).indexOf(t)>=0}each(t,e,i){const{_keys:n}=this,{length:r}=n;this._sorted||(n.sort(((t,e)=>t<e?-1:t>e?1:0)),this._sorted=!0);for(let o=pf(n,t);o<r;o++){const r=n[o];if(t<=r&&r<=e){if(!1===i(this.get(r),r))break}else if(e<r)return}}clear(){this._keys.length=0,this._vals={},this._sorted=!1}}let gf=class t{bounds;constructor(t,e,i,n){this.bounds=new ep,this.bounds.set(t,e,t+i,e+n)}static bounds(e,i,n,r){return new t(e,i,Math.round(n-e),Math.round(r-i))}get left(){return this.bounds.x1}set left(t){this.bounds.x1=t}get top(){return this.bounds.y1}set top(t){this.bounds.y1=t}get right(){return this.bounds.x2}set right(t){this.bounds.x2=t}get bottom(){return this.bounds.y2}set bottom(t){this.bounds.y2=t}get width(){return this.bounds.width()}set width(t){this.bounds.x2=this.bounds.x1+t}get height(){return this.bounds.height()}set height(t){this.bounds.y2=this.bounds.y1+t}offsetLeft(t){this.bounds.translate(t,0)}offsetTop(t){this.bounds.translate(0,t)}copy(){return new t(this.left,this.top,this.width,this.height)}contains(t){return this.bounds.encloses(t.bounds)}inPoint(t,e){return this.bounds.contains(t,e)}};var mf={underlayBackgroundColor:"#FFF",defaultStyle:{color:"#D3D5DA",bgColor:"#373b45",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#2F4774"}},headerStyle:{color:"#D3D5DA",bgColor:"#373b45",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#2F4774"}},rowHeaderStyle:{},cornerHeaderStyle:{},bodyStyle:{color:"#e5e7ea",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#282a2e":"#2d3137"},fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#29364D"}},frameStyle:{borderColor:"#d1d5da",borderLineWidth:1,borderLineDash:[],cornerRadius:10,shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(00, 24, 47, 0.06)"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:4,startColor:"rgba(00, 24, 47, 0.05)",endColor:"rgba(00, 24, 47, 0)"}},menuStyle:{color:"#000",highlightColor:"#2E68CF",fontSize:12,fontFamily:"sans-serif",highlightFont:"12px sans-serif",hoverBgColor:"#EEE"},selectionStyle:{cellBgColor:"#29364D",cellBorderColor:"#4284FF",cellBorderLineWidth:2}};var yf={underlayBackgroundColor:"#FFF",defaultStyle:{color:"#FFF",bgColor:"#5389FF",borderColor:"#5286FA",hover:{cellBgColor:"#2E67E3"}},headerStyle:{color:"#FFF",bgColor:"#5389FF",borderColor:"#A1C1FF",hover:{cellBgColor:"#2E67E3"}},bodyStyle:{color:"#000",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#FFF":"#F4F8FF"},borderColor:"#E0EAFE",hover:{cellBgColor:"#E9EFFD"}},frameStyle:{borderColor:"#E1E4E8",borderLineWidth:1,borderLineDash:[],cornerRadius:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:3,startColor:"#CBDCFE",endColor:"#CBDCFE"}},menuStyle:{color:"#000",highlightColor:"#2E68CF",fontSize:12,fontFamily:"sans-serif",highlightFont:"12px sans-serif",hoverBgColor:"#EEE"},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)"}};var bf={underlayBackgroundColor:"#FFF",defaultStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:600,lineHeight:14,borderColor:"#e1e4e8",padding:[8,12,8,12]},headerStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:600,lineHeight:14,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},rowHeaderStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},cornerHeaderStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},bodyStyle:{padding:[8,12,8,12],color:"#141414",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:400,textAlign:"left",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#fbfbfc":"#FFF"},borderColor:"#e1e4e8",lineHeight:14,hover:{cellBgColor:"#F7F8FA",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},frameStyle:{borderColor:"#d1d5da",borderLineWidth:1,borderLineDash:[],cornerRadius:4,shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(00, 24, 47, 0.06)"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:4,startColor:"rgba(00, 24, 47, 0.05)",endColor:"rgba(00, 24, 47, 0)"}},menuStyle:{color:"#000",highlightColor:"#2E68CF",fontSize:12,fontFamily:"sans-serif",highlightFont:"12px sans-serif",hoverBgColor:"#EEE"},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)",cellBorderLineWidth:2,cellBorderColor:"#3073f2"}};var vf={underlayBackgroundColor:"#FFF",defaultStyle:{borderColor:"#E1E4E8",color:"#000",bgColor:"#ECF1F5"},headerStyle:{fontSize:16,fontWeight:"bold",bgColor:"#ECF1F5",hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},rowHeaderStyle:{fontSize:16,fontWeight:"bold",bgColor:"#ECF1F5",hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},cornerHeaderStyle:{fontSize:16,fontWeight:"bold"},bodyStyle:{fontSize:14,bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#FDFDFD":"#FAF9FB"},hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},frameStyle:{borderColor:"#E1E4E8",borderLineWidth:1,borderLineDash:[],cornerRadius:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:3,startColor:"rgba(225, 228, 232, 0.6)",endColor:"rgba(225, 228, 232, 0.6)"}},menuStyle:{color:"#000",highlightColor:"#2E68CF",fontSize:12,fontFamily:"sans-serif",highlightFont:"12px sans-serif",hoverBgColor:"#EEE"},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)",cellBorderLineWidth:2,inlineColumnBgColor:"#CCE0FF",inlineRowBgColor:"#CCE0FF",cellBorderColor:"#0000ff"}};var wf={underlayBackgroundColor:"#FFF",defaultStyle:{borderColor:function(t){const{col:e,table:i}=t,{colCount:n,frozenColCount:r}=i,o="#ccc7c7",s="#ccc7c7";return r-1===e||n-1===e?[o,"#f2f2f2",s,null]:[o,null,s,null]},hover:{cellBorderColor:"#0000FF",cellBgColor:"#D0E0E3"},bgColor:"#FFF"},headerStyle:{color:"rgba(0, 0, 0, 0.87)",borderColor:function(t){const{row:e,table:{frozenRowCount:i}}=t;return i-1===e?["#f2f2f2","#f2f2f2","#ccc7c7","#f2f2f2"]:["#f2f2f2"]}},bodyStyle:{color:"rgba(0, 0, 0, 0.87)"},frameStyle:{borderColor:"#f2f2f2",borderLineWidth:1},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF"},selectionStyle:{cellBorderColor:"#FD5",cellBgColor:"#6FA8DC"}};const Cf={},xf=[],_f=/^(https?|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/,Sf="$$indicator$$",Af={type:"line"};function Tf(t,e,i,n){return $p(t,...i)||$p(e,...i)||n&&$p(t,...n)||n&&$p(e,...n)}class Bf{internalTheme;_defaultStyle=null;_header=null;_cornerHeader=null;_cornerRightTopCell=null;_cornerLeftBottomCell=null;_cornerRightBottomCell=null;_rightFrozen=null;_bottomFrozen=null;_rowHeader=null;_body=null;_scroll=null;_tooltip=null;_frameStyle=null;_columnResize=null;_dragHeaderSplitLine=null;_frozenColumnLine=null;_selectionStyle=null;constructor(t,e){this.internalTheme={obj:t,superTheme:e}}get font(){const{obj:t,superTheme:e}=this.internalTheme;return Tf(t,e,["font"],["bodyStyle","font"])}get underlayBackgroundColor(){const{obj:t,superTheme:e}=this.internalTheme;return Tf(t,e,["underlayBackgroundColor"])}get defaultStyle(){if(!this._defaultStyle){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.defaultStyle,t.defaultStyle);this._defaultStyle={get fontSize(){return i.fontSize??16},get fontFamily(){return i.fontFamily??"sans-serif"},get fontWeight(){return i.fontWeight},get fontVariant(){return i.fontVariant},get fontStyle(){return i.fontStyle},get bgColor(){return i.bgColor??"#FFF"},get color(){return i.color??"#000"},get borderColor(){return i.borderColor??"#000"},get borderLineWidth(){return i.borderLineWidth??1},get borderLineDash(){return i.borderLineDash??xf},get hover(){if(i.hover)return{get cellBgColor(){return i.hover?.cellBgColor??void 0},get inlineColumnBgColor(){return i.hover?.inlineColumnBgColor??(i.hover?.cellBgColor&&"string"==typeof i.hover?.cellBgColor?yu(i.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return i.hover?.inlineRowBgColor??(i.hover?.cellBgColor&&"string"==typeof i.hover?.cellBgColor?yu(i.hover?.cellBgColor,.1,!1):void 0)??void 0}}},get padding(){return i.padding??[10,16,10,16]},get textAlign(){return i.textAlign??"left"},get textBaseline(){return i.textBaseline??"middle"},get textOverflow(){return i.textOverflow??"ellipsis"},get lineHeight(){return i.lineHeight},get autoWrapText(){return i.autoWrapText??!1},get lineClamp(){return i.lineClamp??"auto"},get linkColor(){return i.linkColor??"#3772ff"},get cursor(){return i.cursor??"auto"},get marked(){return i.marked??!1},get underline(){return i.underline??!1},get underlineColor(){return i.underlineColor},get underlineDash(){return i.underlineDash},get lineThrough(){return i.lineThrough??!1},get lineThroughColor(){return i.lineThroughColor},get lineThroughDash(){return i.lineThroughDash}}}return this._defaultStyle}get headerStyle(){if(!this._header){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},this.defaultStyle,e.headerStyle,t.headerStyle);this._header=this.getStyle(i)}return this._header}get cornerHeaderStyle(){if(!this._cornerHeader){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},this.defaultStyle,e.cornerHeaderStyle,t.cornerHeaderStyle);this._cornerHeader=this.getStyle(i)}return this._cornerHeader}get cornerRightTopCellStyle(){if(!this._cornerRightTopCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerRightTopCellStyle||!t.cornerRightTopCellStyle)return this._cornerRightTopCell;const i=uu({},this.defaultStyle,e.cornerRightTopCellStyle,t.cornerRightTopCellStyle);this._cornerRightTopCell=this.getStyle(i)}return this._cornerRightTopCell}get cornerLeftBottomCellStyle(){if(!this._cornerLeftBottomCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerLeftBottomCellStyle||!t.cornerLeftBottomCellStyle)return this._cornerLeftBottomCell;const i=uu({},this.defaultStyle,e.cornerLeftBottomCellStyle,t.cornerLeftBottomCellStyle);this._cornerLeftBottomCell=this.getStyle(i)}return this._cornerLeftBottomCell}get cornerRightBottomCellStyle(){if(!this._cornerRightBottomCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerRightBottomCellStyle||!t.cornerRightBottomCellStyle)return this._cornerRightBottomCell;const i=uu({},this.defaultStyle,e.cornerRightBottomCellStyle,t.cornerRightBottomCellStyle);this._cornerRightBottomCell=this.getStyle(i)}return this._cornerRightBottomCell}get rightFrozenStyle(){if(!this._rightFrozen){const{obj:t,superTheme:e}=this.internalTheme;if(!e.rightFrozenStyle||!t.rightFrozenStyle)return this._rightFrozen;const i=uu({},this.defaultStyle,this.rowHeaderStyle,e.rightFrozenStyle,t.rightFrozenStyle);this._rightFrozen=this.getStyle(i)}return this._rightFrozen}get bottomFrozenStyle(){if(!this._bottomFrozen){const{obj:t,superTheme:e}=this.internalTheme;if(!e.bottomFrozenStyle||!t.bottomFrozenStyle)return this._bottomFrozen;const i=uu({},this.defaultStyle,this.headerStyle,e.bottomFrozenStyle,t.bottomFrozenStyle);this._bottomFrozen=this.getStyle(i)}return this._bottomFrozen}get rowHeaderStyle(){if(!this._rowHeader){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},this.defaultStyle,e.rowHeaderStyle,t.rowHeaderStyle);this._rowHeader=this.getStyle(i)}return this._rowHeader}get bodyStyle(){if(!this._body){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},this.defaultStyle,e.bodyStyle,t.bodyStyle);this._body=this.getStyle(i)}return this._body}get frameStyle(){if(!this._frameStyle){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.frameStyle,t.frameStyle);this._frameStyle={get borderColor(){return i.borderColor},get borderLineWidth(){return i.borderLineWidth},get borderLineDash(){return i.borderLineDash},get shadowBlur(){return i.shadowBlur},get shadowColor(){return i.shadowColor},get shadowOffsetX(){return i.shadowOffsetX},get shadowOffsetY(){return i.shadowOffsetY},get cornerRadius(){return i.cornerRadius}}}return this._frameStyle}get scrollStyle(){if(!this._scroll){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.scrollStyle,t.scrollStyle);this._scroll={get scrollSliderColor(){return i.scrollSliderColor??"#C0C0C0"},get scrollRailColor(){return i.scrollRailColor},get visible(){return i.visible??"scrolling"},get width(){return i.width??7},get hoverOn(){return i.hoverOn??!0}}}return this._scroll}get tooltipStyle(){if(!this._tooltip){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.tooltipStyle,t.tooltipStyle);this._tooltip={get font(){return i.font??"16px sans-serif"},get bgColor(){return i.bgColor??"#000"},get padding(){return i.padding??[6,8]},get color(){return i.color??"#FFF"}}}return this._tooltip}get columnResize(){if(!this._columnResize){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.columnResize,t.columnResize);this._columnResize={get lineColor(){return i.lineColor??"#416EFF"},get bgColor(){return i.bgColor??"#D9E2FF"},get lineWidth(){return i.lineWidth??1},get width(){return i.width??i.lineWidth+2}}}return this._columnResize}get dragHeaderSplitLine(){if(!this._dragHeaderSplitLine){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.dragHeaderSplitLine,t.dragHeaderSplitLine);this._dragHeaderSplitLine={get lineColor(){return i.lineColor??"blue"},get lineWidth(){return i.lineWidth??2},get shadowBlockColor(){return i.shadowBlockColor??"rgba(204,204,204,0.3)"}}}return this._dragHeaderSplitLine}get frozenColumnLine(){if(!this._frozenColumnLine){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.frozenColumnLine,t.frozenColumnLine);this._frozenColumnLine={get shadow(){if(i.shadow)return{get width(){return i.shadow?.width??24},get startColor(){return i.shadow?.startColor??"rgba(00, 24, 47, 0.06)"},get endColor(){return i.shadow?.endColor??"rgba(00, 24, 47, 0)"}}},get border(){if(i.border)return{get lineColor(){return i.border?.lineColor??"rgba(00, 24, 47, 0.06)"},get bgColor(){return i.border?.bgColor??i.border?.lineColor??"rgba(00, 24, 47, 0.06)"},get lineWidth(){return i.border?.lineWidth??4},get width(){return i.border?.width??i.border?.lineWidth??4}}}}}return this._frozenColumnLine}get selectionStyle(){if(!this._selectionStyle){const{obj:t,superTheme:e}=this.internalTheme,i=uu({},e.selectionStyle,t.selectionStyle);this._selectionStyle={get cellBgColor(){return i?.cellBgColor??"rgba(0, 0, 255,0.1)"},get cellBorderColor(){return i?.cellBorderColor??"#3073f2"},get cellBorderLineWidth(){return i?.cellBorderLineWidth??2}}}return this._selectionStyle}hasProperty(t){const{obj:e,superTheme:i}=this.internalTheme;return Mf(e,t)||Mf(i,t)}extends(t){return new Bf(t,this)}getStyle(t){return{get fontSize(){return t.fontSize},get fontFamily(){return t.fontFamily},get fontWeight(){return t.fontWeight},get fontVariant(){return t.fontVariant},get fontStyle(){return t.fontStyle},get bgColor(){return t.bgColor},get color(){return t.color},get borderColor(){return t.borderColor},get borderLineWidth(){return t.borderLineWidth},get borderLineDash(){return t.borderLineDash},get hover(){if(t.hover)return{get cellBgColor(){return t.hover?.cellBgColor??void 0},get inlineColumnBgColor(){return t.hover?.inlineColumnBgColor??(t.hover?.cellBgColor&&"string"==typeof t.hover?.cellBgColor?yu(t.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return t.hover?.inlineRowBgColor??(t.hover?.cellBgColor&&"string"==typeof t.hover?.cellBgColor?yu(t.hover?.cellBgColor,.1,!1):void 0)??void 0}}},get frameStyle(){if(t.frameStyle)return{get borderColor(){return t.frameStyle?.borderColor??void 0},get borderLineWidth(){return t.frameStyle?.borderLineWidth??void 0},get borderLineDash(){return t.frameStyle?.borderLineDash??void 0}}},get padding(){return t.padding},get textAlign(){return t.textAlign},get textBaseline(){return t.textBaseline},get textOverflow(){return t.textOverflow},get lineHeight(){return t.lineHeight},get autoWrapText(){return t.autoWrapText},get lineClamp(){return t.lineClamp},get linkColor(){return t.linkColor},get cursor(){return t.cursor},get textStick(){return t.textStick},get marked(){return t.marked},get underline(){return t.underline??!1},get underlineColor(){return t.underlineColor},get underlineDash(){return t.underlineDash},get lineThrough(){return t.lineThrough??!1},get lineThroughColor(){return t.lineThroughColor},get lineThroughDash(){return t.lineThroughDash}}}}function Mf(t,e){if(t instanceof Bf)return t.hasProperty(e);let i=t;if(!i)return!1;for(let t=0;t<e.length;t++){if(i=i[e[t]],!i)return!1}return!!i}const Rf=new Bf(mf,mf),Pf=new Bf(yf,yf),Ef=new Bf(bf,bf),Hf=new Bf(vf,vf),Lf=new Bf(wf,wf),kf={DEFAULT:Hf,SIMPLIFY:Lf,ARCO:Ef,DARK:Rf,BRIGHT:Pf},If={TableTheme:Bf};function Of(t){if(!t)return null;if("string"==typeof t){const e=function(t,e){if(t[e])return t[e];const i=e.toLowerCase();if(t[i])return t[i];const n=e.toLowerCase();if(t[n])return t[n];for(const e in t)if(e.toLowerCase()===i)return t[e]}(Df(),t);return e?e instanceof Bf?e:new Bf(e,e):null}return t instanceof Bf?t:new Bf(t,t)}function Df(){return Up(kf,Cf)}var Ff={DARK:Rf,BRIGHT:Pf,ARCO:Ef,DEFAULT:Hf,SIMPLIFY:Lf,theme:If,of:Of,get:Df},zf=Object.freeze({__proto__:null,ARCO:Ef,BRIGHT:Pf,DARK:Rf,DEFAULT:Hf,SIMPLIFY:Lf,default:Ff,get:Df,of:Of,theme:If}),Wf="named",jf="name",Nf="unmanaged",Gf="optional",Vf="inject",Uf="multi_inject",Kf="inversify:tagged",$f="inversify:tagged_props",Xf="inversify:paramtypes",Yf="post_construct",qf="pre_destroy";var Zf=[Vf,Uf,jf,Nf,Wf,Gf],Jf={Request:"Request",Singleton:"Singleton",Transient:"Transient"},Qf={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},tg={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},eg=0;function ig(){return eg++}var ng=function(){function t(t,e){this.id=ig(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Qf.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===Jf.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},t}(),rg="Metadata key was used more than once in a parameter:",og="NULL argument",sg="Key Not Found",ag="Ambiguous match found for serviceIdentifier:",lg="No matching bindings found for serviceIdentifier:",hg="Missing required @injectable annotation in:",cg="Missing required @inject or @multiInject annotation in:",ug="Circular dependency found:",dg="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",pg=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},fg=function(t,e){return"@postConstruct error in class "+t+": "+e},gg=function(t,e){return"@preDestroy error in class "+t+": "+e},mg=function(t,e){return"onDeactivation() error in class "+t+": "+e},yg="Maximum call stack size exceeded",bg=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Xf,t),userGeneratedMetadata:Reflect.getMetadata(Kf,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata($f,t)||[]},t}(),vg={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wg(t){return t instanceof RangeError||t.message===yg}function Cg(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function xg(t,e,i){var n="",r=i(t,e);return 0!==r.length&&(n="\nRegistered bindings:",r.forEach((function(t){var e="Object";null!==t.implementationType&&(e=Ag(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function _g(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||_g(t.parentRequest,e))}function Sg(t){t.childRequests.forEach((function(t){if(_g(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=Cg(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(ug+" "+e)}Sg(t)}))}function Ag(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var Tg=function(){function t(t){this.id=ig(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),Bg=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wf?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),Mg=function(t,e){this.parentContext=t,this.rootRequest=e},Rg=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),Pg=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),Eg=function(){function t(t,e,i,n){this.id=ig(),this.type=t,this.serviceIdentifier=i;var r="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new Pg(r||""),this.identifier=e,this.metadata=new Array;var o=null;"string"==typeof n?o=new Bg(Wf,n):n instanceof Bg&&(o=n),null!==o&&this.metadata.push(o)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e<i.length;e++){if(i[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(Uf)},t.prototype.matchesArray=function(t){return this.matchesTag(Uf)(t)},t.prototype.isNamed=function(){return this.hasTag(Wf)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return Zf.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(Gf)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===Wf}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return Zf.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(Wf)(t)},t.prototype.matchesTag=function(t){var e=this;return function(i){for(var n=0,r=e.metadata;n<r.length;n++){var o=r[n];if(o.key===t&&o.value===i)return!0}return!1}},t}(),Hg=function(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))};function Lg(t,e,i,n){var r=t.getConstructorMetadata(i),o=r.compilerGeneratedMetadata;if(void 0===o)throw new Error(hg+" "+e+".");var s=r.userGeneratedMetadata,a=Object.keys(s),l=0===i.length&&a.length>0,h=a.length>i.length,c=function(t,e,i,n,r){for(var o=[],s=0;s<r;s++){var a=kg(s,t,e,i,n);null!==a&&o.push(a)}return o}(n,e,o,s,l||h?a.length:i.length),u=Og(t,i,e);return Hg(Hg([],c,!0),u,!0)}function kg(t,e,i,n,r){var o=r[t.toString()]||[],s=Fg(o),a=!0!==s.unmanaged,l=n[t],h=s.inject||s.multiInject;if((l=h||l)instanceof Rg&&(l=l.unwrap()),a){if(!e&&(l===Object||l===Function||void 0===l))throw new Error(cg+" argument "+t+" in class "+i+".");var c=new Eg(tg.ConstructorArgument,s.targetName,l);return c.metadata=o,c}return null}function Ig(t,e,i,n){var r=t||e;if(void 0===r){var o=hg+" for property "+String(i)+" in class "+n+".";throw new Error(o)}return r}function Og(t,e,i){for(var n=t.getPropertiesMetadata(e),r=[],o=Object.getOwnPropertySymbols(n),s=0,a=Object.keys(n).concat(o);s<a.length;s++){var l=a[s],h=n[l],c=Fg(h),u=c.targetName||l,d=Ig(c.inject,c.multiInject,l,i),p=new Eg(tg.ClassProperty,u,d);p.metadata=h,r.push(p)}var f=Object.getPrototypeOf(e.prototype).constructor;if(f!==Object){var g=Og(t,f,i);r=Hg(Hg([],r,!0),g,!0)}return r}function Dg(t,e){var i=Object.getPrototypeOf(e.prototype).constructor;if(i!==Object){var n=Lg(t,Ag(i),i,!0),r=n.map((function(t){return t.metadata.filter((function(t){return t.key===Nf}))})),o=[].concat.apply([],r).length,s=n.length-o;return s>0?s:Dg(t,i)}return 0}function Fg(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Vf],multiInject:e[Uf],targetName:e[jf],unmanaged:e[Nf]}}var zg=function(){function t(t,e,i,n,r){this.id=ig(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=r,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var r=new t(e,this.parentContext,this,i,n);return this.childRequests.push(r),r},t}();function Wg(t){return t._bindingDictionary}function jg(t,e,i,n,r){var o=Gg(i.container,r.serviceIdentifier),s=[];return o.length===vg.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof r.serviceIdentifier&&t.getConstructorMetadata(r.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(r.serviceIdentifier).toSelf(),o=Gg(i.container,r.serviceIdentifier)),s=e?o:o.filter((function(t){var e=new zg(t.serviceIdentifier,i,n,t,r);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case vg.NoBindingsAvailable:if(i.isOptional())return e;var r=Cg(t),o=lg;throw o+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),r=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==r&&r.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(r,i),o+=xg(n,r,Gg),new Error(o);case vg.OnlyOneBindingAvailable:return e;case vg.MultipleBindingsAvailable:default:if(i.isArray())return e;r=Cg(t),o=ag+" "+r;throw o+=xg(n,r,Gg),new Error(o)}}(r.serviceIdentifier,s,r,i.container),s}function Ng(t,e,i,n,r,o){var s,a;if(null===r){s=jg(t,e,n,null,o),a=new zg(i,n,null,s,o);var l=new Mg(n,a);n.addPlan(l)}else s=jg(t,e,n,r,o),a=r.addChildRequest(o.serviceIdentifier,s,o);s.forEach((function(e){var i=null;if(o.isArray())i=a.addChildRequest(e.serviceIdentifier,e,o);else{if(e.cache)return;i=a}if(e.type===Qf.Instance&&null!==e.implementationType){var r=function(t,e){return Lg(t,Ag(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var s=Dg(t,e.implementationType);if(r.length<s){var l=pg(Ag(e.implementationType));throw new Error(l)}}r.forEach((function(e){Ng(t,!1,e.serviceIdentifier,n,i,e)}))}}))}function Gg(t,e){var i=[],n=Wg(t);return n.hasKey(e)?i=n.get(e):null!==t.parent&&(i=Gg(t.parent,e)),i}function Vg(t,e,i,n,r,o,s,a){void 0===a&&(a=!1);var l=new Tg(e),h=function(t,e,i,n,r,o){var s=new Bg(t?Uf:Vf,i),a=new Eg(e,n,i,s);if(void 0!==r){var l=new Bg(r,o);a.metadata.push(l)}return a}(i,n,r,"",o,s);try{return Ng(t,a,r,l,null,h),l}catch(t){throw wg(t)&&Sg(l.plan.rootRequest),t}}function Ug(t){return("object"==typeof t&&null!==t||"function"==typeof t)&&"function"==typeof t.then}function Kg(t){return!!Ug(t)||Array.isArray(t)&&t.some(Ug)}var $g,Xg=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},Yg=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},qg=function(t,e,i){t.has(e.id)||t.set(e.id,i)},Zg=function(t,e){t.cache=e,t.activated=!0,Ug(e)&&Jg(t,e)},Jg=function(t,e){return Xg(void 0,void 0,void 0,(function(){var i,n;return Yg(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e];case 1:return i=r.sent(),t.cache=i,[3,3];case 2:throw n=r.sent(),t.cache=null,t.activated=!1,n;case 3:return[2]}}))}))};!function(t){t.DynamicValue="toDynamicValue",t.Factory="toFactory",t.Provider="toProvider"}($g||($g={}));var Qg=function(){return Qg=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Qg.apply(this,arguments)},tm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},em=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},im=function(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))};function nm(t,e,i){var n;if(e.length>0){var r=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===tg.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=Kg(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),o=Qg(Qg({},r),{constr:t});n=r.isAsync?function(t){return tm(this,void 0,void 0,(function(){var e,i;return em(this,(function(n){switch(n.label){case 0:return[4,om(t.constructorInjections)];case 1:return e=n.sent(),[4,om(t.propertyInjections)];case 2:return i=n.sent(),[2,rm(Qg(Qg({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(o):rm(o)}else n=new t;return n}function rm(t){var e,i=new((e=t.constr).bind.apply(e,im([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var r=e.target.identifier,o=t.propertyInjections[n];i[r]=o})),i}function om(t){return tm(this,void 0,void 0,(function(){var e,i,n,r;return em(this,(function(o){for(e=[],i=0,n=t;i<n.length;i++)r=n[i],Array.isArray(r)?e.push(Promise.all(r)):e.push(r);return[2,Promise.all(e)]}))}))}function sm(t,e){var i=function(t,e){var i,n;if(Reflect.hasMetadata(Yf,t)){var r=Reflect.getMetadata(Yf,t);try{return null===(n=(i=e)[r.value])||void 0===n?void 0:n.call(i)}catch(e){throw new Error(fg(t.name,e.message))}}}(t,e);return Ug(i)?i.then((function(){return e})):e}function am(t,e){t.scope!==Jf.Singleton&&function(t,e){var i="Class cannot be instantiated in "+(t.scope===Jf.Request?"request":"transient")+" scope.";if("function"==typeof t.onDeactivation)throw new Error(mg(e.name,i));if(Reflect.hasMetadata(qf,e))throw new Error(gg(e.name,i))}(t,e)}var lm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},hm=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},cm=function(t){return function(e){e.parentContext.setCurrentRequest(e);var i=e.bindings,n=e.childRequests,r=e.target&&e.target.isArray(),o=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(r&&o)return n.map((function(e){return cm(t)(e)}));if(!e.target.isOptional()||0!==i.length){var s=i[0];return fm(t,e,s)}}},um=function(t,e){var i=function(t){switch(t.type){case Qf.Factory:return{factory:t.factory,factoryType:$g.Factory};case Qf.Provider:return{factory:t.provider,factoryType:$g.Provider};case Qf.DynamicValue:return{factory:t.dynamicValue,factoryType:$g.DynamicValue};default:throw new Error("Unexpected factory type "+t.type)}}(t);return function(t,e){try{return t()}catch(t){throw wg(t)&&(t=e()),t}}((function(){return i.factory.bind(t)(e)}),(function(){return new Error((t=i.factoryType,n=e.currentRequest.serviceIdentifier.toString(),"It looks like there is a circular dependency in one of the '"+t+"' bindings. Please investigate bindings withservice identifier '"+n+"'."));var t,n}))},dm=function(t,e,i){var n,r=e.childRequests;switch(function(t){var e=null;switch(t.type){case Qf.ConstantValue:case Qf.Function:e=t.cache;break;case Qf.Constructor:case Qf.Instance:e=t.implementationType;break;case Qf.DynamicValue:e=t.dynamicValue;break;case Qf.Provider:e=t.provider;break;case Qf.Factory:e=t.factory}if(null===e){var i=Cg(t.serviceIdentifier);throw new Error("Invalid binding type: "+i)}}(i),i.type){case Qf.ConstantValue:case Qf.Function:n=i.cache;break;case Qf.Constructor:n=i.implementationType;break;case Qf.Instance:n=function(t,e,i,n){am(t,e);var r=nm(e,i,n);return Ug(r)?r.then((function(t){return sm(e,t)})):sm(e,r)}(i,i.implementationType,r,cm(t));break;default:n=um(i,e.parentContext)}return n},pm=function(t,e,i){var n=function(t,e){return e.scope===Jf.Singleton&&e.activated?e.cache:e.scope===Jf.Request&&t.has(e.id)?t.get(e.id):null}(t,e);return null!==n||function(t,e,i){e.scope===Jf.Singleton&&Zg(e,i),e.scope===Jf.Request&&qg(t,e,i)}(t,e,n=i()),n},fm=function(t,e,i){return pm(t,i,(function(){var n=dm(t,e,i);return n=Ug(n)?n.then((function(t){return gm(e,i,t)})):gm(e,i,n)}))};function gm(t,e,i){var n,r=mm(t.parentContext,e,i),o=wm(t.parentContext.container),s=o.next();do{n=s.value;var a=t.parentContext,l=t.serviceIdentifier,h=vm(n,l);r=Ug(r)?bm(h,a,r):ym(h,a,r),s=o.next()}while(!0!==s.done&&!Wg(n).hasKey(t.serviceIdentifier));return r}var mm=function(t,e,i){return"function"==typeof e.onActivation?e.onActivation(t,i):i},ym=function(t,e,i){for(var n=t.next();!n.done;){if(Ug(i=n.value(e,i)))return bm(t,e,i);n=t.next()}return i},bm=function(t,e,i){return lm(void 0,void 0,void 0,(function(){var n,r;return hm(this,(function(o){switch(o.label){case 0:return[4,i];case 1:n=o.sent(),r=t.next(),o.label=2;case 2:return r.done?[3,4]:[4,r.value(e,n)];case 3:return n=o.sent(),r=t.next(),[3,2];case 4:return[2,n]}}))}))},vm=function(t,e){var i=t._activations;return i.hasKey(e)?i.get(e).values():[].values()},wm=function(t){for(var e=[t],i=t.parent;null!==i;)e.push(i),i=i.parent;return{next:function(){var t=e.pop();return void 0!==t?{done:!1,value:t}:{done:!0,value:void 0}}}};var Cm=function(t,e){var i=t.parentRequest;return null!==i&&(!!e(i)||Cm(i,e))},xm=function(t){return function(e){var i=function(i){return null!==i&&null!==i.target&&i.target.matchesTag(t)(e)};return i.metaData=new Bg(t,e),i}},_m=xm(Wf),Sm=function(t){return function(e){var i=null;if(null!==e){if(i=e.bindings[0],"string"==typeof t)return i.serviceIdentifier===t;var n=e.bindings[0].implementationType;return t===n}return!1}},Am=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new Tm(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=_m(t),new Tm(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t&&(null!==t.target&&!t.target.isNamed()&&!t.target.isTagged())},new Tm(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=xm(t)(e),new Tm(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return null!==e&&Sm(t)(e.parentRequest)},new Tm(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return null!==e&&_m(t)(e.parentRequest)},new Tm(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&xm(t)(e)(i.parentRequest)},new Tm(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&Cm(e,Sm(t))},new Tm(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&!Cm(e,Sm(t))},new Tm(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&Cm(e,_m(t))},new Tm(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&!Cm(e,_m(t))},new Tm(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&Cm(i,xm(t)(e))},new Tm(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&!Cm(i,xm(t)(e))},new Tm(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&Cm(e,t)},new Tm(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&!Cm(e,t)},new Tm(this._binding)},t}(),Tm=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new Am(this._binding)},t.prototype.onDeactivation=function(t){return this._binding.onDeactivation=t,new Am(this._binding)},t}(),Bm=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Am(this._binding),this._bindingOnSyntax=new Tm(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),Mm=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=Jf.Request,new Bm(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=Jf.Transient,new Bm(this._binding)},t}(),Rm=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Am(this._binding),this._bindingOnSyntax=new Tm(this._binding),this._bindingInSyntax=new Mm(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),Pm=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=Qf.Instance,this._binding.implementationType=t,new Rm(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error("The toSelf function can only be applied when a constructor is used as service identifier");var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=Qf.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=Qf.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Rm(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=Qf.Constructor,this._binding.implementationType=t,this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=Qf.Factory,this._binding.factory=t,this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error("Value provided to function binding must be a function!");var e=this.toConstantValue(t);return this._binding.type=Qf.Function,this._binding.scope=Jf.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=Qf.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.toAutoNamedFactory=function(t){return this._binding.type=Qf.Factory,this._binding.factory=function(e){return function(i){return e.container.getNamed(t,i)}},new Bm(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=Qf.Provider,this._binding.provider=t,this._binding.scope=Jf.Singleton,new Bm(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}(),Em=function(){function t(){}return t.of=function(e,i,n,r,o){var s=new t;return s.bindings=e,s.middleware=i,s.deactivations=r,s.activations=n,s.moduleActivationStore=o,s},t}();var Hm=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(og);if(null==e)throw new Error(og);var i=this._map.get(t);void 0!==i?i.push(e):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(og);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(sg)},t.prototype.remove=function(t){if(null==t)throw new Error(og);if(!this._map.delete(t))throw new Error(sg)},t.prototype.removeIntersection=function(t){var e=this;this.traverse((function(i,n){var r=t.hasKey(i)?t.get(i):void 0;if(void 0!==r){var o=n.filter((function(t){return!r.some((function(e){return t===e}))}));e._setValue(i,o)}}))},t.prototype.removeByCondition=function(t){var e=this,i=[];return this._map.forEach((function(n,r){for(var o=[],s=0,a=n;s<a.length;s++){var l=a[s];t(l)?i.push(l):o.push(l)}e._setValue(r,o)})),i},t.prototype.hasKey=function(t){if(null==t)throw new Error(og);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){t.forEach((function(t){return e.add(i,function(t){return"object"==typeof t&&null!==t&&"clone"in t&&"function"==typeof t.clone}(t)?t.clone():t)}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,i){t(i,e)}))},t.prototype._setValue=function(t,e){e.length>0?this._map.set(t,e):this._map.delete(t)},t}(),Lm=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Hm,onDeactivations:new Hm}},t}(),km=function(){return km=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},km.apply(this,arguments)},Im=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},Om=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Dm=function(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))},Fm=function(){function t(t){var e=t||{};if("object"!=typeof e)throw new Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===e.defaultScope)e.defaultScope=Jf.Transient;else if(e.defaultScope!==Jf.Singleton&&e.defaultScope!==Jf.Transient&&e.defaultScope!==Jf.Request)throw new Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=ig(),this._bindingDictionary=new Hm,this._snapshots=[],this._middleware=null,this._activations=new Hm,this._deactivations=new Hm,this.parent=null,this._metadataReader=new bg,this._moduleActivationStore=new Lm}return t.merge=function(e,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=new t,s=Dm([e,i],n,!0).map((function(t){return Wg(t)})),a=Wg(o);return s.forEach((function(t){var e;e=a,t.traverse((function(t,i){i.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))})),o},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=this._getContainerModuleHelpersFactory(),n=0,r=t;n<r.length;n++){var o=r[n],s=i(o.id);o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction,s.unbindAsyncFunction,s.onActivationFunction,s.onDeactivationFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Im(this,void 0,void 0,(function(){var e,i,n,r,o;return Om(this,(function(s){switch(s.label){case 0:e=this._getContainerModuleHelpersFactory(),i=0,n=t,s.label=1;case 1:return i<n.length?(r=n[i],o=e(r.id),[4,r.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction,o.unbindAsyncFunction,o.onActivationFunction,o.onDeactivationFunction)]):[3,4];case 2:s.sent(),s.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];e.forEach((function(e){var i=t._removeModuleBindings(e.id);t._deactivateSingletons(i),t._removeModuleHandlers(e.id)}))},t.prototype.unloadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Im(this,void 0,void 0,(function(){var e,i,n,r;return Om(this,(function(o){switch(o.label){case 0:e=0,i=t,o.label=1;case 1:return e<i.length?(n=i[e],r=this._removeModuleBindings(n.id),[4,this._deactivateSingletonsAsync(r)]):[3,4];case 2:o.sent(),this._removeModuleHandlers(n.id),o.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.bind=function(t){var e=this.options.defaultScope||Jf.Transient,i=new ng(t,e);return this._bindingDictionary.add(t,i),new Pm(i)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.rebindAsync=function(t){return Im(this,void 0,void 0,(function(){return Om(this,(function(e){switch(e.label){case 0:return[4,this.unbindAsync(t)];case 1:return e.sent(),[2,this.bind(t)]}}))}))},t.prototype.unbind=function(t){if(this._bindingDictionary.hasKey(t)){var e=this._bindingDictionary.get(t);this._deactivateSingletons(e)}this._removeServiceFromDictionary(t)},t.prototype.unbindAsync=function(t){return Im(this,void 0,void 0,(function(){var e;return Om(this,(function(i){switch(i.label){case 0:return this._bindingDictionary.hasKey(t)?(e=this._bindingDictionary.get(t),[4,this._deactivateSingletonsAsync(e)]):[3,2];case 1:i.sent(),i.label=2;case 2:return this._removeServiceFromDictionary(t),[2]}}))}))},t.prototype.unbindAll=function(){var t=this;this._bindingDictionary.traverse((function(e,i){t._deactivateSingletons(i)})),this._bindingDictionary=new Hm},t.prototype.unbindAllAsync=function(){return Im(this,void 0,void 0,(function(){var t,e=this;return Om(this,(function(i){switch(i.label){case 0:return t=[],this._bindingDictionary.traverse((function(i,n){t.push(e._deactivateSingletonsAsync(n))})),[4,Promise.all(t)];case 1:return i.sent(),this._bindingDictionary=new Hm,[2]}}))}))},t.prototype.onActivation=function(t,e){this._activations.add(t,e)},t.prototype.onDeactivation=function(t,e){this._deactivations.add(t,e)},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isCurrentBound=function(t){return this._bindingDictionary.hasKey(t)},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,Wf,e)},t.prototype.isBoundTagged=function(t,e,i){var n=!1;if(this._bindingDictionary.hasKey(t)){var r=this._bindingDictionary.get(t),o=function(t,e,i,n){var r=new Eg(tg.Variable,"",e,new Bg(i,n)),o=new Tg(t);return new zg(e,o,null,[],r)}(this,t,e,i);n=r.some((function(t){return t.constraint(o)}))}return!n&&this.parent&&(n=this.parent.isBoundTagged(t,e,i)),n},t.prototype.snapshot=function(){this._snapshots.push(Em.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._activations=t.activations,this._deactivations=t.deactivations,this._middleware=t.middleware,this._moduleActivationStore=t.moduleActivationStore},t.prototype.createChild=function(e){var i=new t(e||this.options);return i.parent=this,i},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),i)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){var e=this._getNotAllArgs(t,!1);return this._getButThrowIfAsync(e)},t.prototype.getAsync=function(t){return Im(this,void 0,void 0,(function(){var e;return Om(this,(function(i){return e=this._getNotAllArgs(t,!1),[2,this._get(e)]}))}))},t.prototype.getTagged=function(t,e,i){var n=this._getNotAllArgs(t,!1,e,i);return this._getButThrowIfAsync(n)},t.prototype.getTaggedAsync=function(t,e,i){return Im(this,void 0,void 0,(function(){var n;return Om(this,(function(r){return n=this._getNotAllArgs(t,!1,e,i),[2,this._get(n)]}))}))},t.prototype.getNamed=function(t,e){return this.getTagged(t,Wf,e)},t.prototype.getNamedAsync=function(t,e){return this.getTaggedAsync(t,Wf,e)},t.prototype.getAll=function(t){var e=this._getAllArgs(t);return this._getButThrowIfAsync(e)},t.prototype.getAllAsync=function(t){var e=this._getAllArgs(t);return this._getAll(e)},t.prototype.getAllTagged=function(t,e,i){var n=this._getNotAllArgs(t,!0,e,i);return this._getButThrowIfAsync(n)},t.prototype.getAllTaggedAsync=function(t,e,i){var n=this._getNotAllArgs(t,!0,e,i);return this._getAll(n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,Wf,e)},t.prototype.getAllNamedAsync=function(t,e){return this.getAllTaggedAsync(t,Wf,e)},t.prototype.resolve=function(t){var e=this.isBound(t);e||this.bind(t).toSelf();var i=this.get(t);return e||this.unbind(t),i},t.prototype._preDestroy=function(t,e){if(Reflect.hasMetadata(qf,t))return e[Reflect.getMetadata(qf,t).value]()},t.prototype._removeModuleHandlers=function(t){var e=this._moduleActivationStore.remove(t);this._activations.removeIntersection(e.onActivations),this._deactivations.removeIntersection(e.onDeactivations)},t.prototype._removeModuleBindings=function(t){return this._bindingDictionary.removeByCondition((function(e){return e.moduleId===t}))},t.prototype._deactivate=function(t,e){var i=this,n=Object.getPrototypeOf(e).constructor;try{if(this._deactivations.hasKey(t.serviceIdentifier)){var r=this._deactivateContainer(e,this._deactivations.get(t.serviceIdentifier).values());if(Ug(r))return this._handleDeactivationError(r.then((function(){return i._propagateContainerDeactivationThenBindingAndPreDestroyAsync(t,e,n)})),n)}var o=this._propagateContainerDeactivationThenBindingAndPreDestroy(t,e,n);if(Ug(o))return this._handleDeactivationError(o,n)}catch(t){throw new Error(mg(n.name,t.message))}},t.prototype._handleDeactivationError=function(t,e){return Im(this,void 0,void 0,(function(){var i;return Om(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,t];case 1:return n.sent(),[3,3];case 2:throw i=n.sent(),new Error(mg(e.name,i.message));case 3:return[2]}}))}))},t.prototype._deactivateContainer=function(t,e){for(var i=this,n=e.next();n.value;){var r=n.value(t);if(Ug(r))return r.then((function(){return i._deactivateContainerAsync(t,e)}));n=e.next()}},t.prototype._deactivateContainerAsync=function(t,e){return Im(this,void 0,void 0,(function(){var i;return Om(this,(function(n){switch(n.label){case 0:i=e.next(),n.label=1;case 1:return i.value?[4,i.value(t)]:[3,3];case 2:return n.sent(),i=e.next(),[3,1];case 3:return[2]}}))}))},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},i=function(i){return function(n){var r=t.rebind(n);return e(r,i),r}},n=function(e){return function(i,n){t._moduleActivationStore.addActivation(e,i,n),t.onActivation(i,n)}},r=function(e){return function(i,n){t._moduleActivationStore.addDeactivation(e,i,n),t.onDeactivation(i,n)}};return function(o){return{bindFunction:(s=o,function(i){var n=t.bind(i);return e(n,s),n}),isboundFunction:function(e){return t.isBound(e)},onActivationFunction:n(o),onDeactivationFunction:r(o),rebindFunction:i(o),unbindFunction:function(e){return t.unbind(e)},unbindAsyncFunction:function(e){return t.unbindAsync(e)}};var s}},t.prototype._getAll=function(t){return Promise.all(this._get(t))},t.prototype._get=function(t){var e=km(km({},t),{contextInterceptor:function(t){return t},targetType:tg.Variable});if(this._middleware){var i=this._middleware(e);if(null==i)throw new Error("Invalid return type in middleware. Middleware must return!");return i}return this._planAndResolve()(e)},t.prototype._getButThrowIfAsync=function(t){var e=this._get(t);if(Kg(e))throw new Error("You are attempting to construct '"+t.serviceIdentifier+"' in a synchronous way\n but it has asynchronous dependencies.");return e},t.prototype._getAllArgs=function(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}},t.prototype._getNotAllArgs=function(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}},t.prototype._planAndResolve=function(){var t=this;return function(e){var i=Vg(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return cm(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(i=e.contextInterceptor(i))}},t.prototype._deactivateIfSingleton=function(t){var e=this;if(t.activated)return Ug(t.cache)?t.cache.then((function(i){return e._deactivate(t,i)})):this._deactivate(t,t.cache)},t.prototype._deactivateSingletons=function(t){for(var e=0,i=t;e<i.length;e++){var n=i[e];if(Ug(this._deactivateIfSingleton(n)))throw new Error("Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)")}},t.prototype._deactivateSingletonsAsync=function(t){return Im(this,void 0,void 0,(function(){var e=this;return Om(this,(function(i){switch(i.label){case 0:return[4,Promise.all(t.map((function(t){return e._deactivateIfSingleton(t)})))];case 1:return i.sent(),[2]}}))}))},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(t,e,i){return this.parent?this._deactivate.bind(this.parent)(t,e):this._bindingDeactivationAndPreDestroy(t,e,i)},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(t,e,i){return Im(this,void 0,void 0,(function(){return Om(this,(function(n){switch(n.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(t,e)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(t,e,i)];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))},t.prototype._removeServiceFromDictionary=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error("Could not unbind serviceIdentifier: "+Cg(t))}},t.prototype._bindingDeactivationAndPreDestroy=function(t,e,i){var n=this;if("function"==typeof t.onDeactivation){var r=t.onDeactivation(e);if(Ug(r))return r.then((function(){return n._preDestroy(i,e)}))}return this._preDestroy(i,e)},t.prototype._bindingDeactivationAndPreDestroyAsync=function(t,e,i){return Im(this,void 0,void 0,(function(){return Om(this,(function(n){switch(n.label){case 0:return"function"!=typeof t.onDeactivation?[3,2]:[4,t.onDeactivation(e)];case 1:n.sent(),n.label=2;case 2:return[4,this._preDestroy(i,e)];case 3:return n.sent(),[2]}}))}))},t}(),zm=function(t){this.id=ig(),this.registry=t};function Wm(t,e,i,n){!function(t){if(void 0!==t)throw new Error(dg)}(e),Nm(Kf,t,i.toString(),n)}function jm(t){var e=[];if(Array.isArray(t)){var i=function(t){for(var e=new Set,i=0,n=t;i<n.length;i++){var r=n[i];if(e.has(r))return r;e.add(r)}}((e=t).map((function(t){return t.key})));if(void 0!==i)throw new Error(rg+" "+i.toString())}else e=[t];return e}function Nm(t,e,i,n){var r=jm(n),o={};Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var s=o[i];if(void 0===s)s=[];else for(var a=function(t){if(r.some((function(e){return e.key===t.key})))throw new Error(rg+" "+t.key.toString())},l=0,h=s;l<h.length;l++){a(h[l])}s.push.apply(s,r),o[i]=s,Reflect.defineMetadata(t,o,e)}function Gm(t){return function(e,i,n){"number"==typeof n?Wm(e,i,n,t):function(t,e,i){if(void 0!==t.prototype)throw new Error(dg);Nm($f,t.constructor,e,i)}(e,i,t)}}function Vm(){return function(t){if(Reflect.hasOwnMetadata(Xf,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(Xf,e,t),t}}function Um(t){return Gm(new Bg(Wf,t))}function Km(t){return function(e){return function(i,n,r){if(void 0===e){var o="function"==typeof i?i.name:i.constructor.name;throw new Error("@inject called with undefined this could mean that the class "+o+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.")}return Gm(new Bg(t,e))(i,n,r)}}}var $m=Km(Vf),Xm=Km(Uf);var Ym,qm,Zm=(Ym=Yf,qm="Cannot apply @postConstruct decorator multiple times in the same class",function(){return function(t,e){var i=new Bg(Ym,e);if(Reflect.hasOwnMetadata(Ym,t.constructor))throw new Error(qm);Reflect.defineMetadata(Ym,i,t.constructor)}});const Jm=Symbol("ContributionProvider");class Qm{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 ty(t,e){t(Jm).toDynamicValue((t=>{let{container:i}=t;return new Qm(e,i)})).inSingletonScope().whenTargetNamed(e)}class ey{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const r=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(r>i)){n++;break}}this.taps[n]=t}}class iy extends ey{call(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.taps.map((t=>t.fn)).forEach((t=>t(...e)))}}const ny=Symbol.for("EnvContribution"),ry=Symbol.for("VGlobal");var oy=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ay=function(t,e){return function(i,n){e(i,n,t)}};let ly=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new iy(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ly=oy([Vm(),ay(0,$m(Jm)),ay(0,Um(ny)),sy("design:paramtypes",[Object])],ly);const hy=zd-1e-8;class cy{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,o){if(Math.abs(r-n)>hy)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let s,a,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function f(t){l=i*Math.cos(t),h=i*Math.sin(t),l<c&&(c=l),l>u&&(u=l),h<d&&(d=h),h>p&&(p=h)}if(f(n),f(r),r!==n)if((n%=zd)<0&&(n+=zd),(r%=zd)<0&&(r+=zd),r<n&&(o=!o,s=n,n=r,r=s),o)for(r-=zd,s=n-n%Fd,a=0;a<4&&s>r;++a,s-=Fd)f(s);else for(s=n-n%Fd+Fd,a=0;a<4&&s<r;++a,s+=Fd)f(s);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,i,n,r){throw new Error("不支持arcTo")}bezierCurveTo(t,e,i,n,r,o){this.bounds.add(t,e),this.bounds.add(i,n),this.bounds.add(r,o)}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,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(){}}class uy{constructor(){this.curves=[],this.bounds=new ip}getCurveLengths(){return this.curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const dy=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,py={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},fy={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let gy,my,yy,by,vy,wy;var Cy,xy,_y,Sy,Ay,Ty,By,My,Ry;function Py(t){const e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=l*o,c=-a*s,u=a*o,d=l*s,p=Math.cos(n),f=Math.sin(n),g=Math.cos(r),m=Math.sin(r),y=.5*(r-n),b=Math.sin(.5*y),v=8/3*b*b/Math.sin(y),w=e+p-v*f,C=i+f+v*p,x=e+g,_=i+m,S=x+v*m,A=_-v*g;return[h*w+c*C,u*w+d*C,h*S+c*A,u*S+d*A,h*x+c*_,u*x+d*_]}function Ey(t,e,i,n){const r=function(t,e,i,n,r,o,s,a,l){const h=np(s),c=Math.sin(h),u=Math.cos(h),d=u*(a-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(a-t)*.5;let f=d*d/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);f>1&&(f=Math.sqrt(f),i*=f,n*=f);const g=u/i,m=c/i,y=-c/n,b=u/n,v=g*a+m*l,w=y*a+b*l,C=g*t+m*e,x=y*t+b*e;let _=1/((C-v)*(C-v)+(x-w)*(x-w))-.25;_<0&&(_=0);let S=Math.sqrt(_);o===r&&(S=-S);const A=.5*(v+C)-S*(x-w),T=.5*(w+x)+S*(C-v),B=Math.atan2(w-T,v-A);let M=Math.atan2(x-T,C-A)-B;M<0&&1===o?M+=zd:M>0&&0===o&&(M-=zd);const R=Math.ceil(Math.abs(M/(Fd+.001))),P=[];for(let t=0;t<R;++t){const e=B+t*M/R,r=B+(t+1)*M/R;P[t]=[A,T,e,r,i,n,c,u]}return P}(n[5],n[6],n[0],n[1],n[3],n[4],n[2],e,i);for(let e=0;e<r.length;++e){const i=Py(r[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(Cy||(Cy={})),function(t){t[t.GLOBAL=1]="GLOBAL",t[t.LOCAL=16]="LOCAL",t[t.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",t[t.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"}(xy||(xy={})),function(t){t[t.INIT=0]="INIT",t[t.DEFAULT=1]="DEFAULT",t[t.STATE=2]="STATE",t[t.ANIMATE_BIND=10]="ANIMATE_BIND",t[t.ANIMATE_PLAY=11]="ANIMATE_PLAY",t[t.ANIMATE_START=12]="ANIMATE_START",t[t.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",t[t.ANIMATE_END=14]="ANIMATE_END",t[t.TRANSLATE=20]="TRANSLATE",t[t.TRANSLATE_TO=21]="TRANSLATE_TO",t[t.SCALE=22]="SCALE",t[t.SCALE_TO=23]="SCALE_TO",t[t.ROTATE=24]="ROTATE",t[t.ROTATE_TO=25]="ROTATE_TO"}(_y||(_y={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Sy||(Sy={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"}(Ay||(Ay={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ty||(Ty={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(By||(By={})),function(t){t[t.CubicBezierCurve=0]="CubicBezierCurve",t[t.QuadraticBezierCurve=1]="QuadraticBezierCurve",t[t.ArcCurve=2]="ArcCurve",t[t.LineCurve=3]="LineCurve",t[t.EllipseCurve=4]="EllipseCurve",t[t.MoveCurve=5]="MoveCurve"}(My||(My={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Ry||(Ry={}));const Hy=[(t,e,i,n,r,o,s)=>e.arc(t[1]*r+i,t[2]*o+n,t[3]*(r+o)/2,t[4],t[5],t[6],s),(t,e,i,n,r,o,s)=>e.arcTo(t[1]*r+i,t[2]*o+n,t[3]*r+i,t[4]*o+n,t[5]*(r+o)/2,s),(t,e,i,n,r,o,s)=>e.bezierCurveTo(t[1]*r+i,t[2]*o+n,t[3]*r+i,t[4]*o+n,t[5]*r+i,t[6]*o+n,s),(t,e,i,n)=>e.closePath(),(t,e,i,n,r,o)=>e.ellipse(t[1]*r+i,t[2]*o+n,t[3]*r,t[4]*o,t[5],t[6],t[7],t[8]),(t,e,i,n,r,o,s)=>e.lineTo(t[1]*r+i,t[2]*o+n,s),(t,e,i,n,r,o,s)=>e.moveTo(t[1]*r+i,t[2]*o+n,s),(t,e,i,n,r,o,s)=>e.quadraticCurveTo(t[1]*r+i,t[2]*o+n,t[3]*r+i,t[4]*o+n,s),(t,e,i,n,r,o,s)=>e.rect(t[1]*r+i,t[2]*o+n,t[3]*r,t[4]*o,s)];function Ly(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0;for(let a=0;a<t.length;a++){const l=t[a];Hy[l[0]](l,e,i,n,r,o,s)}}class ky{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Iy(t,e,i,n,r){return function(t,e){let i=0;const n=t.length;for(let r=0;r<n;r++){const o=t[r],s=e[r],a=t[(r+1)%n],l=e[(r+1)%n];i+=Qd.distanceNN(o,s,a,l)}return i/2}([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])}function Oy(t,e,i,n,r){const o=1-r;return o*o*o*t+3*e*r*o*o+3*i*r*r*o+n*r*r*r}function Dy(t,e,i,n,r){const o=Oy(t.x,e.x,i.x,n.x,r),s=Oy(t.y,e.y,i.y,n.y,r);return new Jd(o,s)}function Fy(t,e){const{p0:i,p1:n,p2:r,p3:o}=t,s=Dy(i,n,r,o,e),a=Qd.pointAtPP(i,n,e),l=Qd.pointAtPP(n,r,e),h=Qd.pointAtPP(r,o,e),c=Qd.pointAtPP(a,l,e),u=Qd.pointAtPP(l,h,e);return[new zy(i,a,c,s),new zy(s,u,h,o)]}class zy extends ky{constructor(t,e,i,n){super(),this.type=My.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=n}_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(!1!==this.defined)return Dy(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Iy(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===By.ROW?jd(this.p0.x-this.p3.x):t===By.COLUMN?jd(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Vd(t-.01,0),i=Ud(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return Nd(r.y-n.y,r.x-n.x)}}function Wy(t,e){const{p0:i,p1:n}=t,r=Qd.pointAtPP(i,n,e);return[new jy(i,r),new jy(r,n)]}class jy extends ky{constructor(t,e){super(),this.type=My.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Qd.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nd(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()?Qd.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===By.ROW?jd(this.p0.x-this.p1.x):t===By.COLUMN?jd(this.p0.y-this.p1.y):0}}class Ny{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,r,o,s,a){const l=new zy(new Jd(this._lastX,this._lastY),new Jd(t,e),new Jd(i,n),new Jd(r,o));l.originP1=this._lastOriginP,l.originP2=a,l.defined=s,this.curves.push(l),this._lastX=r,this._lastY=o,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,n){const r=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,r){const o=new jy(new Jd(this._lastX,this._lastY),new Jd(t,e));return o.originP1=n,o.originP2=r,o.defined=i,o}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===By.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return jd(t.p0.y-n.y)}if(t===By.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return jd(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Gy extends Ny{bezierCurveTo(t,e,i,n,r,o,s,a){return super.bezierCurveTo(e,t,n,i,o,r,s,a)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vy(t,e){let i=!1;for(let n=0,r=e.length;n<=r;n++)n>=r===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class Uy{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ky(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=new Ny("linear",null!=i?i:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new Uy(r,n),t),r}function $y(t,e,i,n,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n,t.lastPoint1)}class Xy{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&$y(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:$y(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Yy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Ky(t,e);const r=new Ny("basis",null!=i?i:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new Xy(r,n),t),r}function qy(t){return t<0?-1:1}function Zy(t,e,i){const n=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(n||Number(r<0&&-0)),s=(i-t._y1)/(r||Number(n<0&&-0)),a=(o*r+s*n)/(n+r);return(qy(o)+qy(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function Jy(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Qy(t,e,i,n,r){const o=t._x0,s=t._y0,a=t._x1,l=t._y1,h=(a-o)/3;t.context.bezierCurveTo(o+h,s+h*e,a-h,l-h*i,a,l,n,t.lastPoint1)}class tb{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2,this.lastPoint1);break;case 3:Qy(this,this._t0,Jy(this,this._t0),!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,Qy(this,Jy(this,e=Zy(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Qy(this,this._t0,e=Zy(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}}tryUpdateLength(){return this.context.tryUpdateLength()}}class eb extends tb{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ib(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Ky(t,e);const r=new Ny("monotoneX",null!=i?i:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new tb(r,n),t),r}function nb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Ky(t,e);const r=new Gy("monotoneY",null!=i?i:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new eb(r,n),t),r}let rb=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&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,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function ob(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:r}=i;if(t.length<2-Number(!!r))return null;const o=new Ny("step",null!=n?n:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new rb(o,e,r),t),o}class sb{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ab(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=new Ny("linear",null!=i?i:jd(t[t.length-1].x-t[0].x)>jd(t[t.length-1].y-t[0].y)?By.ROW:By.COLUMN);return function(t,e){Vy(t,e)}(new sb(r,n),t),r}function lb(t,e,i){switch(e){case"linear":default:return Ky(t,i);case"basis":return Yy(t,i);case"monotoneX":return ib(t,i);case"monotoneY":return nb(t,i);case"step":return ob(t,.5,i);case"stepBefore":return ob(t,0,i);case"stepAfter":return ob(t,1,i);case"linearClosed":return ab(t,i)}}class hb extends uy{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new cy(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([fy.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([fy.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([fy.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,o){return this.commandList.push([fy.C,t,e,i,n,r,o]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,o),this}arcTo(t,e,i,n,r){return this.commandList.push([fy.AT,t,e,i,n,r]),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this}ellipse(t,e,i,n,r,o,s,a){return this.commandList.push([fy.E,t,e,i,n,r,o,s,a]),this._ctx&&this._ctx.ellipse(t,e,i,n,r,o,s,a),this}rect(t,e,i,n){return this.commandList.push([fy.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,r,o){return this.commandList.push([fy.A,t,e,i,n,r,o]),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this}closePath(){return this.commandList.push([fy.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[fy.M]=t=>`M${t[1]} ${t[2]}`,t[fy.L]=t=>`L${t[1]} ${t[2]}`,t[fy.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[fy.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[fy.A]=t=>{const e=[];((t,e,i,n,r,o,s)=>{const a=Math.abs(i-e),l=4*Math.tan(a/4)/3,h=i<e?-1:1,c=Math.cos(e),u=Math.sin(e),d=Math.cos(i),p=Math.sin(i),f=c*o+n,g=u*s+r,m=d*o+n,y=p*s+r,b=o*l*h,v=s*l*h;t.push(f-b*u,g+v*c,m+b*p,y-v*d,m,y)})(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t<e.length;t+=6)i+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return i},t[fy.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,r){this.clear();const o=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const r=[];for(let t=0,o=e.length;t<o;t++)if(gy=e[t],my=gy.slice(1),yy=gy[0],i=[yy],n=my.match(dy),null!==n){for(let t=0,e=n.length;t<e;t++)by=n[t],vy=parseFloat(by),Number.isNaN(vy)||i.push(vy);if(wy=py[yy],i.length-1>wy){let t;for(let e=1,n=i.length;e<n;e+=wy){t=[yy];for(let n=e,r=e+wy;n<r;n++)t.push(i[n]);r.push(t)}}else r.push(i)}else r.push(i);return r}(t);return this._runCommandStrList(o,e,i,n,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const r=lb(e,i);"x"===n?this.direction=By.ROW:"y"===n?this.direction=By.COLUMN:"auto"===n&&(this.direction=r.direction),this.curves=r.curves}fromCustomPath2D(t,e,i,n,r){return this.clear(),this._runCommandList(t.commandList,e,i,n,r),this._updateBounds(),this}transform(t,e,i,n){const r=this.commandList;if(!this.transformCbList){const t=[];t[fy.M]=this.moveToTransform,t[fy.L]=this.lineToTransform,t[fy.Q]=this.quadraticCurveToTransform,t[fy.C]=this.bezierCurveToTransform,t[fy.AT]=this.arcToTransform,t[fy.E]=this.ellipseTransform,t[fy.R]=this.rectTransform,t[fy.A]=this.arcTransform,t[fy.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*n+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*(n+r)/2}ellipseTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}rectTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}arcTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*(n+r)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,r,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,u=0,d=0,p=0,f=0;for(let g=0,m=t.length;g<m;++g){switch(e=t[g],1===l&&1===h||(e=ub(e,l,h)),e[0]){case"l":u+=e[1],d+=e[2],this.lineTo(u+s,d+a);break;case"L":u=e[1],d=e[2],this.lineTo(u+s,d+a);break;case"h":u+=e[1],this.lineTo(u+s,d+a);break;case"H":u=e[1],this.lineTo(u+s,d+a);break;case"v":d+=e[1],this.lineTo(u+s,d+a);break;case"V":d=e[1],this.lineTo(u+s,d+a);break;case"m":u+=e[1],d+=e[2],this.moveTo(u+s,d+a);break;case"M":u=e[1],d=e[2],this.moveTo(u+s,d+a);break;case"c":i=u+e[5],n=d+e[6],p=u+e[3],f=d+e[4],this.bezierCurveTo(u+e[1]+s,d+e[2]+a,p+s,f+a,i+s,n+a),u=i,d=n;break;case"C":u=e[5],d=e[6],p=e[3],f=e[4],this.bezierCurveTo(e[1]+s,e[2]+a,p+s,f+a,u+s,d+a);break;case"s":i=u+e[3],n=d+e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+s,f+a,u+e[1]+s,d+e[2]+a,i+s,n+a),p=u+e[1],f=d+e[2],u=i,d=n;break;case"S":i=e[3],n=e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+s,f+a,e[1]+s,e[2]+a,i+s,n+a),u=i,d=n,p=e[1],f=e[2];break;case"q":i=u+e[3],n=d+e[4],p=u+e[1],f=d+e[2],this.quadraticCurveTo(p+s,f+a,i+s,n+a),u=i,d=n;break;case"Q":i=e[3],n=e[4],this.quadraticCurveTo(e[1]+s,e[2]+a,i+s,n+a),u=i,d=n,p=e[1],f=e[2];break;case"t":i=u+e[1],n=d+e[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-r,f=2*d-o):"q"===c[0]&&(p=2*u-p,f=2*d-f),r=p,o=f,this.quadraticCurveTo(p+s,f+a,i+s,n+a),u=i,d=n,p=u+e[1],f=d+e[2];break;case"T":i=e[1],n=e[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+s,f+a,i+s,n+a),u=i,d=n;break;case"a":Ey(this,u+s,d+a,[e[1],e[2],e[3],e[4],e[5],e[6]+u+s,e[7]+d+a]),u+=e[6],d+=e[7];break;case"A":Ey(this,u+s,d+a,[e[1],e[2],e[3],e[4],e[5],e[6]+s,e[7]+a]),u=e[6],d=e[7];break;case"z":case"Z":this.closePath()}c=e}}_runCommandList(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==r)for(let o=0,s=t.length;o<s;++o){const s=t[o].slice();switch(s[0]){case fy.L:this.lineToTransform(s,e,i,n,r);break;case fy.M:this.moveToTransform(s,e,i,n,r);break;case fy.C:this.bezierCurveToTransform(s,e,i,n,r);break;case fy.Q:this.quadraticCurveToTransform(s,e,i,n,r);break;case fy.A:this.arcToTransform(s,e,i,n,r);break;case fy.E:this.ellipseTransform(s,e,i,n,r);break;case fy.R:this.rectTransform(s,e,i,n,r);break;case fy.AT:this.arcToTransform(s,e,i,n,r);break;case fy.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Ly(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===By.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return jd(t.p0.y-e.p1.y)}if(this.direction===By.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return jd(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n<this.curves.length;n++){e=this.curves[n];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const cb=["l",0,0,0,0,0,0,0];function ub(t,e,i){const n=cb[0]=t[0];if("a"===n||"A"===n)cb[1]=e*t[1],cb[2]=i*t[2],cb[3]=t[3],cb[4]=t[4],cb[5]=t[5],cb[6]=e*t[6],cb[7]=i*t[7];else if("h"===n||"H"===n)cb[1]=e*t[1];else if("v"===n||"V"===n)cb[1]=i*t[1];else for(let n=1,r=t.length;n<r;++n)cb[n]=(n%2==1?e:i)*t[n];return cb}const db={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,anchor:[0,0],anchor3d:[0,0],postMatrix:new op},pb={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},fb={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},gb=Object.assign({outerBorder:Object.assign(Object.assign({},fb),{distance:0}),innerBorder:Object.assign(Object.assign({},fb),{distance:0})},fb),mb={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n 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},yb=Object.assign(Object.assign(Object.assign({opacity:1,background:null,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:0,blur:0,cursor:null,html:null},pb),gb),{alignSelf:"auto"}),bb={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},vb=Object.assign(Object.assign({strokeSeg:null,pickable:!0,childrenPickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0},yb),db),wb=Object.assign(Object.assign({},vb),{startAngle:0,endAngle:Wd,innerRadius:0,outerRadius:1,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),Cb=Object.assign(Object.assign(Object.assign({},vb),bb),{points:[],segments:[],curveType:"linear",clipRange:1}),xb=Object.assign(Object.assign({},vb),{radius:1,startAngle:0,endAngle:Wd}),_b=Object.assign(Object.assign({},vb),{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"}),Sb=Object.assign(Object.assign({},vb),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Ab=Object.assign(Object.assign(Object.assign({},vb),bb),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default"}),Tb=Object.assign(Object.assign({},vb),{path:new hb,customPath:()=>{console.warn("空函数")}}),Bb=Object.assign(Object.assign({},vb),{points:[],cornerRadius:0}),Mb=Object.assign(Object.assign({},vb),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Rb=Object.assign(Object.assign({},vb),{width:0,height:0,cornerRadius:0,length:0}),Pb=Object.assign(Object.assign({},vb),{symbolType:"circle",size:10,keepDirIn3d:!0}),Eb=Object.assign(Object.assign(Object.assign({},vb),mb),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Hb=Object.assign(Object.assign({},vb),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Lb=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},vb),{fill:!0,cornerRadius:0}),kb=Object.assign(Object.assign({},Lb),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const Ib=new class{},Ob={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"}},Db=!0,Fb=!1,zb=/\w|\(|\)|-/,Wb=/[.?!,;:/,。?!、;:]/,jb=/\S/;function Nb(t,e,i,n,r){if(!e||e<=0)return 0;const o=Ib.graphicUtil.textMeasure;let s=n,a=t.slice(0,s),l=Math.floor(o.measureText(a,i).width),h=t.slice(0,s+1),c=Math.floor(o.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?s--:s++,s>t.length){s=t.length;break}if(s<0){s=0;break}a=t.slice(0,s),l=Math.floor(o.measureText(a,i).width),h=t.slice(0,s+1),c=Math.floor(o.measureText(h,i).width)}return r&&(s=Gb(t,s)),s}function Gb(t,e){let i=e;for(;zb.test(t[i-1])&&zb.test(t[i])||Wb.test(t[i]);)if(i--,i<=0)return e;return i}function Vb(t,e){const i=Ib.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var Ub=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Kb=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Eb.fontSize}=e,n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*i+r*i),height:i}}measureTextPixelHeight(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:mb.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return Math.abs(n.actualBoundingBoxAscent-n.actualBoundingBoxDescent)}measureTextBoundHieght(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:mb.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return Math.abs(n.fontBoundingBoxAscent-n.fontBoundingBoxDescent)}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,n){if(0===t.length)return{verticalList:t,width:0};const{fontSize:r=12}=e;t.forEach((t=>{t.width=0===t.direction?r:this.measureTextWidth(t.text,e)}));const o=[];let s=0,a=0;for(;a<t.length&&s+t[a].width<i;a++)s+=t[a].width,o.push(t[a]);if(t[a]&&t[a].text.length>1){const r=this._clipText(t[a].text,e,i-s,0,t[a].text.length-1);if(n&&r.str!==t[a].text){let i="",n=0;for(let e=0;e<a;e++){const r=t[e];i+=r.text,n+=r.text.length}i+=t[a].text;let o=Gb(i,n+r.str.length);o-=n,o!==r.str.length-1&&(r.str=r.str.substring(0,o),r.width=this.measureTextWidth(r.str,e))}o.push(Object.assign(Object.assign({},t[a]),{text:r.str,width:r.width})),s+=r.width}return{verticalList:o,width:s}}clipText(t,e,i,n){if(0===t.length)return{str:"",width:0};let r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};if(r=this.measureTextWidth(t[0],e),r>i)return{str:"",width:0};const o=this._clipText(t,e,i,0,t.length-1);if(n&&o.str!==t){const i=Gb(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o}_clipText(t,e,i,n,r){const o=Math.floor((n+r)/2),s=t.substring(0,o+1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const r=t.substring(0,o);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipText(t,e,i,n,o)}if(a<i){if(o>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,o+2);return l=this.measureTextWidth(n,e),l>=i?{str:s,width:a}:this._clipText(t,e,i,o,r)}return{str:s,width:a}}clipTextWithSuffixVertical(t,e,i,n,r){if(""===n)return this.clipTextVertical(t,e,i,r);if(0===t.length)return{verticalList:t,width:0};const o=this.clipTextVertical(t,e,i,r);if(o.verticalList.length===t.length&&o.verticalList[o.verticalList.length-1].width===t[t.length-1].width)return o;const s=this.measureTextWidth(n,e);if(s>i)return o;i-=s;const a=this.clipTextVertical(t,e,i,r);return a.width+=s,a.verticalList.push({text:n,direction:1,width:s}),a}clipTextWithSuffix(t,e,i,n,r){if(""===n)return this.clipText(t,e,i,r);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(o<=i)return{str:t,width:o};const s=this.measureTextWidth(n,e);if(s>i)return{str:"",width:0};i-=s;const a=this._clipText(t,e,i,0,t.length-1);if(r&&a.str!==t){const i=Gb(t,a.str.length);i!==a.str.length&&(a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a.str+=n,a.width+=s,a}};Kb=Ub([Vm()],Kb);var $b=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const Xb=Symbol.for("TextMeasureContribution");let Yb=class extends Kb{};Yb=$b([Vm()],Yb);const qb=new Fm,Zb=Symbol.for("CanvasFactory"),Jb=Symbol.for("Context2dFactory");function Qb(t){return qb.getNamed(Zb,Ib.global.env)(t)}const tv=1e-4,ev=Math.sqrt(3),iv=1/3;function nv(t){return t>-yv&&t<yv}function rv(t){return t>yv||t<-yv}const ov=[0,0],sv=[0,0],av=[0,0];function lv(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hv(t,e,i,n){const r=1-n;return r*(r*t+2*n*e)+n*n*i}function cv(t,e,i,n,r){const o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function uv(t){return(t%=Wd)<0&&(t+=Wd),t}function dv(t,e,i,n,r,o){if(o>e&&o>n||o<e&&o<n)return 0;if(n===e)return 0;const s=(o-e)/(n-e);let a=n<e?1:-1;1!==s&&0!==s||(a=n<e?.5:-.5);const l=s*(i-t)+t;return l===r?1/0:l>r?a:0}function pv(t,e,i,n,r,o,s,a,l){if(0===s)return!1;const h=s;return!(l>e+h&&l>n+h&&l>o+h||l<e-h&&l<n-h&&l<o-h||a>t+h&&a>i+h&&a>r+h||a<t-h&&a<i-h&&a<r-h)&&function(t,e,i,n,r,o,s,a,l){let h=0,c=.005,u=1/0;ov[0]=s,ov[1]=a;for(let s=0;s<1;s+=.05){sv[0]=hv(t,i,r,s),sv[1]=hv(e,n,o,s);const a=lv(ov,sv);a<u&&(h=s,u=a)}u=1/0;for(let s=0;s<32&&!(c<tv);s++){const s=h-c,a=h+c;sv[0]=hv(t,i,r,s),sv[1]=hv(e,n,o,s);const l=lv(sv,ov);if(s>=0&&l<u)h=s,u=l;else{av[0]=hv(t,i,r,a),av[1]=hv(e,n,o,a);const s=lv(av,ov);a<=1&&s<u?(h=a,u=s):c*=.5}}return l&&(l[0]=hv(t,i,r,h),l[1]=hv(e,n,o,h)),Math.sqrt(u)}(t,e,i,n,r,o,a,l,null)<=h/2}function fv(t,e,i,n,r,o,s,a,l,h,c){if(0===l)return!1;const u=l;return!(c>e+u&&c>n+u&&c>o+u&&c>a+u||c<e-u&&c<n-u&&c<o-u&&c<a-u||h>t+u&&h>i+u&&h>r+u&&h>s+u||h<t-u&&h<i-u&&h<r-u&&h<s-u)&&function(t,e,i,n,r,o,s,a,l,h,c){let u,d,p,f,g=0,m=.005,y=1/0;ov[0]=l,ov[1]=h;for(let l=0;l<1;l+=.05)sv[0]=cv(t,i,r,s,l),sv[1]=cv(e,n,o,a,l),p=lv(ov,sv),p<y&&(g=l,y=p);y=1/0;for(let l=0;l<32&&!(m<tv);l++)u=g-m,d=g+m,sv[0]=cv(t,i,r,s,u),sv[1]=cv(e,n,o,a,u),p=lv(sv,ov),u>=0&&p<y?(g=u,y=p):(av[0]=cv(t,i,r,s,d),av[1]=cv(e,n,o,a,d),f=lv(av,ov),d<=1&&f<y?(g=d,y=f):m*=.5);return c&&(c[0]=cv(t,i,r,s,g),c[1]=cv(e,n,o,a,g)),Math.sqrt(y)}(t,e,i,n,r,o,s,a,h,c,null)<=u/2}function gv(t,e,i,n,r,o,s,a,l){if(0===s)return!1;const h=s;a-=t,l-=e;const c=Math.sqrt(a*a+l*l);if(c-h>i||c+h<i)return!1;if(Math.abs(n-r)%Wd<1e-4)return!0;if(o){const t=n;n=uv(r),r=uv(t)}else n=uv(n),r=uv(r);n>r&&(r+=Wd);let u=Math.atan2(l,a);return u<0&&(u+=Wd),u>=n&&u<=r||u+Wd>=n&&u+Wd<=r}function mv(t,e,i,n,r,o,s){if(0===r)return!1;const a=r,l=r/2;let h=0,c=t;if(s>e+l&&s>n+l||s<e-l&&s<n-l||o>t+l&&o>i+l||o<t-l&&o<i-l)return!1;if(t===i)return Math.abs(o-t)<=a/2;h=(e-n)/(t-i),c=(t*n-i*e)/(t-i);const u=h*o-s+c;return u*u/(h*h+1)<=a/2*a/2}const yv=1e-4;function bv(t,e,i,n,r){const o=6*i-12*e+6*t,s=9*e+3*n-3*t-9*i,a=3*e-3*t;let l=0;if(nv(s)){if(rv(o)){const t=-a/o;t>=0&&t<=1&&(r[l++]=t)}}else{const t=o*o-4*s*a;if(nv(t))r[0]=-o/(2*s);else if(t>0){const e=Math.sqrt(t),i=(-o+e)/(2*s),n=(-o-e)/(2*s);i>=0&&i<=1&&(r[l++]=i),n>=0&&n<=1&&(r[l++]=n)}}return l}const vv=[-1,-1,-1],wv=[-1,-1];function Cv(){const t=wv[0];wv[0]=wv[1],wv[1]=t}function xv(t,e,i,n,r,o,s,a,l,h){if(h>e&&h>n&&h>o&&h>a||h<e&&h<n&&h<o&&h<a)return 0;const c=function(t,e,i,n,r,o){const s=n+3*(e-i)-t,a=3*(i-2*e+t),l=3*(e-t),h=t-r,c=a*a-3*s*l,u=a*l-9*s*h,d=l*l-3*a*h;let p=0;if(nv(c)&&nv(u))if(nv(a))o[0]=0;else{const t=-l/a;t>=0&&t<=1&&(o[p++]=t)}else{const t=u*u-4*c*d;if(nv(t)){const t=u/c,e=-a/s+t,i=-t/2;e>=0&&e<=1&&(o[p++]=e),i>=0&&i<=1&&(o[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*a+1.5*s*(-u+e),n=c*a+1.5*s*(-u-e);i=i<0?-Math.pow(-i,iv):Math.pow(i,iv),n=n<0?-Math.pow(-n,iv):Math.pow(n,iv);const r=(-a-(i+n))/(3*s);r>=0&&r<=1&&(o[p++]=r)}else{const t=(2*c*a-3*s*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),r=(-a-2*i*n)/(3*s),l=(-a+i*(n+ev*Math.sin(e)))/(3*s),h=(-a+i*(n-ev*Math.sin(e)))/(3*s);r>=0&&r<=1&&(o[p++]=r),l>=0&&l<=1&&(o[p++]=l),h>=0&&h<=1&&(o[p++]=h)}}return p}(e,n,o,a,h,vv);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=vv[h],g=0===c||1===c?.5:1;cv(t,i,r,s,c)<l||(d<0&&(d=bv(e,n,o,a,wv),wv[1]<wv[0]&&d>1&&Cv(),p=cv(e,n,o,a,wv[0]),d>1&&(f=cv(e,n,o,a,wv[1]))),2===d?c<wv[0]?u+=p<e?g:-g:c<wv[1]?u+=f<p?g:-g:u+=a<f?g:-g:c<wv[0]?u+=p<e?g:-g:u+=a<p?g:-g)}return u}function _v(t,e,i,n,r,o,s,a){if(a>e&&a>n&&a>o||a<e&&a<n&&a<o)return 0;const l=function(t,e,i,n,r){const o=t-2*e+i,s=2*(e-t),a=t-n;let l=0;if(nv(o)){if(rv(s)){const t=-a/s;t>=0&&t<=1&&(r[l++]=t)}}else{const t=s*s-4*o*a;if(nv(t)){const t=-s/(2*o);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-s+e)/(2*o),n=(-s-e)/(2*o);i>=0&&i<=1&&(r[l++]=i),n>=0&&n<=1&&(r[l++]=n)}}return l}(e,n,o,a,vv);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,o);if(h>=0&&h<=1){let a=0;const c=hv(e,n,o,h);for(let n=0;n<l;n++){const l=0===vv[n]||1===vv[n]?.5:1;hv(t,i,r,vv[n])<s||(vv[n]<h?a+=c<e?l:-l:a+=o<c?l:-l)}return a}const c=0===vv[0]||1===vv[0]?.5:1;return hv(t,i,r,vv[0])<s?0:o<e?c:-c}function Sv(t,e,i,n,r,o,s,a){if((a-=e)>i||a<-i)return 0;const l=Math.sqrt(i*i-a*a);vv[0]=-l,vv[1]=l;const h=Math.abs(n-r);if(h<1e-4)return 0;if(h>=Wd-1e-4){n=0,r=Wd;const e=o?1:-1;return s>=vv[0]+t&&s<=vv[1]+t?e:0}if(n>r){const t=n;n=r,r=t}n<0&&(n+=Wd,r+=Wd);let c=0;for(let e=0;e<2;e++){const i=vv[e];if(i+t>s){let t=Math.atan2(a,i),e=o?1:-1;t<0&&(t=Wd+t),(t>=n&&t<=r||t+Wd>=n&&t+Wd<=r)&&(t>Dd/2&&t<1.5*Dd&&(e=-e),c+=e)}}return c}function Av(t){return Math.round(t/Dd*1e8)/1e8%2*Dd}function Tv(t,e){let i=Av(t[0]);i<0&&(i+=Wd);const n=i-t[0];let r=t[1];r+=n,!e&&r-i>=Wd?r=i+Wd:e&&i-r>=Wd?r=i-Wd:!e&&i>r?r=i+(Wd-Av(i-r)):e&&i<r&&(r=i-(Wd-Av(r-i))),t[0]=i,t[1]=r}const Bv=[0,0];function Mv(t,e,i,n,r){const o=t,s=t.length;let a,l,h=0,c=0,u=0,d=0,p=0;for(let t=0;t<s;t++){const s=o[t],f=0===t;s[0]===fy.M&&t>1&&(i||(h+=dv(c,u,d,p,n,r))),f&&(c=s[1],u=s[2],d=c,p=u);const g=s[0],m=s[1],y=s[2],b=s[3],v=s[4],w=s[5],C=s[6];let x=v,_=w;Bv[0]=x,Bv[1]=_,Tv(Bv,Boolean(s[6])),x=Bv[0],_=Bv[1];const S=x,A=_-x,T=!!(1-(s[6]?0:1)),B=(n-m)*b/b+m;switch(g){case fy.M:d=m,p=y,c=d,u=p;break;case fy.L:if(i){if(mv(c,u,m,y,e,n,r))return!0}else h+=dv(c,u,m,y,n,r)||0;c=m,u=y;break;case fy.C:if(i){if(fv(c,u,m,y,b,v,w,C,e,n,r))return!0}else h+=xv(c,u,m,y,b,v,w,C,n,r)||0;c=w,u=C;break;case fy.Q:if(i){if(pv(c,u,m,y,b,v,e,n,r))return!0}else h+=_v(c,u,m,y,b,v,n,r)||0;c=b,u=v;break;case fy.A:if(a=Math.cos(S)*b+m,l=Math.sin(S)*b+y,f?(d=a,p=l):h+=dv(c,u,a,l,n,r),i){if(gv(m,y,b,S,S+A,T,e,B,r))return!0}else h+=Sv(m,y,b,S,S+A,T,B,r);c=Math.cos(S+A)*b+m,u=Math.sin(S+A)*b+y;break;case fy.R:if(d=c=m,p=u=y,a=d+b,l=p+v,i){if(mv(d,p,a,p,e,n,r)||mv(a,p,a,l,e,n,r)||mv(a,l,d,l,e,n,r)||mv(d,l,d,p,e,n,r))return!0}else h+=dv(a,p,a,l,n,r),h+=dv(d,l,d,p,n,r);break;case fy.Z:if(i){if(mv(c,u,d,p,e,n,r))return!0}else h+=dv(c,u,d,p,n,r);c=d,u=p}}return i||(f=u,g=p,Math.abs(f-g)<yv)||(h+=dv(c,u,d,p,n,r)||0),0!==h;var f,g}var Rv=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ev=function(t,e){return function(i,n){e(i,n,t)}};let Hv=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Qb({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const r=this.global.measureTextMethod;this.global.measureTextMethod=i;const o={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:mb.fontSize};return this.global.measureTextMethod=r,o}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Lp(Object.assign({defaultFontParams:{fontFamily:mb.fontFamily,fontSize:mb.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Lp.ALPHABET_CHAR_SET+Lp.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var Lv;Hv=Rv([Vm(),Ev(0,$m(Jm)),Ev(0,Um(Xb)),Ev(1,$m(ry)),Pv("design:paramtypes",[Object,Object])],Hv),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Lv||(Lv={}));const kv=new op;let Iv=class{constructor(){this.matrix=new op}init(t){return this.mode=Lv.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Lv.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(kv.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:r}=i;this.outTargetMatrix.translate(n,r),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-r)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(kv.a,kv.b,kv.c,kv.d,kv.e,kv.f),this}scale(t,e,i){return this.mode===Lv.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kv.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kv.a,kv.b,kv.c,kv.d,kv.e,kv.f),this}translate(t,e){return this.mode===Lv.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Lv.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Iv=Rv([Vm(),Pv("design:paramtypes",[])],Iv);const Ov={arc:wb,area:Cb,circle:xb,line:Ab,path:Tb,symbol:Pb,text:Eb,rect:Mb,rect3d:Rb,polygon:Bb,richtext:Hb,richtextIcon:kb,image:Lb,group:_b,glyph:Sb},Dv=Object.keys(Ov);function Fv(){return{arc:Object.assign({},Ov.arc),area:Object.assign({},Ov.area),circle:Object.assign({},Ov.circle),line:Object.assign({},Ov.line),path:Object.assign({},Ov.path),symbol:Object.assign({},Ov.symbol),text:Object.assign({},Ov.text),rect:Object.assign({},Ov.rect),rect3d:Object.assign({},Ov.rect3d),polygon:Object.assign({},Ov.polygon),richtext:Object.assign({},Ov.richtext),richtextIcon:Object.assign({},Ov.richtextIcon),image:Object.assign({},Ov.image),group:Object.assign({},Ov.group),glyph:Object.assign({},Ov.glyph)}}function zv(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],r=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=r[t])}))}else t[i]=e[i]})))}const Wv=new Array(60).fill(0).map((()=>Fv()));class jv{constructor(){this._defaultTheme=Wv.pop()||Fv(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?zv(this.userTheme,t.userTheme,!1):this.userTheme=hd(t.userTheme),zv(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,r=t.common||{},o=Object.assign(r,this.commonTheme);Dv.forEach((r=>{var s,a;e[r]||o||t[r]?n[r]=Object.assign({},i[r],null!=o?o:{},null!==(s=t[r])&&void 0!==s?s:{},null!==(a=e[r])&&void 0!==a?a:{}):n[r]=i[r]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Nv=new jv;function Gv(t,e){return t.glyphHost?Gv(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Nv.getTheme()}return null}(t)||Nv.getTheme()}class Vv{static GenAutoIncrementId(){return Vv.auto_increment_id++}}Vv.auto_increment_id=0;var Uv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Kv extends Wu{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=Vv.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Uv(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!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&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>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 i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;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(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}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(null!==e);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(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const n=Nu(i,!0)&&i||Ku(i)&&i.capture,r=Ku(i)&&i.once,o=Gu(e)?void 0:e;return t=n?`${t}capture`:t,e=Gu(e)?e:e.handleEvent,r?super.once(t,e,o):super.on(t,e,o),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=Nu(i,!0)&&i||Ku(i)&&i.capture,r=Gu(e)?void 0:e;t=n?`${t}capture`:t,e=Gu(e)?e:e.handleEvent;const o=Ku(i)&&i.once;return super.off(t,e,r,o),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return Ku(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){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class $v{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=$v.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Jd,this.page=new Jd,this.canvas=new Jd,this.viewport=new Jd,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.path}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Xv extends $v{constructor(){super(...arguments),this.client=new Jd,this.movement=new Jd,this.offset=new Jd,this.global=new Jd,this.screen=new Jd}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,n,r,o,s,a,l,h,c,u,d,p,f){throw new Error("Method not implemented.")}}class Yv extends Xv{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const n=new Yv(this.manager);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice(),n.type=this.type,n}}class qv extends Xv{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new qv(this.manager);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice(),n.type=this.type,n}}qv.DOM_DELTA_PIXEL=0,qv.DOM_DELTA_LINE=1,qv.DOM_DELTA_PAGE=2;class Zv extends $v{constructor(t,e){super(),this.type=t,this.detail=e}}const Jv="object"==typeof performance&&performance.now?performance:Date;function Qv(t){return"mouse"===t||"pen"===t}class tw{constructor(t){this.dispatch=new Wu,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Qv(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e),o=Qv(r.pointerType),s=this.trackingData(t.pointerId),a=this.findMountedTarget(s.overTargets);if(s.overTargets&&a&&a!==this.rootTarget&&a!==r.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,a||void 0);if(this.dispatchEvent(i,"pointerout"),o&&this.dispatchEvent(i,"mouseout"),!r.composedPath().includes(a)){const e=this.createPointerEvent(t,"pointerleave",a||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!r.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),o&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(a!==r.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(r,e);this.dispatchEvent(i,"pointerover"),o&&this.dispatchEvent(i,"mouseover");let n=null==a?void 0:a.parent;for(;n&&n!==this.rootTarget.parent&&n!==r.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(r,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==a&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),o&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(r,"pointermove"),"touch"===r.pointerType&&this.dispatchEvent(r,"touchmove"),o&&(this.dispatchEvent(r,"mousemove"),this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),s.overTargets=r.composedPath(),this.freeEvent(r)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId),o=this.createPointerEvent(t,t.type,e),s=Qv(o.pointerType);this.dispatchEvent(o,"pointerover"),s&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursor=(null===(n=null===(i=o.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const a=this.clonePointerEvent(o,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;r.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(a)},this.onPointerOut=(t,e)=>{if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Qv(t.pointerType),n=this.findMountedTarget(i.overTargets),r=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(r),e&&this.dispatchEvent(r,"mouseout");const o=this.createPointerEvent(t,"pointerleave",n||void 0);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),e&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;i.overTargets=[],this.freeEvent(r),this.freeEvent(o)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=Jv.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Qv(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),o=this.findMountedTarget(r.pressTargetsByButton[t.button]);let s=o;if(o&&!n.composedPath().includes(o)){let e=o;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Qv(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],s=e}if(s){const e=this.clonePointerEvent(n,"click");e.target=s,e.path=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const o=r.clicksByButton[t.button];o.target===e.target&&i-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=e.target,o.timeStamp=i,e.detail=o.clickCount,Qv(e.pointerType)?(this.dispatchEvent(e,"click"),2===o.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Yv))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),r=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):Qv(r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(r)},this.onWheel=(t,e)=>{if(!(t instanceof qv))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,r,o;if(!this.rootTarget)return;const s=this.mappingTable[t.type];let a;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(r=this._prePointTargetCache)||void 0===r?void 0:r.stageRenderCount)?a=this._prePointTargetCache[l]:(a=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:a,stageRenderCount:null!==(o=null==a?void 0:a.stage.renderCount)&&void 0!==o?o:-1}),s)for(let e=0,i=s.length;e<i;e++)s[e].fn(t,a);else console.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 n=0,r=i.length-1;n<r;n++)if(t.currentTarget=i[n],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 n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const n=this.allocateEvent(Yv);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=i||this.pickTarget(n.global.x,n.global.y),"string"==typeof e&&(n.type=e),n}createWheelEvent(t,e){const i=this.allocateEvent(qv);return this.copyWheelData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=e||this.pickTarget(i.global.x,i.global.y),i}clonePointerEvent(t,e){const i=this.allocateEvent(Yv);return 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(),i.type=null!=e?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 Yv&&e instanceof Yv&&(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 Xv&&e instanceof Xv&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset),e.viewport.copyFrom(t.viewport))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Jv.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events["*"];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e){let i;const n=this.rootTarget.pick(t,e);return i=n&&n.graphic?n.graphic:n&&n.group?n.group:t>=0&&t<=sd(this.rootTarget,"width")&&e>=0&&e<=sd(this.rootTarget,"height")?this.rootTarget:null,i}}const ew={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof $v))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new Zv(t,e))}},iw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class nw{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){const i=e[t],n=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(n)}this.setCursor(this.manager.cursor)},this.onPointerMove=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor)},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t<n;t++){const n=this.bootstrapEvent(this.rootPointerEvent,i[t]);n.type+=e,this.manager.mapEvent(n)}this.setCursor(this.manager.cursor)},this.onPointerOverOut=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor)},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:r,viewport:o,autoPreventDefault:s=!1}=t;this.manager=new tw(n),this.globalObj=r,this.supportsPointerEvents=r.supportsPointerEvents,this.supportsTouchEvents=r.supportsTouchEvents,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.viewport=o,this.rootPointerEvent=new Yv,this.rootWheelEvent=new qv,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&Yu(t)&&!ld(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:r}=t,o=this.domElement.getBoundingClientRect();return{x:n-o.left,y:r-o.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const n=t.changedTouches[i];Xu(n.button)&&(n.button=0),Xu(n.buttons)&&(n.buttons=1),Xu(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),Xu(n.width)&&(n.width=n.radiusX||1),Xu(n.height)&&(n.height=n.radiusY||1),Xu(n.tiltX)&&(n.tiltX=0),Xu(n.tiltY)&&(n.tiltY=0),Xu(n.pointerType)&&(n.pointerType="touch"),Xu(n.pointerId)&&(n.pointerId=n.identifier||0),Xu(n.pressure)&&(n.pressure=n.force||.5),Xu(n.twist)&&(n.twist=0),Xu(n.tangentialPressure)&&(n.tangentialPressure=0),Xu(n.layerX)&&(n.layerX=n.offsetX=n.clientX),Xu(n.layerY)&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;Xu(i.isPrimary)&&(i.isPrimary=!0),Xu(i.width)&&(i.width=1),Xu(i.height)&&(i.height=1),Xu(i.tiltX)&&(i.tiltX=0),Xu(i.tiltY)&&(i.tiltY=0),Xu(i.pointerType)&&(i.pointerType="mouse"),Xu(i.pointerId)&&(i.pointerId=1),Xu(i.pressure)&&(i.pressure=.5),Xu(i.twist)&&(i.twist=0),Xu(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);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:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas);const{x:r,y:o}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=o,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:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas);const{x:r,y:o}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=o,t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=iw[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Jv.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}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)}}class rw{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return rw.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class ow{static Avaliable(){return!0}avaliable(){return ow.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 sw{static Avaliable(){return!!Ib.global.getRequestAnimationFrame()}avaliable(){return sw.Avaliable()}tick(t,e){Ib.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var aw;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(aw||(aw={}));class lw{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-lw.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*lw.bounceIn(2*t):.5*lw.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Wd*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Wd/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Wd*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Wd/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Wd*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Wd/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Wd/e)*.5+1}}}lw.quadIn=lw.getPowIn(2),lw.quadOut=lw.getPowOut(2),lw.quadInOut=lw.getPowInOut(2),lw.cubicIn=lw.getPowIn(3),lw.cubicOut=lw.getPowOut(3),lw.cubicInOut=lw.getPowInOut(3),lw.quartIn=lw.getPowIn(4),lw.quartOut=lw.getPowOut(4),lw.quartInOut=lw.getPowInOut(4),lw.quintIn=lw.getPowIn(5),lw.quintOut=lw.getPowOut(5),lw.quintInOut=lw.getPowInOut(5),lw.backIn=lw.getBackIn(1.7),lw.backOut=lw.getBackOut(1.7),lw.backInOut=lw.getBackInOut(1.7),lw.elasticIn=lw.getElasticIn(1,.3),lw.elasticOut=lw.getElasticOut(1,.3),lw.elasticInOut=lw.getElasticInOut(1,.3*1.5);class hw{constructor(){this.id=Vv.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===Sy.END?this.removeAnimate(e):e.status===Sy.RUNNING||e.status===Sy.INITIAL?(this.animateCount++,e.advance(t)):e.status===Sy.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const cw=new hw;class uw{constructor(t,e,i,n,r){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class dw extends uw{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class pw{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vv.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cw;this.id=t,this.timeline=e,this.status=Sy.INITIAL,this.tailAnimate=new fw(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Vd(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){pw.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pw.mode;t&&e&Ay.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_y.ANIMATE_PLAY})}runCb(t){const e=new dw((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,o){const s=pw.interpolateMap.get(t)||pw.interpolateMap.get("");return!!s&&s(t,e,i,n,r,o)}pause(){this.status===Sy.RUNNING&&(this.status=Sy.PAUSED)}resume(){this.status===Sy.PAUSED&&(this.status=Sy.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new fw(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._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===Sy.INITIAL&&(this.status=Sy.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Sy.RUNNING&&(this.status=Sy.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,r=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const o=t>=r;if(o&&(t=r),t===n)return o;for(let n=0;n<this.subAnimates.length&&(e=this.subAnimates[n],!(i+e.totalDuration>=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),o}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=Sy.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}pw.mode=Ay.NORMAL,pw.interpolateMap=new Map;class fw{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 gw(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?lw[i]:i,r=this._addStep(e,null,n);return r.type=Ty.customAnimate,this._appendProps(t.getEndProps(),r,!1),this._appendCustomAnimate(t,r),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const r="string"==typeof i?lw[i]:i,o=this._addStep(e,null,r);return o.type=Ty.to,this._appendProps(t,o,!!n&&n.tempProps),o.propKeys||(o.propKeys=Object.keys(o.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(o.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const r={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{r[t]=this.getLastPropByName(t,this.stepTail)})),this.to(r,e,i,n),this.stepTail.type=Ty.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Ty.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new gw(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===r[t]&&(r[t]=n.props[t])}))),n=n.prev;const o=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach((t=>{if(void 0===o[t]){const e=this.animate.getStartProps();o[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,r=this.rawPosition;let o,s,a=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t<l)return this.rawPosition=t,!1;if(t-=l,i<=0)return a=!0,a;if(o=Math.floor(t/i),s=t-o*i,a=t>=n*i+i,a&&(s=i,o=n,t=s*o+i),t===r)return a;const h=!this.reversed!=!(this.bounce&&o%2);return h&&(s=i-s),this._deltaPosition=s-this.position,this.position=s,this.rawPosition=t+l,this.updatePosition(a,h),a}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,r=this.duration;if(this.target&&i){let o=i.next;for(;o&&o.position<=n;)i=o,o=i.next;let s=t?0===r?1:n/r:(n-i.position)/i.duration;i.easing&&(s=i.easing(s)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,s,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,s)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class gw{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const mw=200,yw="cubicOut";var bw;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(bw||(bw={}));const vw=[!1,!1,!1,!1],ww=[0,0,0,0],Cw=t=>t?qu(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ww[0]=t[0],ww[2]=t[0],ww[1]=t[1],ww[3]=t[1],ww):t:t:0,xw=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],_w=[1,2,3,0,1,2,3,0];function Sw(t,e,i,n){for(;t>=Wd;)t-=Wd;for(;t<0;)t+=Wd;for(;t>e;)e+=Wd;xw[0].x=i,xw[1].y=i,xw[2].x=-i,xw[3].y=-i;const r=Math.ceil(t/Fd)%4,o=Math.ceil(e/Fd)%4;if(n.add(Gd(t)*i,Kd(t)*i),n.add(Gd(e)*i,Kd(e)*i),r!==o||e-t>Dd){let t=!1;for(let e=0;e<_w.length;e++)if(t||r!==_w[e]){if(t&&o===_w[e])break;if(t){const t=xw[_w[e]];n.add(t.x,t.y)}}else{t=!0;const e=xw[r];n.add(e.x,e.y)}}}function Aw(t,e,i){const{x:n,y:r}=Zd(t.x,t.y,e.x,e.y,i),{x:o,y:s}=Zd(t.x1,t.y1,e.x1,e.y1,i),a=new Jd(n,r,o,s);return a.defined=e.defined,a}function Tw(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let n=[];if(t.length>e.length){n=e.map((t=>{const e=new Jd(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)n[r]=Aw(t[r],e[r],i)}else{n=e.map((t=>{const e=new Jd(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)n[r]=Aw(t[r],e[r],i)}return n}function Bw(t,e){if(qu(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}class Mw{constructor(){this.durations=[],this.timeout=Mw.TimeOut,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Mw.TimeOut=1e3/60;const Rw=new Mw;var Pw;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Pw||(Pw={}));var Ew={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Hw={};for(const t in Ew)ld(Ew,t)&&(Hw[Ew[t]]=t);const Lw={to:{},get:{}};function kw(t,e,i){return Math.min(Math.max(e,t),i)}function Iw(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}Lw.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=Lw.get.hsl(t,n),i="hsl";break;case"hwb":e=Lw.get.hwb(t,n),i="hwb";break;default:e=Lw.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},Lw.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,r;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}r&&(e[3]=Math.round(parseInt(r,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],r=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);r&&(e[3]=Math.round(parseInt(r+r,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=Ew[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=kw(e[n],0,255);return e[3]=kw(e[3],0,1),e},Lw.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=kw(parseFloat(i[2]),0,100),e[2]=kw(parseFloat(i[3]),0,100),e[3]=kw(isNaN(t)?1:t,0,1),e}return null},Lw.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=kw(parseFloat(i[2]),0,100),e[2]=kw(parseFloat(i[3]),0,100),e[3]=kw(isNaN(t)?1:t,0,1),e}return null},Lw.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const n=e;return"#"+Iw(n[0])+Iw(n[1])+Iw(n[2])+(n[3]<1?Iw(Math.round(255*n[3])):"")},Lw.to.rgb=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const n=e;return n.length<4||1===n[3]?"rgb("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+")":"rgba("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+", "+n[3]+")"},Lw.to.rgb.percent=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const n=e,r=Math.round(n[0]/255*100),o=Math.round(n[1]/255*100),s=Math.round(n[2]/255*100);return n.length<4||1===n[3]?"rgb("+r+"%, "+o+"%, "+s+"%)":"rgba("+r+"%, "+o+"%, "+s+"%, "+n[3]+")"},Lw.to.hsl=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const n=e;return n.length<4||1===n[3]?"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)":"hsla("+n[0]+", "+n[1]+"%, "+n[2]+"%, "+n[3]+")"},Lw.to.hwb=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const n=e;let r="";return n.length>=4&&1!==n[3]&&(r=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+r+")"},Lw.to.keyword=function(t){return Hw[t.slice(0,3)]};const Ow=Lw;var Dw;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Dw||(Dw={}));class Fw{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dw.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Dw.Color1){let e=Fw.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=Lw.get(t),e&&e.value){const n=e.value,r=[n[0]/255,n[1]/255,n[2]/255,n[3]];Fw.store1[t]=r,Fw.store255[t]=n,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3]}return i}let n=Fw.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=Lw.get(t),n&&n.value){const e=n.value;Fw.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],Fw.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===Dw.Color1){if(Fw.store1[t])return;Fw.store1[t]=i,Fw.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Fw.store255[t])return;Fw.store255[t]=i,Fw.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function zw(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ww(t,e,i,n,r){if(!t||!e)return t&&zw(t)||e&&zw(e)||!1;let o,s,a=!1,l=!1;if(Array.isArray(t)?o=t:"string"==typeof t?o=Fw.Get(t,Dw.Color255):a=!0,Array.isArray(e)?s=e:"string"==typeof e?s=Fw.Get(e,Dw.Color255):l=!0,a!==l){const o=a?t:e,s=a?e:t,l=Object.assign(Object.assign({},o),{stops:o.stops.map((t=>Object.assign(Object.assign({},t),{color:zw(s)})))});return a?Ww(o,l,i,n,r):Ww(l,o,i,n,r)}if(a){if(t.gradient===e.gradient){const n=t,r=e,o=n.stops,s=r.stops;if(o.length!==s.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,r=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:Gw(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}(n,r,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,r=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:Gw(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}(n,r,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,r=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:Gw(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}(n,r,i)}return!1}return r&&r(o,s),zw(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(o,s,i),n)}Fw.store255={},Fw.store1={};const jw=[0,0,0,0],Nw=[0,0,0,0];function Gw(t,e,i){return Fw.Get(t,Dw.Color255,jw),Fw.Get(e,Dw.Color255,Nw),`rgba(${Math.round(jw[0]+(Nw[0]-jw[0])*i)},${Math.round(jw[1]+(Nw[1]-jw[1])*i)},${Math.round(jw[2]+(Nw[2]-jw[2])*i)},${jw[3]+(Nw[3]-jw[3])*i})`}class Vw{static GetImage(t,e){var i;let n=Vw.cache.get(t);n?"fail"===n.loadState?Ib.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Ib.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},Vw.cache.set(t,n),n.dataPromise=Ib.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=Vw.cache.get(t);n?"fail"===n.loadState?Ib.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Ib.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},Vw.cache.set(t,n),n.dataPromise=Ib.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Vw.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Vw.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ib.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ib.global.loadBlob(t):"json"===e&&(i.dataPromise=Ib.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}Vw.cache=new Map;const Uw=new op,Kw=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],$w=["x","y"],Xw=["scaleX","scaleY"],Yw=["angle"],qw=new Jd;class Zw extends Kv{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(Zw.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode)}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new ip,this._updateTag=Cy.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=Gv(this.parent).group,{scrollX:e=t.scrollX,scrollY:r=t.scrollY}=this.parent.attribute;qw.x=i+e,qw.y=n+r}else qw.x=i,qw.y=n;return qw}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ib.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.addUpdateLayoutTag(),Ib.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new op),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Cy.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Cy.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Cy.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Cy.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Cy.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&Cy.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Cy.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===xy.GLOBAL){const i=new Jd(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e<n.length;e++){const i=n[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var r;const o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);o?this._setAttributes(o,i,n):Vu(null===(r=this.normalAttrs)||void 0===r?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(n)):this.normalAttrs[t]=e,"background"===t&&this.loadImage(e,!0)}needUpdateTags(t){for(let e=0;e<Kw.length;e++){const i=Kw[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Kw.length;e++)if(t===Kw[e])return!0;return!1}initAttributes(t){const e={type:_y.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background&&this.loadImage(t.background,!0),this._updateTag=Cy.INIT,this.onAttributeUpdate(e)}translate(t,e){var i,n;if(0===t&&0===e)return this;const r={type:_y.TRANSLATE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,$w,r);o&&(t=o.x,e=o.y,delete o.x,delete o.y,this._setAttributes(o));const s=this.attribute,a=s.postMatrix;return a?Ib.transformUtil.fromMatrix(a,a).translate(t,e):(s.x=(null!==(i=s.x)&&void 0!==i?i:db.x)+t,s.y=(null!==(n=s.y)&&void 0!==n?n:db.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 n={type:_y.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,$w,n);return r?(this._setAttributes(r,!1,n),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}scale(t,e,i){var n,r;if(1===t&&1===e)return this;const o={type:_y.SCALE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,Xw,o);s&&(t=s.scaleX,e=s.scaleY,delete s.scaleX,delete s.scaleY,this._setAttributes(s));const a=this.attribute;if(i){let{postMatrix:n}=this.attribute;n||(n=new op,a.postMatrix=n),Ib.transformUtil.fromMatrix(n,n).scale(t,e,i)}else a.scaleX=(null!==(n=a.scaleX)&&void 0!==n?n:db.scaleX)*t,a.scaleY=(null!==(r=a.scaleY)&&void 0!==r?r:db.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const n={type:_y.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Xw,n);return r?(this._setAttributes(r,!1,n),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}rotate(t){var e;if(0===t)return this;const i={type:_y.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Yw,i);if(n)return this._setAttributes(n,!1,i),this;const r=this.attribute;return r.angle=(null!==(e=r.angle)&&void 0!==e?e:db.angle)+t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:_y.ROTATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Yw,i);return n?(this._setAttributes(n,!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 pw(null==t?void 0:t.id).bind(this);if(t){const{onStart:i,onFrame:n,onEnd:r,onRemove:o}=t;null!=i&&e.onStart(i),null!=n&&e.onFrame(n),null!=r&&e.onEnd(r),null!=o&&e.onRemove(o),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove((()=>{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Ib.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!Vu(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var r,o,s,a;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(o=null===(r=this.stateAnimateConfig)||void 0===r?void 0:r.duration)&&void 0!==o?o:mw,null!==(a=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.easing)&&void 0!==a?a:yw)}else this.setAttributes(t,!1,{type:_y.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();ld(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const r=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const r=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];r&&Object.assign(n,r)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=Cy.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Cy.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Cy.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Cy.UPDATE_SHAPE_AND_BOUNDS)===Cy.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Cy.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Cy.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Cy.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Cy.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Cy.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Cy.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Cy.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Cy.UPDATE_LAYOUT)}doUpdateLocalMatrix(){const{x:t=db.x,y:e=db.y,scaleX:i=db.scaleX,scaleY:n=db.scaleY,angle:r=db.angle,anchor:o,postMatrix:s}=this.attribute,a=[0,0];if(o){if("string"==typeof o[0]){const t=parseFloat(o[0])/100,e=this.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=o[0];if("string"==typeof o[1]){const t=parseFloat(o[1])/100,e=this.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=o[1]}!function(t,e,i,n,r,o,s,a){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=Gd(s),g=Kd(s);let m,y;a?(m=a[0],y=a[1]):(m=i,y=n);const b=m-i,v=y-n,w=l*f+c*g,C=h*f+u*g,x=c*f-l*g,_=u*f-h*g;t.a=r*w,t.b=r*C,t.c=o*x,t.d=o*_,t.e=d+l*m+c*y-w*b-x*v,t.f=p+h*m+u*y-C*b-_*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,o&&a);const l=this.getOffsetXY(db);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,s){const t=Uw.setValue(s.a,s.b,s.c,s.d,s.e,s.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Ib.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_y.ANIMATE_END})}onStep(t,e,i,n,r){const o={};if(i.customAnimate)i.customAnimate.update(r,n,o);else{const s=i.props,a=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,o,i,n,r,s,void 0,a,l)}this.setAttributes(o,!1,{type:_y.ANIMATE_UPDATE,animationState:{ratio:n,end:r,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,r,o,s,a,l,h){h||(h=Object.keys(s),n.propKeys=h),o?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=s[t])})):h.forEach((o=>{var h;if(!e.validAttr(o))return;const c=s[o],u=null!==(h=a&&a[o])&&void 0!==h?h:t.getLastPropByName(o,n);let d;d=e.interpolateFunc&&e.interpolateFunc(o,r,u,c,i),d||(d=e.customInterpolate(o,r,u,c,this,i),d||this.defaultInterpolate(c,u,o,i,l,r)||this._interpolate(o,r,u,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,r,o){if(Number.isFinite(t))return n[i]=e+(t-e)*o,!0;if("fill"===i){r||(r={});const s=r.fillColorArray,a=Ww(e,null!=s?s:t,o,!1,((t,e)=>{r.fillColorArray=e}));return a&&(n[i]=a),!0}if("stroke"===i){r||(r={});const s=r.strokeColorArray,a=Ww(e,null!=s?s:t,o,!1,((t,e)=>{r.strokeColorArray=e}));return a&&(n[i]=a),!0}if("shadowColor"===i){r||(r={});const s=r.shadowColorArray,a=Ww(e,null!=s?s:t,o,!0,((t,e)=>{r.shadowColorArray=e}));return a&&(n[i]=a),!0}return!1}_interpolate(t,e,i,n,r){}getDefaultAttribute(t){return Gv(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ib.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 Yu(t,!0)?this.pathProxy=(new hb).fromString(t):this.pathProxy=new hb,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var r;this.resources.set(i,n),"string"==typeof t?(n.state="loading",r=t,new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(r)||(t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t))(t)?(Vw.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("<svg")&&(Vw.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e)):(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e)}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.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((t=>{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Zv(t,e);r.bubbles=!1,r.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(r)}}}Zw.mixin(ew);var Jw={},Qw={};!function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+e+"]["+(e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",n=new RegExp("^"+i+"$");t.isExist=function(t){return void 0!==t},t.isEmptyObject=function(t){return 0===Object.keys(t).length},t.merge=function(t,e,i){if(e){const n=Object.keys(e),r=n.length;for(let o=0;o<r;o++)t[n[o]]="strict"===i?[e[n[o]]]:e[n[o]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(t){const e=n.exec(t);return!(null==e)},t.getAllMatches=function(t,e){const i=[];let n=e.exec(t);for(;n;){const r=[];r.startIndex=e.lastIndex-n[0].length;const o=n.length;for(let t=0;t<o;t++)r.push(n[t]);i.push(r),n=e.exec(t)}return i},t.nameRegexp=i}(Qw);const tC=Qw,eC={allowBooleanAttributes:!1,unpairedTags:[]};function iC(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function nC(t,e){const i=e;for(;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{const n=t.substr(i,e-i);if(e>5&&"xml"===n)return uC("InvalidXml","XML declaration allowed only at the start of the document.",pC(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function rC(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}Jw.validate=function(t,e){e=Object.assign({},eC,e);const i=[];let n=!1,r=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if(s+=2,s=nC(t,s),s.err)return s}else{if("<"!==t[s]){if(iC(t[s]))continue;return uC("InvalidChar","char '"+t[s]+"' is not expected.",pC(t,s))}{let a=s;if(s++,"!"===t[s]){s=rC(t,s);continue}{let l=!1;"/"===t[s]&&(l=!0,s++);let h="";for(;s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)h+=t[s];if(h=h.trim(),"/"===h[h.length-1]&&(h=h.substring(0,h.length-1),s--),o=h,!tC.isName(o)){let e;return e=0===h.trim().length?"Invalid space after '<'.":"Tag '"+h+"' is an invalid name.",uC("InvalidTag",e,pC(t,s))}const c=aC(t,s);if(!1===c)return uC("InvalidAttr","Attributes for '"+h+"' have open quote.",pC(t,s));let u=c.value;if(s=c.index,"/"===u[u.length-1]){const i=s-u.length;u=u.substring(0,u.length-1);const r=hC(u,e);if(!0!==r)return uC(r.err.code,r.err.msg,pC(t,i+r.err.line));n=!0}else if(l){if(!c.tagClosed)return uC("InvalidTag","Closing tag '"+h+"' doesn't have proper closing.",pC(t,s));if(u.trim().length>0)return uC("InvalidTag","Closing tag '"+h+"' can't have attributes or invalid starting.",pC(t,a));{const e=i.pop();if(h!==e.tagName){let i=pC(t,e.tagStartPos);return uC("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+h+"'.",pC(t,a))}0==i.length&&(r=!0)}}else{const o=hC(u,e);if(!0!==o)return uC(o.err.code,o.err.msg,pC(t,s-u.length+o.err.line));if(!0===r)return uC("InvalidXml","Multiple possible root nodes found.",pC(t,s));-1!==e.unpairedTags.indexOf(h)||i.push({tagName:h,tagStartPos:a}),n=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s++,s=rC(t,s);continue}if("?"!==t[s+1])break;if(s=nC(t,++s),s.err)return s}else if("&"===t[s]){const e=cC(t,s);if(-1==e)return uC("InvalidChar","char '&' is not expected.",pC(t,s));s=e}else if(!0===r&&!iC(t[s]))return uC("InvalidXml","Extra text at the end",pC(t,s));"<"===t[s]&&s--}}}var o;return n?1==i.length?uC("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",pC(t,i[0].tagStartPos)):!(i.length>0)||uC("InvalidXml","Invalid '"+JSON.stringify(i.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):uC("InvalidXml","Start tag expected.",1)};const oC='"',sC="'";function aC(t,e){let i="",n="",r=!1;for(;e<t.length;e++){if(t[e]===oC||t[e]===sC)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){r=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:r}}const lC=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function hC(t,e){const i=tC.getAllMatches(t,lC),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return uC("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",fC(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return uC("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",fC(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return uC("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",fC(i[t]));const r=i[t][2];if(!dC(r))return uC("InvalidAttr","Attribute '"+r+"' is an invalid name.",fC(i[t]));if(n.hasOwnProperty(r))return uC("InvalidAttr","Attribute '"+r+"' is repeated.",fC(i[t]));n[r]=1}return!0}function cC(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function uC(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function dC(t){return tC.isName(t)}function pC(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function fC(t){return t.startIndex+t[1].length}var gC={};const mC={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}};gC.buildOptions=function(t){return Object.assign({},mC,t)},gC.defaultOptions=mC;var yC=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}};const bC=Qw;function vC(t,e){let i="";for(;e<t.length&&"'"!==t[e]&&'"'!==t[e];e++)i+=t[e];if(i=i.trim(),-1!==i.indexOf(" "))throw new Error("External entites are not supported");const n=t[e++];let r="";for(;e<t.length&&t[e]!==n;e++)r+=t[e];return[i,r,e]}function wC(t,e){return"!"===t[e+1]&&"-"===t[e+2]&&"-"===t[e+3]}function CC(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"N"===t[e+3]&&"T"===t[e+4]&&"I"===t[e+5]&&"T"===t[e+6]&&"Y"===t[e+7]}function xC(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"L"===t[e+3]&&"E"===t[e+4]&&"M"===t[e+5]&&"E"===t[e+6]&&"N"===t[e+7]&&"T"===t[e+8]}function _C(t,e){return"!"===t[e+1]&&"A"===t[e+2]&&"T"===t[e+3]&&"T"===t[e+4]&&"L"===t[e+5]&&"I"===t[e+6]&&"S"===t[e+7]&&"T"===t[e+8]}function SC(t,e){return"!"===t[e+1]&&"N"===t[e+2]&&"O"===t[e+3]&&"T"===t[e+4]&&"A"===t[e+5]&&"T"===t[e+6]&&"I"===t[e+7]&&"O"===t[e+8]&&"N"===t[e+9]}function AC(t){if(bC.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var TC=function(t,e){const i={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let n=1,r=!1,o=!1,s="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,n--):n--,0===n)break}else"["===t[e]?r=!0:s+=t[e];else{if(r&&CC(t,e))e+=7,[entityName,val,e]=vC(t,e+1),-1===val.indexOf("&")&&(i[AC(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(r&&xC(t,e))e+=8;else if(r&&_C(t,e))e+=8;else if(r&&SC(t,e))e+=9;else{if(!wC)throw new Error("Invalid DOCTYPE");o=!0}n++,s=""}if(0!==n)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}};const BC=/^[-+]?0x[a-fA-F0-9]+$/,MC=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const RC={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};var PC=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=Object.assign({},RC,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if(e.hex&&BC.test(i))return Number.parseInt(i,16);{const n=MC.exec(i);if(n){const r=n[1],o=n[2];let s=function(t){if(t&&-1!==t.indexOf("."))return"."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substr(0,t.length-1)),t;return t}(n[3]);const a=n[4]||n[6];if(!e.leadingZeros&&o.length>0&&r&&"."!==i[2])return t;if(!e.leadingZeros&&o.length>0&&!r&&"."!==i[1])return t;{const n=Number(i),l=""+n;return-1!==l.search(/[eE]/)||a?e.eNotation?n:t:-1!==i.indexOf(".")?"0"===l&&""===s||l===s||r&&l==="-"+s?n:t:o?s===l||r+s===l?n:t:i===l||i===r+l?n:t}}return t}};const EC=Qw,HC=yC,LC=TC,kC=PC;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,EC.nameRegexp);function IC(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function OC(t,e,i,n,r,o,s){if(void 0!==t&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t));const n=this.options.tagValueProcessor(e,t,i,r,o);if(null==n)return t;if(typeof n!=typeof t||n!==t)return n;if(this.options.trimValues)return XC(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?XC(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function DC(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const FC=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function zC(t,e,i){if(!this.options.ignoreAttributes&&"string"==typeof t){const i=EC.getAllMatches(t,FC),n=i.length,r={};for(let t=0;t<n;t++){const n=this.resolveNameSpace(i[t][1]);let o=i[t][4],s=this.options.attributeNamePrefix+n;if(n.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),"__proto__"===s&&(s="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const t=this.options.attributeValueProcessor(n,o,e);r[s]=null==t?o:typeof t!=typeof o||t!==o?t:XC(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(r[s]=!0)}if(!Object.keys(r).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=r,t}return r}}const WC=function(t){t=t.replace(/\r\n?/g,"\n");const e=new HC("!xml");let i=e,n="",r="";for(let o=0;o<t.length;o++){if("<"===t[o])if("/"===t[o+1]){const e=UC(t,">",o,"Closing Tag is not closed.");let s=t.substring(o+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),i&&(n=this.saveTextToParentTag(n,i,r));const a=r.substring(r.lastIndexOf(".")+1);if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=r.lastIndexOf("."),r=r.substring(0,l),i=this.tagsNodeStack.pop(),n="",o=e}else if("?"===t[o+1]){let e=KC(t,o,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,i,r),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new HC(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,r,e.tagName)),this.addChild(i,t,r)}o=e.closeIndex+1}else if("!--"===t.substr(o+1,3)){const e=UC(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(o+4,e-2);n=this.saveTextToParentTag(n,i,r),i.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}o=e}else if("!D"===t.substr(o+1,2)){const e=LC(t,o);this.docTypeEntities=e.entities,o=e.i}else if("!["===t.substr(o+1,2)){const e=UC(t,"]]>",o,"CDATA is not closed.")-2,s=t.substring(o+9,e);if(n=this.saveTextToParentTag(n,i,r),this.options.cdataPropName)i.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]);else{let t=this.parseTextData(s,i.tagname,r,!0,!1,!0);null==t&&(t=""),i.add(this.options.textNodeName,t)}o=e+2}else{let s=KC(t,o,this.options.removeNSPrefix),a=s.tagName,l=s.tagExp,h=s.attrExpPresent,c=s.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,r,!1));const u=i;if(u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),a!==e.tagname&&(r+=r?"."+a:a),this.isItStopNode(this.options.stopNodes,r,a)){let e="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=s.closeIndex;else{const i=this.readStopNodeData(t,a,c+1);if(!i)throw new Error(`Unexpected end of ${a}`);o=i.i,e=i.tagContent}const n=new HC(a);a!==l&&h&&(n[":@"]=this.buildAttributesMap(l,r,a)),e&&(e=this.parseTextData(e,a,r,!0,h,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),n.add(this.options.textNodeName,e),this.addChild(i,n,r)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),r=r.substr(0,r.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const t=new HC(a);a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,a)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new HC(a);this.tagsNodeStack.push(i),a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,a)),this.addChild(i,t,r),i=t}n="",o=c}}else n+=t[o]}return e.child};function jC(t,e,i){const n=this.options.updateTag(e.tagname,i,e[":@"]);!1===n||("string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e))}const NC=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function GC(t,e,i,n){return t&&(void 0===n&&(n=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function VC(t,e,i){const n="*."+i;for(const i in t){const r=t[i];if(n===r||e===r)return!0}return!1}function UC(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function KC(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",r="";for(let o=e;o<t.length;o++){let e=t[o];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:r,index:o};if(t[o+1]===n[1])return{data:r,index:o}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let r=n.data;const o=n.index,s=r.search(/\s/);let a=r,l=!0;if(-1!==s&&(a=r.substr(0,s).replace(/\s\s*$/,""),r=r.substr(s+1)),i){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1),l=a!==n.data.substr(t+1))}return{tagName:a,tagExp:r,closeIndex:o,attrExpPresent:l}}function $C(t,e,i){const n=i;let r=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const o=UC(t,">",i,`${e} is not closed`);if(t.substring(i+2,o).trim()===e&&(r--,0===r))return{tagContent:t.substring(n,i),i:o};i=o}else if("?"===t[i+1]){i=UC(t,"?>",i+1,"StopNode is not closed.")}else if("!--"===t.substr(i+1,3)){i=UC(t,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===t.substr(i+1,2)){i=UC(t,"]]>",i,"StopNode is not closed.")-2}else{const n=KC(t,i,">");if(n){(n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&r++,i=n.closeIndex}}}function XC(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&kC(t,i)}return EC.isExist(t)?t:""}var YC=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=IC,this.parseXml=WC,this.parseTextData=OC,this.resolveNameSpace=DC,this.buildAttributesMap=zC,this.isItStopNode=VC,this.replaceEntitiesValue=NC,this.readStopNodeData=$C,this.saveTextToParentTag=GC,this.addChild=jC}},qC={};function ZC(t,e,i){let n;const r={};for(let o=0;o<t.length;o++){const s=t[o],a=JC(s);let l="";if(l=void 0===i?a:i+"."+a,a===e.textNodeName)void 0===n?n=s[a]:n+=""+s[a];else{if(void 0===a)continue;if(s[a]){let t=ZC(s[a],e,l);const i=tx(t,e);s[":@"]?QC(t,s[":@"],l,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==r[a]&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(t)):e.isArray(a,l,i)?r[a]=[t]:r[a]=t}}}return"string"==typeof n?n.length>0&&(r[e.textNodeName]=n):void 0!==n&&(r[e.textNodeName]=n),r}function JC(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function QC(t,e,i,n){if(e){const r=Object.keys(e),o=r.length;for(let s=0;s<o;s++){const o=r[s];n.isArray(o,i+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}}function tx(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}qC.prettify=function(t,e){return ZC(t,e)};const{buildOptions:ex}=gC,ix=YC,{prettify:nx}=qC,rx=Jw;var ox=class{constructor(t){this.externalEntities={},this.options=ex(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const i=rx.validate(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new ix(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:nx(n,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}};function sx(t,e,i,n){let r="",o=!1;for(let s=0;s<t.length;s++){const a=t[s],l=ax(a);let h="";if(h=0===i.length?l:`${i}.${l}`,l===e.textNodeName){let t=a[l];hx(h,e)||(t=e.tagValueProcessor(l,t),t=cx(t,e)),o&&(r+=n),r+=t,o=!1;continue}if(l===e.cdataPropName){o&&(r+=n),r+=`<![CDATA[${a[l][0][e.textNodeName]}]]>`,o=!1;continue}if(l===e.commentPropName){r+=n+`\x3c!--${a[l][0][e.textNodeName]}--\x3e`,o=!0;continue}if("?"===l[0]){const t=lx(a[":@"],e),i="?xml"===l?"":n;let s=a[l][0][e.textNodeName];s=0!==s.length?" "+s:"",r+=i+`<${l}${s}${t}?>`,o=!0;continue}let c=n;""!==c&&(c+=e.indentBy);const u=n+`<${l}${lx(a[":@"],e)}`,d=sx(a[l],e,h,c);-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?r+=u+">":r+=u+"/>":d&&0!==d.length||!e.suppressEmptyNode?d&&d.endsWith(">")?r+=u+`>${d}${n}</${l}>`:(r+=u+">",d&&""!==n&&(d.includes("/>")||d.includes("</"))?r+=n+e.indentBy+d+n:r+=d,r+=`</${l}>`):r+=u+"/>",o=!0}return r}function ax(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function lx(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){let r=e.attributeValueProcessor(n,t[n]);r=cx(r,e),!0===r&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${r}"`}return i}function hx(t,e){let i=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+i)return!0;return!1}function cx(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const ux=function(t,e){let i="";return e.format&&e.indentBy.length>0&&(i="\n"),sx(t,e,"",i)},dx={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function px(t){this.options=Object.assign({},dx,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=mx),this.processTextOrObjNode=fx,this.options.format?(this.indentate=gx,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function fx(t,e,i){const n=this.j2x(t,i+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,i):this.buildObjectNode(n.val,e,n.attrStr,i)}function gx(t){return this.options.indentBy.repeat(t)}function mx(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}px.prototype.build=function(t){return this.options.preserveOrder?ux(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},px.prototype.j2x=function(t,e){let i="",n="";for(let r in t)if(void 0===t[r])this.isAttribute(r)&&(n+="");else if(null===t[r])this.isAttribute(r)?n+="":"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar;else if(t[r]instanceof Date)n+=this.buildTextValNode(t[r],r,"",e);else if("object"!=typeof t[r]){const o=this.isAttribute(r);if(o)i+=this.buildAttrPairStr(o,""+t[r]);else if(r===this.options.textNodeName){let e=this.options.tagValueProcessor(r,""+t[r]);n+=this.replaceEntitiesValue(e)}else n+=this.buildTextValNode(t[r],r,"",e)}else if(Array.isArray(t[r])){const i=t[r].length;let o="";for(let s=0;s<i;s++){const i=t[r][s];void 0===i||(null===i?"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar:"object"==typeof i?this.options.oneListGroup?o+=this.j2x(i,e+1).val:o+=this.processTextOrObjNode(i,r,e):o+=this.buildTextValNode(i,r,"",e))}this.options.oneListGroup&&(o=this.buildObjectNode(o,r,"",e)),n+=o}else if(this.options.attributesGroupName&&r===this.options.attributesGroupName){const e=Object.keys(t[r]),n=e.length;for(let o=0;o<n;o++)i+=this.buildAttrPairStr(e[o],""+t[r][e[o]])}else n+=this.processTextOrObjNode(t[r],r,e);return{attrStr:i,val:n}},px.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},px.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let r="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",r=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+o+this.tagEndChar+t+this.indentate(n)+r:this.indentate(n)+"<"+e+i+o+">"+t+r}},px.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},px.prototype.buildTextValNode=function(t,e,i,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,t);return r=this.replaceEntitiesValue(r),""===r?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+r+"</"+e+this.tagEndChar}},px.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};var yx={XMLParser:ox,XMLValidator:Jw,XMLBuilder:px};function bx(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let vx=0;function Cx(){return vx++}var xx;function _x(t){const e=[];let i=0,n="";for(let r=0;r<t.length;r++)Tx(t[r])?i?n+=t[r]:(i=1,n=t[r]):(i&&(e.push({text:n,direction:xx.VERTICAL}),n="",i=0),e.push({text:t[r],direction:xx.HORIZONTAL}));return n&&e.push({text:n,direction:xx.VERTICAL}),e}!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(xx||(xx={}));const Sx=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Sx.set(t,!0)));const Ax=new Map;function Tx(t){if(Sx.has(t))return!0;if(Ax.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Ax.set(t,!0)));const Bx=Cx(),Mx=Cx(),Rx=Cx(),Px=Cx(),Ex=Cx(),Hx=Cx(),Lx=Cx(),kx=Cx(),Ix=Cx(),Ox=Cx(),Dx=Cx(),Fx=Cx(),zx=Cx(),Wx=Cx(),jx=Cx(),Nx=Cx(),Gx=Symbol.for("GraphicService"),Vx=Symbol.for("GraphicCreator"),Ux={"@_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"},Kx=Object.keys(Ux);var $x;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}($x||($x={}));let Xx=class t extends Zw{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Hx,this._childUpdateTag=Cy.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new jv),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new jv)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===xy.GLOBAL){const i=new Jd(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Cy.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Ib.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ib.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=Gv(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Ib.graphicService.updateGroupAABBBounds(t,Gv(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,r=Cw(n);return r&&i.expand(r),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=Cy.CLEAR_BOUNDS,this._childUpdateTag&=Cy.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=Cy.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Cy.UPDATE_BOUNDS||(this._childUpdateTag|=Cy.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(),Ib.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ib.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Ib.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Ib.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Ib.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Cy.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Ib.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const Yx=Symbol.for("LayerHandlerContribution");class qx extends Xx{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=qb.get(Yx),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(r=n.zIndex)&&void 0!==r?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new jv,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ib.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i,n,r;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:null!==(n=e.x)&&void 0!==n?n:this.stage.x,y:null!==(r=e.y)&&void 0!==r?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ib.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i,n,r;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:null!==(n=e.x)&&void 0!==n?n:this.stage.x,y:null!==(r=e.y)&&void 0!==r?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var Zx=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,n){e(i,n,t)}};let t_=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new qx(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};t_=Zx([Vm(),Qx(0,$m(ry)),Jx("design:paramtypes",[Object])],t_);var e_=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},i_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,n){e(i,n,t)}};const r_=Symbol.for("VWindow"),o_=Symbol.for("WindowHandlerContribution");let s_=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new iy(["x","y","width","height"])},this._uid=Vv.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(qb.getNamed(o_,t.env).configure(this,t),this.actived=!0,this._handler)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};e_([Zm(),i_("design:type",Function),i_("design:paramtypes",[]),i_("design:returntype",void 0)],s_.prototype,"postInit",null),s_=e_([Vm(),n_(0,$m(ry)),i_("design:paramtypes",[Object])],s_);const a_=Symbol.for("TransformUtil"),l_=Symbol.for("GraphicUtil"),h_=Symbol.for("LayerService");var c_=new zm((t=>{t(ly).toSelf().inSingletonScope(),t(ry).toService(ly),t(s_).to(s_),t(r_).toService(s_),t(Hv).toSelf().inSingletonScope(),t(l_).toService(Hv),t(Iv).toSelf().inSingletonScope(),t(a_).toService(Iv),t(t_).toSelf().inSingletonScope(),t(h_).toService(t_)}));function u_(t,e){return!(!t&&!e)}function d_(t,e){let i;return i=qu(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function p_(t,e,i){return i&&t*e>0}function f_(t,e,i,n,r){return r&&t*e>0&&i>0&&n>0}function g_(t,e){return t*e>0}function m_(t,e,i,n){return t*e>0&&i>0&&n>0}function y_(t,e,i,n,r,o,s,a){if(!t.pathProxy)return!1;const l=Gv(t,null==o?void 0:o.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:g=l.visible}=t.attribute,m=p_(u,d,h),y=g_(u,f),b=u_(h),v=d_(c,p);if(!g)return!0;if(!b&&!v)return!0;if(!(m||y||s||a))return!0;e.beginPath();return Ly(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(a?a(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),b&&(s?s(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function b_(t,e,i,n,r,o,s,a){const l=i-t,h=n-e,c=s-r,u=a-o;let d=u*l-c*h;return d*d<Od?[]:(d=(c*(e-o)-u*(t-r))/d,[t+d*l,e+d*h])}function v_(t,e,i,n,r,o,s){const a=t-i,l=e-n,h=(s?o:-o)/Math.sqrt(a*a+l*l),c=h*l,u=-h*a,d=t+c,p=e+u,f=i+c,g=n+u,m=(d+f)/2,y=(p+g)/2,b=f-d,v=g-p,w=b*b+v*v,C=r-o,x=d*g-f*p,_=(v<0?-1:1)*Math.sqrt(Math.max(0,C*C*w-x*x));let S=(x*v-b*_)/w,A=(-x*b-v*_)/w;const T=(x*v+b*_)/w,B=(-x*b+v*_)/w,M=S-m,R=A-y,P=T-m,E=B-y;return M*M+R*R>P*P+E*E&&(S=T,A=B),{cx:S,cy:A,x01:-c,y01:-u,x11:S*(r/C-1),y11:A*(r/C-1)}}function w_(t,e,i,n,r,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=jd(l-a),c=l>a;let u=!1;if(r<o){const t=r;r=o,o=t}if(r<=Od)e.moveTo(i,n);else if(h>=Wd-Od)e.moveTo(i+r*Gd(a),n+r*Kd(a)),e.arc(i,n,r,a,l,!c),o>Od&&(e.moveTo(i+o*Gd(l),n+o*Kd(l)),e.arc(i,n,o,l,a,c));else{const d=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:f,outerStartAngle:g,outerEndAngle:m,innerEndAngle:y,innerStartAngle:b}=t.getParsePadAngle(a,l),v=d,w=d,C=d,x=d,_=Math.max(w,v),S=Math.max(C,x);let A=_,T=S;const B=r*Gd(g),M=r*Kd(g),R=o*Gd(y),P=o*Kd(y);let E,H,L,k;if((S>Od||_>Od)&&(E=r*Gd(m),H=r*Kd(m),L=o*Gd(b),k=o*Kd(b),h<Dd)){const t=b_(B,M,L,k,E,H,R,P);if(t){const e=B-t[0],i=M-t[1],n=E-t[0],s=H-t[1],a=1/Kd(Yd((e*n+i*s)/($d(e*e+i*i)*$d(n*n+s*s)))/2),l=$d(t[0]*t[0]+t[1]*t[1]);T=Ud(S,(o-l)/(a-1)),A=Ud(_,(r-l)/(a+1))}}if(p<.001)s&&(s[3]||s[1])&&e.moveTo(i+B,n+M),u=!0;else if(A>Od){const t=Ud(v,A),o=Ud(w,A),a=v_(L,k,B,M,r,t,Number(c)),l=v_(E,H,R,P,r,o,Number(c));A<_&&t===o?!s||s[0]?(e.moveTo(i+a.cx+a.x01,n+a.cy+a.y01),e.arc(i+a.cx,n+a.cy,A,Nd(a.y01,a.x01),Nd(l.y01,l.x01),!c)):e.moveTo(i+a.cx+A*Gd(Nd(l.y01,l.x01)),n+a.cy+A*Kd(Nd(l.y01,l.x01))):!s||s[0]?(e.moveTo(i+a.cx+a.x01,n+a.cy+a.y01),t>0&&e.arc(i+a.cx,n+a.cy,t,Nd(a.y01,a.x01),Nd(a.y11,a.x11),!c),e.arc(i,n,r,Nd(a.cy+a.y11,a.cx+a.x11),Nd(l.cy+l.y11,l.cx+l.x11),!c),o>0&&e.arc(i+l.cx,n+l.cy,o,Nd(l.y11,l.x11),Nd(l.y01,l.x01),!c)):o>0?e.moveTo(i+l.cx+o*Gd(Nd(l.y01,l.x01)),n+l.cy+o*Kd(Nd(l.y01,l.x01))):e.moveTo(i+E,n+r*Kd(m))}else s&&!s[0]||(e.moveTo(i+B,n+M),e.arc(i,n,r,g,m,!c));if(!(o>Od)||f<.001)!s||s[1]?e.lineTo(i+R,n+P):e.moveTo(i+R,n+P),u=!0;else if(T>Od){const t=Ud(x,T),r=Ud(C,T),a=v_(R,P,E,H,o,-r,Number(c)),l=v_(B,M,L,k,o,-t,Number(c));if(!s||s[1]?e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01):e.moveTo(i+a.cx+a.x01,n+a.cy+a.y01),T<S&&t===r){const t=Nd(l.y01,l.x01);!s||s[2]?e.arc(i+a.cx,n+a.cy,T,Nd(a.y01,a.x01),t,!c):e.moveTo(i+a.cx+Gd(t),n+a.cy+Kd(t))}else!s||s[2]?(r>0&&e.arc(i+a.cx,n+a.cy,r,Nd(a.y01,a.x01),Nd(a.y11,a.x11),!c),e.arc(i,n,o,Nd(a.cy+a.y11,a.cx+a.x11),Nd(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Nd(l.y11,l.x11),Nd(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gd(Nd(l.y01,l.x01)),n+l.cy+t*Kd(Nd(l.y01,l.x01))):e.moveTo(i+L,n+k)}else!s||s[1]?e.lineTo(i+R,n+P):e.moveTo(i+R,n+P),!s||s[2]?e.arc(i,n,o,y,b,c):e.moveTo(i+o*Gd(b),n+o*Kd(b))}return s?s[3]&&e.lineTo(i+r*Gd(l),n+r*Gd(l)):e.closePath(),u}class C_{static GetCanvas(){try{return C_.canvas||(C_.canvas=Ib.global.createCanvas({})),C_.canvas}catch(t){return null}}static GetCtx(){if(!C_.ctx){const t=C_.GetCanvas();C_.ctx=t.getContext("2d")}return C_.ctx}}class x_{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=C_.GetCanvas(),n=C_.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const r=n.createLinearGradient(0,0,e,0);t.forEach((t=>{r.addColorStop(t[0],t[1])})),n.fillStyle=r,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=x_.dataMap.get(i);return n||(n=new x_(t,e),x_.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){x_.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return x_.dataMap.get(t)}}x_.dataMap=new Map;class __{static GetSize(t){for(let e=0;e<__.ImageSize.length;e++)if(__.ImageSize[e]>=t)return __.ImageSize[e];return t}static Get(t,e,i,n,r,o,s){const a=__.GenKey(t,e,i,n,r),l=__.cache[a];if(!l||0===l.length)return null;for(let t=0;t<l.length;t++)if(l[t].width>=o&&l[t].height>=s)return l[t].pattern;return null}static Set(t,e,i,n,r,o,s,a){const l=__.GenKey(t,e,i,n,r);__.cache[l]?__.cache[l].push({width:s,height:a,pattern:o}):__.cache[l]=[{width:s,height:a,pattern:o}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}__.cache={},__.ImageSize=[20,40,80,160,320,640,1280,2560];const S_=Symbol.for("ArcRenderContribution"),A_=Symbol.for("AreaRenderContribution"),T_=Symbol.for("CircleRenderContribution"),B_=Symbol.for("GroupRenderContribution"),M_=Symbol.for("ImageRenderContribution"),R_=Symbol.for("PathRenderContribution"),P_=Symbol.for("PolygonRenderContribution"),E_=Symbol.for("RectRenderContribution"),H_=Symbol.for("SymbolRenderContribution"),L_=Symbol.for("TextRenderContribution"),k_=Symbol.for("InteractiveSubRenderContribution");var I_=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},O_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},D_=function(t,e){return function(i,n){e(i,n,t)}};let F_=class{constructor(t){this.arcRenderContribitions=t,this.numberType=Bx}drawArcTailCapPath(t,e,i,n,r,o,s,a){const l=a-s,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=a;const d=jd(u-c),p=u>c;let f=!1;if(r<o){const t=r;r=o,o=t}const g=t.getParsedCornerRadius(),{outerDeltaAngle:m,innerDeltaAngle:y,outerStartAngle:b,outerEndAngle:v,innerEndAngle:w,innerStartAngle:C}=t.getParsePadAngle(c,u),x=g,_=g,S=g,A=g,T=Math.max(_,x),B=Math.max(S,A);let M=T,R=B;const P=r*Gd(b),E=r*Kd(b),H=o*Gd(w),L=o*Kd(w);let k,I,O,D;if((B>Od||T>Od)&&(k=r*Gd(v),I=r*Kd(v),O=o*Gd(C),D=o*Kd(C),d<Dd)){const t=b_(P,E,O,D,k,I,H,L);if(t){const e=P-t[0],i=E-t[1],n=k-t[0],s=I-t[1],a=1/Kd(Yd((e*n+i*s)/($d(e*e+i*i)*$d(n*n+s*s)))/2),l=$d(t[0]*t[0]+t[1]*t[1]);R=Ud(B,(o-l)/(a-1)),M=Ud(T,(r-l)/(a+1))}}if(M>Od){const t=Ud(x,M),o=Ud(_,M),s=v_(O,D,P,E,r,t,Number(p)),a=v_(k,I,H,L,r,o,Number(p));if(M<T&&t===o)e.moveTo(i+s.cx+s.x01,n+s.cy+s.y01),e.arc(i+s.cx,n+s.cy,M,Nd(s.y01,s.x01),Nd(a.y01,a.x01),!p);else{const t=u-l-.03,s=Nd(a.y11,a.x11);e.arc(i,n,r,t,s,!p),o>0&&e.arc(i+a.cx,n+a.cy,o,Nd(a.y11,a.x11),Nd(a.y01,a.x01),!p)}}else e.moveTo(i+P,n+E);if(!(o>Od)||y<.001)e.lineTo(i+H,n+L),f=!0;else if(R>Od){const t=Ud(A,R),r=Ud(S,R),s=v_(H,L,k,I,o,-r,Number(p)),a=v_(P,E,O,D,o,-t,Number(p));if(e.lineTo(i+s.cx+s.x01,n+s.cy+s.y01),R<B&&t===r){const t=Nd(a.y01,a.x01);e.arc(i+s.cx,n+s.cy,R,Nd(s.y01,s.x01),t,!p)}else{r>0&&e.arc(i+s.cx,n+s.cy,r,Nd(s.y01,s.x01),Nd(s.y11,s.x11),!p);const t=Nd(s.cy+s.y11,s.cx+s.x11),a=u-l-.03;e.arc(i,n,o,t,a,p)}}else e.lineTo(i+o*Gd(C),n+o*Kd(C));return f}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).arc,{fill:h=l.fill,background:c,stroke:u=l.stroke,opacity:d=l.opacity,fillOpacity:p=l.fillOpacity,lineWidth:f=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:y=l.x,y:b=l.y}=t.attribute,v=p_(d,p,h),w=g_(d,g),C=u_(h,c),x=d_(u,f);if(!t.valid||!m)return;if(!C&&!x)return;if(!(v||w||s||a||c))return;const{outerRadius:_=l.outerRadius,innerRadius:S=l.innerRadius,cap:A=l.cap,forceShowCap:T=l.forceShowCap}=t.attribute;let B=0;const M=(Nu(A)&&A||A[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();jd(n-i)<Wd-Od&&(B=e||0,h.startAngle-=B,h.endAngle-=B)}let R=!1;const{isFullStroke:P,stroke:E}=(t=>{var e;let i=!0;if(Nu(t,!0)){for(let n=0;n<4;n++)vw[n]=t,i&&(i=!(null!==(e=vw[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)vw[e]=!!t[e],i&&(i=!!vw[e]);else vw[0]=!1,vw[1]=!1,vw[2]=!1,vw[3]=!1;return{isFullStroke:i,stroke:vw}})(u);if(C||P){if(e.beginPath(),w_(t,e,i,n,_,S),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===Ry.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}R=!0,this._arcBeforeRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,C,x,v,w,l,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C&&(s?s(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,y-i,b-n,l),e.fill())),x&&P&&(a?a(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-n,l),e.stroke()))}if(!P&&x){if(e.beginPath(),w_(t,e,i,n,_,S,E),!R){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===Ry.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}R=!0,this._arcBeforeRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,C,x,v,w,l,r,s,a)}))}a?a(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())}if((Nu(A)&&A||A[1])&&T){const{startAngle:o,endAngle:h}=t.getParsedAngle();if(jd(h-o)>=Wd-Od){e.beginPath();const o=Math.abs(_-S)/2/_,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;if(this.drawArcTailCapPath(t,e,i,n,_,S,u,u+o),!R){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===Ry.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}R=!0,this._arcBeforeRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,C,x,v,w,l,r,s,a)}))}if(C){const r=c;if("conical"===r.gradient){const o=function(t,e,i,n){const{stops:r,startAngle:o,endAngle:s}=n;for(;i<0;)i+=Wd;for(;i>Wd;)i-=Wd;if(i<o)return r[0].color;if(i>s)return r[0].color;let a,l,h=(i-o)/(s-o);for(let t=0;t<r.length;t++)if(r[t].offset>=h){a=r[t-1],l=r[t];break}return h=(h-a.offset)/(l.offset-a.offset),Ww(a.color,l.color,h,!1)}(0,0,h,r);s||p_&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=o,e.fill())}}x&&(a||w&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this._arcAfterRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,C,x,v,w,l,r,s,a)})),M&&(h.startAngle+=B,h.endAngle+=B)}draw(t,e,i,n){const{context:r}=i;if(!r)return;const o=Gv(t,null==n?void 0:n.theme).arc;r.highPerformanceSave();let{x:s=o.x,y:a=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(o);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);y_(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};F_=I_([Vm(),D_(0,$m(Jm)),D_(0,Um(S_)),O_("design:paramtypes",[Object])],F_);var z_=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},W_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},j_=function(t,e){return function(i,n){e(i,n,t)}};let N_=class{constructor(t){this.circleRenderContribitions=t,this.numberType=Px}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).circle,{fill:h=l.fill,background:c,stroke:u=l.stroke,radius:d=l.radius,startAngle:p=l.startAngle,endAngle:f=l.endAngle,fillOpacity:g=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:b=l.lineWidth,visible:v=l.visible,x:w=l.x,y:C=l.y}=t.attribute,x=p_(y,g,h),_=g_(y,m),S=u_(h,c),A=d_(u,b);t.valid&&v&&(S||A)&&(x||_||s||a||c)&&(e.beginPath(),e.arc(i,n,d,p,f),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),S&&(s?s(e,t.attribute,l):x&&(e.setCommonStyle(t,t.attribute,w-i,C-n,l),e.fill())),A&&(a?a(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,w-i,C-n,l),e.stroke())),this._circleRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a)})))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).circle;let{x:s=o.x,y:a=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(o);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);y_(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};N_=z_([Vm(),j_(0,$m(Jm)),j_(0,Um(T_)),W_("design:paramtypes",[Object])],N_);const G_=["radius","startAngle","endAngle",...Kw];let V_=class t extends Zw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Px}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Gv(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Ib.graphicService.updateCircleAABBBounds(i,Gv(this).circle,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=Cw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).circle[t]}needUpdateTags(t){for(let e=0;e<G_.length;e++){const i=G_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<G_.length;e++)if(t===G_[e])return!0;return!1}toCustomPath(){var t,e,i;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),o=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),s=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),a=new hb;return a.arc(0,0,r,o,s),a}clone(){return new t(Object.assign({},this.attribute))}};function U_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:o=e.fontWeight,fontSize:s=e.fontSize,fontFamily:a=e.fontFamily}=t;return(n?n+" ":"")+(r?r+" ":"")+(o?o+" ":"")+s*i+"px "+(a||"sans-serif")}function K_(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function $_(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class X_{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,r,o,s,a,l){const h=[],c=[e,i],u=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,s,a);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?u[0]=c[0]/-2:"right"!==n&&"end"!==n||(u[0]=-c[0])),"top"===r||("middle"===r?u[1]=c[1]/-2:"bottom"===r&&(u[1]=-c[1]));const d={xOffset:u[0],yOffset:u[1],width:c[0],height:c[1]};return this.layoutWithBBox(d,h,n,r,o)}GetLayoutByLines(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const a=[],l=[0,0];if("number"==typeof s&&s!==1/0){let e;for(let i=0,n=t.length;i<n;i++)e=Math.min(this.textMeasure.measureTextWidth(t[i],this.textOptions),s),a.push({str:this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,e,r,o).str,width:e});l[0]=s}else{let e,i;s=0;for(let n=0,r=t.length;n<r;n++)i=t[n],e=this.textMeasure.measureTextWidth(i,this.textOptions),s=Math.max(s,e),a.push({str:i,width:e});l[0]=s}l[1]=a.length*n,l[0]=a.reduce(((t,e)=>Math.max(t,e.width)),0);const h={xOffset:0,yOffset:0,width:l[0],height:l[1]};return this.LayoutBBox(h,e,i),this.layoutWithBBox(h,a,e,i,n)}layoutWithBBox(t,e,i,n,r){const o=[0,0],s=e.length*r;"top"===n||("middle"===n?o[1]=(t.height-s)/2:"bottom"===n&&(o[1]=t.height-s));for(let s=0;s<e.length;s++)this.lineOffset(t,e[s],i,n,r,o);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,r,o){return"left"===i||"start"===i?e.leftOffset=0:"center"===i?e.leftOffset=(t.width-e.width)/2:"right"!==i&&"end"!==i||(e.leftOffset=t.width-e.width),e.topOffset=(r-this.textOptions.fontSize)/2+.79*this.textOptions.fontSize+o[1],o[1]+=r,e}}const Y_=["text","maxLineWidth","fontSize","fontFamily","fontWeight","ellipsis","lineHeight",...Kw];let q_=class t extends Zw{get font(){const t=Gv(this).text;return this._font||(this._font=U_(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=Gv(this).text;if(Array.isArray(e.text))return;const{maxLineWidth:n=i.maxLineWidth}=e;return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){if(!Array.isArray(this.attribute.text))return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){const t=Gv(this).text,e=this.attribute;if(Array.isArray(e.text))return;const{maxLineWidth:i=t.maxLineWidth}=e;return!!Number.isFinite(i)&&(this.tryUpdateAABBBounds(),this.clipedText!==e.text.toString())}get multilineLayout(){if(Array.isArray(this.attribute.text))return this.tryUpdateAABBBounds(),this.cache.layoutData}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Nx,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=Gv(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=Gv(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=Gv(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e,i;const n=Gv(this).text,r=Ib.graphicUtil.textMeasure;let o,s;const a=this.attribute,{maxLineWidth:l=n.maxLineWidth,ellipsis:h=n.ellipsis,textAlign:c=n.textAlign,textBaseline:u=n.textBaseline,fontFamily:d=n.fontFamily,fontSize:p=n.fontSize,fontWeight:f=n.fontWeight,stroke:g=n.stroke,lineWidth:m=n.lineWidth,wordBreak:y=n.wordBreak,ignoreBuf:b=n.ignoreBuf}=a,v=b?0:Math.max(2,.075*p),{lineHeight:w=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||n.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){o=null!==(i=this.cache.clipedWidth)&&void 0!==i?i:0;const t=K_(c,o),e=$_(u,w,p);return this._AABBBounds.set(t,e,t+o,e+w),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?n.ellipsis:h,i=r.clipTextWithSuffix(t.toString(),{fontSize:p,fontWeight:f,fontFamily:d},l,e,!1);s=i.str,o=i.width}else{const e=r.clipText(t.toString(),{fontSize:p,fontWeight:f,fontFamily:d},l,!1);s=e.str,o=e.width}this.cache.clipedText=s,this.cache.clipedWidth=o}else o=r.measureTextWidth(t.toString(),{fontSize:p,fontWeight:f,fontFamily:d}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=o;this.clearUpdateShapeTag();const C=K_(c,o);let x=w;Ib.global&&Ib.global.isSafari()&&(x+=.2*p);const _=$_(u,x,p,v);return this._AABBBounds.set(C,_,C+o,_+x),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=Gv(this).text,n=Ib.graphicUtil.textMeasure;let r;const o=this.attribute,{ignoreBuf:s=i.ignoreBuf}=o,a=s?0:2,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:u=i.textBaseline,fontSize:d=i.fontSize,fontWeight:p=i.fontWeight,fontFamily:f=i.fontFamily,stroke:g=i.stroke,lineHeight:m=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:y=i.lineWidth,wordBreak:b=i.wordBreak}=o;if(!this.shouldUpdateShape()&&this.cache){r=this.cache.clipedWidth;const t=K_(c,r),e=$_(u,m,d);return this._AABBBounds.set(e,t,e+m,t+r),g&&this._AABBBounds.expand(y/2),this._AABBBounds}let v=[_x(t.toString())];if(Number.isFinite(l)){if(h){const t=!0===h?i.ellipsis:h,e=n.clipTextWithSuffixVertical(v[0],{fontSize:d,fontWeight:p,fontFamily:f},l,t,!1);v=[e.verticalList],r=e.width}else{const t=n.clipTextVertical(v[0],{fontSize:d,fontWeight:p,fontFamily:f},l,!1);v=[t.verticalList],r=t.width}this.cache.verticalList=v,this.cache.clipedWidth=r}else r=0,v[0].forEach((t=>{const e=t.direction===xx.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:p,fontFamily:f});r+=e,t.width=e})),this.cache.verticalList=v,this.cache.clipedWidth=r;this.clearUpdateShapeTag();const w=K_(c,r),C=$_(u,m,d);return this._AABBBounds.set(C,w,C+m,w+r),g&&this._AABBBounds.expand(y/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=Gv(this).text,n=this.attribute,{fontFamily:r=i.fontFamily,textAlign:o=i.textAlign,textBaseline:s=i.textBaseline,fontSize:a=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:u,stroke:d=i.stroke,lineWidth:p=i.lineWidth,wordBreak:f=i.wordBreak}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=Ib.graphicUtil.textMeasure,m=new X_(r,{fontSize:a,fontWeight:l,fontFamily:r},g).GetLayoutByLines(t,o,s,h,!0===c?i.ellipsis:c||void 0,!1,u),{bbox:y}=m;return this.cache.layoutData=m,this.clearUpdateShapeTag(),this._AABBBounds.set(y.xOffset,y.yOffset,y.xOffset+y.width,y.yOffset+y.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=Gv(this).text,n=Ib.graphicUtil.textMeasure;let r;const o=this.attribute,{ignoreBuf:s=i.ignoreBuf}=o,a=s?0:2,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:u=i.textBaseline,fontFamily:d=i.fontFamily,fontSize:p=i.fontSize,fontWeight:f=i.fontWeight,stroke:g=i.stroke,lineHeight:m=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:y=i.lineWidth,wordBreak:b=i.wordBreak}=o;if(r=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Vd(e,r)}));const t=K_(c,r),e=this.cache.verticalList.length*m,i=$_(u,e,p);return this._AABBBounds.set(i,t,i+e,t+r),g&&this._AABBBounds.expand(y/2),this._AABBBounds}const v=t.map((t=>_x(t.toString())));v.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const o=!0===h?i.ellipsis:h,s=n.clipTextWithSuffixVertical(t,{fontSize:p,fontWeight:f,fontFamily:d},l,o,!1);v[e]=s.verticalList,r=s.width}else{const i=n.clipTextVertical(t,{fontSize:p,fontWeight:f,fontFamily:d},l,!1);v[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===xx.HORIZONTAL?p:n.measureTextWidth(t.text,{fontSize:p,fontWeight:f,fontFamily:d});r+=e,t.width=e}))})),this.cache.verticalList=v,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Vd(e,r)}));const w=K_(c,r),C=this.cache.verticalList.length*m,x=$_(u,C,p);return this._AABBBounds.set(x,w,x+C,w+r),g&&this._AABBBounds.expand(y/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).text[t]}needUpdateTags(t){for(let e=0;e<Y_.length;e++){const i=Y_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Y_.length;e++)if(t===Y_[e])return!0;return!1}clone(){return new t(Object.assign({},this.attribute))}};const Z_=["heightLimit","lineClamp"];class J_ extends q_{_isValid(){const{text:t}=this.attribute;return qu(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const r=Gv(this).text,{fontFamily:o=r.fontFamily,textAlign:s=r.textAlign,textBaseline:a=r.textBaseline,fontSize:l=r.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:f=r.wordBreak,fontWeight:g=r.fontWeight,ignoreBuf:m=r.ignoreBuf,heightLimit:y=0,lineClamp:b}=this.attribute,v=m?0:2;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const w=Ib.graphicUtil.textMeasure,C=new X_(o,{fontSize:l,fontWeight:g,fontFamily:o},w),x=t.map((t=>t.toString())),_=[],S=[0,0];let A=1/0;if(y>0&&(A=Math.max(Math.floor(y/h),1)),b&&(A=Math.min(A,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t<x.length;t++){const e=x[t];let r=!0;if(t===A-1){const t=C.textMeasure.clipTextWithSuffix(e,C.textOptions,u,c,!1);_.push({str:t.str,width:t.width});break}const o=C.textMeasure.clipText(e,C.textOptions,u,"break-word"===f);if(""!==e&&""===o.str){if(c){const t=C.textMeasure.clipTextWithSuffix(e,C.textOptions,u,c,!1);o.str=null!==(i=t.str)&&void 0!==i?i:"",o.width=null!==(n=t.width)&&void 0!==n?n:0}else o.str="",o.width=0;r=!1}if(_.push({str:o.str,width:o.width}),o.str.length===e.length);else if(r){const i=e.substring(o.str.length);x.splice(t+1,0,i)}}let t=0;_.forEach((e=>{t=Math.max(t,e.width)})),S[0]=t}else{let t,e,i=0;for(let n=0,r=x.length;n<r;n++){if(n===A-1){const t=C.textMeasure.clipTextWithSuffix(x[n],C.textOptions,u,c,!1);_.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=x[n],t=C.textMeasure.measureTextWidth(e,C.textOptions,"break-word"===f),i=Math.max(i,t),_.push({str:e,width:t})}S[0]=i}S[1]=_.length*(h+v);const T={xOffset:0,yOffset:0,width:S[0],height:S[1]};C.LayoutBBox(T,s,a);const B=C.layoutWithBBox(T,_,s,a,h);return this.cache.layoutData=B,this.clearUpdateShapeTag(),this._AABBBounds.set(T.xOffset,T.yOffset,T.xOffset+T.width,T.yOffset+T.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<Z_.length;e++){const i=Z_[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<Z_.length;e++)if(t===Z_[e])return!0;return super.needUpdateTag(t)}}function Q_(t,e,i,n,r){return r?t.arc(i,n,e,0,zd,!1,r):t.arc(i,n,e,0,zd),!1}var tS=new class{constructor(){this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,r){return Q_(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,o){return Q_(t,e/2+r,i,n,o)}drawToSvgPath(t,e,i,n){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`}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};var eS=new class{constructor(){this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(-3*e+i,-e+n,r),t.lineTo(-e+i,-e+n,r),t.lineTo(-e+i,-3*e+n,r),t.lineTo(e+i,-3*e+n,r),t.lineTo(e+i,-e+n,r),t.lineTo(3*e+i,-e+n,r),t.lineTo(3*e+i,e+n,r),t.lineTo(e+i,e+n,r),t.lineTo(e+i,3*e+n,r),t.lineTo(-e+i,3*e+n,r),t.lineTo(-e+i,e+n,r),t.lineTo(-3*e+i,e+n,r),t.closePath(),!0}(t,e/6,i,n,r)}drawOffset(t,e,i,n,r,o){return function(t,e,i,n,r,o){return t.moveTo(-3*e+i-r,-e+n-r,o),t.lineTo(-e+i-r,-e+n-r,o),t.lineTo(-e+i-r,-3*e+n-r,o),t.lineTo(e+i+r,-3*e+n-r,o),t.lineTo(e+i+r,-e+n-r,o),t.lineTo(3*e+i+r,-e+n-r,o),t.lineTo(3*e+i+r,e+n+r,o),t.lineTo(e+i+r,e+n+r,o),t.lineTo(e+i+r,3*e+n+r,o),t.lineTo(-e+i-r,3*e+n+r,o),t.lineTo(-e+i-r,e+n+r,o),t.lineTo(-3*e+i-r,e+n+r,o),t.closePath(),!0}(t,e/6,i,n,r,o)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function iS(t,e,i,n,r){return t.moveTo(i,n-e,r),t.lineTo(e+i,n,r),t.lineTo(i,n+e,r),t.lineTo(i-e,n,r),t.closePath(),!0}var nS=new class{constructor(){this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,r){return iS(t,e/2,i,n,r)}drawFitDir(t,e,i,n,r){return iS(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,o){return iS(t,e/2+r,i,n,o)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function rS(t,e,i,n){const r=2*e;return t.rect(i-e,n-e,r,r),!1}var oS=new class{constructor(){this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return rS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return rS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};class sS{constructor(){this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i+e,e+n),t.lineTo(i-e,e+n),t.lineTo(i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(i+e+2*r,e+n+r),t.lineTo(i-e-2*r,e+n+r),t.lineTo(i,n-e-2*r),t.closePath(),!0}(t,e/2,i,n,r)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}}var aS=new sS;var lS=new class extends sS{constructor(){super(...arguments),this.type="triangle"}};const hS=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),cS=Math.sin(zd/10)*hS,uS=-Math.cos(zd/10)*hS;function dS(t,e,i,n){const r=cS*e,o=uS*e;t.moveTo(i,-e+n),t.lineTo(r+i,o+n);for(let s=1;s<5;++s){const a=zd*s/5,l=Math.cos(a),h=Math.sin(a);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*r-h*o+i,h*r+l*o+n)}return t.closePath(),!0}var pS=new class{constructor(){this.type="star",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,n){return dS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return dS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};const fS=$d(3);function gS(t,e,i,n){const r=e,o=r/fS,s=o/5,a=e;return t.moveTo(0+i,-r+n),t.lineTo(o/2+i,n),t.lineTo(s/2+i,n),t.lineTo(s/2+i,a+n),t.lineTo(-s/2+i,a+n),t.lineTo(-s/2+i,n),t.lineTo(-o/2+i,n),t.closePath(),!0}var mS=new class{constructor(){this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return gS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return gS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function yS(t,e,i,n){const r=2*e;return t.moveTo(i,-e+n),t.lineTo(r/3/2+i,e+n),t.lineTo(-r/3/2+i,e+n),t.closePath(),!0}var bS=new class{constructor(){this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return yS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return yS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function vS(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var wS=new class{constructor(){this.type="stroke",this.pathStr=""}draw(t,e,i,n){return vS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return vS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};const CS=-.5,xS=$d(3)/2,_S=1/$d(12);function SS(t,e,i,n){const r=e/2,o=e*_S,s=r,a=e*_S+e,l=-s,h=a;return t.moveTo(r+i,o+n),t.lineTo(s+i,a+n),t.lineTo(l+i,h+n),t.lineTo(CS*r-xS*o+i,xS*r+CS*o+n),t.lineTo(CS*s-xS*a+i,xS*s+CS*a+n),t.lineTo(CS*l-xS*h+i,xS*l+CS*h+n),t.lineTo(CS*r+xS*o+i,CS*o-xS*r+n),t.lineTo(CS*s+xS*a+i,CS*a-xS*s+n),t.lineTo(CS*l+xS*h+i,CS*h-xS*l+n),t.closePath(),!1}var AS=new class{constructor(){this.type="wye",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,n){return SS(t,e/2,i,n)}drawOffset(t,e,i,n,r){return SS(t,e/2+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};var TS=new class{constructor(){this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(e+i,e+n),t.lineTo(e+i,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(-e+i-2*r,n),t.lineTo(e+i+r,e+n+2*r),t.lineTo(e+i+r,n-e-2*r),t.closePath(),!0}(t,e/2,i,n,r)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};var BS=new class{constructor(){this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,e+n),t.lineTo(e+i,n),t.lineTo(i-e,n-e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(i-e-r,e+n+2*r),t.lineTo(e+i+2*r,n),t.lineTo(i-e-r,n-e-2*r),t.closePath(),!0}(t,e/2,i,n,r)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};var MS=new class{constructor(){this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return function(t,e,i,n){return t.moveTo(i-e,n-e),t.lineTo(i+e,n-e),t.lineTo(i,n+e),t.closePath(),!0}(t,e/2,i,n)}drawOffset(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(i-e-2*r,n-e-r),t.lineTo(i+e+2*r,n-e-r),t.lineTo(i,n+e+2*r),t.closePath(),!0}(t,e/2,i,n,r)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};const RS=$d(3);function PS(t,e,i,n){const r=e*RS;return t.moveTo(i,n+-r/3*2),t.lineTo(e+i,n+r),t.lineTo(i-e,n+r),t.closePath(),!0}var ES=new class extends sS{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return PS(t,e/2/RS,i,n)}drawOffset(t,e,i,n,r){return PS(t,e/2/RS+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function HS(t,e,i,n){const r=2*e;return t.moveTo(e+i,n-r),t.lineTo(i-e,n),t.lineTo(e+i,r+n),!0}var LS=new class{constructor(){this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return HS(t,e/4,i,n)}drawOffset(t,e,i,n,r){return HS(t,e/4+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function kS(t,e,i,n){const r=2*e;return t.moveTo(i-e,n-r),t.lineTo(i+e,n),t.lineTo(i-e,r+n),!0}var IS=new class{constructor(){this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return kS(t,e/4,i,n)}drawOffset(t,e,i,n,r){return kS(t,e/4+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function OS(t,e,i,n){const r=2*e;return t.moveTo(i-r,n+e),t.lineTo(i,n-e),t.lineTo(i+r,n+e),!0}var DS=new class{constructor(){this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return OS(t,e/4,i,n)}drawOffset(t,e,i,n,r){return OS(t,e/4+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function FS(t,e,i,n){const r=2*e;return t.moveTo(i-r,n-e),t.lineTo(i,n+e),t.lineTo(i+r,n-e),!0}var zS=new class{constructor(){this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return FS(t,e/4,i,n)}drawOffset(t,e,i,n,r){return FS(t,e/4+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function WS(t,e,i,n,r){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var jS=new class{constructor(){this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,r){return WS(t,e/2,i,n)}drawOffset(t,e,i,n,r,o){return WS(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e}, ${i-r} L ${e},${i+r}`}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function NS(t,e,i,n,r){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var GS=new class{constructor(){this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,r){return NS(t,e/2,i,n)}drawOffset(t,e,i,n,r,o){return NS(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e-r}, ${i} L ${e+r},${i}`}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function VS(t,e,i,n,r){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var US=new class{constructor(){this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,r){return VS(t,e/2,i,n)}drawOffset(t,e,i,n,r,o){return VS(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){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}`}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function KS(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}var $S=new class{constructor(){this.type="rect",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return KS(t,Qu(e)?[e,e]:e,i,n)}drawOffset(t,e,i,n,r){return KS(t,Qu(e)?[e+2*r,e+2*r]:[e[0]+2*r,e[1]+2*r],i,n)}bounds(t,e){const i=Qu(t)?[t,t]:t;e.x1=-i[0]/2,e.x2=i[0]/2,e.y1=-i[1]/2,e.y2=i[1]/2}};const XS=new ip;class YS{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,qu(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,r,o,s){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Ly(r.path.commandList,t,i,n,e,e),s&&s(r.path,r.attribute)})),!1):(Ly(this.path.commandList,t,i,n,e+r,e+r),!1)}draw(t,e,i,n,r,o){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Ly(r.path.commandList,t,i,n,e,e),o&&o(r.path,r.attribute)})),!1):(Ly(this.path.commandList,t,i,n,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;XS.x1=n.bounds.x1*t,XS.y1=n.bounds.y1*t,XS.x2=n.bounds.x2*t,XS.y2=n.bounds.y2*t,e.union(XS)}))}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 qS={};[tS,eS,nS,oS,ES,lS,pS,mS,bS,wS,AS,TS,BS,aS,MS,LS,IS,DS,zS,$S,jS,GS,US].forEach((t=>{qS[t.type]=t}));const ZS=["symbolType","size",...Kw];let JS=class t extends Zw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=jx}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return qu(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Gv(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=qS[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(!0===yx.XMLValidator.validate(i,{allowBooleanAttributes:!0})){const e=new yx.XMLParser({ignoreAttributes:!1}),{svg:n}=e.parse(i);if(!n)return null;const r=qu(n.path)?n.path:[n.path],o=new ip,s=[];r.forEach((t=>{const e=(new hb).fromString(t["@_d"]),i={fill:"black"};Kx.forEach((e=>{t[e]&&(i[Ux[e]]=t[e])})),s.push({path:e,attribute:i}),o.union(e.bounds)}));const a=o.width(),l=o.height(),h=1/Vd(a,l);return s.forEach((t=>t.path.transform(0,0,h,h))),this._parsedPath=new YS(i,s,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const r=(new hb).fromString(i),o=r.bounds.width(),s=r.bounds.height(),a=1/Vd(o,s);return r.transform(0,0,a,a),this._parsedPath=new YS(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Gv(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Ib.graphicService.updateSymbolAABBBounds(i,Gv(this).symbol,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=Cw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).symbol[t]}needUpdateTags(t){for(let e=0;e<ZS.length;e++){const i=ZS[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<ZS.length;e++)if(t===ZS[e])return!0;return!1}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=qu(e)?e:[e,e];return t.path?(new hb).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hb).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}};JS.userSymbolMap={};const QS=["segments","points","curveType",...Kw];let tA=class t extends Zw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=kx}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,r){"points"===t&&(r.points=Tw(i,n,e))}doUpdateAABBBounds(){const t=Gv(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateLineAABBBounds(e,Gv(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).line[t]}needUpdateTags(t){for(let e=0;e<QS.length;e++){const i=QS[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<QS.length;e++)if(t===QS[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=new hb,i=t.segments,n=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const eA=["width","height","cornerRadius",...Kw];let iA=class t extends Zw{constructor(t){super(t),this.type="rect",this.numberType=Fx}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=Gv(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateRectAABBBounds(e,Gv(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).rect[t]}needUpdateTags(t){for(let e=0;e<eA.length;e++){const i=eA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<eA.length;e++)if(t===eA[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new hb;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new t(Object.assign({},this.attribute))}};const nA=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class rA extends iA{constructor(t){super(t),this.type="rect3d",this.numberType=zx}findFace(){const t={polygons:[],vertices:[],edges:[]},e=Gv(this).rect3d,{width:i=e.width,height:n=e.width,length:r=Ud(e.width,e.height)}=this.attribute;for(let e=0;e<nA.length;e++){const o=nA[e];t.vertices.push([o[0]*i,o[1]*n,o[2]*r])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}}class oA{constructor(t,e,i,n,r,o,s,a,l,h,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=r,this.wordBreak=o,this.verticalDirection=s,this.lines=[],this.globalAlign=a,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Ob[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let o=this.isHeightMax?Math.min(this.height,n):this.height||n||0;o=Math.min(o,n);let s=0;switch(this.globalBaseline){case"top":s=0;break;case"middle":s=-o/2;break;case"bottom":s=-o}let a=0;switch(this.globalAlign){case"left":a=0;break;case"center":a=-r/2;break;case"right":a=-r}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i];if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+l)return h;let o=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(o=!0,h=!0),this.lines[i].draw(t,o,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?a+=i:s+=i;for(let i=0;i<this.lines.length;i++)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}else if("bottom"===this.verticalDirection&&"vertical"!==this.layoutDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i],o=l-this.lines[i].top-this.lines[i].height;if(0===l)this.lines[i].draw(t,!1,a,o+s,e);else{if(o+r>this[this.directionKey.top]+l||o<this[this.directionKey.top])return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&o-this.lines[i+1].height<this[this.directionKey.top]&&(n=!0,h=!0),this.lines[i].draw(t,n,a,o+s,e)}}}else{"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&this.singleLine&&this.isWidthMax&&(a+=this.lines[0].height+1);for(let i=0;i<this.lines.length;i++){"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&(a-=this.lines[i].height+this.lines[i].top);const{top:n,height:r}=this.lines[i];if(0===l)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e);else{if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const n=this.lines[i];n.actualWidth>t&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=r&&0!==r)for(let i=0;i<this.lines.length;i++){const{top:n,height:o}=this.lines[i];if(n+o<this[this.directionKey.top]||n+o>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((r-this.actualHeight)/2);for(let i=0;i<this.lines.length;i++)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:o}=this.lines[i],s=r-this.lines[i].top-this.lines[i].height;if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+o>this[this.directionKey.top]+r||s<this[this.directionKey.top]);else if(this.ellipsis&&this.lines[i+1]&&s-this.lines[i+1].height<this[this.directionKey.top]){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;i<this.lines.length;i++){const{top:n,height:o}=this.lines[i];if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+o<this[this.directionKey.top]||n+o>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class sA{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:o,width:s}=Vb(t,i);let a=0,l=0,h=0;this.height>r&&(a=(this.height-r)/2,l=Math.ceil(a),h=Math.floor(a)),"top"===this.textBaseline?(this.ascent=a,this.descent=r-a):"bottom"===this.textBaseline?(this.ascent=r-a,this.descent=a):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=o+h),this.length=t.length,this.width=s||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=Vb(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,r){let o=this.text,s=this.left+i;e+=this.top;let a=this.direction;if(this.verticalEllipsis)o="...",a="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)o+="...","right"===r&&(s-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Nb(o,("vertical"===a?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,o.length-1);if(o=o.slice(0,t),o+="...","right"===r){const{width:e}=Vb(this.text.slice(t),this.character);"vertical"===a||(s-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===a&&(t.save(),t.rotateAbout(Math.PI/2,s,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(s,e),s=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Fb;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(o,s,e)),function(t,e){const i=e&&e.fill||Db;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(o,s,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(s,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(s,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(s,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(s,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===a&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Nb(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=Vb(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const aA=["width","height","image",...Kw];let lA=class t extends Zw{constructor(t){super(t),this.type="image",this.numberType=Lx,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=Gv(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateImageAABBBounds(e,Gv(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lb[t]}needUpdateTags(t){for(let e=0;e<aA.length;e++){const i=aA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<aA.length;e++)if(t===aA[e])return!0;return!1}clone(){return new t(Object.assign({},this.attribute))}};class hA extends lA{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cw(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(qu(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cw(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Lb.width,height:e=Lb.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,r=(i-t)/2,o=(n-e)/2;return this._AABBBounds.expand([0,2*r,2*o,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class cA{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=Ob[this.direction]}store(t){if(t instanceof hA){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new class{constructor(t,e,i,n,r,o,s,a){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=r,this.top=i-n,this.paragraphs=o.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof hA?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=s,this.directionKey=Ob[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof sA){const e=jb.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=a?0:this.width-this.actualWidth;let c=this.left,u=0;if(this.actualWidth<e&&!a)switch(this.textAlign){case"right":c=e-this.actualWidth;break;case"center":c=(e-this.actualWidth)/2;break;case"justify":this.paragraphs.length<2?c=(e-this.actualWidth)/2:u=(e-this.actualWidth)/(this.paragraphs.length-1)}this.paragraphs.map((function(t){t instanceof hA?(t["_"+l.x]=c,c+=t[l.width]+u,t["_"+l.y]="top"===t.attribute.textBaseline?0:"bottom"===t.attribute.textBaseline?h-t.height:(h-t.height)/2):(t[l.left]=c,c+=t[l.width]+u)}))}draw(t,e,i,n,r){if(e){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof hA)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=Vb("...",i.character),r=n||0;if(r<=this.blankWidth+t){i.ellipsis="add";break}if(r<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=r,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,o)=>{if(e instanceof hA)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===o,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof hA)break;const{width:n}=Vb("...",i.character),r=n||0;if(r<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=r;break}if(r<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=r,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof hA?t.width:t.getWidthWithEllips(this.direction)})),e}}(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof hA?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=Nb(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new sA(i,t.newLine,t.character),new sA(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const uA=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Kw];class dA extends Zw{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Wx}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Hb.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Hb.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Hb.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Hb.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Hb.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Hb.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Hb.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Hb.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Gv(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateRichTextAABBBounds(e,Gv(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Hb[t]}needUpdateTags(t){for(let e=0;e<uA.length;e++){const i=uA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<uA.length;e++)if(t===uA[e])return!0;return!1}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}doUpdateFrameCache(){var t;const{textConfig:e,maxWidth:i,maxHeight:n,width:r,height:o,ellipsis:s,wordBreak:a,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:u,singleLine:d}=this.attribute,p=[];for(let t=0;t<e.length;t++)if("image"in e[t]){const i=e[t],n=i.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(i.id);if(n)p.push(n);else{const t=new hA(i);t.successCallback=()=>{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;n<i.length;n++)p.push(new sA(i[n],0!==n,e[t]))}else p.push(new sA(e[t].text,!1,e[t]));const f=new oA(0,0,("number"==typeof i&&(!r||r>i)?i:r)||0,("number"==typeof n&&(!o||o>n)?n:o)||0,s,a,l,h,c,u||"horizontal","number"==typeof i&&(!r||r>i),"number"==typeof n&&(!o||o>n),d||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),g=new cA(f);for(let t=0;t<p.length;t++)g.deal(p[t]);g.send(),this._frameCache=f}clone(){return new dA(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,r,o;const s=this.pickIcon(t.global);s&&s===this._currentHoverIcon||(s?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=s,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(s.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!s&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(r=this.stage)||void 0===r||r.setCursor(),null===(o=this.stage)||void 0===o||o.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let r;return e.icons.forEach((e=>{var o,s;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(r=e,r.globalX=(null!==(o=r.attribute.x)&&void 0!==o?o:0)+i,r.globalY=(null!==(s=r.attribute.y)&&void 0!==s?s:0)+n)})),r}}const pA=["path","customPath",...Kw];class fA extends Zw{constructor(t){super(t),this.type="path",this.numberType=Ix}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Gv(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hb?e.path:(Vu(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hb?this.cache:t.path)}doUpdateAABBBounds(){const t=Gv(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updatePathAABBBounds(e,Gv(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;Yu(t.path,!0)?this.cache=(new hb).fromString(t.path):t.customPath&&(this.cache=new hb,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Gv(this).path[t]}needUpdateTags(t){for(let e=0;e<pA.length;e++){const i=pA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<pA.length;e++)if(t===pA[e])return!0;return!1}toCustomPath(){return(new hb).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new fA(Object.assign({},this.attribute))}}const gA=["segments","points","curveType",...Kw];class mA extends Zw{constructor(t){super(t),this.type="area",this.numberType=Rx}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Gv(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updateAreaAABBBounds(e,Gv(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){"points"===t&&(r.points=Tw(i,n,e))}getDefaultAttribute(t){return Gv(this).area[t]}needUpdateTags(t){for(let e=0;e<gA.length;e++){const i=gA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<gA.length;e++)if(t===gA[e])return!0;return!1}toCustomPath(){const t=new hb,e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var r,o;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(r=e.x1)&&void 0!==r?r:e.x,y:null!==(o=e.y1)&&void 0!==o?o:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new mA(Object.assign({},this.attribute))}}const yA=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Kw];class bA extends Zw{constructor(t){super(t),this.type="arc",this.numberType=Bx}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=Gv(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const r=Math.abs(i-n);return Math.min(Qu(e,!0)?e:r*parseFloat(e)/100,r/2)}getParsedAngle(){const t=Gv(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,r=i-e>=0?1:-1,o=i-e;if(e=rp(e),i=e+o,n&&jd(o)<Wd-Od){let o=1,s=1;n.length&&(o=Number(n[0]),s=Number(n[1]));const{outerRadius:a=t.outerRadius,innerRadius:l=t.innerRadius}=this.attribute,h=Math.abs(a-l)/2,c=h/a;if(h>Od&&a>Od)return{startAngle:e-r*c*o,endAngle:i+r*c*s,sc:r*c*o,ec:r*c*s}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Gv(this).arc,{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius,padAngle:o=i.padAngle}=this.attribute,{padRadius:s=$d(n*n+r*r)}=this.attribute,a=jd(e-t);let l=t,h=e,c=t,u=e;const d=o/2;let p=a,f=a;if(d>Od&&s>Od){const i=e>t?1:-1;let o=qd(Number(s)/r*Kd(d)),a=qd(Number(s)/n*Kd(d));return(p-=2*o)>Od?(o*=i,c+=o,u-=o):(p=0,c=u=(t+e)/2),(f-=2*a)>Od?(a*=i,l+=a,h-=a):(f=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:u,innerDeltaAngle:p,outerDeltaAngle:f}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:u,innerDeltaAngle:p,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Gv(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Ib.graphicService.updateArcAABBBounds(i,Gv(this).arc,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=Cw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;e<yA.length;e++){const i=yA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<yA.length;e++)if(t===yA[e])return!0;return!1}getDefaultAttribute(t){return Gv(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius,r=t.outerRadius;const o=jd(i-e),s=i>e;if(r<n){const t=r;r=n,n=t}const a=new hb;if(r<=Od)a.moveTo(0,0);else if(o>=Wd-Od)a.moveTo(0+r*Gd(e),0+r*Kd(e)),a.arc(0,0,r,e,i,!s),n>Od&&(a.moveTo(0+n*Gd(i),0+n*Kd(i)),a.arc(0,0,n,i,e,s));else{const t=r*Gd(e),o=r*Kd(e),l=n*Gd(i),h=n*Kd(i);a.moveTo(0+t,0+o),a.arc(0,0,r,e,i,!s),a.lineTo(0+l,0+h),a.arc(0,0,n,i,e,s),a.closePath()}return a}clone(){return new bA(Object.assign({},this.attribute))}}const vA=["points","cornerRadius",...Kw];class wA extends Zw{constructor(t){super(t),this.type="polygon",this.numberType=Ox}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Gv(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Ib.graphicService.updatePolygonAABBBounds(e,Gv(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=Cw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){"points"===t&&(r.points=Tw(i,n,e))}getDefaultAttribute(t){return Gv(this).polygon[t]}needUpdateTags(t){for(let e=0;e<vA.length;e++){const i=vA[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<vA.length;e++)if(t===vA[e])return!0;return!1}toCustomPath(){const t=this.attribute.points,e=new hb;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new wA(Object.assign({},this.attribute))}}var CA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let xA=class{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:o=e.shadowBlur}=t;if(r){const t=e.outerBorder,{distance:n=t.distance,lineWidth:s=t.lineWidth}=r;i.expand(n+o+s/2)}return i}};xA=CA([Vm()],xA);var _A=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const SA=Symbol.for("RectBoundsContribution");let AA=class extends xA{};AA=_A([Vm()],AA);var TA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const BA=Symbol.for("SymbolBoundsContribution");let MA=class extends xA{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(r){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=r;bx(i,n+o+a/2,!0,s)}return i}};MA=TA([Vm()],MA);var RA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const PA=Symbol.for("CircleBoundsContribution");let EA=class extends xA{};EA=RA([Vm()],EA);var HA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const LA=Symbol.for("ArcBoundsContribution");let kA=class extends xA{};kA=HA([Vm()],kA);var IA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const OA=Symbol.for("PathBoundsContribution");let DA=class extends xA{};DA=IA([Vm()],DA);class FA{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return FA.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const zA=new class{constructor(){this.pools=[]}allocate(t,e,i,n,r,o){if(!this.pools.length)return new op(t,e,i,n,r,o);const s=this.pools.pop();return s.a=t,s.b=e,s.c=i,s.d=n,s.e=r,s.f=o,s}allocateByObj(t){if(!this.pools.length)return new op(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(){this.pools=[]}},WA=new FA;var jA=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},NA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,n){e(i,n,t)}};function VA(t,e,i){const n=i[0],r=i[1],o=i[2];let s,a,l,h,c,u,d,p,f,g,m,y;return e===t?(t[12]=e[0]*n+e[4]*r+e[8]*o+e[12],t[13]=e[1]*n+e[5]*r+e[9]*o+e[13],t[14]=e[2]*n+e[6]*r+e[10]*o+e[14],t[15]=e[3]*n+e[7]*r+e[11]*o+e[15]):(s=e[0],a=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],f=e[8],g=e[9],m=e[10],y=e[11],t[0]=s,t[1]=a,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=m,t[11]=y,t[12]=s*n+c*r+f*o+e[12],t[13]=a*n+u*r+g*o+e[13],t[14]=l*n+d*r+m*o+e[14],t[15]=h*n+p*r+y*o+e[15]),t}function UA(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function KA(t,e,i){const n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],y=e[14],b=e[15];let v=i[0],w=i[1],C=i[2],x=i[3];return t[0]=v*n+w*a+C*u+x*g,t[1]=v*r+w*l+C*d+x*m,t[2]=v*o+w*h+C*p+x*y,t[3]=v*s+w*c+C*f+x*b,v=i[4],w=i[5],C=i[6],x=i[7],t[4]=v*n+w*a+C*u+x*g,t[5]=v*r+w*l+C*d+x*m,t[6]=v*o+w*h+C*p+x*y,t[7]=v*s+w*c+C*f+x*b,v=i[8],w=i[9],C=i[10],x=i[11],t[8]=v*n+w*a+C*u+x*g,t[9]=v*r+w*l+C*d+x*m,t[10]=v*o+w*h+C*p+x*y,t[11]=v*s+w*c+C*f+x*b,v=i[12],w=i[13],C=i[14],x=i[15],t[12]=v*n+w*a+C*u+x*g,t[13]=v*r+w*l+C*d+x*m,t[14]=v*o+w*h+C*p+x*y,t[15]=v*s+w*c+C*f+x*b,t}function $A(t,e,i){var n;const{x:r=i.x,y:o=i.y,z:s=i.z,dx:a=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:f=i.beta,angle:g=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,b=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;b[0]=i.x1+(i.x2-i.x1)*t}else b[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;b[1]=i.x1+(i.x2-i.x1)*t}else b[1]=m[1];b[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),VA(t,t,[r+a,o+l,s+h]),VA(t,t,[b[0],b[1],b[2]]),function(t,e,i){const n=Math.sin(i),r=Math.cos(i),o=e[4],s=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*r+h*n,t[5]=s*r+c*n,t[6]=a*r+u*n,t[7]=l*r+d*n,t[8]=h*r-o*n,t[9]=c*r-s*n,t[10]=u*r-a*n,t[11]=d*r-l*n}(t,t,f),function(t,e,i){const n=Math.sin(i),r=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r-h*n,t[1]=s*r-c*n,t[2]=a*r-u*n,t[3]=l*r-d*n,t[8]=o*n+h*r,t[9]=s*n+c*r,t[10]=a*n+u*r,t[11]=l*n+d*r}(t,t,p),VA(t,t,[-b[0],-b[1],b[2]]),function(t,e,i){const n=i[0],r=i[1],o=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,u,d]),g){const i=WA.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}VA(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),r=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r+h*n,t[1]=s*r+c*n,t[2]=a*r+u*n,t[3]=l*r+d*n,t[4]=h*r-o*n,t[5]=c*r-s*n,t[6]=u*r-a*n,t[7]=d*r-l*n}(i,i,g),VA(i,i,[-n[0],-n[1],0]),KA(t,t,i)}}let XA=class{constructor(t,e,i,n,r,o){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=r,this.pathBoundsContribitions=o,this.hooks={onAttributeUpdate:new iy(["graphic"]),onSetStage:new iy(["graphic","stage"]),onRemove:new iy(["graphic"]),onAddIncremental:new iy(["graphic","group","stage"]),onClearIncremental:new iy(["graphic","group","stage"]),beforeUpdateAABBBounds:new iy(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new iy(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new ip,this.tempAABBBounds2=new ip}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,r){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,r)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new cy(t);return Ly(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:r=e.height}=t;i.set(0,0,n,r)}const r=this.tempAABBBounds1,o=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(o.x1,o.y1,o.x2,o.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:r,height:o,path:s,clip:a=e.clip}=t;s&&s.length?s.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=o&&i.set(0,0,r,o),a||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:r=e.width,height:o=e.height,maxWidth:s=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(r>0&&o>0)i.set(0,0,r,o);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=r||e||0,c=o||l||0;c="number"==typeof a&&c>a?a:c||0,h="number"==typeof s&&h>s?s:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let u=0;switch(l){case"left":u=0;break;case"center":u=-i.width()/2;break;case"right":u=-i.width()}i.translate(u,c);const d=this.tempAABBBounds1,p=this.tempAABBBounds2;return d.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:r=e.text}=n.attribute;Array.isArray(r)?n.updateMultilineAABBBounds(r):n.updateSingallineAABBBounds(r);const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:a=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){bx(o,h/Math.abs(a+l),!0,c),i.union(o)}return this.combindShadowAABBBounds(i,n),tp(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const r=this.tempAABBBounds1,o=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(o.x1,o.y1,o.x2,o.y2)}));const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const r=n.getParsedPathShape();return i.union(r.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const r=n.stage;if(!r||!r.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;return o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const r=n.stage;if(!r||!r.camera)return i;const{outerRadius:o=e.outerRadius,height:s=0}=t,a=o+s;i.setValue(-a,-a,a,a);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const r=this.tempAABBBounds1,o=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:r=e.points}=t;return r.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const r=this.tempAABBBounds1,o=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:r=e.points}=t,o=i;return r.forEach((t=>{o.add(t.x,t.y)})),o}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments}=t,o=i;return r.forEach((t=>{t.points.forEach((t=>{o.add(t.x,t.y)}))})),o}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const r=this.tempAABBBounds1,o=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:r=e.points}=t,o=i;return r.forEach((t=>{var e,i;o.add(t.x,t.y),o.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),o}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments}=t,o=i;return r.forEach((t=>{t.points.forEach((t=>{var e,i;o.add(t.x,t.y),o.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),o}updateCircleAABBBounds(t,e,i,n,r){this.updatePathProxyAABBBounds(i,r)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,r):this.updateCircleAABBBoundsAccurate(t,e,i,r));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;return o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,o,r),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)})),this.transformAABBBounds(t,i,e,!1,r),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:r=e.radius}=t;return i.set(-r,-r,r,r),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:r=e.startAngle,endAngle:o=e.endAngle,radius:s=e.radius}=t;return o-r>Wd-Od?i.set(-s,-s,s,s):Sw(r,o,s,i),i}updateArcAABBBounds(t,e,i,n,r){this.updatePathProxyAABBBounds(i,r)||(n?this.updateArcAABBBoundsImprecise(t,e,i,r):this.updateArcAABBBoundsAccurate(t,e,i,r));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,o,r),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:r=e.outerRadius}=t;return i.set(-r,-r,r,r),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:r=e.outerRadius,innerRadius:o=e.innerRadius}=t;if(r<o){const t=r;r=o,o=t}let{endAngle:s=e.endAngle,startAngle:a=e.startAngle}=t;if(a>s){const t=a;a=s,s=t}return r<=Od?i.set(0,0,0,0):Math.abs(s-a)>Wd-Od?i.set(-r,-r,r,r):(Sw(a,s,r,i),Sw(a,s,o,i)),i}updateSymbolAABBBounds(t,e,i,n,r){this.updatePathProxyAABBBounds(i,r)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,r):this.updateSymbolAABBBoundsAccurate(t,e,i,r));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,o,r),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,r),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:r=e.size}=t;if(qu(r))i.set(-r[0]/2,-r[1]/2,r[0]/2,r[1]/2);else{const t=r/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:r=e.size}=t;return n.getParsedPath().bounds(r,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:r=e.height}=t;i.set(0,0,n,r)}const r=this.tempAABBBounds1,o=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,r){const{scaleX:o=i.scaleX,scaleY:s=i.scaleY,stroke:a=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a){bx(u,h/Math.abs(o+s),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(l){bx(u,l/Math.abs(o+s),n,c),e.union(u)}this.combindShadowAABBBounds(e,r),tp(e,e,r.transMatrix)}};XA=jA([Vm(),GA(0,$m(Vx)),GA(1,$m(Jm)),GA(1,Um(SA)),GA(2,$m(Jm)),GA(2,Um(BA)),GA(3,$m(Jm)),GA(3,Um(PA)),GA(4,$m(Jm)),GA(4,Um(LA)),GA(5,$m(Jm)),GA(5,Um(OA)),NA("design:paramtypes",[Object,Object,Object,Object,Object,Object])],XA);class YA extends Xx{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function qA(t){return new bA(t)}function ZA(t){return new V_(t)}function JA(t){return new Xx(t)}function QA(t){return new tA(t)}function tT(t){return new fA(t)}function eT(t){return new iA(t)}function iT(t){return new q_(t)}function nT(t){return new JS(t)}function rT(t){return new lA(t)}function oT(t){return new dA(t)}const sT={arc:qA,area:function(t){return new mA(t)},circle:ZA,group:JA,image:rT,line:QA,path:tT,rect:eT,rect3d:function(t){return new rA(t)},symbol:nT,text:iT,richtext:oT,polygon:function(t){return new wA(t)},shadowRoot:function(t){return new YA(t)},wrapText:function(t){return new J_(t)}},aT=iT({text:""});function lT(t){return aT.setAttributes(t),aT.AABBBounds}oT({});var hT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let cT=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=t.transMatrix,{x:o=e.x,y:s=e.y,z:a=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:u}=t.attribute,d=r.onlyTranslate()&&!u,p=i.modelMatrix,f=i.camera,g={x:o,y:s,z:a,lastModelMatrix:p},m=f&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=WA.allocate(),r=WA.allocate();$A(r,t,e),KA(n,p||n,r),g.x=0,g.y=0,g.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),WA.free(r)}if(d&&!p){const n=t.getOffsetXY(e);g.x+=n.x,g.y+=n.y,g.z=a,i.setTransformForCurrent()}else if(m)g.x=0,g.y=0,g.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(f&&i.project){const n=t.getOffsetXY(e);g.x+=n.x,g.y+=n.y,this.transformWithoutTranslate(i,g.x,g.y,g.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),g.x=0,g.y=0,g.z=0;return g}transformUseContext2d(t,e,i,n){const r=n.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,o=e.y2-e.y1,s=n.project(0,0,i),a=n.project(r,0,i),l=n.project(r,o,i),h={x:0,y:0},c={x:r,y:0},u={x:r,y:o};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-a.x)-c.y*l.x+u.y*a.x+(c.y-u.y)*s.x)*d,f=(c.y*l.y+h.y*(a.y-l.y)-u.y*a.y+(u.y-c.y)*s.y)*d,g=(h.x*(l.x-a.x)-c.x*l.x+u.x*a.x+(c.x-u.x)*s.x)*d,m=-(c.x*l.y+h.x*(a.y-l.y)-u.x*a.y+(u.x-c.x)*s.y)*d,y=(h.x*(u.y*a.x-c.y*l.x)+h.y*(c.x*l.x-u.x*a.x)+(u.x*c.y-c.x*u.y)*s.x)*d,b=(h.x*(u.y*a.y-c.y*l.y)+h.y*(c.x*l.y-u.x*a.y)+(u.x*c.y-c.x*u.y)*s.y)*d;n.setTransform(p,f,g,m,y,b,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,r,o,s){const a=t.project(e,i,n);t.translate(a.x,a.y,!1),t.scale(r,o,!1),t.rotate(s,!1),t.translate(-a.x,-a.y,!1),t.setTransformForCurrent()}};function uT(t,e,i,n,r){var o;const{offsetX:s=0,offsetY:a=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:u=0,zeroY:d=0}=r||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:f}=e;if(i>=1){if(c){let e,i=!0;f.forEach(((n,r)=>{var o;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+s,h.y+a,l),i=!i);else{const{originP1:e,originP2:r}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==r.defined&&(c=null!==(o=n.p3)&&void 0!==o?o:n.p1),i){i=!i;const e=c?c.x:n.p0.x,r=c?c.y:n.p0.y;t.moveTo(e+s,r+a,l)}else c&&(i=!i,t.lineTo(c.x+s,c.y+a,l))}e=n}else e=n}))}else f.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+s,e.p0.y+a,l),dT(t,e,1,r),p=!1):p=!0}));return}if(i<=0)return;let g;"x"===n?g=By.ROW:"y"===n?g=By.COLUMN:"auto"===n&&(g=e.direction);const m=i*e.tryUpdateLength(g);let y=0,b=!0,v=null;for(let e=0,i=f.length;e<i;e++){const i=f[e],n=i.getLength(g),h=(m-y)/n;if(y+=n,h<0)break;if(c){let e=i.p0;if(i.originP1===i.originP2){v=i;continue}if(v&&v.originP1===v.originP2&&(e=v.p0),i.defined)b||(t.lineTo(e.x+s,e.y+a,l),b=!b);else{const{originP1:n,originP2:r}=i;let h;if(n&&!1!==n.defined?h=e:n&&!1!==r.defined&&(h=null!==(o=i.p3)&&void 0!==o?o:i.p1),b){b=!b;const e=h?h.x:i.p0.x,n=h?h.y:i.p0.y;t.moveTo(e+s,n+a,l)}else h&&(b=!b,t.lineTo(h.x+s,h.y+a,l))}v=i}else{if(!i.defined){p=!0;continue}p&&t.moveTo(i.p0.x+s,i.p0.y+a,l),dT(t,i,Ud(h,1),r),p=!1}}}function dT(t,e,i,n){if(!e.p1)return;const{offsetX:r=0,offsetY:o=0,offsetZ:s=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(r+e.p1.x,o+e.p1.y,r+e.p2.x,o+e.p2.y,r+e.p3.x,o+e.p3.y,s):t.lineTo(r+e.p1.x,o+e.p1.y,s);else if(e.p2&&e.p3){const[n]=Fy(e,i);t.bezierCurveTo(r+n.p1.x,o+n.p1.y,r+n.p2.x,o+n.p2.y,r+n.p3.x,o+n.p3.y,s)}else{const n=e.getPointAt(i);t.lineTo(r+n.x,o+n.y,s)}}cT=hT([Vm()],cT);var pT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let fT=class extends cT{constructor(){super(...arguments),this.numberType=kx}draw(t,e,i,n){const{context:r}=i;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).line,s=this.transform(t,o,r),{x:a,y:l,z:h,lastModelMatrix:c}=s;this.z=h,y_(t,r,a,l)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&WA.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}drawSegmentItem(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f){var g,m,y,b,v;if(!e)return;t.beginPath();const w=null!==(g=this.z)&&void 0!==g?g:0;uT(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:w}),d.cache&&!qu(d.cache)&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(d,s,a);const{x:C=0,x:x=0}=s;!1!==i&&(p?p(t,s,a):r&&(t.setCommonStyle(d,s,C-c,x-u,a),t.fill())),!1!==n&&(f?f(t,s,a):o&&(t.setStrokeStyle(d,s,C-c,x-u,a),t.stroke()));let{connectedType:_,connectedX:S,connectedY:A,connectedStyle:T}=s;if(qu(a)?(_=null!==(m=null!=_?_:a[0].connectedType)&&void 0!==m?m:a[1].connectedType,S=null!==(y=null!=S?S:a[0].connectedX)&&void 0!==y?y:a[1].connectedX,A=null!==(b=null!=A?A:a[0].connectedY)&&void 0!==b?b:a[1].connectedY,T=null!==(v=null!=T?T:a[0].connectedStyle)&&void 0!==v?v:a[1].connectedStyle):(_=null!=_?_:a.connectedType,S=null!=S?S:a.connectedX,A=null!=A?A:a.connectedY,T=null!=T?T:a.connectedStyle),"connect"!==_&&"zero"!==_&&(_="none"),"none"!==_){t.beginPath(),uT(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:w,drawConnect:!0,mode:_,zeroX:S,zeroY:A});const g=[];qu(a)?a.forEach((t=>g.push(t))):g.push(a),g.push(s),!1!==i&&(p?p(t,s,a):r&&(t.setCommonStyle(d,T,C-c,x-u,g),t.fill())),!1!==n&&(f?f(t,s,a):o&&(t.setStrokeStyle(d,T,C-c,x-u,g),t.stroke()))}return!1}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:f=l.lineWidth,visible:g=l.visible}=t.attribute,m=p_(u,d,h),y=g_(u,p),b=u_(h),v=d_(c,f);if(!t.valid||!g)return;if(!b&&!v)return;if(!(m||y||s||a))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,r=e;if(i&&i.length){let e,r;t.cache=i.map(((t,i)=>(1===i?e={x:r.endX,y:r.endY,defined:r.curves[r.curves.length-1].defined}:i>1&&(e.x=r.endX,e.y=r.endY,e.defined=r.curves[r.curves.length-1].defined),r=lb(t.points,n,{startPoint:e}),r)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=lb(r,n)}t.clearUpdateShapeTag()}const{clipRange:w=l.clipRange,clipRangeByDimension:C=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===w){let r=!1;t.cache.forEach(((o,u)=>{r||(r=this.drawSegmentItem(e,o,!!h,!!c,d,p,t.attribute.segments[u],[l,t.attribute],w,C,i,n,t,s,a))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),o=w*r;let u=0,f=!1;t.cache.forEach(((r,g)=>{if(f)return;const m=r.getLength(),y=(o-u)/m;u+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,p,t.attribute.segments[g],[l,t.attribute],Ud(y,1),C,i,n,t,s,a))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,p,t.attribute,l,w,C,i,n,t,s,a)}};function gT(t,e,i,n){if(e.length<2)return;const{offsetX:r=0,offsetY:o=0,offsetZ:s=0,mode:a}=n||{};let l=e[0];t.moveTo(l.p0.x+r,l.p0.y+o,s),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+r,h.y+o,s),l=i[i.length-1],t.lineTo(l.p0.x+r,l.p0.y+o,s),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+r,h.y+o,s),t.closePath()}function mT(t,e,i,n){const{offsetX:r=0,offsetY:o=0,offsetZ:s=0}=n||{};let a=!0;e.forEach((e=>{e.defined?(a&&t.moveTo(e.p0.x+r,e.p0.y+o,s),yT(t,e,1,n),a=!1):a=!0})),a=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(a&&t.lineTo(l.p0.x+r,l.p0.y+o,s),yT(t,l,1,n),a=!1):a=!0}t.closePath()}function yT(t,e,i,n){if(!e.p1)return;const{offsetX:r=0,offsetY:o=0,offsetZ:s=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(r+e.p1.x,o+e.p1.y,r+e.p2.x,o+e.p2.y,r+e.p3.x,o+e.p3.y,s):t.lineTo(r+e.p1.x,o+e.p1.y,s);else if(e.p2&&e.p3){const[n]=Fy(e,i);t.bezierCurveTo(r+n.p1.x,o+n.p1.y,r+n.p2.x,o+n.p2.y,r+n.p3.x,o+n.p3.y,s)}else{const n=e.getPointAt(i);t.lineTo(r+n.x,o+n.y,s)}}fT=pT([Vm()],fT);var bT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},vT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wT=function(t,e){return function(i,n){e(i,n,t)}};function CT(t,e,i){switch(e){case"linear":default:return Ky(t,i);case"basis":return Yy(t,i);case"monotoneX":return ib(t,i);case"monotoneY":return nb(t,i);case"step":return ob(t,.5,i);case"stepBefore":return ob(t,0,i);case"stepAfter":return ob(t,1,i);case"linearClosed":return ab(t,i)}}let xT=class{constructor(t){this.areaRenderContribitions=t,this.numberType=Rx}drawShape(t,e,i,n,r,o,s,a){var l,h,c,u,d,p;const f=Gv(t,null==o?void 0:o.theme).area,{fill:g=f.fill,fillOpacity:m=f.fillOpacity,opacity:y=f.opacity,visible:b=f.visible,z:v=f.z,background:w,stroke:C=t.attribute.stroke,lineWidth:x=f.lineWidth,strokeOpacity:_=f.strokeOpacity}=t.attribute,S=p_(y,m,g),A=u_(g,w),T=d_(C,x),B=g_(y,_);if(!t.valid||!b)return;if(!A&&!T)return;if(!(S||s||B||a))return;const{clipRange:M=f.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=f.curveType}=t.attribute;if(i&&i.length){let e,r;const o=i.map(((t,i)=>(1===i?e={x:r.endX,y:r.endY}:i>1&&(e.x=r.endX,e.y=r.endY),r=CT(t.points,n,{startPoint:e}),r)));let s;const a=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,r=[];for(let t=e.length-1;t>=0;t--)r.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&r.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}s=CT(r,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),a.unshift(s)}t.cacheArea=a.map(((t,e)=>({top:o[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,r=[];for(let t=e.length-1;t>=0;t--)r.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const o=CT(i,n),s=CT(r,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:o,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===M){let o=!1;t.cacheArea.forEach(((l,h)=>{o||(o=this.drawSegmentItem(e,l,A,m,T,_,t.attribute.segments[h],[f,t.attribute],M,i,n,v,t,r,s,a))}))}else{const o=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=M*o;let h=0,c=!1;t.cacheArea.forEach(((o,u)=>{if(c)return;const d=o.top.getLength(),p=(l-h)/d;h+=d,p>0&&(c=this.drawSegmentItem(e,o,A,m,T,_,t.attribute.segments[u],[f,t.attribute],Ud(p,1),i,n,v,t,r,s,a))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,T,_,t.attribute,f,M,i,n,v,t,r,s,a)}draw(t,e,i,n){const{context:r}=i,o=Gv(t,null==n?void 0:n.theme).area;let{x:s=o.x,y:a=o.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(o);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);y_(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}drawSegmentItem(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){let m=!1;return m=m||this._drawSegmentItem(t,e,i,n,r,o,s,a,l,h,c,u,d,p,!1,f,g),m=m||this._drawSegmentItem(t,e,i,n,r,o,s,a,l,h,c,u,d,p,!0,f,g),m}_drawSegmentItem(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m){var y,b,v,w;let{connectedType:C,connectedX:x,connectedY:_,connectedStyle:S}=s;const A=[];if(f&&(qu(a)?(C=null!==(y=null!=C?C:a[0].connectedType)&&void 0!==y?y:a[1].connectedType,x=null!==(b=null!=x?x:a[0].connectedX)&&void 0!==b?b:a[1].connectedX,_=null!==(v=null!=_?_:a[0].connectedY)&&void 0!==v?v:a[1].connectedY,S=null!==(w=null!=S?S:a[0].connectedStyle)&&void 0!==w?w:a[1].connectedStyle):(C=null!=C?C:a.connectedType,x=null!=x?x:a.connectedX,_=null!=_?_:a.connectedY,S=null!=S?S:a.connectedStyle),"connect"!==C&&"zero"!==C&&(C="none"),qu(a)?a.forEach((t=>A.push(t))):A.push(a),A.push(s)),f&&"none"===C)return!1;if(!e)return;t.beginPath();const{points:T,segments:B}=d.attribute;let M,R,P=By.ROW;if(B){const t=B[B.length-1];R=B[0].points[0],M=t.points[t.points.length-1]}else R=T[0],M=T[T.length-1];P=jd(M.x-R.x)>jd(M.y-R.y)?By.ROW:By.COLUMN,function(t,e,i,n){var r;const{drawConnect:o=!1,mode:s="none"}=n||{};if(o&&"none"===s)return;const{top:a,bottom:l}=e;if(i>=1){const e=[],i=[];let r=!0;if(o){let r,o,s=!0;const h=a.curves.length;a.curves.forEach(((a,c)=>{const u=l.curves[h-c-1];let d=a,p=u;if(a.originP1===a.originP2)return r=a,void(o=u);if(r&&r.originP1===r.originP2&&(d=r,p=o),a.defined)s||(e.push(d),i.push(p),gT(t,e,i,n),e.length=0,i.length=0,s=!s);else{const{originP1:r,originP2:o}=a;let l,h;r&&!1!==r.defined?(l=d,h=p):r&&!1!==o.defined&&(l=a,h=u),s?(s=!s,e.push(l||a),i.push(h||u)):l&&(s=!s,e.push(l||a),i.push(h||u),gT(t,e,i,n),e.length=0,i.length=0)}r=a})),gT(t,e,i,n)}else{for(let o=0,s=a.curves.length;o<s;o++){const h=a.curves[o];r!==h.defined?(r?(mT(t,e,i,n),e.length=0,i.length=0):(e.push(h),i.push(l.curves[s-o-1])),r=!r):r&&(e.push(h),i.push(l.curves[s-o-1]))}mT(t,e,i,n)}return}if(i<=0)return;let{direction:h}=n||{};const{curves:c}=a,u=null!==(r=c[c.length-1].p3)&&void 0!==r?r:c[c.length-1].p1,d=jd(u.x-c[0].p0.x),p=jd(u.y-c[0].p0.y);h=null!=h?h:d>p?By.ROW:By.COLUMN,Number.isFinite(d)||(h=By.COLUMN),Number.isFinite(p)||(h=By.ROW);const f=i*(h===By.ROW?d:p);let g=0,m=!0;const y=[],b=[];let v,w,C=!0;for(let e=0,i=a.curves.length;e<i;e++){const r=a.curves[e],s=r.getLength(h),c=(f-g)/s;if(c<0)break;if(g+=s,o){const o=l.curves[i-e-1];let s=r,a=o;if(r.originP1===r.originP2){v=r,w=o;continue}if(v&&v.originP1===v.originP2&&(s=v,a=w),r.defined)C||(y.push(s),b.push(a),gT(t,y,b,n),y.length=0,b.length=0,C=!C);else{const{originP1:e,originP2:i}=r;let l,h;e&&!1!==e.defined?(l=s,h=a):e&&!1!==i.defined&&(l=r,h=o),C?(C=!C,y.push(l||r),b.push(h||o)):l&&(C=!C,y.push(l||r),b.push(h||o),gT(t,y,b,n),y.length=0,b.length=0)}v=r}else{let o=null,s=null;m!==r.defined?(m?(mT(t,y,b,n),y.length=0,b.length=0):(o=r,s=l.curves[i-e-1]),m=!m):m&&(o=r,s=l.curves[i-e-1]),o&&s&&(c<1&&(o=o.p2&&o.p3?Fy(o,c)[0]:Wy(o,c)[0],s=s.p2&&s.p3?Fy(s,1-c)[1]:Wy(s,1-c)[1]),o.defined=m,s.defined=m,y.push(o),b.push(s)),o=null,s=null}}o?gT(t,y,b,n):mT(t,y,b,n)}(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:P,drawConnect:f,mode:C,zeroX:x,zeroY:_}),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[],this._areaRenderContribitions.sort(((t,e)=>e.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===Ry.beforeFillStroke&&e.drawShape(d,t,h,c,!!n,!1,i,!1,a,p,g,null,{attribute:s})})),t.setShadowStyle&&t.setShadowStyle(d,s,a);const{x:E=0,x:H=0}=s;if(!1!==i&&(g?g(t,s,a):n&&(t.setCommonStyle(d,f?S:s,E-h,H-c,f?A:a),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===Ry.afterFillStroke&&e.drawShape(d,t,h,c,!!n,!1,i,!1,a,p,g,null,{attribute:s})})),!1!==r)if(m)m(t,s,a);else{const{stroke:i=a&&a[1]&&a[1].stroke}=s;qu(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),uT(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,P===By.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u,drawConnect:f,mode:C,zeroX:x,zeroY:_})),t.setStrokeStyle(d,f?S:s,E-h,H-c,f?A:a),t.stroke()}return!1}};xT=bT([Vm(),wT(0,$m(Jm)),wT(0,Um(A_)),vT("design:paramtypes",[Object])],xT);var _T=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ST=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AT=function(t,e){return function(i,n){e(i,n,t)}};let TT=class extends cT{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=Ix}drawShape(t,e,i,n,r,o,s,a){var l,h;const c=Gv(t,null==o?void 0:o.theme).path,{fill:u=c.fill,stroke:d=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:f=c.strokeOpacity,opacity:g=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:b=c.visible,x:v=c.x,y:w=c.y}=t.attribute,C=null!==(l=this.z)&&void 0!==l?l:0,x=p_(g,p,u),_=g_(g,f),S=u_(u,m),A=d_(d,y);if(t.valid&&b&&(S||A)&&(x||_||s||a||m)){if(e.beginPath(),t.pathShape)Ly(t.pathShape.commandList,e,i,n,1,1,C);else{Ly((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,C)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,c,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),A&&(a?a(e,t.attribute,c):_&&(e.setStrokeStyle(t,t.attribute,v-i,w-n,c),e.stroke())),S&&(s?s(e,t.attribute,c):x&&(e.setCommonStyle(t,t.attribute,v-i,w-n,c),e.fill())),this._pathRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,c,r,s,a)}))}}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).path,s=this.transform(t,o,r),{x:a,y:l,z:h,lastModelMatrix:c}=s;this.z=h,y_(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&WA.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}};TT=_T([Vm(),AT(0,$m(Jm)),AT(0,Um(R_)),ST("design:paramtypes",[Object])],TT);const BT=Dd/2;function MT(t,e,i,n,r,o){let s;if(Qu(o,!0))s=[o,o,o,o];else if(Array.isArray(o)){const t=o;switch(t.length){case 0:s=[0,0,0,0];break;case 1:s=[t[0],t[0],t[0],t[0]];break;case 2:case 3:s=[t[0],t[1],t[0],t[1]];break;default:s=t.slice(0,5)}}else s=[0,0,0,0];if(n<0||Math.abs(s[0])+Math.abs(s[1])+Math.abs(s[2])+Math.abs(s[3])<1e-12)return t.rect(e,i,n,r);const[a,l,h,c]=[[e,i],[e+n,i],[e+n,i+r],[e,i+r]],u=Math.min(n/2,r/2),d=[Math.min(u,s[0]),Math.min(u,s[1]),Math.min(u,s[2]),Math.min(u,s[3])],p=[a[0]+d[0],a[1]],f=[a[0],a[1]+d[0]],g=[l[0]-d[1],l[1]],m=[l[0],l[1]+d[1]],y=[h[0]-d[2],h[1]],b=[h[0],h[1]-d[2]],v=[c[0]+d[3],c[1]],w=[c[0],c[1]-d[3]];if(t.moveTo(p[0],p[1]),t.lineTo(g[0],g[1]),!wd(g,m)){const e=g[0],i=g[1]+d[1];t.arc(e,i,d[1],-BT,0,!1)}if(t.lineTo(b[0],b[1]),!wd(y,b)){const e=b[0]-d[2],i=b[1];t.arc(e,i,d[2],0,BT,!1)}if(t.lineTo(v[0],v[1]),!wd(v,w)){const e=v[0],i=v[1]-d[3];t.arc(e,i,d[3],BT,Dd,!1)}if(t.lineTo(f[0],f[1]),!wd(p,f)){const e=p[0],i=p[1]+d[0];t.arc(e,i,d[0],Dd,Dd+BT,!1)}return t.closePath(),t}var RT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},PT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ET=function(t,e){return function(i,n){e(i,n,t)}};let HT=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=Fx}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).rect,{fill:h=l.fill,background:c,stroke:u=l.stroke,width:d=l.width,height:p=l.height,cornerRadius:f=l.cornerRadius,opacity:g=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:b=l.strokeOpacity,visible:v=l.visible,x:w=l.x,y:C=l.y}=t.attribute,x=f_(g,m,d,p,h),_=m_(g,b,d,p),S=u_(h,c),A=d_(u,y);if(!t.valid||!v)return;if(!S&&!A)return;if(!(x||_||s||a||c))return;0===f||qu(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(i,n,d,p)):(e.beginPath(),MT(e,i,n,d,p,f)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const T={doFill:S,doStroke:A};this._rectRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a,T)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),T.doFill&&(s?s(e,t.attribute,l):x&&(e.setCommonStyle(t,t.attribute,w-i,C-n,l),e.fill())),T.doStroke&&(a?a(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,w-i,C-n,l),e.stroke())),this._rectRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).rect;let{x:s=o.x,y:a=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(o);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);y_(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};HT=RT([Vm(),ET(0,$m(Jm)),ET(0,Um(E_)),PT("design:paramtypes",[Object])],HT);var LT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},kT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IT=function(t,e){return function(i,n){e(i,n,t)}};let OT=class extends cT{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=jx}drawShape(t,e,i,n,r,o,s,a){var l;const h=Gv(t,null==o?void 0:o.theme).symbol,{size:c=h.size,fill:u=h.fill,background:d,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,opacity:g=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:b=h.visible,x:v=h.x,y:w=h.y,scaleX:C=h.scaleX,scaleY:x=h.scaleY}=t.attribute,_=p_(g,p,u),S=g_(g,f),A=u_(u,d),T=d_(y,m);if(!t.valid||!b)return;if(!A&&!T)return;if(!(_||S||s||a||d))return;const B=t.getParsedPath();if(!B)return;const{keepDirIn3d:M=h.keepDirIn3d}=t.attribute,R=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),M&&e.camera&&e.project){const r=e.project(i,n,R),o=e.camera;e.camera=null,!1===B.draw(e,c,r.x,r.y,void 0,((r,o)=>{o.fill&&(s?s(e,t.attribute,h):(e.setCommonStyle(t,o,v-i,w-n),e.fill())),o.stroke&&(a?a(e,t.attribute,h):(e.setStrokeStyle(t,o,(v-i)/C,(w-n)/x),e.stroke()))}))&&e.closePath(),e.camera=o}else!1===B.draw(e,c,i,n,R,((r,o)=>{o.fill&&(s?s(e,t.attribute,h):(e.setCommonStyle(t,o,v-i,w-n),e.fill())),o.stroke&&(a?a(e,t.attribute,h):(e.setStrokeStyle(t,o,(v-i)/C,(w-n)/x),e.stroke()))}))&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,A,T,_,S,h,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),A&&!B.isSvg&&(s?s(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,v-i,w-n,h),e.fill())),T&&!B.isSvg&&(a?a(e,t.attribute,h):S&&(e.setStrokeStyle(t,t.attribute,(v-i)/C,(w-n)/x,h),e.stroke())),this._symbolRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,A,T,_,S,h,r,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).symbol,s=this.transform(t,o,r),{x:a,y:l,z:h,lastModelMatrix:c}=s;this.z=h,y_(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&WA.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}};OT=LT([Vm(),IT(0,$m(Jm)),IT(0,Um(H_)),kT("design:paramtypes",[Object])],OT);var DT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},FT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zT=function(t,e){return function(i,n){e(i,n,t)}};let WT=class extends cT{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Nx}drawShape(t,e,i,n,r,o,s,a){var l;const h=Gv(t,null==o?void 0:o.theme).text,{text:c,fill:u=h.fill,stroke:d=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,opacity:g=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:b=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:w=h.keepDirIn3d,direction:C=h.direction,fontSize:x=h.fontSize,textBaseline:_=h.textBaseline,textAlign:S=h.textAlign,x:A=h.x,y:T=h.y}=t.attribute,B=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=p_(g,p,u),R=g_(g,f),P=u_(u),E=d_(d,m);if(!t.valid||!y)return;if(!(P||E||M||R))return;const H=!w,L=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===Ry.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,P,E,M,R,h,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),H&&this.transformUseContext2d(t,h,L,e);const k=(r,o,l,c)=>{let u=i+o;const d=n+l;if(c){e.highPerformanceSave(),u+=x;const t=zA.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,u,d),e.transformFromMatrix(t,!0),zA.free(t)}E&&(a?a(e,t.attribute,h):R&&(e.setStrokeStyle(t,t.attribute,A-i,T-n,h),e.strokeText(r,u,d,L))),P&&(s?s(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,A-i,T-n,h),e.fillText(r,u,d,L),this.drawUnderLine(b,v,t,u,d,L,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,L),"horizontal"===C){const{multilineLayout:r}=t;if(!r)return void e.highPerformanceRestore();const{xOffset:o,yOffset:l}=r.bbox;E&&(a?a(e,t.attribute,h):R&&(e.setStrokeStyle(t,t.attribute,A-i,T-n,h),r.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+o+i,(t.topOffset||0)+l+n,L)})))),P&&(s?s(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,A-i,T-n,h),r.lines.forEach((r=>{e.fillText(r.str,(r.leftOffset||0)+o+i,(r.topOffset||0)+l+n,L),this.drawMultiUnderLine(b,v,t,(r.leftOffset||0)+i,(r.topOffset||0)+l+n,L,r.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const r=B*n.length;let o=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Vd(e,o)}));let s=0,a=0;"bottom"===_?a=-r:"middle"===_&&(a=-r/2),"center"===S?s-=o/2:"right"===S&&(s-=o),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-i;let l=s;"center"===S?l+=n/2:"right"===S&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:o}=t;k(i,r-(e+1)*B+a,l,o),l+=n}))}))}else{const i=t.cache;if("horizontal"===C){e.setTextStyle(t.attribute,h,L);const i=t.clipedText;let n=0;B!==x&&("top"===_?n=(B-x)/2:"middle"===_||"bottom"===_&&(n=-(B-x)/2)),k(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,L);const{verticalList:n}=i;let r=0;const o=n[0].reduce(((t,e)=>t+(e.width||0)),0);let s=0;"bottom"===_?s=-B:"middle"===_&&(s=-B/2),"center"===S?r-=o/2:"right"===S&&(r-=o),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;k(e,s,r,n),r+=i}))}}H&&this.restoreTransformUseContext2d(t,h,L,e),this._textAfterRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,P,E,M,R,h,r,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).text,{keepDirIn3d:s=o.keepDirIn3d}=t.attribute,a=!s,l=this.transform(t,o,r,a),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawShape(t,r,h,c,i,n),this.z=0,r.modelMatrix=d,r.highPerformanceRestore()}drawUnderLine(t,e,i,n,r,o,s,a){if(e+t<=0)return;const{textAlign:l=s.textAlign,textBaseline:h=s.textBaseline,fontSize:c=s.fontSize,fill:u=s.fill,opacity:d=s.opacity,fillOpacity:p=s.fillOpacity}=i.attribute,f=i.clipedWidth,g=K_(l,f),m=$_(h,c,c),y={lineWidth:0,stroke:u,opacity:d,strokeOpacity:p};if(t){y.lineWidth=t,a.setStrokeStyle(i,y,n,r,s),a.beginPath();const e=r+m+c;a.moveTo(n+g,e,o),a.lineTo(n+g+f,e,o),a.stroke()}if(e){y.lineWidth=e,a.setStrokeStyle(i,y,n,r,s),a.beginPath();const t=r+m+c/2;a.moveTo(n+g,t,o),a.lineTo(n+g+f,t,o),a.stroke()}}drawMultiUnderLine(t,e,i,n,r,o,s,a,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,fontSize:c=a.fontSize,fill:u=a.fill,opacity:d=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,f=K_(h,s),g=$_("alphabetic",c,c),m={lineWidth:0,stroke:u,opacity:d,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,r,a),l.beginPath();const e=r+g+c+y;l.moveTo(n+f,e,o),l.lineTo(n+f+s,e,o),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,r,a),l.beginPath();const t=r+g+c/2+y;l.moveTo(n+f,t,o),l.lineTo(n+f+s,t,o),l.stroke()}}};WT=DT([Vm(),zT(0,$m(Jm)),zT(0,Um(L_)),FT("design:paramtypes",[Object])],WT);var jT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let NT=class{};function GT(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let r=1;r<e.length;r++)t.lineTo(e[r].x+i,e[r].y+n)}function VT(t,e){return Math.sqrt(t*t+e*e)}function UT(t,e,i,n,r){const o=e/i;return{x:t.x-n*o,y:t.y-r*o}}NT=jT([Vm()],NT);var KT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},$T=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XT=function(t,e){return function(i,n){e(i,n,t)}};let YT=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=Ox}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:f,strokeOpacity:g=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:b=l.visible,x:v=l.x,y:w=l.y}=t.attribute,C=p_(y,p,c),x=g_(y,g),_=u_(c,f),S=d_(u,m);t.valid&&b&&(_||S)&&(C||x||s||a||f)&&(e.beginPath(),d<=0||qu(d)&&d.every((t=>0===t))?GT(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,r){var o;if(e.length<3)GT(t,e,i,n);else for(let s=0;s<e.length;s++){const a=e[s],l=e[(s+1)%e.length],h=e[(s+2)%e.length],c=l.x-a.x,u=l.y-a.y,d=l.x-h.x,p=l.y-h.y,f=(Math.atan2(u,c)-Math.atan2(p,d))/2,g=Math.abs(Math.tan(f));let m=Array.isArray(r)?null!==(o=r[(s+1)%e.length])&&void 0!==o?o:0:r,y=m/g;const b=VT(c,u),v=VT(d,p),w=Math.min(b,v);y>w&&(y=w,m=w*g);const C=UT(l,y,b,c,u),x=UT(l,y,v,d,p),_=2*l.x-C.x-x.x,S=2*l.y-C.y-x.y,A=VT(_,S),T=UT(l,VT(y,m),A,_,S);let B=Math.atan2(C.y-T.y,C.x-T.x);const M=Math.atan2(x.y-T.y,x.x-T.x);let R=M-B;R<0&&(B=M,R=-R),R>Math.PI&&(R-=Math.PI),0===s?t.moveTo(C.x+i,C.y+n):t.lineTo(C.x+i,C.y+n),R&&t.arcTo(l.x+i,l.y+n,x.x+i,x.y+n,m),t.lineTo(x.x+i,x.y+n)}}(e.camera?e:e.nativeContext,h,i,n,d),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,_,S,C,x,l,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(s?s(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,v-i,w-n,l),e.fill())),S&&(a?a(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,v-i,w-n,l),e.stroke())),this._polygonRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,_,S,C,x,l,r,s,a)})))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Gv(t,null==n?void 0:n.theme).polygon;let{x:s=o.x,y:a=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(o);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,r.transformFromMatrix(t.transMatrix,!0);y_(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};YT=KT([Vm(),XT(0,$m(Jm)),XT(0,Um(P_)),$T("design:paramtypes",[Object])],YT);var qT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ZT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JT=function(t,e){return function(i,n){e(i,n,t)}};const QT=["","repeat-x","repeat-y","repeat"];let tB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=Lx}drawShape(t,e,i,n,r,o,s){const a=Gv(t).image,{fill:l=a.fill,width:h=a.width,height:c=a.height,opacity:u=a.opacity,fillOpacity:d=a.fillOpacity,visible:p=a.visible,repeatX:f=a.repeatX,repeatY:g=a.repeatY,cornerRadius:m=a.cornerRadius,image:y}=t.attribute,b=p_(u,d,l),v=u_(l);if(t.valid&&p&&v&&(b||s)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,v,!1,b,!1,a,r,s)})),e.setShadowStyle&&e.setShadowStyle(t,a),v)if(s)s(e,t.attribute,a);else if(b){if(!y||!t.resources)return;const r=t.resources.get(y);if("success"!==r.state)return;let o=!1;0===m||qu(m)&&m.every((t=>0===t))||(e.beginPath(),MT(e,i,n,h,c,m),e.save(),e.clip(),o=!0),e.setCommonStyle(t,t.attribute,i,n,a);let s=0;if("repeat"===f&&(s|=1),"repeat"===g&&(s|=2),s){const t=e.createPattern(r.data,QT[s]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(r.data,i,n,h,c);o&&e.restore()}this._imageRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,v,!1,b,!1,a,r,s)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const r=Gv(t).image;let{x:o=r.x,y:s=r.y}=t.attribute;const{image:a}=t.attribute;if(a&&t.resources&&"success"===t.resources.get(a).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,o,s,i),n.highPerformanceRestore()}}};tB=qT([Vm(),JT(0,$m(Jm)),JT(0,Um(M_)),ZT("design:paramtypes",[Object])],tB);const eB=Symbol.for("IncrementalDrawContribution"),iB=Symbol.for("ArcRender"),nB=Symbol.for("Arc3dRender"),rB=Symbol.for("AreaRender"),oB=Symbol.for("CircleRender"),sB=Symbol.for("GraphicRender"),aB=Symbol.for("GroupRender"),lB=Symbol.for("LineRender"),hB=Symbol.for("PathRender"),cB=Symbol.for("PolygonRender"),uB=Symbol.for("RectRender"),dB=Symbol.for("Rect3DRender"),pB=Symbol.for("SymbolRender"),fB=Symbol.for("TextRender"),gB=Symbol.for("RichTextRender"),mB=Symbol.for("Pyramid3dRender"),yB=Symbol.for("GlyphRender"),bB=Symbol.for("ImageRender"),vB=Symbol.for("RenderSelector"),wB=Symbol.for("DrawContribution");function CB(t,e,i){let n=e;const{a:r,b:o,c:s,d:a}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+o*o),h=Math.sign(a)*Math.sqrt(s*s+a*a);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function xB(t,e,i,n,r){if(!e||!0===e)return"black";let o,s;if(qu(e))for(let t=0;t<e.length&&(s=e[t],!s);t++);else s=e;return"string"==typeof s?s:("linear"===s.gradient?o=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s,a,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,u=h.y2-h.y1,d=h.x1-n,p=h.y1-r;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,u/=e,d/=t,p/=e}const f=t.createLinearGradient(d+(null!==(o=e.x0)&&void 0!==o?o:0)*c,p+(null!==(s=e.y0)&&void 0!==s?s:0)*u,d+(null!==(a=e.x1)&&void 0!==a?a:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*u);return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,s,i,n,r):"conical"===s.gradient?o=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s;const a=i.AABBBounds;if(!a)return;let l=a.x2-a.x1,h=a.y2-a.y1,c=a.x1-n,u=a.y1-r;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,u/=e}const d=t.createConicGradient(c+(null!==(o=e.x)&&void 0!==o?o:0)*l,u+(null!==(s=e.y)&&void 0!==s?s:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d.GetPattern(l+c,h+u,void 0)}(t,s,i,n,r):"radial"===s.gradient&&(o=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s,a,l,h,c;const u=i.AABBBounds;if(!u)return;let d=u.x2-u.x1,p=u.y2-u.y1,f=u.x1-n,g=u.y1-r;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;f/=t,g/=e,d/=t,p/=e}const m=t.createRadialGradient(f+(null!==(o=e.x0)&&void 0!==o?o:.5)*d,g+(null!==(s=e.y0)&&void 0!==s?s:.5)*p,Math.max(d,p)*(null!==(a=e.r0)&&void 0!==a?a:0),f+(null!==(l=e.x1)&&void 0!==l?l:.5)*d,g+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(d,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,s,i,n,r)),o||"orange")}const _B=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Qb(Object.assign({nativeCanvas:Ib.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return Qb(Object.assign({nativeCanvas:Ib.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var SB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},AB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TB=function(t,e){return function(i,n){e(i,n,t)}};let BB=class{constructor(){this.time=Ry.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const r=t.resources.get(p);if("success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Gv(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}e.clip();const o=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(r.data,o.x1,o.y1,o.width(),o.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};BB=SB([Vm()],BB);let MB=class{constructor(t){this.subRenderContribitions=t,this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,r,o,s,a,l,h,c,u,d)}))}};MB=SB([Vm(),TB(0,$m(Jm)),TB(0,Um(k_)),AB("design:paramtypes",[Object])],MB);let RB=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const o=(t-2*e)/2,s=_B.allocate({width:t,height:t,dpr:1}),a=s.getContext("2d");if(!a)return null;a.clearRect(0,0,t,t),r(o,a);const l=n.createPattern(s.nativeCanvas,"repeat");return _B.free(s),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Wd),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const r=t/2,o=r;n.fillStyle=i,n.moveTo(r,o-e),n.lineTo(e+r,o),n.lineTo(r,o+e),n.lineTo(r-e,o),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,o=r;n.fillStyle=i,n.fillRect(r,o,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const o=e;r.fillStyle=i,r.fillRect(o,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const o=e;r.fillStyle=i,r.fillRect(0,o,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const r=t/2,o=-r;n.moveTo(r,o),n.lineTo(r+t,o+t),n.moveTo(-r,-o),n.lineTo(-r+t,-o+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const r=t/2,o=r;n.moveTo(t+r,o),n.lineTo(r,o+t),n.moveTo(t-r,-o),n.lineTo(-r,-o+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,o=r;n.fillStyle=i,n.fillRect(r,o,t,t),n.fillRect(r+t,o+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:g=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(g,m,f,e);break;case"diamond":y=this.createDiamondPattern(g,m,f,e);break;case"rect":y=this.createRectPattern(g,m,f,e);break;case"vertical-line":y=this.createVerticalLinePattern(g,m,f,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(g,m,f,e);break;case"bias-lr":y=this.createBiasLRLinePattern(g,m,f,e);break;case"bias-rl":y=this.createBiasRLLinePattern(g,m,f,e);break;case"grid":y=this.createGridPattern(g,m,f,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};RB=SB([Vm()],RB);var PB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let EB=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{innerRadius:m=l.innerRadius,outerRadius:y=l.outerRadius,startAngle:b=l.startAngle,endAngle:v=l.endAngle,opacity:w=l.opacity,x:C=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!d||!d.stroke),T=!(!p||!p.stroke);if(f){const{distance:r=l.outerBorder.distance}=d,o=CB(e,r,e.dpr),s=r/y;if(t.setAttributes({outerRadius:y+o,innerRadius:m-o,startAngle:b-s,endAngle:v+s}),e.beginPath(),w_(t,e,i,n,y+o,m-o),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,d,l.outerBorder);else if(A){const r=l.outerBorder.opacity;l.outerBorder.opacity=w,e.setStrokeStyle(t,d,(C-i)/_,(x-n)/S,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(g){const{distance:r=l.innerBorder.distance}=p,o=CB(e,r,e.dpr),s=r/y;if(t.setAttributes({outerRadius:y-o,innerRadius:m+o,startAngle:b+s,endAngle:v-s}),e.beginPath(),w_(t,e,i,n,y-o,m+o),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(T){const r=l.innerBorder.opacity;l.innerBorder.opacity=w,e.setStrokeStyle(t,p,(C-i)/_,(x-n)/S,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}t.setAttributes({outerRadius:y,innerRadius:m,startAngle:b,endAngle:v})}};EB=PB([Vm()],EB);let HB=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};HB=PB([Vm()],HB);let LB=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}};LB=PB([Vm()],LB);var kB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let IB=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{radius:m=l.radius,startAngle:y=l.startAngle,endAngle:b=l.endAngle,opacity:v=l.opacity,x:w=l.x,y:C=l.y,scaleX:x=l.scaleX,scaleY:_=l.scaleY}=t.attribute,S=!(!d||!d.stroke),A=!(!p||!p.stroke);if(f){const{distance:r=l.outerBorder.distance}=d,o=CB(e,r,e.dpr);if(e.beginPath(),e.arc(i,n,m+o,y,b),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,d,l.outerBorder);else if(S){const r=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,d,(w-i)/x,(C-n)/_,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(g){const{distance:r=l.innerBorder.distance}=p,o=CB(e,r,e.dpr);if(e.beginPath(),e.arc(i,n,m-o,y,b),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(A){const r=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(w-i)/x,(C-n)/_,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}};IB=kB([Vm()],IB);let OB=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};OB=kB([Vm()],OB);let DB=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}};DB=kB([Vm()],DB);var FB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let zB=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{background:d}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}};zB=FB([Vm()],zB);var WB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let jB=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{background:d,width:p,height:f}=t.attribute;if(d)if(t.backgroundImg){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Gv(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(Ku(d)){const{stroke:i,fill:n,lineWidth:r=1,cornerRadius:o=0,expandX:s=0,expandY:a=0}=d;if(!i&&!n)return;e.beginPath();const{x:l,y:h,width:c,height:u}=function(t){const e=Cw(t.attribute.boundsPadding),i=t.AABBBounds;let n=i.x1,r=i.y1,o=i.width(),s=i.height();return Qu(e)?(n+=e,r+=e,o-=2*e,s-=2*e):(n+=e[3],r+=e[0],o-=e[1]+e[3],s-=e[0]+e[2]),{x:n,y:r,width:o,height:s}}(t);o?MT(e,l-s,h-a,c+2*s,u+2*a,o):e.rect(l-s,h-a,c+2*s,u+2*a),e.globalAlpha=1,n&&(e.fillStyle=n,e.fill()),i&&r>0&&(e.lineWidth=r,e.strokeStyle=i,e.stroke())}else{e.beginPath();const r=t.AABBBounds;e.rect(i,n,r.width(),r.height()),e.fillStyle=d,e.globalAlpha=1,e.fill()}}};jB=WB([Vm()],jB);var NB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let GB=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{width:m=l.width,height:y=l.height,cornerRadius:b=l.cornerRadius,opacity:v=l.opacity,x:w=l.x,y:C=l.y,scaleX:x=l.scaleX,scaleY:_=l.scaleY}=t.attribute,S=!(!d||!d.stroke),A=!(!p||!p.stroke);if(f){const{distance:r=l.outerBorder.distance}=d,o=CB(e,r,e.dpr),s=i-o,a=n-o,h=2*o;if(0===b||qu(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(s,a,m+h,y+h)):(e.beginPath(),MT(e,s,a,m+h,y+h,b)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,d,l.outerBorder);else if(S){const r=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,d,(w-i)/x,(C-n)/_,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(g){const{distance:r=l.innerBorder.distance}=p,o=CB(e,r,e.dpr),s=i+o,a=n+o,h=2*o;if(0===b||qu(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(s,a,m-h,y-h)):(e.beginPath(),MT(e,s,a,m-h,y-h,b)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,p,l.innerBorder);else if(A){const r=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(w-i)/x,(C-n)/_,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}};GB=NB([Vm()],GB);let VB=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};VB=NB([Vm()],VB);let UB=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}};UB=NB([Vm()],UB);let KB=class{constructor(){this.time=Ry.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};KB=NB([Vm()],KB);let $B=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{width:d=l.width,height:p=l.height,stroke:f=l.stroke}=t.attribute;if(Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),f[0]?e.lineTo(i+d,n):e.moveTo(i+d,n),f[1]?e.lineTo(i+d,n+p):e.moveTo(i+d,n+p),f[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),f[3]){const t=f[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};$B=NB([Vm()],$B);var XB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let YB=class{constructor(){this.time=Ry.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,m=f&&!1!==f.visible;if(!g&&!m)return;const{size:y=l.size,opacity:b=l.opacity,x:v=l.x,y:w=l.y,scaleX:C=l.scaleX,scaleY:x=l.scaleY}=t.attribute,_=!(!p||!p.stroke),S=!(!f||!f.stroke);if(g){const{distance:r=l.outerBorder.distance}=p,o=CB(e,r,e.dpr);if(e.beginPath(),!1===d.drawOffset(e,y,i,n,o)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,p,l.outerBorder);else if(_){const r=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,p,(v-i)/C,(w-n)/x,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(m){const{distance:r=l.innerBorder.distance}=f,o=CB(e,r,e.dpr);if(e.beginPath(),!1===d.drawOffset(e,y,i,n,-o)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,f,l.innerBorder);else if(S){const r=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,f,(v-i)/C,(w-n)/x,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}};YB=XB([Vm()],YB);class qB extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}}class ZB extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}}var JB=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},QB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tM=function(t,e){return function(i,n){e(i,n,t)}};const eM=Symbol.for("RenderService");let iM=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};iM=JB([Vm(),tM(0,$m(wB)),QB("design:paramtypes",[Object])],iM);var nM=new zm((t=>{t(iM).toSelf(),t(eM).toService(iM)})),rM=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function oM(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o={},s=[];let a=!1;if(r)a=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:r=e}=t.attribute;if(0===n)i=r;else if(i!==r)return a=!0,!0;return!1}),n)}if(a){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;o[i]?o[i].push(t):(o[i]=[t],s.push(i))}),n),s.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;t<s.length&&!a;t++){const e=s[t],l=o[e];r&&l.sort(((t,e)=>{var i,r;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(r=t.attribute.z)&&void 0!==r?r:0))}));for(let t=0;t<l.length;t++)if(i(l[t],t)){a=!0;break}}}else t.forEachChildren(i,n)}function sM(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return rM(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function aM(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r={},o=[];let s=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let a=null,l=!1;if(s){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;r[e]?r[e].push(t):(r[e]=[t],o.push(e))}),n),o.sort(((t,e)=>n?e-t:t-e));let s=!1;for(let t=0;t<o.length&&!s;t++){const i=o[t],n=r[i];for(let t=0;t<n.length;t++){if(l){s=!0,a=n[t];break}n[t]._uid!==e||(l=!0)}}}else t.forEachChildren((t=>l?(a=t,!0):(t._uid===e&&(l=!0),!1)),n);return a}var lM=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const hM=Symbol.for("PickItemInterceptor");let cM=class{constructor(){this.order=1}beforePickItem(t,e,i,n,r){if(!t.in3dMode||n.in3dInterceptor)return null;const o=e.pickContext,s=t.stage;if(!o||!s)return null;if(n.in3dInterceptor=!0,o.save(),this.initCanvasCtx(o),o.camera=s.camera,t.isContainer){let s,a=!1,l=!1;if(t.forEachChildren((t=>(a=t.numberType===Mx,!a))),t.forEachChildren((t=>(l=!!t.findFace,!l))),a){const o=t.getChildren(),a=[...o];a.sort(((t,e)=>{var i,n,r,o;let s=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,a=(null!==(o=null!==(r=e.attribute.startAngle)&&void 0!==r?r:0+e.attribute.endAngle)&&void 0!==o?o:0)/2;for(;s<0;)s+=Wd;for(;a<0;)a+=Wd;return a-s})),a.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),a.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",s=e.pickGroup(t,i,r.parentMatrix,n),s.graphic||(n.hack_pieFace="inside",s=e.pickGroup(t,i,r.parentMatrix,n)),s.graphic||(n.hack_pieFace="top",s=e.pickGroup(t,i,r.parentMatrix,n)),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),o.forEach((e=>{t.appendChild(e)}))}else if(l){const a=t.getChildren(),l=a.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return o.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),s=e.pickGroup(t,i,r.parentMatrix,n),t.removeAllChild(),a.forEach((t=>{t._next=null,t._prev=null})),t.update(),a.forEach((e=>{t.add(e)}))}else s=e.pickGroup(t,i,r.parentMatrix,n);return o.camera=null,n.in3dInterceptor=!1,s}return o.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};cM=lM([Vm()],cM);var uM=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},dM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pM=function(t,e){return function(i,n){e(i,n,t)}};const fM=Symbol.for("PickerService");let gM=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let r=0,o=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;r=i.bounds.x1,o=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const s=new op(1,0,0,1,r,o);let a;for(let r=t.length-1;r>=0&&(t[r].isContainer?n=this.pickGroup(t[r],e,s,i):n.graphic=this.pickItem(t[r],e,i),!n.graphic);r--)a||(a=n.group);return n.graphic||(n.group=a),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const o=n.pickContext,s=o.modelMatrix;if(o.camera){const e=t.transMatrix,i=WA.allocate();if(UA(i,e),s){if(i){const t=WA.allocate();o.modelMatrix=KA(t,s,i),WA.free(i)}}else UA(i,t.globalTransMatrix),o.modelMatrix=i}if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const a=this.InterceptorContributions[r];if(a.beforePickItem){const r=a.beforePickItem(t,this,e,n,{parentMatrix:i});if(r)return o.modelMatrix!==s&&WA.free(o.modelMatrix),o.modelMatrix=s,r}}const a=t.transMatrix,l=zA.allocateByObj(i),h=new Jd(e.x,e.y);l.transformPoint(h,h);const c=t.AABBBounds.containsPoint(h);if(!c&&!t.stage.camera)return r;const u=!1!==t.attribute.pickable&&c;return l.multiply(a.a,a.b,a.c,a.d,a.e,a.f),!1!==t.attribute.childrenPickable&&oM(t,vb.zIndex,(i=>{if(i.isContainer){const o=new Jd(e.x,e.y),s=Gv(t).group,{scrollX:a=s.scrollX,scrollY:h=s.scrollY}=t.attribute;o.x-=a,o.y-=h,r=this.pickGroup(i,o,l,n)}else{const o=new Jd(e.x,e.y);l.transformPoint(o,o);const s=Gv(t).group,{scrollX:a=s.scrollX,scrollY:h=s.scrollY}=t.attribute;o.x-=a,o.y-=h;const c=this.pickItem(i,o,n);r.graphic=c}return!!r.graphic||!!r.group}),!0,!!o.camera),o.modelMatrix!==s&&WA.free(o.modelMatrix),o.modelMatrix=s,r.graphic||r.group||!u||t.stage.camera||(r.group=t),zA.free(l),r}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};gM=uM([Vm(),pM(0,$m(ry)),pM(1,$m(Jm)),pM(1,Um(hM)),dM("design:paramtypes",[Object,Object])],gM);var mM=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},yM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bM=function(t,e){return function(i,n){e(i,n,t)}};const vM=Symbol.for("GlobalPickerService");let wM=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const r=new op(1,0,0,1,0,0);let o;for(let s=0;s<t.length&&(t[s].isContainer?n=this.pickGroup(t[s],e,r,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s++)o||(o=n.group);return n.graphic||(n.group=o),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const o=t.transMatrix,s=new Jd(e.x,e.y);i.transformPoint(s,s);const a=t.AABBBounds.containsPoint(s);if(!a)return r;const l=!1!==t.attribute.pickable&&a;return i.multiply(o.a,o.b,o.c,o.d,o.e,o.f),!1!==t.attribute.childrenPickable&&t.forEachChildren((t=>{if(t.isContainer)r=this.pickGroup(t,e,i,n);else{const o=new Jd(e.x,e.y);i.transformPoint(o,o),r.graphic=this.pickItem(t,o,n)}return!!r.graphic||!!r.group})),r.graphic||r.group||!l||(r.group=t),r}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function CM(t,e,i){const n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],y=e[14],b=e[15];let v=i[0],w=i[1],C=i[2],x=i[3];return t[0]=v*n+w*a+C*u+x*g,t[1]=v*r+w*l+C*d+x*m,t[2]=v*o+w*h+C*p+x*y,t[3]=v*s+w*c+C*f+x*b,v=i[4],w=i[5],C=i[6],x=i[7],t[4]=v*n+w*a+C*u+x*g,t[5]=v*r+w*l+C*d+x*m,t[6]=v*o+w*h+C*p+x*y,t[7]=v*s+w*c+C*f+x*b,v=i[8],w=i[9],C=i[10],x=i[11],t[8]=v*n+w*a+C*u+x*g,t[9]=v*r+w*l+C*d+x*m,t[10]=v*o+w*h+C*p+x*y,t[11]=v*s+w*c+C*f+x*b,v=i[12],w=i[13],C=i[14],x=i[15],t[12]=v*n+w*a+C*u+x*g,t[13]=v*r+w*l+C*d+x*m,t[14]=v*o+w*h+C*p+x*y,t[15]=v*s+w*c+C*f+x*b,t}function xM(t,e,i){const n=e[0],r=e[1],o=e[2];let s=i[3]*n+i[7]*r+i[11]*o+i[15];return s=s||1,t[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/s,t[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/s,t[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/s,t}wM=mM([Vm(),bM(0,$m(ry)),yM("design:paramtypes",[Object])],wM);class _M{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=WA.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=WA.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let r,o,s,a,l,h,c,u,d,p;const f=e[0],g=e[1],m=e[2],y=n[0],b=n[1],v=n[2],w=i[0],C=i[1],x=i[2];Math.abs(f-w)<Od&&Math.abs(g-C)<Od&&Math.abs(m-x)<Od?FA.identity(t):(c=f-w,u=g-C,d=m-x,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,r=b*d-v*u,o=v*c-y*d,s=y*u-b*c,p=Math.hypot(r,o,s),p?(p=1/p,r*=p,o*=p,s*=p):(r=0,o=0,s=0),a=u*s-d*o,l=d*r-c*s,h=c*o-u*r,p=Math.hypot(a,l,h),p?(p=1/p,a*=p,l*=p,h*=p):(a=0,l=0,h=0),t[0]=r,t[1]=a,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=u,t[7]=0,t[8]=s,t[9]=h,t[10]=d,t[11]=0,t[12]=-(r*f+o*g+s*m),t[13]=-(a*f+l*g+h*m),t[14]=-(c*f+u*g+d*m),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=WA.allocate()),this._vp=CM(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=WA.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=WA.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return function(t,e,i,n,r,o,s){const a=1/(e-i),l=1/(n-r),h=1/(o-s);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*a,t[13]=(r+n)*l,t[14]=(s+o)*h,t[15]=1}(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=WA.allocate()),this._vp=CM(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return xM(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;xM(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const o=this.getProjectionScale(i);return{x:t*o+r[0],y:e*o+r[1]}}}var SM=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TM=[0,0,0],BM=new op(1,0,0,1,0,0);let MM=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pb),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},gb),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},mb),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new op(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new op(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new op(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zA.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(zA.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(zA.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(a*t,a*e,a*i,a*n,a*r,a*o),s&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,o),s&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,r,o,s){if(s=s||0,this.camera){const a=[];((t,e,i,n,r,o,s,a)=>{if(a)for(;i>e;)i-=Wd;else for(;i<e;)i+=Wd;const l=Dd/3*(i>e?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),a=4*Math.tan(e/4)/3,u=c<h?-1:1,d=Math.cos(h),p=Math.sin(h),f=Math.cos(c),g=Math.sin(c),m=d*o+n,y=p*s+r,b=f*o+n,v=g*s+r,w=o*a*u,C=s*a*u;t.push([m-w*p,y+C*d,b+w*g,v-C*f,b,v]),h=c}})(a,n,r,t,e,i,i,o);for(let t=0;t<a.length;++t){const e=a[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],s)}}else this.nativeContext.arc(t,e,i,n,r,o)}arcTo(t,e,i,n,r){this.nativeContext.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,o,s){if(s=s||0,this.camera){let a=s,l=s;this.modelMatrix&&(xM(TM,[t,e,s],this.modelMatrix),t=TM[0],e=TM[1],a=TM[2],xM(TM,[i,n,s],this.modelMatrix),i=TM[0],n=TM[1],l=TM[2],xM(TM,[r,o,s],this.modelMatrix),r=TM[0],o=TM[1],s=TM[2]);let h=this.camera.vp(r,o,s);r=h.x,o=h.y,h=this.camera.vp(t,e,a),t=h.x,e=h.y,h=this.camera.vp(i,n,l),i=h.x,n=h.y}this.nativeContext.bezierCurveTo(t,e,i,n,r,o)}closePath(){this.nativeContext.closePath()}ellipse(t,e,i,n,r,o,s,a){null==a?this.nativeContext.ellipse(t,e,i,n,r,o,s):this.nativeContext.ellipse(t,e,i,n,r,o,s,a)}lineTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(xM(TM,[t,e,i],this.modelMatrix),t=TM[0],e=TM[1],i=TM[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.lineTo(t,e)}moveTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(xM(TM,[t,e,i],this.modelMatrix),t=TM[0],e=TM[1],i=TM[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.moveTo(t,e)}quadraticCurveTo(t,e,i,n,r){if(r=r||0,this.camera){let o=r;this.modelMatrix&&(xM(TM,[t,e,r],this.modelMatrix),t=TM[0],e=TM[1],o=TM[2],xM(TM,[i,n,r],this.modelMatrix),i=TM[0],n=TM[1],r=TM[2]);let s=this.camera.vp(i,n,r);i=s.x,n=s.y,s=this.camera.vp(t,e,o),t=s.x,e=s.y}this.nativeContext.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n,r){r=r||0,this.camera?(this.moveTo(t,e,r),this.lineTo(t+i,e,r),this.lineTo(t+i,e+n,r),this.lineTo(t,e+n,r),this.closePath()):this.nativeContext.rect(t,e,i,n)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,i,n){return this.nativeContext.createLinearGradient(t,e,i,n)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,i,n,r,o){return this.nativeContext.createRadialGradient(t,e,i,n,r,o)}createConicGradient(t,e,i,n){let r,o=!1;const s=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),o=!0},GetPattern(a,l,h){return o&&(h||(h=n-i),r=function(t,e,i,n,r,o,s,a,l){const h=Math.floor(180*r/Math.PI),c=C_.GetCanvas(),u=C_.GetCtx();if(!u)return null;const d=__.GetSize(a),p=__.GetSize(l);let f=__.Get(e,i,n,o,s,d,p);if(f)return f;const g=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),m=h+1,y=r/Math.max(1,m-1),b=x_.GetOrCreate(e,m),v=2*Math.PI*g/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(o);for(let t=0,e=m-1;t<e&&!(o+t*y>s);t++){const e=b.getColor(t);u.beginPath(),u.rotate(y),u.moveTo(0,0),u.lineTo(g,-2*v),u.lineTo(g,0),u.fillStyle=e,u.closePath(),u.fill()}const w=u.getImageData(0,0,d,p);return c.width=w.width,c.height=w.height,u.putImageData(w,0,0),f=t.createPattern(c,"no-repeat"),f&&__.Set(e,i,n,o,s,f,d,p),f}(s,this.stops,t,e,h,i,n,a,l),o=!1),r}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(xM(TM,[t,e,i],this.modelMatrix),t=TM[0],e=TM[1],i=TM[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(xM(TM,[t,e,i],this.modelMatrix),t=TM[0],e=TM[1],i=TM[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(xM(TM,[e,i,n],this.modelMatrix),e=TM[0],i=TM[1],n=TM[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ib.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Ib.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:mb.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:mb.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(xM(TM,[e,i,n],this.modelMatrix),e=TM[0],i=TM[1],n=TM[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setCommonStyle(t,e,i,n,r[0]);const o={};return r.forEach((t=>{Object.assign(o,t)})),this._setCommonStyle(t,e,i,n,o)}return this._setCommonStyle(t,e,i,n,r)}_setCommonStyle(t,e,i,n,r){const o=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:s=r.fillOpacity,opacity:a=r.opacity,fill:l=r.fill}=e;s>1e-12&&a>1e-12?(o.globalAlpha=s*a,o.fillStyle=xB(this,l,t,i,n)):o.globalAlpha=s*a}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:r=i.opacity,shadowBlur:o=i.shadowBlur,shadowColor:s=i.shadowColor,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;r<=1e-12||(o||a||l?(n.shadowBlur=o,n.shadowColor=s,n.shadowOffsetX=a,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setStrokeStyle(t,e,i,n,r[0]);const o={};return r.forEach((t=>{Object.assign(o,t)})),this._setStrokeStyle(t,e,i,n,o)}return this._setStrokeStyle(t,e,i,n,r)}_setStrokeStyle(t,e,i,n,r){const o=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:s=r.strokeOpacity,opacity:a=r.opacity}=e;if(s>1e-12&&a>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit}=e;o.globalAlpha=s*a,o.lineWidth=CB(this,l,this.dpr),o.strokeStyle=xB(this,h,t,i,n),o.lineJoin=c,o.setLineDash(u),o.lineCap=d,o.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:r=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=U_(t,e,r&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:o=e.fontFamily,fontSize:s=e.fontSize}=t;this.fontFamily=o,this.fontSize=s,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,r;const o=this.nativeContext;e||(e=this.textAttributes),t.font?o.font=t.font:o.font=U_(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=s,this.fontSize=a,o.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,o.textBaseline=null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(BM,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zA.free(t))),this.stack.length=0}};MM.env="browser",MM=SM([Vm(),AM("design:paramtypes",[Object,Number])],MM);var RM=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},PM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const EM={WIDTH:500,HEIGHT:500,DPR:1};let HM=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=EM.WIDTH,height:n=EM.HEIGHT,dpr:r=EM.DPR,container:o,x:s,y:a,canvasControled:l=!0}=t;if(this._x=null!=s?s:0,this._y=null!=a?a:0,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof o){const t=Ib.global.getElementById(o);t&&(this._container=t)}else this._container=o;this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._context=new MM(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:r=this._x,y:o=this._y}=t,{nativeCanvas:s}=this;s.width=e*n,s.height=i*n,!s.style||this.setCanvasStyle(s,r,o,e,i),t.id&&(s.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,r){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${r}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};HM.env="browser",HM=RM([Vm(),PM("design:paramtypes",[Object])],HM);const LM=Symbol.for("CanvasArcPicker"),kM=Symbol.for("CanvasArc3dPicker"),IM=Symbol.for("CanvasAreaPicker"),OM=Symbol.for("CanvasCirclePicker"),DM=Symbol.for("CanvasImagePicker"),FM=Symbol.for("CanvasLinePicker"),zM=Symbol.for("CanvasPathPicker"),WM=Symbol.for("CanvasRectPicker"),jM=Symbol.for("CanvasRect3dPicker"),NM=Symbol.for("CanvasSymbolPicker"),GM=Symbol.for("CanvasTextPicker"),VM=Symbol.for("CanvasPolygonPicker"),UM=Symbol.for("CanvasPyramid3dPicker"),KM=Symbol.for("CanvasRichTextPicker"),$M=Symbol.for("CanvasGlyphPicker"),XM=Symbol.for("CanvasPickerContribution"),YM=Symbol.for("MathArcPicker"),qM=Symbol.for("MathAreaPicker"),ZM=Symbol.for("MathCirclePicker"),JM=Symbol.for("MathLinePicker"),QM=Symbol.for("MathPathPicker"),tR=Symbol.for("MathRectPicker"),eR=Symbol.for("MathSymbolPicker"),iR=Symbol.for("MathTextPicker"),nR=Symbol.for("MathPolygonPicker"),rR=Symbol.for("MathGlyphPicker"),oR=Symbol.for("MathPickerContribution");var sR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},aR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lR=function(t,e){return function(i,n){e(i,n,t)}};let hR=class extends gM{constructor(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f){super(p,f),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=r,this.imagePicker=o,this.linePicker=s,this.pathPicker=a,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=u,this.drawContribution=d,this.global=p,this.pickItemInterceptorContributions=f,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new HM(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const r=this.InterceptorContributions[n];if(r.beforePickItem&&r.beforePickItem(t,this,e,i))return t}const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};sR([Zm(),aR("design:type",Function),aR("design:paramtypes",[]),aR("design:returntype",void 0)],hR.prototype,"init",null),hR=sR([Vm(),lR(0,$m(Jm)),lR(0,Um(XM)),lR(1,$m(OM)),lR(2,$m(WM)),lR(3,$m(LM)),lR(4,$m(IM)),lR(5,$m(DM)),lR(6,$m(FM)),lR(7,$m(zM)),lR(8,$m(NM)),lR(9,$m(GM)),lR(10,$m(VM)),lR(11,$m(KM)),lR(12,$m(wB)),lR(13,$m(ry)),lR(14,$m(Jm)),lR(14,Um(hM)),aR("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object])],hR);var cR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},uR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dR=new op(1,0,0,1,0,0),pR={x:0,y:0};let fR=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new op(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new op(1,0,0,1,0,0),this.path=new hb}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zA.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(zA.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(zA.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(a*t,a*e,a*i,a*n,a*r,a*o),s&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,o),s&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,r,o){this.path.arc(t,e,i,n,r,o)}arcTo(t,e,i,n,r){this.path.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,o){this.path.bezierCurveTo(t,e,i,n,r,o)}closePath(){this.path.closePath()}ellipse(t,e,i,n,r,o,s,a){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,r,o){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},pR),function(t,e,i){return Mv(t,0,!1,e,i)}(this.path.commandList,pR.x,pR.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},pR);const i=CB(this,this.lineWidth,this.dpr);return function(t,e,i,n){return Mv(t,e,!0,i,n)}(this.path.commandList,i,pR.x,pR.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,r){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,r){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(dR,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zA.free(t))),this.stack.length=0}};fR=cR([Vm(),uR("design:paramtypes",[Object,Number])],fR);var gR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},mR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yR=function(t,e){return function(i,n){e(i,n,t)}};let bR=class extends gM{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new fR(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};gR([Zm(),mR("design:type",Function),mR("design:paramtypes",[]),mR("design:returntype",void 0)],bR.prototype,"init",null),bR=gR([Vm(),yR(0,$m(Jm)),yR(0,Um(oR)),yR(1,$m(ry)),yR(2,$m(Jm)),yR(2,Um(hM)),mR("design:paramtypes",[Object,Object,Object])],bR);var vR=new zm((t=>{t(hR).toSelf().inSingletonScope(),t(bR).toSelf().inSingletonScope(),t(fM).toService(hR),t(wM).toSelf().inSingletonScope(),t(vM).toService(wM),t(cM).toSelf().inSingletonScope(),t(hM).toService(cM),ty(t,hM)})),wR=new zm((t=>{t(XA).toSelf().inSingletonScope(),t(Gx).toService(XA),t(AA).toSelf().inSingletonScope(),t(SA).toService(AA),ty(t,SA),t(MA).toSelf().inSingletonScope(),t(BA).toService(MA),ty(t,BA),t(EA).toSelf().inSingletonScope(),t(PA).toService(EA),ty(t,PA),t(kA).toSelf().inSingletonScope(),t(LA).toService(kA),ty(t,LA),t(DA).toSelf().inSingletonScope(),t(OA).toService(DA),ty(t,OA),t(Vx).toConstantValue(sT)}));const CR=Symbol.for("AutoEnablePlugins"),xR=Symbol.for("PluginService");var _R=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},SR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AR=function(t,e){return function(i,n){e(i,n,t)}};let TR=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&qb.isBound(CR)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};TR=_R([Vm(),AR(0,$m(Jm)),AR(0,Um(CR)),SR("design:paramtypes",[Object])],TR);var BR=new zm((t=>{t(TR).toSelf(),t(xR).toService(TR),function(t,e){t(Jm).toDynamicValue((t=>{let{container:i}=t;return new Qm(e,i)})).whenTargetNamed(e)}(t,CR)})),MR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let RR=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ip}removeDom(t){return!1}createDom(t){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};RR=MR([Vm()],RR);var PR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ER=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class HR{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function LR(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let kR=class extends RR{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:r}=t,o=e.getBoundingClientRect(),s=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let a,l;return s&&(a=o.width/s.offsetWidth,l=o.height/s.offsetHeight),{x:(n-o.left)/(td(a)?a:1),y:(r-o.top)/(td(l)?a:1)}}return{x:t.offsetX,y:t.offsetY}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/xml").firstChild),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new HR(t)}return new ip}removeDom(t){return t.parentElement.removeChild(t),!0}createDom(t){const{tagName:e="div",width:i,height:n,style:r,parent:o}=t,s=document.createElement(e);if(r&&(Yu(r)?s.setAttribute("style",r):Object.keys(r).forEach((t=>{s.setAttribute(t,r[t])}))),null!=i&&(s.style.width=`${i}px`),null!=n&&(s.style.height=`${n}px`),o){const t=Yu(o)?this.getElementById(o):o;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return LR(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return LR(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:Vv.GenAutoIncrementId().toString());const r=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*r,n.height=t.height*r),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{top:i,left:n}}};function IR(){qb.rebind(fM).toService(bR)}kR=PR([Vm(),ER("design:paramtypes",[])],kR);var OR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},DR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let FR=class extends RR{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r){const o=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,s)=>{const a=tt.createCanvasContext(e);a.canvas={width:t.width*o,height:t.height*o};const l={width:t.width*o,height:t.height*o,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>a,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),s>=n&&r.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),IR())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Rw.call(t)}}getCancelAnimationFrame(){return t=>{Rw.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};FR=OR([Vm(),DR("design:paramtypes",[])],FR);var zR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},WR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jR=class extends RR{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,r,o,s,a,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,r=this.canvasMap,o=e.freeCanvasIdx,s=this.freeCanvasList,a=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=a.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&a.canvasGetImageData&&(n.getImageData=(e,i,n,r)=>new Promise(((o,s)=>{try{a.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:r,success(t){o(t)}})}catch(t){s(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return r.set(t,h),e>=o&&s.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,qb.rebind(fM).toService(bR))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:r,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};jR=zR([Vm(),WR("design:paramtypes",[])],jR);var NR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},GR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VR=!1;try{VR=!!lynx.createCanvasNG}catch(t){}let UR=class extends RR{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r){const o=SystemInfo.pixelRatio;e.forEach(((e,s)=>{const a=VR?lynx.createCanvasNG(e):lynx.createCanvas(e);a.width=t.width*o,a.height=t.height*o,VR&&a.attachToCanvasView(e);const l=a.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*o,height:t.height*o,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),s>=n&&r.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),IR())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return Rw.call(t)}}getCancelAnimationFrame(){return t=>{Rw.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};UR=NR([Vm(),GR("design:paramtypes",[])],UR);var KR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let $R=class extends RR{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Rw.call(t)}}getCancelAnimationFrame(){return t=>{Rw.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};$R=KR([Vm()],$R);var XR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},YR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qR=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};let ZR=class extends RR{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,r,o){return qR(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let s=0;s<e.length;s++){const a=e[s];yield new Promise((e=>{let l=wx.createSelectorQuery();o&&(l=l.in(o)),l.select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{if(!o[0])return;const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),s>=n&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{IR()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Rw.call(t)}}getCancelAnimationFrame(){return t=>{Rw.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};ZR=XR([Vm(),YR("design:paramtypes",[])],ZR);var JR=new zm((t=>{t(kR).toSelf().inSingletonScope(),t(ny).toService(kR),t(FR).toSelf().inSingletonScope(),t(ny).toService(FR),t(jR).toSelf().inSingletonScope(),t(ny).toService(jR),t(UR).toSelf().inSingletonScope(),t(ny).toService(UR),t(ZR).toSelf().inSingletonScope(),t(ny).toService(ZR),t($R).toSelf().inSingletonScope(),t(ny).toService($R),ty(t,ny)})),QR=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},tP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eP=class{constructor(){this._uid=Vv.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}};eP=QR([Vm(),tP("design:paramtypes",[])],eP);var iP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},nP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rP=function(t,e){return function(i,n){e(i,n,t)}};let oP=class extends eP{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser",this._canvasIsIntersecting=!0}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Vv.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new HM(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,r=t.height}let o=t.dpr;!1===t.canvasControled&&(o&&console.warn("canvasControled为false后,dpr参数将无效"),o=null),null==o&&(o=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new HM({width:n,height:r,dpr:o,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};oP.env="browser",oP=iP([Vm(),rP(0,$m(ry)),nP("design:paramtypes",[Object])],oP);var sP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let aP=class extends MM{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((r,o)=>{var s;try{tt.canvasGetImageData({canvasId:null!==(s=this.canvas.nativeCanvas.id)&&void 0!==s?s:this.canvas.id,x:t,y:e,width:i,height:n,success(t){r(t)}})}catch(t){o(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};aP.env="feishu",aP=sP([Vm()],aP);var lP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},hP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cP={WIDTH:500,HEIGHT:500,DPR:1};let uP=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=cP.WIDTH,height:n=cP.HEIGHT,dpr:r=cP.DPR}=t,{x:o,y:s}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=o,this._y=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._context=new aP(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};uP.env="feishu",uP=lP([Vm(),hP("design:paramtypes",[Object])],uP);var dP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},pP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fP=function(t,e){return function(i,n){e(i,n,t)}};let gP=class extends eP{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Vv.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new uP(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new uP({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};gP.env="feishu",gP=dP([Vm(),fP(0,$m(ry)),pP("design:paramtypes",[Object])],gP);var mP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let yP=class extends MM{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,r){const o=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:s=r.fillOpacity,opacity:a=r.opacity,fill:l=r.fill}=e;s>1e-12&&a>1e-12&&(o.setGlobalAlpha(s*a),o.setFillStyle(xB(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,r){const o=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:s=r.strokeOpacity,opacity:a=r.opacity}=e;if(s>1e-12&&a>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit}=e;o.setGlobalAlpha(s*a),o.setLineWidth(CB(this,l,this.dpr)),o.setStrokeStyle(xB(this,h,t,i,n)),o.setLineJoin(c),o.setLineDash(u),o.setLineCap(d),o.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=U_(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=U_(t,e),r.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),r.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};yP.env="taro",yP=mP([Vm()],yP);var bP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},vP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const wP={WIDTH:500,HEIGHT:500,DPR:1};let CP=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=wP.WIDTH,height:n=wP.HEIGHT,dpr:r=wP.DPR}=t,{x:o,y:s}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=o,this._y=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._context=new yP(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};CP.env="taro",CP=bP([Vm(),vP("design:paramtypes",[Object])],CP);var xP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},_P=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SP=function(t,e){return function(i,n){e(i,n,t)}};let AP=class extends eP{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Vv.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CP(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new CP({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};AP.env="taro",AP=xP([Vm(),SP(0,$m(ry)),_P("design:paramtypes",[Object])],AP);var TP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let BP=class extends MM{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,r){const o=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:s=r.strokeOpacity,opacity:a=r.opacity}=e;if(s>1e-12&&a>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit}=e;o.globalAlpha=s*a,o.lineWidth=CB(this,l,this.dpr),o.strokeStyle=xB(this,h,t,i,n),o.lineJoin=c,0===u[0]&&0===u[1]||o.setLineDash(u),o.lineCap=d,o.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};BP.env="lynx",BP=TP([Vm()],BP);var MP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const PP={WIDTH:500,HEIGHT:500,DPR:1};let EP=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=PP.WIDTH,height:n=PP.HEIGHT,dpr:r=PP.DPR}=t,{x:o,y:s}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=o,this._y=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._context=new BP(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EP.env="lynx",EP=MP([Vm(),RP("design:paramtypes",[Object])],EP);var HP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},LP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kP=function(t,e){return function(i,n){e(i,n,t)}};let IP=class extends eP{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Vv.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new EP(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new EP({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IP.env="lynx",IP=HP([Vm(),kP(0,$m(ry)),LP("design:paramtypes",[Object])],IP);var OP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},DP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let FP=class extends MM{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new op(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};FP.env="node",FP=OP([Vm(),DP("design:paramtypes",[Object,Number])],FP);var zP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},WP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jP={WIDTH:500,HEIGHT:500,DPR:1};let NP=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jP.WIDTH,height:n=jP.HEIGHT,canvasControled:r=!0,dpr:o=jP.DPR}=t;this._visiable=!1!==t.visiable,this.controled=r,this._pixelWidth=i*o,this._pixelHeight=n*o,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new FP(this,t.dpr),this._id=e.id,this._dpr=o}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&Gu(this._nativeCanvas.release)&&this._nativeCanvas.release()}};NP.env="node",NP=zP([Vm(),WP("design:paramtypes",[Object])],NP);var GP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},VP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UP=function(t,e){return function(i,n){e(i,n,t)}};let KP=class extends eP{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Vv.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new NP(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new NP({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};KP.env="node",KP=GP([Vm(),UP(0,$m(ry)),VP("design:paramtypes",[Object])],KP);var $P=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let XP=class extends MM{draw(){}createPattern(t,e){return null}};XP.env="wx",XP=$P([Vm()],XP);var YP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},qP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZP={WIDTH:500,HEIGHT:500,DPR:1};let JP=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=ZP.WIDTH,height:n=ZP.HEIGHT,dpr:r=ZP.DPR}=t,{x:o,y:s}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=o,this._y=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._context=new XP(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JP.env="wx",JP=YP([Vm(),qP("design:paramtypes",[Object])],JP);var QP=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},tE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eE=function(t,e){return function(i,n){e(i,n,t)}};class iE{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let nE=class extends eP{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new iE}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Vv.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JP(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new JP({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,r;const{type:o}=t;return!!this.eventManager.cache[o]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[o].listener&&this.eventManager.cache[o].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};nE.env="wx",nE=QP([Vm(),eE(0,$m(ry)),tE("design:paramtypes",[Object])],nE);var rE=new zm((t=>{t(oP).toSelf(),t(o_).toDynamicValue((t=>t.container.get(oP))).whenTargetNamed(oP.env),t(gP).toSelf(),t(o_).toDynamicValue((t=>t.container.get(gP))).whenTargetNamed(gP.env),t(AP).toSelf(),t(o_).toDynamicValue((t=>t.container.get(AP))).whenTargetNamed(AP.env),t(IP).toSelf(),t(o_).toDynamicValue((t=>t.container.get(IP))).whenTargetNamed(IP.env),t(nE).toSelf(),t(o_).toDynamicValue((t=>t.container.get(nE))).whenTargetNamed(nE.env),t(KP).toSelf(),t(o_).toDynamicValue((t=>t.container.get(KP))).whenTargetNamed(KP.env)})),oE=new zm((t=>{t(Yb).toSelf().inSingletonScope(),t(Xb).toService(Yb),ty(t,Xb)})),sE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},aE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};let hE=class{constructor(t){this.global=t,this.offscreen=!1}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,r=Qb({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const r=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:r},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};hE=sE([Vm(),lE(0,$m(ry)),aE("design:paramtypes",[Object])],hE);var cE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},uE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dE=function(t,e){return function(i,n){e(i,n,t)}};let pE=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=Qb({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),r=t.dpr,{x:o=0,y:s=0,width:a=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(r,0,0,r,0,0),i.clear&&n.clearRect(o,s,a,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,o,s,a,l),n.nativeContext.restore()}merge(t){}};pE=cE([Vm(),dE(0,$m(ry)),uE("design:paramtypes",[Object])],pE);var fE=new zm((t=>{t(hE).toSelf(),t(pE).toSelf(),t(Yx).toService(hE)}));var gE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const mE=Symbol.for("DrawItemInterceptor"),yE=new ip;let bE=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){if(!t.shadowRoot)return!1;const{context:o}=i;if(o.highPerformanceSave(),o.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){yE.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),o.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(yE),!0}};bE=gE([Vm()],bE);let vE=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:o,stage:s}=e.drawParams;o.canvas,o.save(),this.initCanvasCtx(o),o.camera=s.camera;const a=o.currentMatrix;a.a/=o.dpr,a.b/=o.dpr,a.c/=o.dpr,a.d/=o.dpr,a.e/=o.dpr,a.f/=o.dpr;const l=WA.allocate();UA(l,a);const h=o.modelMatrix;if(h){if(l){const t=WA.allocate();o.modelMatrix=KA(t,h,l)}}else o.modelMatrix=l;if(o.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,r=!1;if(t.forEachChildren((t=>(e=t.numberType===Mx,!e))),t.forEachChildren((t=>(r=!!t.findFace,!r))),e){const e=t.getChildren(),r=[...e];r.sort(((t,e)=>{var i,n,r,o;let s=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,a=((null!==(r=e.attribute.startAngle)&&void 0!==r?r:0)+(null!==(o=e.attribute.endAngle)&&void 0!==o?o:0))/2;for(;s<0;)s+=Wd;for(;a<0;)a+=Wd;return a-s})),r.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),r.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(r){const e=t.getChildren(),r=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return o.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));r.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),r.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),r.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return o.camera=null,o.restore(),o.modelMatrix!==h&&WA.free(o.modelMatrix),o.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};vE=gE([Vm()],vE);var wE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},CE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xE=function(t,e){return function(i,n){e(i,n,t)}};let _E=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ep,this.backupDirtyBounds=new ep}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:r=0,y:o=0,width:s,height:a}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,s,a);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Sp(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(r,o,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:vb.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:vb.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=aM(e,i,vb.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!Tp(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),r=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):oM(t,vb.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:r}=i;let o=r.get(t._uid);o||(o={layer:this.layerService.createLayer(n),zIndex:r.size,group:t},r.set(t._uid,o));const s=o.layer.getNativeHandler().getContext(),a=o.drawContribution||qb.get(eB);a.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:o.layer,context:s,startAtId:t._uid,break:!1})),o.drawContribution=a;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=r.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:r.size},r.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const r=this.InterceptorContributions[n];if(r.beforeDrawItem&&r.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const n=this.getRenderContribution(t);if(!n)return;if(!t.isContainer&&!Tp(t.AABBBounds,this.dirtyBounds,!1))return;const r=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=r),r?t.isContainer&&n.draw(t,this.currentRenderService,e,i):n.draw(t,this.currentRenderService,e,i),this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.afterDrawItem&&n.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return console.warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t){return this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){const{clear:n}=i;if(n){const t=e.getCanvas(),{width:r=t.width,height:o=t.height}=i,s=0,a=0;e.clearRect(s,a,r,o),e.fillStyle=xB(e,n,{AABBBounds:{x1:s,y1:a,x2:s+r,y2:a+o}},0,0),e.fillRect(s,a,r,o)}}afterDraw(t,e){}};wE([$m(ry),CE("design:type",Object)],_E.prototype,"global",void 0),wE([Zm(),CE("design:type",Function),CE("design:paramtypes",[]),CE("design:returntype",void 0)],_E.prototype,"init",null),_E=wE([Vm(),xE(0,Xm(sB)),xE(1,$m(vB)),xE(2,$m(h_)),xE(3,$m(Jm)),xE(3,Um(mE)),CE("design:paramtypes",[Array,Object,Object,Object])],_E);var SE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let AE=class{selector(t){return null}};AE=SE([Vm()],AE);var TE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},BE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ME=function(t,e){return function(i,n){e(i,n,t)}};let RE=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Hx}drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,null==o?void 0:o.theme).group,{fill:h=l.fill,background:c,stroke:u=l.stroke,opacity:d=l.opacity,width:p=l.width,height:f=l.height,clip:g=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:b=l.cornerRadius,path:v=l.path,lineWidth:w=l.lineWidth,visible:C=l.visible}=t.attribute,x=f_(d,m,p,f,h),_=m_(d,y,p,f),S=u_(h,c),A=d_(u,w);if(!t.valid||!C)return;if(!g){if(!S&&!A)return;if(!(x||_||s||a||c))return}if(v&&v.length&&r.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,v.forEach((t=>{r.drawContribution.getRenderContribution(t).draw(t,r.renderService,r,o)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===b||qu(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,f)):(e.beginPath(),MT(e,i,n,p,f,b));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const T={doFill:S,doStroke:A};this._groupRenderContribitions.forEach((o=>{o.time===Ry.beforeFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a,T)})),g&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),T.doFill&&(s?s(e,t.attribute,l):x&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),T.doStroke&&(a?a(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((o=>{o.time===Ry.afterFillStroke&&o.drawShape(t,e,i,n,S,A,x,_,l,r,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;const{clip:o}=t.attribute;o?r.save():r.highPerformanceSave();const s=Gv(t,null==n?void 0:n.theme).group,a=r.modelMatrix;if(r.camera){const e=WA.allocate(),i=WA.allocate();$A(i,t,s),KA(e,a||e,i),r.modelMatrix=e,WA.free(i),r.setTransform(1,0,0,1,0,0,!0)}else r.transformFromMatrix(t.transMatrix,!0);r.beginPath(),n.skipDraw?this.drawShape(t,r,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,r,0,0,i);const{scrollX:l=s.scrollX,scrollY:h=s.scrollY}=t.attribute;let c;(l||h)&&r.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),r.modelMatrix!==a&&WA.free(r.modelMatrix),r.modelMatrix=a,c&&c.then?c.then((()=>{o?r.restore():r.highPerformanceRestore()})):o?r.restore():r.highPerformanceRestore()}};RE=TE([Vm(),ME(0,$m(Jm)),ME(0,Um(B_)),BE("design:paramtypes",[Object])],RE);var PE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let EE=class extends fT{constructor(){super(...arguments),this.numberType=kx}drawShape(t,e,i,n,r,o,s,a){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:e,length:o}=r.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Gv(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,lineWidth:g=h.lineWidth,visible:m=h.visible}=t.attribute,y=p_(d,p,c),b=g_(d,f),v=u_(c),w=d_(u,g);if(!t.valid||!m)return;if(!v&&!w)return;if(!(y||b||s||a))return;const{context:C}=r;for(let r=e;r<e+o;r++)this.drawIncreaseSegment(t,C,l[r-1],l[r],t.attribute.segments[r],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,o,s,a)}drawIncreaseSegment(t,e,i,n,r,o,s,a){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:r=0,offsetY:o=0}=n||{},s=e?e.points[e.points.length-1]:i.points[0];t.moveTo(s.x+r,s.y+o),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+o):t.moveTo(e.x+r,e.y+o)}))}(e.nativeContext,i,n,{offsetX:s,offsetY:a}),e.setShadowStyle&&e.setShadowStyle(t,r,o),e.setStrokeStyle(t,r,s,a,o),e.stroke())}};EE=PE([Vm()],EE);var HE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let LE=class extends xT{constructor(){super(...arguments),this.numberType=Rx}drawShape(t,e,i,n,r,o,s){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:o,length:a}=r.multiGraphicOptions,{segments:l=[]}=t.attribute;if(o>l.length)return;const h=Gv(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=p_(d,u,c),g=u_(c);if(!t.valid||!p)return;if(!g)return;if(!f&&!s)return;for(let r=o;r<o+a;r++)this.drawIncreaseSegment(t,e,l[r-1],l[r],t.attribute.segments[r],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,o,s)}drawIncreaseSegment(t,e,i,n,r,o,s,a){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:r=0,offsetY:o=0}=n||{},{points:s}=i,a=[];for(let t=0;t<s.length;t++)s[t].defined;a.push(s),a.forEach(((i,n)=>{var s,a,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+r,c.y+o),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+o):t.moveTo(e.x+r,e.y+o)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(s=n.x1)&&void 0!==s?s:n.x,null!==(a=n.y1)&&void 0!==a?a:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:s,offsetY:a}),e.setShadowStyle&&e.setShadowStyle(t,r,o),e.setCommonStyle(t,r,s,a,o),e.fill())}};LE=HE([Vm()],LE);var kE,IE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},OE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DE=function(t,e){return function(i,n){e(i,n,t)}},FE=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(kE||(kE={}));let zE=class extends _E{constructor(t,e,i,n,r,o){super(t,e,r,o),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=r,this.drawItemInterceptorContributions=o,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=kE.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new iy([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return FE(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:r=0,y:o=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(r,o,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:vb.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:vb.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return FE(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return FE(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>FE(this,void 0,void 0,(function*(){if(2!==t.count)yield sM(t,vb.zIndex,((i,n)=>{if(this.status===kE.STOP)return!0;if(i.isContainer)return!1;if(n<this.currentIdx)return!1;const r=this.currFrameStartAt+t.incremental;return n<r&&(this.currentIdx=n+1,this.renderItem(i,e)),n===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const n=t.getChildAt(0);if(n.incremental&&n.attribute.segments)for(n.incrementalAt||(n.incrementalAt=0);n.incrementalAt<n.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:n.incrementalAt,length:n.incremental},this.renderItem(n,e),n.incrementalAt+=n.incremental,yield this.waitToNextFrame();else this.renderItem(n,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return FE(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return FE(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return FE(this,void 0,void 0,(function*(){this.rendering&&(this.status=kE.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=kE.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return FE(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>FE(this,void 0,void 0,(function*(){yield sM(t,vb.zIndex,(t=>FE(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};IE([$m(ry),OE("design:type",Object)],zE.prototype,"global",void 0),zE=IE([Vm(),DE(0,Xm(sB)),DE(1,$m(vB)),DE(2,$m(EE)),DE(3,$m(LE)),DE(4,$m(h_)),DE(5,$m(Jm)),DE(5,Um(mE)),OE("design:paramtypes",[Array,Object,Object,Object,Object,Object])],zE);var WE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let jE=class extends cT{constructor(){super(...arguments),this.type="rect3d",this.numberType=zx}drawShape(t,e,i,n,r,o,s,a){var l;const h=Gv(t,null==o?void 0:o.theme).rect3d,{fill:c=h.fill,stroke:u=h.stroke,width:d=h.width,height:p=h.height,opacity:f=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:b=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,w=f_(f,g,d,p,c),C=m_(f,y,d,p),x=u_(c),_=d_(u,m);if(!t.valid||!b)return;if(!x&&!_)return;if(!(w||C||s||a))return;const{light:S,camera:A}=r.stage||{},T=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,v,T,r,e,S,s)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,T,e))}stroke(t,e,i,n,r){const o=n.vertices;n.edges.forEach((n=>{const s=o[n[0]],a={x:t+s[0],y:e+s[1],z:i+s[2]},l=o[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};r.beginPath(),r.moveTo(a.x,a.y,a.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(t,e,i,n,r,o,s,a){const l=Ow.get(r).value,h=n.vertices,c=h.map((t=>o.view(t[0],t[1],t[2])[2])),u=[];n.polygons.forEach(((t,e)=>{u.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=c[i[0]],o=c[i[1]],s=c[i[2]],a=c[i[3]];t.ave_z=r+o+s+a})),u.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),u.forEach((n=>{const{polygon:c,normal:u}=n.polygon,d=h[c[0]],p=h[c[1]],f=h[c[2]],g=h[c[3]],m={x:t+d[0],y:e+d[1],z:i+d[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},b={x:t+f[0],y:e+f[1],z:i+f[2]},v={x:t+g[0],y:e+g[1],z:i+g[2]};o.beginPath(),o.moveTo(m.x,m.y,m.z),o.lineTo(y.x,y.y,y.z),o.lineTo(b.x,b.y,b.z),o.lineTo(v.x,v.y,v.z),o.closePath(),a?a(o,null,null):(o.fillStyle=s?s.computeColor(u,l):r,o.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const r=Gv(t).rect,o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;this.z=l,this.drawShape(t,n,s,a,i),this.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};jE=WE([Vm()],jE);var NE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let GE=class{constructor(){this.numberType=Wx}drawShape(t,e,i,n,r){const o=Gv(t).richtext,{width:s=o.width,height:a=o.height,opacity:l=o.opacity,fillOpacity:h=o.fillOpacity,visible:c=o.visible}=t.attribute;t.valid&&c&&p_(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,r){var o;const s=Gv(t).richtextIcon,{width:a=s.width,height:l=s.height,opacity:h=s.opacity,image:c,backgroundFill:u=s.backgroundFill,backgroundFillOpacity:d=s.backgroundFillOpacity,backgroundStroke:p=s.backgroundStroke,backgroundStrokeOpacity:f=s.backgroundStrokeOpacity,backgroundRadius:g=s.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=a,backgroundHeight:b=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-a)/2,r=(b-l)/2;0===g?(e.beginPath(),e.rect(i-t,n-r,y,b)):(e.beginPath(),MT(e,i-t,n-r,y,b,g)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=f,e.strokeStyle=p,e.stroke())}const v=c&&(null===(o=null==t?void 0:t.resources)||void 0===o?void 0:o.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,a,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const r=Gv(t).richtext;let{x:o=r.x,y:s=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,o,s,i),n.highPerformanceRestore()}};GE=NE([Vm()],GE);var VE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let UE=class{constructor(){this.numberType=Ex}drawShape(t,e,i,n,r,o,s,a){r.drawContribution&&t.getSubGraphic().forEach((t=>{const l=r.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,r,o,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;if(r.highPerformanceSave(),!i.drawContribution)return;const o=Gv(t),s=t.getSubGraphic();s.length&&s.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:o})})),r.highPerformanceRestore()}};UE=VE([Vm()],UE);var KE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let $E=class extends cT{constructor(){super(...arguments),this.numberType=Mx}drawShape(t,e,i,n,r,o,s,a){var l;const h=Gv(t,null==o?void 0:o.theme).arc,{fill:c=h.fill,background:u,stroke:d=h.stroke,opacity:p=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,b=p_(p,f,c),v=g_(p,m),w=u_(c,u),C=d_(d,g),x=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!w&&!C)return;if(!(b||v||s||a||u))return;const{outerRadius:_=h.outerRadius,innerRadius:S=h.innerRadius,height:A=10}=t.attribute,T=Ow.get(c).value,{light:B}=r.stage||{},M=r.hack_pieFace,R={top:x,bottom:x+A},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===M||"top"===M?(e.beginPath(),function(t,e,i,n,r,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=jd(l-a),c=l>a;let u=!1;if(o<s){const t=o;o=s,s=t}if(o<=Od)e.moveTo(i,n,r);else if(h>=Wd-Od)e.moveTo(i+o*Gd(a),n+o*Kd(a),r),e.arc(i,n,o,a,l,!c,r),s>Od&&(e.moveTo(i+s*Gd(l),n+s*Kd(l),r),e.arc(i,n,s,l,a,c,r));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:f,innerEndAngle:g,innerStartAngle:m}=t.getParsePadAngle(a,l),y=o*Gd(p),b=o*Kd(p),v=s*Gd(g),w=s*Kd(g);h<.001?u=!0:(e.moveTo(i+y,n+b,r),e.arc(i,n,o,p,f,!c,r)),!(s>Od)||d<.001?(e.lineTo(i+v,n+w,r),u=!0):(e.lineTo(i+v,n+w,r),e.arc(i,n,s,g,m,c,r))}e.closePath()}(t,e,i,n,R[M],_,S),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),w&&(s?s(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=B?B.computeColor(P[M],T):c,e.fill())),C&&(a?a(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==M&&"inside"!==M||("inside"===M&&(e.save(),e.beginPath(),e.arc(i,n,S,0,Wd,!0,R.top),e.clip()),e.beginPath(),function(t,e,i,n,r,o,s,a){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=jd(h-l),u=h>l;let d=!1;if(s<=Od)e.moveTo(i,n,r);else if(c>=Wd-Od)e.moveTo(i+s*Gd(l),n+s*Kd(l),r),e.arc(i,n,s,l,h,!u,r),e.lineTo(i+s*Gd(h),n+s*Kd(h),o),e.arc(i,n,s,h,l,u,o);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=a(l,h),f=s*Gd(c),g=s*Kd(c),m=s*Gd(p),y=s*Kd(p);t<.001?d=!0:(e.moveTo(i+f,n+g,r),e.arc(i,n,s,c,p,!u,r),e.lineTo(i+m,n+y,o),e.arc(i,n,s,p,c,u,o))}e.closePath()}(t,e,i,n,R.top,R.bottom,"outside"===M?_:S,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:r,outerStartAngle:o,outerEndAngle:s,innerEndAngle:a,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===M?{innerouterDeltaAngle:n,innerouterEndAngle:s,innerouterStartAngle:o}:{innerouterDeltaAngle:r,innerouterEndAngle:a,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),w&&(s?s(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=B?B.computeColor(P[M],T):c,e.fill())),C&&(a?a(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===M&&e.restore())}draw(t,e,i,n){const{context:r}=i;if(!r)return;const o=Gv(t,null==n?void 0:n.theme).arc;r.save();const s=this.transform(t,o,r),{x:a,y:l,z:h,lastModelMatrix:c}=s;this.z=h,y_(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&WA.free(r.modelMatrix),r.modelMatrix=c),r.restore()}};$E=KE([Vm()],$E);var XE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let YE=class extends cT{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Dx}drawShape(t,e,i,n,r,o,s,a){var l;const h=Gv(t,null==o?void 0:o.theme).polygon,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:g=h.strokeOpacity,visible:m=h.visible,points:y,face:b=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,w=p_(d,p,c),C=g_(d,g),x=u_(c),_=d_(u,f);if(!t.valid||!m||4!==y.length)return;if(!x&&!_)return;if(!(w||C||s||a))return;const{light:S,camera:A}=r.stage||{},T=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,v,T,b,r,e,S,A,t,h,s)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,T,e))}stroke(t,e,i,n,r){const o=n.vertices;n.edges.forEach((n=>{const s=o[n[0]],a=o[n[1]],l={x:t+s[0],y:e+s[1],z:i+s[2]},h={x:t+a[0],y:e+a[1],z:i+a[2]};r.beginPath(),r.moveTo(l.x,l.y,l.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(t,e,i,n,r,o,s,a,l,h,c,u){const d=Ow.get(o).value,p=n.vertices,f=p.map((t=>s.view(t[0],t[1],t[2])[2])),g=[];n.polygons.forEach(((t,e)=>{if(!r[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,o=f[i[0]],s=f[i[1]],a=f[i[2]],l=f[i[3]];t.ave_z=o+s+a+l})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((n=>{const{polygon:r,normal:l}=n.polygon,f=p[r[0]],g=p[r[1]],m=p[r[2]],y=p[r[3]],b={x:t+f[0],y:e+f[1],z:i+f[2]},v={x:t+g[0],y:e+g[1],z:i+g[2]},w={x:t+m[0],y:e+m[1],z:i+m[2]},C={x:t+y[0],y:e+y[1],z:i+y[2]};s.beginPath(),s.moveTo(b.x,b.y,b.z),s.lineTo(v.x,v.y,v.z),s.lineTo(w.x,w.y,w.z),s.lineTo(C.x,C.y,C.z),s.closePath(),u?u(s,h.attribute,c):(s.fillStyle=a?a.computeColor(l,d):o,s.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const r=Gv(t).polygon,o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;this.z=l,this.drawShape(t,n,s,a,i),this.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};YE=XE([Vm()],YE);var qE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let ZE=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};ZE=qE([Vm()],ZE);let JE=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}};JE=qE([Vm()],JE);var QE=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let tH=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};tH=QE([Vm()],tH);let eH=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}};eH=QE([Vm()],eH);var iH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let nH=class extends BB{constructor(){super(...arguments),this.time=Ry.beforeFillStroke}};nH=iH([Vm()],nH);let rH=class extends RB{constructor(){super(...arguments),this.time=Ry.afterFillStroke}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){var p,f,g,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=d||{},{texture:b=(null!==(p=t.attribute.texture)&&void 0!==p?p:Bw(l,"texture")),textureColor:v=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:Bw(l,"textureColor")),textureSize:w=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:Bw(l,"textureSize")),texturePadding:C=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Bw(l,"texturePadding"))}=y;if(!b)return;let x=this.textureMap.get(b);if(!x)switch(b){case"circle":x=this.createCirclePattern(w,C,v,e);break;case"diamond":x=this.createDiamondPattern(w,C,v,e);break;case"rect":x=this.createRectPattern(w,C,v,e);break;case"vertical-line":x=this.createVerticalLinePattern(w,C,v,e);break;case"horizontal-line":x=this.createHorizontalLinePattern(w,C,v,e);break;case"bias-lr":x=this.createBiasLRLinePattern(w,C,v,e);break;case"bias-rl":x=this.createBiasRLLinePattern(w,C,v,e);break;case"grid":x=this.createGridPattern(w,C,v,e)}x&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=x,e.fill(),e.highPerformanceRestore())}};rH=iH([Vm()],rH);var oH=new zm((t=>{t(_E).toSelf(),t(wB).toService(_E),t(zE).toSelf(),t(eB).toService(zE),t(AE).toSelf(),t(vB).toService(AE),t(N_).toSelf().inSingletonScope(),t(oB).to(N_),t(sB).to(N_),t(IB).toSelf().inSingletonScope(),t(OB).toSelf().inSingletonScope(),t(DB).toSelf().inSingletonScope(),t(T_).toService(IB),t(T_).toService(OB),t(T_).toService(DB),ty(t,T_),t(HT).toSelf().inSingletonScope(),t(uB).to(HT),t(sB).to(HT),t(jE).toSelf().inSingletonScope(),t(dB).toService(jE),t(sB).toService(dB),t(GB).toSelf().inSingletonScope(),t(VB).toSelf().inSingletonScope(),t(UB).toSelf().inSingletonScope(),t(KB).toSelf().inSingletonScope(),t($B).toSelf().inSingletonScope(),t(E_).toService(GB),t(E_).toService(VB),t(E_).toService(UB),t(E_).toService(KB),t(E_).toService($B),ty(t,E_),t(WT).toSelf().inSingletonScope(),t(fB).to(WT),t(sB).to(WT),ty(t,L_),t(TT).toSelf().inSingletonScope(),t(hB).to(TT),t(sB).to(TT),t(tH).toSelf().inSingletonScope(),t(eH).toSelf().inSingletonScope(),t(R_).toService(tH),t(R_).toService(eH),ty(t,R_),t(OT).toSelf().inSingletonScope(),t(pB).to(OT),t(sB).to(OT),t(YB).toSelf().inSingletonScope(),t(qB).toSelf().inSingletonScope(),t(ZB).toSelf().inSingletonScope(),t(H_).toService(YB),t(H_).toService(qB),t(H_).toService(ZB),ty(t,H_),t(F_).toSelf().inSingletonScope(),t(iB).to(F_),t(sB).to(F_),t($E).toSelf().inSingletonScope(),t(nB).toService($E),t(sB).toService(nB),t(EB).toSelf().inSingletonScope(),t(HB).toSelf().inSingletonScope(),t(LB).toSelf().inSingletonScope(),t(S_).toService(EB),t(S_).toService(HB),t(S_).toService(LB),ty(t,S_),t(fT).toSelf().inSingletonScope(),t(lB).to(fT),t(sB).to(fT),t(EE).toSelf().inSingletonScope(),t(LE).toSelf().inSingletonScope(),t(xT).toSelf().inSingletonScope(),t(rB).to(xT),t(sB).to(xT),t(nH).toSelf().inSingletonScope(),t(rH).toSelf().inSingletonScope(),t(A_).toService(nH),t(A_).toService(rH),ty(t,A_),t(RE).toSelf().inSingletonScope(),t(aB).to(RE),t(sB).to(RE),t(zB).toSelf().inSingletonScope(),t(B_).toService(zB),ty(t,B_),t(YT).toSelf().inSingletonScope(),t(cB).to(YT),t(sB).to(YT),t(ZE).toSelf().inSingletonScope(),t(JE).toSelf().inSingletonScope(),t(P_).toService(ZE),t(P_).toService(JE),ty(t,P_),t(UE).toSelf().inSingletonScope(),t(yB).toService(UE),t(sB).toService(yB),t(tB).toSelf().inSingletonScope(),t(bB).toService(tB),t(sB).toService(bB),t(jB).toSelf().inSingletonScope(),t(M_).toService(jB),ty(t,M_),t(GE).toSelf().inSingletonScope(),t(gB).toService(GE),t(sB).toService(gB),t(YE).toSelf().inSingletonScope(),t(mB).toService(YE),t(sB).toService(mB),t(MB).toSelf().inSingletonScope(),t(L_).toService(MB),t(S_).toService(MB),t(R_).toService(MB),t(H_).toService(MB),t(E_).toService(MB),t(M_).toService(MB),t(T_).toService(MB),t(A_).toService(MB),t(P_).toService(MB),ty(t,k_),ty(t,sB),t(bE).toSelf().inSingletonScope(),t(mE).toService(bE),t(vE).toSelf().inSingletonScope(),t(mE).toService(vE),ty(t,mE)}));var sH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lH=function(t,e){return function(i,n){e(i,n,t)}};let hH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Px}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).circle;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=CB(n,o,n.dpr),a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};hH=sH([Vm(),lH(0,$m(oB)),aH("design:paramtypes",[Object])],hH);var cH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},uH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};const pH=new ip;let fH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=Fx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).rect,{cornerRadius:o=r.cornerRadius}=t.attribute;let{x:s=r.x,y:a=r.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);s+=e.x,a+=e.y,n.setTransformForCurrent()}else s=0,a=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||Qu(o,!0)&&0!==o||qu(o)&&o.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,r)=>{if(h)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=CB(n,o,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=r.fill,stroke:n=r.stroke,lineWidth:o=r.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;pH.setValue(i.x1,i.y1,i.x2,i.y2),pH.expand(-o/2),h=!pH.containsPoint(e)}}return n.highPerformanceRestore(),h}};fH=cH([Vm(),dH(0,$m(uB)),uH("design:paramtypes",[Object])],fH);var gH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},mH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yH=function(t,e){return function(i,n){e(i,n,t)}};let bH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Bx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).arc;n.highPerformanceSave();let{x:o=r.x,y:s=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=CB(n,o,n.dpr),a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};bH=gH([Vm(),yH(0,$m(iB)),mH("design:paramtypes",[Object])],bH);var vH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Rx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).area;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,(t=>!!a||(a=t.isPointInPath(e.x,e.y),a))),n.highPerformanceRestore(),a}};xH=vH([Vm(),CH(0,$m(rB)),wH("design:paramtypes",[Object])],xH);var _H=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let SH=class{constructor(){this.type="image",this.numberType=Lx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};SH=_H([Vm()],SH);var AH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let TH=class extends cT{};TH=AH([Vm()],TH);var BH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RH=function(t,e){return function(i,n){e(i,n,t)}};let PH=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=kx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const r=Gv(t).line,o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,s,a,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const r=e.lineWidth||i.lineWidth;return n.lineWidth=CB(n,r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};PH=BH([Vm(),RH(0,$m(lB)),MH("design:paramtypes",[Object])],PH);var EH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ix}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).path;n.highPerformanceSave();const o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const r=e.lineWidth||i.lineWidth;return n.lineWidth=CB(n,r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};kH=EH([Vm(),LH(0,$m(hB)),HH("design:paramtypes",[Object])],kH);var IH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DH=function(t,e){return function(i,n){e(i,n,t)}};eT({});let FH=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=jx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(r.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const o=Gv(t).symbol,s=this.transform(t,o,n),{x:a,y:l,z:h,lastModelMatrix:c}=s;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,a,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const r=e.lineWidth||i.lineWidth;return n.lineWidth=CB(n,r,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&WA.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}};FH=IH([Vm(),DH(0,$m(pB)),OH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Nx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.AABBBounds;if(!n.camera)return!!r.containsPoint(e);n.highPerformanceSave();const o=Gv(t).text,{keepDirIn3d:s=o.keepDirIn3d}=t.attribute,a=!s,l=this.transform(t,o,n,a),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let f=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(f)return!0;const{fontSize:r=o.fontSize,textBaseline:s=o.textBaseline,textAlign:a=o.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),g=l.width(),m=$_(s,d,r),y=K_(a,g);return e.rect(y+h,m+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,i)=>f)),this.canvasRenderer.z=0,n.modelMatrix!==d&&WA.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),f}};NH=zH([Vm(),jH(0,$m(fB)),WH("design:paramtypes",[Object])],NH);var GH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},VH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Ox}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).polygon;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};KH=GH([Vm(),UH(0,$m(cB)),VH("design:paramtypes",[Object])],KH);var $H=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},XH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YH=function(t,e){return function(i,n){e(i,n,t)}};new ip;let qH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Wx}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};qH=$H([Vm(),YH(0,$m(gB)),XH("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},JH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QH=function(t,e){return function(i,n){e(i,n,t)}};let tL=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Ex}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=null==i?void 0:i.pickerService;if(r){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!r.pickItem(t,e,i))})),n}return!1}};tL=ZH([Vm(),QH(0,$m(yB)),JH("design:paramtypes",[Object])],tL);var eL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},iL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nL=function(t,e){return function(i,n){e(i,n,t)}};new ip;let rL=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=zx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).rect;n.highPerformanceSave();const o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,s,a,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};rL=eL([Vm(),nL(0,$m(dB)),iL("design:paramtypes",[Object])],rL);var oL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aL=function(t,e){return function(i,n){e(i,n,t)}};new ip;let lL=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Dx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).polygon;n.highPerformanceSave();const o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};lL=oL([Vm(),aL(0,$m(mB)),sL("design:paramtypes",[Object])],lL);var hL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},cL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uL=function(t,e){return function(i,n){e(i,n,t)}};new ip;let dL=class extends TH{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=Mx}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).arc;n.highPerformanceSave();const o=this.transform(t,r,n),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,s,a,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&WA.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};dL=hL([Vm(),uL(0,$m(nB)),cL("design:paramtypes",[Object])],dL);var pL=new zm(((t,e,i,n)=>{t(hH).toSelf().inSingletonScope(),t(OM).toService(hH),t(XM).toService(OM),t(fH).toSelf().inSingletonScope(),t(WM).toService(fH),t(XM).toService(WM),t(rL).toSelf().inSingletonScope(),t(jM).toService(rL),t(XM).toService(jM),t(bH).toSelf().inSingletonScope(),t(LM).toService(bH),t(XM).toService(LM),t(xH).toSelf().inSingletonScope(),t(IM).toService(xH),t(XM).toService(IM),t(SH).toSelf().inSingletonScope(),t(DM).toService(SH),t(XM).toService(DM),t(PH).toSelf().inSingletonScope(),t(FM).toService(PH),t(XM).toService(FM),t(kH).toSelf().inSingletonScope(),t(zM).toService(kH),t(XM).toService(zM),t(FH).toSelf().inSingletonScope(),t(NM).toService(FH),t(XM).toService(NM),t(NH).toSelf().inSingletonScope(),t(GM).toService(NH),t(XM).toService(GM),t(KH).toSelf().inSingletonScope(),t(VM).toService(KH),t(XM).toService(VM),t(lL).toSelf().inSingletonScope(),t(UM).toService(lL),t(XM).toService(UM),t(dL).toSelf().inSingletonScope(),t(kM).toService(dL),t(XM).toService(kM),t(qH).toSelf().inSingletonScope(),t(KM).toService(qH),t(XM).toService(KM),t(tL).toSelf().inSingletonScope(),t($M).toService(tL),t(XM).toService($M),ty(t,XM)})),fL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},gL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mL=function(t,e){return function(i,n){e(i,n,t)}};let yL=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=Ix}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).path;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};yL=fL([Vm(),mL(0,$m(hB)),gL("design:paramtypes",[Object])],yL);var bL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wL=function(t,e){return function(i,n){e(i,n,t)}};let CL=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Px}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).circle;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};CL=bL([Vm(),wL(0,$m(oB)),vL("design:paramtypes",[Object])],CL);var xL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SL=function(t,e){return function(i,n){e(i,n,t)}};const AL=new ip;let TL=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=Fx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).rect,{cornerRadius:o=r.cornerRadius}=t.attribute;let{x:s=r.x,y:a=r.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);s+=e.x,a+=e.y,n.setTransformForCurrent()}else s=0,a=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||Qu(o,!0)&&0!==o||qu(o)&&o.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,r)=>{if(h)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=r.fill,stroke:n=r.stroke,lineWidth:o=r.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;AL.setValue(i.x1,i.y1,i.x2,i.y2),AL.expand(-o/2),h=!AL.containsPoint(e)}}return n.highPerformanceRestore(),h}};TL=xL([Vm(),SL(0,$m(uB)),_L("design:paramtypes",[Object])],TL);var BL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ML=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RL=function(t,e){return function(i,n){e(i,n,t)}};let PL=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Bx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).arc;n.highPerformanceSave();let{x:o=r.x,y:s=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};PL=BL([Vm(),RL(0,$m(iB)),ML("design:paramtypes",[Object])],PL);var EL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},HL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LL=function(t,e){return function(i,n){e(i,n,t)}};let kL=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Rx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).area;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,(t=>!!a||(a=t.isPointInPath(e.x,e.y),a))),n.highPerformanceRestore(),a}};kL=EL([Vm(),LL(0,$m(rB)),HL("design:paramtypes",[Object])],kL);var IL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},OL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let FL=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=kx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).line;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,(t=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};FL=IL([Vm(),DL(0,$m(lB)),OL("design:paramtypes",[Object])],FL);var zL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},WL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jL=function(t,e){return function(i,n){e(i,n,t)}};let NL=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=jx}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).symbol;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};NL=zL([Vm(),jL(0,$m(pB)),WL("design:paramtypes",[Object])],NL);var GL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let VL=class{constructor(){this.type="text",this.numberType=Nx}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};VL=GL([Vm()],VL);var UL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},KL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$L=function(t,e){return function(i,n){e(i,n,t)}};let XL=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Ox}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Gv(t).polygon;let{x:o=r.x,y:s=r.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);o+=e.x,s+=e.y,n.setTransformForCurrent()}else o=0,s=0,n.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,n,o,s,{},null,((t,i,n)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,r)=>{if(a)return!0;const o=i.lineWidth||r.lineWidth;return n.lineWidth=o,a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};XL=UL([Vm(),$L(0,$m(cB)),KL("design:paramtypes",[Object])],XL);var YL=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZL=function(t,e){return function(i,n){e(i,n,t)}};let JL=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Ex}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=null==i?void 0:i.pickerService;if(r){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!r.pickItem(t,e,i))})),n}return!1}};JL=YL([Vm(),ZL(0,$m(yB)),qL("design:paramtypes",[Object])],JL);var QL=new zm((t=>{t(CL).toSelf().inSingletonScope(),t(ZM).toService(CL),t(oR).toService(ZM),t(TL).toSelf().inSingletonScope(),t(tR).toService(TL),t(oR).toService(tR),t(PL).toSelf().inSingletonScope(),t(YM).toService(PL),t(oR).toService(YM),t(kL).toSelf().inSingletonScope(),t(qM).toService(kL),t(oR).toService(qM),t(FL).toSelf().inSingletonScope(),t(JM).toService(FL),t(oR).toService(JM),t(yL).toSelf().inSingletonScope(),t(QM).toService(yL),t(oR).toService(QM),t(NL).toSelf().inSingletonScope(),t(eR).toService(NL),t(oR).toService(eR),t(VL).toSelf().inSingletonScope(),t(iR).toService(VL),t(oR).toService(iR),t(XL).toSelf().inSingletonScope(),t(nR).toService(XL),t(oR).toService(nR),t(JL).toSelf().inSingletonScope(),t(rR).toService(JL),t(JL).toService(rR),ty(t,oR)}));var tk=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new HM(t))).whenTargetNamed(HM.env),t(Jb).toDynamicValue((()=>(t,e)=>new MM(t,e))).whenTargetNamed(MM.env)})),ek=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new CP(t))).whenTargetNamed(CP.env),t(Jb).toDynamicValue((()=>(t,e)=>new yP(t,e))).whenTargetNamed(yP.env)})),ik=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new uP(t))).whenTargetNamed(uP.env),t(Jb).toDynamicValue((()=>(t,e)=>new aP(t,e))).whenTargetNamed(aP.env)})),nk=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new EP(t))).whenTargetNamed(EP.env),t(Jb).toDynamicValue((()=>(t,e)=>new BP(t,e))).whenTargetNamed(BP.env)})),rk=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new JP(t))).whenTargetNamed(JP.env),t(Jb).toDynamicValue((()=>(t,e)=>new XP(t,e))).whenTargetNamed(XP.env)})),ok=new zm((t=>{t(Zb).toDynamicValue((()=>t=>new NP(t))).whenTargetNamed(NP.env),t(Jb).toDynamicValue((()=>(t,e)=>new FP(t,e))).whenTargetNamed(FP.env)}));qb.load(c_),qb.load(wR),qb.load(nM),qb.load(vR),qb.load(BR),function(t){t.load(JR),t.load(rE),t.load(oE),t.load(fE)}(qb),function(t){t.load(oH)}(qb),function(t){t.load(pL),t.load(QL)}(qb),function(t){t.load(tk),t.load(ik),t.load(ek),t.load(nk),t.load(rk),t.load(ok)}(qb);const sk=qb.get(ry);Ib.global=sk;const ak=qb.get(l_);Ib.graphicUtil=ak;const lk=qb.get(a_);Ib.transformUtil=lk;const hk=qb.get(Gx);Ib.graphicService=hk,qb.get(vM);const ck=qb.get(h_);Ib.layerService=ck;class uk{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ib.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ib.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ib.graphicService.hooks.onAttributeUpdate.taps=Ib.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ib.graphicService.hooks.onSetStage.taps=Ib.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class dk{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,o=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const s=r/100,a=o/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+s,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+a,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class pk{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ib.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Ib.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Ib.graphicService.hooks.onAddIncremental.taps=Ib.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ib.graphicService.hooks.onClearIncremental.taps=Ib.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ib.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class fk{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key))}drawHTML(t){"browser"===Ib.global.env&&t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:vb.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:vb.zIndex)})).forEach((t=>{this.renderGroupHTML(t)}))}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{this.renderGraphicHTML(t)}))}renderGraphicHTML(t){const{html:e}=t.attribute;if(!e)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach((t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)})),t.bindDom.clear()));const i=t.stage;if(!i)return;const{dom:n,container:r,width:o,height:s,style:a,anchorType:l="boundsLeftTop"}=e;t.bindDom||(t.bindDom=new Map);const h=t.bindDom.get(n);if(h&&(!r||r===h.container))return;let c,u;t.bindDom.forEach((t=>{let{wrapGroup:e}=t;Ib.global.removeDom(e)})),c="string"==typeof n?(new DOMParser).parseFromString(n,"text/xml").firstChild:n;const d=r||(!0===i.params.enableHtmlAttribute?null:i.params.enableHtmlAttribute);u=d?"string"==typeof d?Ib.global.getElementById(d):d:t.stage.window.getContainer();const p=Ib.global.createDom({tagName:"div",width:o,height:s,style:a,parent:u});p&&(p.appendChild(c),t.bindDom.set(n,{dom:c,container:r,wrapGroup:p})),p.style.pointerEvents="none",p.style.position||(p.style.position="absolute",u.style.position="relative");let f=0,g=0;if("position"===l){const e=t.transMatrix;f=e.e,g=e.f}else{const e=t.AABBBounds;f=e.x1,g=e.y1}const m=Ib.global.getElementTopLeft(u,!1),y=i.window.getTopLeft(!1),b=f+y.left-m.left,v=g+y.top-m.top;p.style.left=`${b}px`,p.style.top=`${v}px`}}const gk=new ip;class mk{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Ib.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(gk.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(gk,t.parent&&t.parent.globalTransMatrix)))})),Ib.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!r||e.dirty(n.globalAABBBounds))})),Ib.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Ib.graphicService.hooks.beforeUpdateAABBBounds.taps=Ib.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ib.graphicService.hooks.afterUpdateAABBBounds.taps=Ib.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ib.graphicService.hooks.onRemove.taps=Ib.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class yk{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Vv.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new ip}tryLayout(t){const e=t.parent;if(!e||!t.needUpdateLayout())return;const i=Gv(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{flexDirection:r=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:s=i.justifyContent,alignItems:a=i.alignItems,alignContent:l=i.alignContent,clip:h=i.clip}=e.attribute;let c=0,u=0,d=0;if(e.forEachChildren((t=>{const e=t.AABBBounds;"column"===r||"column-reverse"===r?(u+=e.height(),c=Math.max(c,e.width())):(c+=e.width(),u=Math.max(u,e.height())),d+=e.x1,d+=e.y1,d+=e.x2,d+=e.y2})),!isFinite(d))return;const p=e.attribute.width||c,f=e.attribute.height||u;e.attribute.width||(e.attribute.width=0),e.attribute.height||(e.attribute.height=0),this.tempBounds.copy(e._AABBBounds);const g={main:{len:p,field:"x"},cross:{len:f,field:"y"},dir:1},m=g.main,y=g.cross;"row-reverse"===r?g.dir=-1:"column"===r?(m.len=f,y.len=p,m.field="y",y.field="x"):"column-reverse"===r&&(m.len=f,y.len=p,m.field="y",y.field="x",g.dir=-1);let b=0,v=0;const w=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===m.field?e.width():e.height(),n="x"===y.field?e.width():e.height();w.push({mainLen:i,crossLen:n}),b+=i,v=Math.max(v,n)}));const C=[];if(b>m.len&&"wrap"===o){let t=0,e=0;w.forEach(((i,n)=>{let{mainLen:r,crossLen:o}=i;t+r>m.len?0===t?(C.push({idx:n,mainLen:t+r,crossLen:o}),t=0,e=0):(C.push({idx:n-1,mainLen:t,crossLen:o}),t=r,e=o):(t+=r,e=Math.max(e,o))})),C.push({idx:w.length-1,mainLen:t,crossLen:e})}else C.push({idx:w.length-1,mainLen:b,crossLen:v});const x=e.getChildren();let _=0;if(C.forEach((t=>{this.layoutMain(e,x,s,m,w,_,t),_=t.idx+1})),v=C.reduce(((t,e)=>t+e.crossLen),0),1===C.length)if("flex-end"===a){const t=y.len;this.layoutCross(x,a,y,t,w,C[0],0)}else if("center"===a){const t=y.len/2;this.layoutCross(x,a,y,t,w,C[0],0)}else x.forEach((t=>{t.attribute[y.field]=bk(t,y.field)}));else if("flex-start"===l){_=0;let t=0;C.forEach(((e,i)=>{this.layoutCross(x,"flex-start",y,t,w,C[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===l){_=0;let t=Math.max(0,(y.len-v)/2);C.forEach(((e,i)=>{this.layoutCross(x,"center",y,t+e.crossLen/2,w,C[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===l){_=0;const t=Math.max(0,(y.len-v)/C.length/2);let e=t;C.forEach(((i,n)=>{this.layoutCross(x,"flex-start",y,e,w,C[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===l){_=0;const t=Math.max(0,(y.len-v)/(2*C.length-2));let e=0;C.forEach(((i,n)=>{this.layoutCross(x,"flex-start",y,e,w,C[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}x.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),e.addUpdateLayoutTag(),h||this.tempBounds.equals(e.AABBBounds)||this.tryLayout(e)}layoutMain(t,e,i,n,r,o,s){if("flex-start"===i){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[n.field]=t+bk(e[i],n.field),t+=r[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=o;i<=s.idx;i++)t-=r[i].mainLen,e[i].attribute[n.field]=t+bk(e[i],n.field)}else if("space-around"===i)if(s.mainLen>=n.len){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[n.field]=t+bk(e[i],n.field),t+=r[i].mainLen}else{const t=s.idx-o+1,i=(n.len-s.mainLen)/t/2;let a=i;for(let t=o;t<=s.idx;t++)e[t].attribute[n.field]=a+bk(e[t],n.field),a+=r[t].mainLen+2*i}else if("space-between"===i)if(s.mainLen>=n.len){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[n.field]=t+bk(e[i],n.field),t+=r[i].mainLen}else{const t=s.idx-o+1,i=(n.len-s.mainLen)/(2*t-2);let a=0;for(let t=o;t<=s.idx;t++)e[t].attribute[n.field]=a+bk(e[t],n.field),a+=r[t].mainLen+2*i}}layoutCross(t,e,i,n,r,o,s){if("flex-end"===e)for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=n-r[e].crossLen+bk(t[e],i.field);else if("center"===e)for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=n-r[e].crossLen/2+bk(t[e],i.field);else for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=n+bk(t[e],i.field)}activate(t){this.pluginService=t,hk.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),hk.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){hk.hooks.onAttributeUpdate.taps=hk.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),hk.hooks.onSetStage.taps=hk.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}function bk(t,e){if(!t.attribute.boundsPadding)return 0;if(function(t){return"number"==typeof t&&Number.isFinite(t)}(t.attribute.boundsPadding))return t.attribute.boundsPadding;if(qu(t.attribute.boundsPadding)&&1===t.attribute.boundsPadding.length)return t.attribute.boundsPadding[0];const i=Cw(t.attribute.boundsPadding);return"x"===e?i[3]:"y"===e?i[0]:0}const vk=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===aw.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=aw.INITIAL,Ib.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Ib.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:sw},{mode:"timeout",cons:ow},{mode:"manual",cons:rw}];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 sw;break;case"timeout":t=new ow;break;case"manual":t=new rw;break;default:console.warn("非法的计时器模式"),t=new sw}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,(t=>{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==aw.INITIAL&&(this.status=aw.PAUSE,!0)}resume(){return this.status!==aw.INITIAL&&(this.status=aw.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===aw.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===aw.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=aw.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=aw.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};vk.addTimeline(cw),vk.setFPS(60);class wk{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=Ow.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=$d(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Ud(Vd((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let r;r=Yu(e)?Ow.get(e).value:e;const o=this.colorRgb;return Ow.to.rgb(o[0]*r[0]*n,o[1]*r[1]*n,o[2]*r[2]*n)}}const Ck="white";class xk extends Xx{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Ck}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new jv,this.hooks={beforeRender:new iy(["stage"]),afterRender:new iy(["stage"])},this.global=qb.get(ry),this.window=qb.get(r_),this.renderService=qb.get(eM),this.pickerService=qb.get(fM),this.pluginService=qb.get(xR),this.layerService=qb.get(h_),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new ip,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Ck,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new nw({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||vk,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new hw,this.ticker.addTimeline(this.timeline),this.timeline.pause(),this.optmize(t.optimize)}optmize(t){this.optmizeRender(null==t?void 0:t.skipRenderWithOutRange)}optmizeRender(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this._skipRender=this.window.isVisible()?0:1,this.window.onVisibleChange((t=>{t?(this.dirtyBounds&&this.dirtyBounds.setValue(0,0,this._viewBox.width(),this._viewBox.height()),this._skipRender>1&&this.renderNextFrame(),this._skipRender=0):this._skipRender=1})))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:r=0,camera:o,fieldRatio:s=1,fieldDepth:a}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:r,camera:o,fieldRatio:s,fieldDepth:a})}set3dOptions(t){var e,i,n,r,o,s;this.option3d=t;const a=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=a,{dir:g=[1,1,-1],color:m="white",ambient:y}=l,b=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(r=h.dy)&&void 0!==r?r:0),w=[b,v,(null!==(o=h.z)&&void 0!==o?o:0)+(null!==(s=h.dz)&&void 0!==s?s:0)];let C=0,x=0,_=0;c||(C=Math.sin(u)+b,x=Math.sin(d)+v,_=Math.cos(u)*Math.cos(d)*1),this.light=new wk(g,m,y);const S={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[C,x,_],center:w,up:[0,1,0]}};this.camera?this.camera.params=S:this.camera=new _M(S),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new dk))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new uk))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new pk))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ep;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new mk,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new yk))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new fk))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.timeline.resume(),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)),this._skipRender&&this._skipRender++}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start(),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear()),this._skipRender&&this._skipRender++}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,r){let o=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(o=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===r&&(o=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),o&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Jd(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;const i=qb.get(r_);if(t)i.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""});else{const t=e?e.width():Math.min(this.viewWidth,this.window.width-this.x),n=e?e.height():Math.min(this.viewHeight,this.window.height-this.y);i.create({width:t,height:n,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""})}const n=e?-e.x1:0,r=e?-e.y1:0;return this.renderTo(i,{x:n,y:r,width:e?e.x2:i.width,height:e?e.y2:i.height}),i}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var _k;function Sk(t,e,i){if(!t.isHeader(e,i)&&!0!==t.getBodyColumnDefine(e,i)?.mergeCell)return!1;const n=t.getCellRange(e,i);return!(n.start.col===n.end.col&&n.start.row===n.end.row)&&n}!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(_k||(_k={}));const Ak=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class Tk extends Xx{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){$u(this.attribute[t])?fd(this.attribute[t],e):this.attribute[t]=e,Ak.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Ak.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){Vu(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const n=e[i];$u(this.attribute[n])?fd(this.attribute[n],t[n]):this.attribute[n]=t[n]}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class Bk extends Tk{constructor(t){super(fd({},Bk.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{var e,i;const{viewX:n,viewY:r}=t,{direction:o,width:s,height:a,range:l}=this.attribute,h=this._sliderSize,[c,u]=this._getScrollRange();let d;if("vertical"===o){const t=r-this._viewPosition.y,e=Pd(t-h/2,c,u);d=t/a,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=Pd(t-h/2,c,u);d=t/s,this._slider.setAttribute("x",e,!0)}this.setScrollRange([d-(l[1]-l[0])/2,d+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===sk.env?(sk.addEventListener("pointermove",this._onSliderPointerMove),sk.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,r=0;const o=this.getScrollRange(),{width:s,height:a}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,r=n-this._prePos,i=r/a):(n=t.clientX,r=n-this._prePos,i=r/s),this.setScrollRange([o[0]+i,o[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===sk.env?(sk.removeEventListener("pointermove",this._onSliderPointerMove),sk.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:r="horizontal",limitRange:o=[0,1],range:s}=this.attribute,a=Ed(t,o[0],o[1]);if(e){const t=this._getSliderPos(a);this._slider&&("horizontal"===r?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=a,this._onChange({pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:r=[0,1],railStyle:o,sliderStyle:s,padding:a=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},o),"rect");this._rail=h;const c=this._getSliderRenderBounds(),u=this._getSliderPos(Ed(n,r[0],r[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const f=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),s),{boundsPadding:Ip(a),pickMode:"imprecise"}),"rect");this._slider=f,this._container=l;const g=this._container.AABBBounds;this._viewPosition={x:g.x1,y:g.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,r,o,s]=Ip(i),a={x1:s,y1:n,x2:t-r,y2:e-o,width:t-(s+r),height:e-(n+o)};return this._sliderRenderBounds=a,a}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:r,y1:o}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+r,i*t[1]+r]:[n*t[0]+o,n*t[1]+o]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=Ed(t,0,1),{width:r,height:o,x1:s,y1:a}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Ed([s+i*r,s+n*r],s,r-l):Ed([a+i*o,a+n*o],a,o-l)}_onChange(t){var e;const i=new Zv("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function Mk(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Mk(t,e)}))}function Rk(t,e,i){const n=function(t,e){const[i,n]=t,[r,o]=e,s=Math.sqrt((i*i+n*n)*(r*r+o*o)),a=s&&(i*r+n*o)/s;return Math.acos(Math.min(Math.max(a,-1),1))}(t,e),r=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?r?2*Math.PI-n:n:r?n:2*Math.PI-n}var Pk;Bk.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]},function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Pk||(Pk={}));const Ek={[Pk.selectedReverse]:{},[Pk.selected]:{},[Pk.hover]:{},[Pk.hoverReverse]:{}};function Hk(t,e){var i;if(!t)return{width:0,height:0};const n=lT({text:t,fontFamily:e.fontFamily,fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(i=e.textAlign)&&void 0!==i?i:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:n.width(),height:n.height()}}var Lk=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};class kk extends Tk{constructor(t){super(fd({},kk.defaultAttributes,t)),this.name="tag"}render(){var t;const{text:e="",textStyle:i={},shape:n={},panel:r={},space:o=4,minWidth:s,maxWidth:a,padding:l=4,visible:h,state:c}=this.attribute,u=Ip(l),d=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let p,f=u[1]+u[3],g=u[0]+u[2],m=0,y=0;const{visible:b}=n,v=Lk(n,["visible"]);if(Nu(b)){const t=(null==v?void 0:v.size)||10,e=Qu(t)?t:Math.max(t[0],t[1]);p=d.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:t,strokeBoundsBuffer:0},v),{visible:b,x:e/2,y:e/2}),"symbol"),od(null==c?void 0:c.shape)||(p.states=c.shape),b&&(y=e+o)}f+=y,m+=y;const w=Object.assign(Object.assign({text:e,visible:Uu(e)&&!1!==h,lineHeight:null==i?void 0:i.fontSize},i),{x:m,y:0});Vu(w.lineHeight)&&(w.lineHeight=w.fontSize);const C=d.createOrUpdateChild("tag-text",w,"text");od(null==c?void 0:c.text)||(C.states=c.text);const x=Hk(w.text,i),_=x.width,S=x.height;f+=_;const A=null!==(t=n.size)&&void 0!==t?t:10,T=Qu(A)?A:Math.max(A[0],A[1]);g+=Math.max(S,(null==n?void 0:n.visible)?T:0);const{textAlign:B,textBaseline:M}=i;(Uu(s)||Uu(a))&&(Uu(s)&&f<s&&(f=s),Uu(a)&&f>a&&(f=a,C.setAttribute("maxLineWidth",a-u[1]-u[2])));let R=0,P=0;"center"===B?(R-=f/2,p&&p.setAttribute("x",(p.attribute.x||0)-_/2),d.setAttribute("x",-y/2)):"right"===B||"end"===B?(R-=f,p&&p.setAttribute("x",(p.attribute.x||0)-_),d.setAttribute("x",-u[1]-y)):"left"!==B&&"start"!==B||d.setAttribute("x",u[3]),"middle"===M?(P-=g/2,p&&p.setAttribute("y",0)):"bottom"===M?(P-=g,p&&p.setAttribute("y",-S/2),d.setAttribute("y",-u[2])):"top"===M&&(d.setAttribute("y",u[0]),p&&p.setAttribute("y",S/2));const{visible:E}=r,H=Lk(r,["visible"]);if(h&&Nu(E)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},H),{visible:E&&!!e,x:R,y:P,width:f,height:g}),"rect");od(null==c?void 0:c.panel)||(t.states=c.panel)}}}kk.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var Ik=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};const Ok=new ip;class Dk extends Tk{constructor(t){super(fd({},Dk.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,i,n,r,o,s,a;const{titleStyle:l={},position:h,contentStyle:c={},panel:u={},space:d=4,minWidth:p=0,maxWidth:f=1/0,padding:g=4,maxWidthPercent:m,visible:y,state:b,dx:v=0,dy:w=0}=this.attribute;let{title:C="",content:x=""}=this.attribute;C=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(C):C,x=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(x):x;const _=Ip(g),S=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),A=f-_[1]-_[3],T=Uu(C)&&!1!==y,B=Object.assign(Object.assign({text:qu(C)?C:[C],visible:T},l),{x:_[3],y:_[0],maxLineWidth:A,textAlign:"left",textBaseline:"top"}),M=S.createOrUpdateChild("poptip-title",B,"wrapText");od(null==b?void 0:b.title)||(M.states=b.title);const R=M.AABBBounds,P=R.height(),E=R.width();let H=P+d;T||(H=0);const L=Uu(x)&&!1!==y,k=Object.assign(Object.assign({text:qu(x)?x:[x],visible:L},c),{x:_[3],y:_[0]+H,maxLineWidth:A,textAlign:"left",textBaseline:"top"}),I=S.createOrUpdateChild("poptip-content",k,"wrapText");od(null==b?void 0:b.content)||(I.states=b.content);const O=I.AABBBounds,D=O.height(),F=O.width();L&&(H+=D);let z=Vd(E+_[1]+_[3],F+_[1]+_[3]);z>f?z=f:z<p&&(z=p);let W=_[0]+_[2]+H;const{visible:j}=u,N=Ik(u,["visible"]),G=null!==(t=N.size)&&void 0!==t?t:12,V=qu(G)?[G[0]+(null!==(e=N.space)&&void 0!==e?e:0),G[1]+(null!==(i=N.space)&&void 0!==i?i:0)]:G+(null!==(n=N.space)&&void 0!==n?n:0),U=null!==(r=N.lineWidth)&&void 0!==r?r:1,K=this.stage?[null!==(o=this.stage.viewWidth)&&void 0!==o?o:this.stage.width,null!==(s=this.stage.viewHeight)&&void 0!==s?s:this.stage.height]:void 0;if(K){const t=this.AABBBounds,e=null!==(a=this.attribute.x)&&void 0!==a?a:t.x1,i=K[0]-t.x1;let n=Math.max(e,i);const r=(qu(G)?G[0]:12)+3;if(n=Math.min(n-r,n*m),n<z){z=n;const t=_[1]+_[3];M.setAttribute("maxLineWidth",n-t),I.setAttribute("maxLineWidth",n-t),W=_[0]+_[2],T&&(W+=M.AABBBounds.height()+d),W+=I.AABBBounds.height()}}const $="auto"===h;let X,Y=-1/0;for(let t=0;t<this.positionList.length+1;t++){const e=$?this.positionList[t===this.positionList.length?X:t]:h,{angle:i,offset:n,rectOffset:r}=this.getAngleAndOffset(e,z,W,qu(V)?V:[V,V-U]);if(Nu(j)){const t=(qu(G)?G[0]:G)/4,e=S.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},N),{visible:j&&(L||T),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:i,dx:n[0],dy:n[1],size:G,zIndex:-9}),"symbol");od(null==b?void 0:b.panel)||(e.states=b.panel);const r=S.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},N),{visible:j&&(L||T),x:0,y:0,width:z,height:W,zIndex:-8}),"rect");od(null==b?void 0:b.panel)||(r.states=b.panel)}if(S.setAttributes({x:-n[0]+v,y:-n[1]+w}),!$||!K)break;{Ok.setValue(0,0,z,W).transformWithMatrix(S.globalTransMatrix);const e=Ok,i=(new ep).setValue(0,0,K[0],K[1]);if(Z=i,J=!1,(q=e)&&Z?(mp=q.x1,yp=q.x2,bp=q.y1,vp=q.y2,wp=Z.x1,Cp=Z.x2,xp=Z.y1,_p=Z.y2,J&&(mp>yp&&([mp,yp]=[yp,mp]),bp>vp&&([bp,vp]=[vp,bp]),wp>Cp&&([wp,Cp]=[Cp,wp]),xp>_p&&([xp,_p]=[_p,xp])),mp>wp&&yp<Cp&&bp>xp&&vp<_p?Ap.BBOX1:wp>mp&&Cp<yp&&xp>bp&&_p<vp?Ap.BBOX2:Ap.NONE):Ap.NONE)break;{const n=Sp(e,i,!1),r=(n.x2-n.x1)*(n.y2-n.y1);r>Y&&(Y=r,X=t)}}}var q,Z,J}getAngleAndOffset(t,e,i,n){const r=n[1]/2;switch(t){case"tl":return{angle:Dd/2*3,offset:[e/4,i+r],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:Dd/2*3,offset:[e/2,i+r],rectOffset:[0,-i-n[1]]};case"tr":return{angle:Dd/2*3,offset:[e/4*3,i+r],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-r,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-r,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-r,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:Dd/2,offset:[e/4,-r],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:Dd/2,offset:[e/2,-r],rectOffset:[0,-i-n[1]]};case"br":return{angle:Dd/2,offset:[e/4*3,-r],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:Dd,offset:[e+r,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:Dd,offset:[e+r,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:Dd,offset:[e+r,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}Dk.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const Fk={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},zk={poptip:fd({},Fk)};var Wk=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let jk=class{render(t,e,i,n,r,o,s,a,l,h,c,u,d){var p,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const n={};fd(n,Dk.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new Dk(n);let r=t.attribute.poptip||{};if("text"===t.type&&null==r.title&&null==r.content){const e={};f=r,fd(e,zk.poptip,f),r=e,r.content=null!==(p=r.content)&&void 0!==p?p:t.attribute.text}const o=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},r),{x:o.e,y:o.f})),h.stage.tryInitInteractiveLayer();const s=h.stage.getLayer("_builtin_interactive");s&&s.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};jk=Wk([Vm()],jk);var Nk=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Gk=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};Gk=Nk([Vm()],Gk);let Vk=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=Vv.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};Vk=Nk([Vm()],Vk);const Uk=new zm(((t,e,i,n)=>{i(jk)||(t(jk).toSelf().inSingletonScope(),t(k_).toService(jk)),i(Gk)||(t(Gk).toSelf(),t(CR).toService(Gk)),i(Vk)||(t(Vk).toSelf(),t(CR).toService(Vk))}));class Kk extends Tk{constructor(t){super(fd({},Kk.defaultAttributes,t)),this.name="segment"}computeLineAngle(){const{points:t}=this.attribute,e=t[0],i=t[1],n=t[t.length-2],r=t[t.length-1],o=[e.x-i.x,e.y-i.y],s=Math.atan2(o[1],o[0]),a=[r.x-n.x,r.y-n.y],l=Math.atan2(a[1],a[0]);this._startAngle=s,this._endAngle=l}render(){this.removeAllChild();const{points:t,startSymbol:e,endSymbol:i,lineStyle:n,state:r,visible:o=!0}=this.attribute;if(!o)return;t.length>1&&this.computeLineAngle();const s=this.renderSymbol(e,"start"),a=this.renderSymbol(i,"end");this.startSymbol=s,this.endSymbol=a;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=QA(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),od(null==r?void 0:r.line)||(h.states=r.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const r=this._startAngle,o=this._endAngle,{points:s,state:a}=this.attribute,l=s[0],h=s[s.length-1],{refX:c=0,refY:u=0,refAngle:d=0,style:p,symbolType:f,size:g=12}=t;let m,y;"start"===e?(m={x:l.x+(r?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(r?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},y=r+Math.PI/2):(m={x:h.x+(o?c*Math.cos(o)+u*Math.cos(o-Math.PI/2):0),y:h.y+(o?c*Math.sin(o)+u*Math.sin(o-Math.PI/2):0)},y=o+Math.PI/2),n=nT(Object.assign(Object.assign(Object.assign({},m),{symbolType:f,size:g,angle:i?y+d:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),od(null==a?void 0:a.symbol)||(n.states=a.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var $k,Xk;Kk.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}($k||($k={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Xk||(Xk={}));const Yk={[Xk.selectedReverse]:{},[Xk.selected]:{},[Xk.hover]:{},[Xk.hoverReverse]:{}},qk={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};var Zk=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};class Jk extends Tk{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!od(e.states)&&(e.addState(Pk.hover,!0),Mk(this.axisContainer,(t=>{t!==e&&t.name&&!od(t.states)&&t.addState(Pk.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Mk(this.axisContainer,(t=>{t.name&&!od(t.states)&&(t.removeState(Pk.hoverReverse),t.removeState(Pk.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(Pk.selected))return this._lastSelect=null,void Mk(this.axisContainer,(t=>{t.name&&!od(t.states)&&(t.removeState(Pk.selectedReverse),t.removeState(Pk.selected))}));e.name&&!od(e.states)&&(e.addState(Pk.selected,!0),Mk(this.axisContainer,(t=>{t!==e&&t.name&&!od(t.states)&&t.addState(Pk.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=cd(this.attribute);fd(this.attribute,t);const i=JA({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=JA({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:r,items:o}=this.attribute,s=JA({x:0,y:0,zIndex:1});if(s.name=$k.axisContainer,s.id=this._getNodeId("container"),s.setMode(this.mode),this.axisContainer=s,t.add(s),(null==r?void 0:r.visible)&&this.renderLine(s),o&&o.length&&(this.data=this._transformItems(o[0]),(null==n?void 0:n.visible)&&this.renderTicks(s),null==i?void 0:i.visible)){const t=JA({x:0,y:0,pickable:!1});t.name=$k.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,s.add(t),o.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),r=n.getChildren();this.beforeLabelsOverlap(r,e,n,i,o.length),this.handleLabelsOverlap(r,e,n,i,o.length),this.afterLabelsOverlap(r,e,n,i,o.length)}))}(null==e?void 0:e.visible)&&this.renderTitle(s)}renderTicks(t){const e=this.getTickLineItems(),i=JA({x:0,y:0,pickable:!1});i.name=$k.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var r;const o=QA(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(o.name=$k.tick,o.id=this._getNodeId(t.id),od(null===(r=this.attribute.tick)||void 0===r?void 0:r.state))o.states=Ek;else{const t=this.data[n],e=fd({},Ek,this.attribute.tick.state);Object.keys(e).forEach((i=>{Gu(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),o.states=e}i.add(o)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,r)=>{const o=QA(Object.assign({},this._getTickLineAttribute("subTick",t,r,e)));if(o.name=$k.subTick,o.id=this._getNodeId(`${r}`),od(n.state))o.states=Ek;else{const i=fd({},Ek,n.state);Object.keys(i).forEach((n=>{Gu(i[n])&&(i[n]=i[n](t.value,r,t,e))})),o.states=i}i.add(o)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&Gu(n)&&(e=n(e,i));const r=this._transformItems(e),o=JA({x:0,y:0,pickable:!1});o.name=`${$k.labelContainer}-layer-${i}`,o.id=this._getNodeId(`label-container-layer-${i}`),t.add(o);let s=0,a=0,l="center",h="middle";return r.forEach(((t,e)=>{var n,c;const u=this._getLabelAttribute(t,e,r,i),d=iT(u);if(d.name=$k.label,d.id=this._getNodeId(`layer${i}-label-${t.id}`),od(null===(n=this.attribute.label)||void 0===n?void 0:n.state))d.states=Ek;else{const n=fd({},Ek,this.attribute.label.state);Object.keys(n).forEach((o=>{Gu(n[o])&&(n[o]=n[o](t,e,r,i))})),d.states=n}o.add(d);const p=null!==(c=u.angle)&&void 0!==c?c:0;s=Math.max(s,d.AABBBounds.width()),a=Math.max(a,d.AABBBounds.height()),p&&(s=Math.abs(s*Math.cos(p)),a=Math.abs(a*Math.sin(p))),l=u.textAlign,h=u.textBaseline})),this.axisLabelLayerSize[i]={width:s,height:a,textAlign:l,textBaseline:h},o}renderTitle(t){const e=this.getTitleAttribute(),i=new kk(Object.assign({},e));i.name=$k.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return Td(t[0],0)?Td(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:r=!1,length:o,dataFilter:s}=t;let a=1;return e.length>=2&&(a=e[1].value-e[0].value),(s&&Gu(s)?s(e):e).forEach((t=>{let e=t.point,s=t.value;if(!n){const i=t.value-a/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),s=i}const l=this.getVerticalCoord(e,o,r);if("3d"===this.mode){const n=this.getVerticalVector(o,r,e);let a=0,h=0;jd(n[0])>jd(n[1])?a=Dd/2*(l.x>e.x?1:-1):h=Dd/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:s,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:a,beta:h})}else i.push({start:e,end:l,value:s,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:r=2}=t,o=this.tickLineItems,s=o.length;if(s>=2)for(let t=0;t<s-1;t++){const s=o[t],a=o[t+1];for(let t=0;t<i;t++){const o=(t+1)/(i+1),l=(1-o)*s.value+o*a.value,h=this.getTickCoord(l),c=this.getVerticalCoord(h,r,n);e.push({start:h,end:c,value:l,id:`sub-tick-${l}`})}}return e}_getTickLineAttribute(t,e,i,n){let r=sd(this.attribute,`${t}.style`);const o=this.data[i];r=Gu(r)?fd({},sd(qk,`${t}.style`),"tick"===t?r(o.rawValue,i,o,this.data):r(e.value,i,e,n)):r;const{start:s,end:a,anchor:l,alpha:h,beta:c}=e;return Object.assign({points:[s,a],anchor:l,alpha:h,beta:c},r)}_getLabelAttribute(t,e,i,n){var r,o,s,a,l,h;const c=this.attribute.label,{space:u=4,inside:d=!1,formatMethod:p}=c,f=Zk(c,["space","inside","formatMethod"]);let g=u,m=0;(null===(r=this.attribute.tick)||void 0===r?void 0:r.visible)&&(null===(o=this.attribute.tick)||void 0===o?void 0:o.inside)===d&&(m=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(a=this.attribute.subTick)||void 0===a?void 0:a.visible)&&(null===(l=this.attribute.subTick)||void 0===l?void 0:l.inside)===d&&(m=Math.max(m,(null===(h=this.attribute.subTick)||void 0===h?void 0:h.length)||2)),g+=m;const y=this.getRelativeVector(t.point);n>0&&(0===y[1]?g+=(this.axisLabelLayerSize[n-1].height+sd(this.attribute,"label.space",4))*n:g+=(this.axisLabelLayerSize[n-1].width+sd(this.attribute,"label.space",4))*n);const b=this.getVerticalCoord(t.point,g,d),v=this.getVerticalVector(g,d,b),w=p?p(`${t.label}`,t,e,i,n):t.label;let{style:C}=f;C=Gu(C)?fd({},qk.label.style,C(t,e,i,n)):C;return C=fd(this.getLabelAlign(v,d,C.angle),C),Gu(C.text)&&(C.text=C.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},b),{text:w,lineHeight:null==C?void 0:C.fontSize}),C)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}}const Qk={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&tI(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function tI(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function eI(t,e){for(let i,n=1,r=t.length,o=t[0].AABBBounds;n<r;o=i,++n)if(tI(o,i=t[n].AABBBounds,e))return!0}function iI(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function nI(t){for(let n=1;n<t.length;n++)if(e=t[n-1],i=t[n],function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const r=Ep(t,i),o=Ep(e,i),s=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,o.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const a=Pp(t),l=Pp(e);n&&n.fillRect(a.x,a.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=s(a,l),c=s(r[0],r[1]),u=s(r[1],r[2]),d=s(o[0],o[1]),p=s(o[1],o[2]),f=i?t.angle:Rp(t.angle);let g=i?t.angle+Fd:Rp(90-t.angle);const m=i?e.angle:Rp(e.angle);let y=i?e.angle+Fd:Rp(90-e.angle);g>Wd&&(g-=Wd),y>Wd&&(y-=Wd);const b=(t,e,i,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(Bp(r,i)+Bp(r,n))/2>Bp(r,h)};return b((t.x2-t.x1)/2,f,d,p)&&b((t.y2-t.y1)/2,g,d,p)&&b((e.x2-e.x1)/2,m,c,u)&&b((e.y2-e.y1)/2,y,c,u)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function rI(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},sI(t,e.attribute.angle)),{angle:oI(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},aI(t,e.attribute.angle)),{angle:oI(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(o=e.centerX,s=e.centerY,a=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(o-l)*Math.cos(a)+(s-h)*Math.sin(a)+l,y:(o-l)*Math.sin(a)+(h-s)*Math.cos(a)+h}),n=i.x-e.centerX,r=i.y-e.centerY;var o,s,a,l,h;e.x1+=n,e.x2+=n,e.y1+=r,e.y2+=r,e.centerX+=n,e.centerY+=r,t.rotatedBounds=e}))}(e)}function oI(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function sI(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const r=(e=oI(e))/(.5*Math.PI);let o;return o=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,{textAlign:i[o],textBaseline:n[o]}}function aI(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const r=(e=oI(e))/(.5*Math.PI);let o;return o=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,{textAlign:i[o],textBaseline:n[o]}}var lI=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};class hI extends Jk{constructor(t,e){super(fd({},hI.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_renderInner(t){var e;super._renderInner(t);const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,n=t.AABBBounds,r=eT(Object.assign({x:n.x1,y:n.y1,width:n.width(),height:n.height()},i.style));r.name=$k.background,r.id=this._getNodeId("background"),r.states=fd({},Yk,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(r,t.firstChild)}}renderLine(t){const{start:e,end:i,line:n}=this.attribute,r=n,{startSymbol:o,endSymbol:s,style:a,breakRange:l,breakShape:h,breakShapeStyle:c,state:u}=r,d=lI(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),p=Object.assign({points:[e,i],startSymbol:o,endSymbol:s,lineStyle:a},d);od(u)||(p.state={line:fd({},Yk,u),symbol:fd({},Yk,u)});const f=new Kk(p);f.name=$k.line,f.id=this._getNodeId("line"),t.add(f)}getTitleAttribute(){var t,e,i,n,r,o,s,a;const l=this.attribute.title,{position:h="middle",space:c=4,textStyle:u={},autoRotate:d=!0,shape:p,background:f,state:g}=l,m=lI(l,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===h?y=0:"end"===h&&(y=1);const{verticalFactor:b=1}=this.attribute,v=-1*b,w=this.getTickCoord(y),C=this.getRelativeVector();let x=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+sd(this.attribute,"label.space",4);x+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===C[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?x+=i+(e-1)*t:x=0}else{if(0===C[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?x+=i+(e-1)*t:x=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{x+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,r="center"===i,o=C[1]>0;x=1===v?o?n?x:r?x/2:t:n?t:r?x/2:x:o?n?t:r?x/2:x:n?x:r?x/2:t}}let _=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(_=(null===(r=this.attribute.tick)||void 0===r?void 0:r.length)||4),(null===(o=this.attribute.subTick)||void 0===o?void 0:o.visible)&&!1===(null===(s=this.attribute.subTick)||void 0===s?void 0:s.inside)&&(_=Math.max(_,(null===(a=this.attribute.subTick)||void 0===a?void 0:a.length)||2));const S=_+x+c,A=this.getVerticalCoord(w,S,!1),T=this.getVerticalVector(S,!1,{x:0,y:0});let B,M,{angle:R}=m;if(B="start"===h?"start":"end"===h?"end":"center",Vu(R)&&d){R=Rk(C,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else B=this.getTextAlign(T),M=this.getTextBaseline(T,!1);const P=Object.assign(Object.assign(Object.assign({},A),m),{textStyle:Object.assign({textAlign:B,textBaseline:M},u),state:{text:fd({},Yk,null==g?void 0:g.text),shape:fd({},Yk,null==g?void 0:g.shape),panel:fd({},Yk,null==g?void 0:g.background)}});return P.angle=R,p&&p.visible&&(P.shape=Object.assign({visible:!0},p.style),p.space&&(P.space=p.space)),f&&f.visible&&(P.panel=Object.assign({visible:!0},f.style)),P}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,r=(e?1:-1)*n;return Td(t[1],0)?i=!Td(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===r?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(td(i)){if("top"===n||"bottom"===n)return sI(n,i);if("left"===n||"right"===n)return aI(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,r){const{flush:o=!1}=this.attribute.label||{};if(o){const{orient:e,start:i,end:n}=this.attribute,r="bottom"===e||"top"===e,o=t[0],s=vd(t),a=r?o.attribute.x>s.attribute.x:o.attribute.y<s.attribute.y;if(r){const t=Math.abs(i.x-n.x);if(a){const e=t,i=0,n=o.AABBBounds.x2,r=s.AABBBounds.x1;n>e&&o.setAttributes({x:e,textAlign:"right"}),r<i&&s.setAttributes({x:i,textAlign:"left"})}else{const e=0,i=t,n=o.AABBBounds.x1,r=s.AABBBounds.x2;n<e&&o.setAttributes({x:e,textAlign:"left"}),r>i&&s.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(a){const e=o.AABBBounds.y1,i=s.AABBBounds.y2,n=0,r=t;e<n&&o.setAttributes({y:n,textBaseline:"top"}),i>r&&s.setAttributes({y:r,textBaseline:"bottom"})}else{const e=t,i=0,n=o.AABBBounds.y2,r=s.AABBBounds.y1;n>e&&o.setAttributes({y:e,textBaseline:"bottom"}),r<i&&s.setAttributes({y:i,textBaseline:"top"})}}}}handleLabelsOverlap(t,e,i,n,r){if(od(t))return;const{verticalLimitSize:o,label:s,orient:a}=this.attribute,l=this._getAxisLabelLimitLength(o,r),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:d,limitEllipsis:p,autoHide:f,autoHideMethod:g,autoHideSeparation:m}=s;Gu(h)?h(t,e,n,this):(c&&function(t,e){if(od(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let r=0,o=0;for(n&&n.length>0&&(o=n.length);r<o;){const e=n[r++];if(t.forEach((t=>{t.attribute.angle=np(e)})),rI(i,t),!nI(t))break}}(t,{labelRotateAngle:u,orient:a}),d&&td(l)&&l>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:r}=e;!od(t)&&td(i)&&t.forEach((t=>{if(("top"===r||"bottom"===r)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===r||"right"===r)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||Vu(t.attribute.angle)?"top"===r||"bottom"===r?null:i:Math.abs(i/Math.sin(t.attribute.angle));td(t.attribute.maxLineWidth)&&(e=td(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:l,ellipsis:p,orient:a}),f&&function(t,e){if(od(t))return;const i=t.filter(iI);if(od(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:r="parity",separation:o=0}=e,s=Gu(r)?r:Qk[r]||Qk.parity;if(n.length>=3&&eI(n,o)){do{n=s(n,o)}while(n.length>=3&&eI(n,o));n.length<3&&!vd(i).attribute.opacity&&(n.length>1&&vd(n).setAttribute("opacity",0),vd(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:a,method:g,separation:m}))}afterLabelsOverlap(t,e,i,n,r){const{verticalLimitSize:o,orient:s}=this.attribute,a="bottom"===s||"top"===s,l=i.AABBBounds;let h=a?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(td(c)&&(!td(o)||c<=o)){const t=this._getAxisLabelLimitLength(c,r);let e,n;h=Math.max(h,t),"left"===s?(e=l.x2-h,n=l.y1):"right"===s?(e=l.x1,n=l.y1):"top"===s?(e=l.x1,n=l.y2-h):"bottom"===s&&(e=l.x1,n=l.y1);const o=eT({x:e,y:n,width:a?l.width():h,height:a?h:l.height(),pickable:!1});o.name=$k.axisLabelBackground,o.id=this._getNodeId("axis-label-background"),i.insertBefore(o,i.firstChild)}if(Uu(this.attribute.label.containerAlign)){let e;"left"===s?e=l.x2:"right"===s?e=l.x1:"top"===s?e=l.y2:"bottom"===s&&(e=l.y1),function(t,e,i,n,r){if("right"===n||"left"===n){if("left"===r){const r="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*r,textAlign:"left"})}))}else if("right"===r){const r="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*r,textAlign:"right"})}))}else if("center"===r){const r="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*r,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===r){const r="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*r,textBaseline:"top"})}))}else if("bottom"===r){const r="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*r,textBaseline:"bottom"})}))}else if("middle"===r){const r="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*r,textBaseline:"middle"})}))}}(t,e,h,s,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,r;const{label:o,title:s,line:a,tick:l}=this.attribute,h=null!==(i=o.space)&&void 0!==i?i:4;let c=t,u=0,d=0;const p=(null==a?void 0:a.visible)?null!==(n=a.style.lineWidth)&&void 0!==n?n:1:0,f=(null==l?void 0:l.visible)?null!==(r=l.length)&&void 0!==r?r:4:0;if(null==s?void 0:s.visible){u=Hk(s.text,s.textStyle).height;const t=Ip(s.padding);d=s.space+t[0]+t[2]}return c&&(c=(c-h-d-u-p-f)/e),c}}hI.defaultAttributes=qk,function(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let r=0;r<n.length;r++){const o=n[r];"constructor"!==o&&(i?null!=e[o]:null==t[o])&&(t[o]=e[o])}}else bd(t,e,i)}(hI,class{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*i)}});const cI={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class uI extends Tk{getCurrent(){return this._current}constructor(t){super(fd({},uI.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new Zv("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new Zv("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var t;this._reset();const{layout:e="horizontal",handler:i=cI,total:n,defaultCurrent:r=1,textStyle:o,padding:s=0}=this.attribute;this._current=r;const a=Ip(s),l="horizontal"===e,h=JA({x:0,y:0}),c=i.style||{},u=c.size||15,d=null!==(t=i.space)&&void 0!==t?t:8,p=i.state||{};let{preShape:f,nextShape:g}=i;f||(f=l?"triangleLeft":"triangleUp"),g||(g=l?"triangleRight":"triangleDown");const m=nT(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:f,size:u}));m.states=p,m.name="preHandler",this.preHandler=m,h.add(m);const{width:y,height:b}=Hk(`${n}/${n}`,Object.assign({textAlign:"center",textBaseline:"middle"},o)),v=Qu(u)?u:u[0],w=Qu(u)?u:u[1],C=iT(Object.assign({x:l?v/2+d+y/2:0,y:l?0:w/2+d+b/2,text:`${r}/${n}`,textAlign:"center",textBaseline:"middle",lineHeight:null==o?void 0:o.fontSize},o));this.text=C,h.add(C);const x=nT(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:l?v+2*d+y:0,y:l?0:w+2*d+b,symbolType:g,size:u}));x.name="nextHandler",x.states=p,this.nextHandler=x,h.add(x),1===this._total?(m.addState("disable"),x.addState("disable")):1===this._current?m.addState("disable"):this._current===n&&x.addState("disable");const _=h.AABBBounds,S=_.width(),A=_.height();h.translateTo(0-_.x1+a[3],0-_.y1+a[0]),this.add(h),this.attribute.width=S+a[1]+a[3],this.attribute.height=A+a[0]+a[2],this._bindEvents()}_bindEvents(){this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}uI.defaultAttributes={handler:cI,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const dI=16,pI=8,fI=12;var gI,mI,yI;!function(t){t.selected="selected",t.unSelected="unSelected",t.selectedHover="selectedHover",t.unSelectedHover="unSelectedHover",t.focus="focus"}(gI||(gI={})),function(t){t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.legendItemClick="legendItemClick",t.legendItemAttributeUpdate="legendItemAttributeUpdate"}(mI||(mI={})),function(t){t.innerView="innerView",t.title="legendTitle",t.item="legendItem",t.itemShape="legendItemShape",t.itemLabel="legendItemLabel",t.itemValue="legendItemValue",t.focus="legendItemFocus"}(yI||(yI={}));class bI extends Tk{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:t=!0,title:e,padding:i=0}=this.attribute,n=Ip(i),r=JA({x:n[3],y:n[0],pickable:t,childrenPickable:t});r.name=yI.innerView,this.add(r),this._innerView=r,(null==e?void 0:e.visible)&&this._renderTitle(e),this._renderContent(),this._adjustLayout(),t&&this._bindEvents();const o=this._innerView.AABBBounds;this.attribute.width=o.width()+n[1]+n[3],this.attribute.height=o.height()+n[0]+n[2]}_renderTitle(t){const{text:e="",textStyle:i,padding:n=0,background:r,minWidth:o,maxWidth:s,shape:a}=t,l={x:0,y:0,text:e,textStyle:i,padding:Ip(n),minWidth:o,maxWidth:s};a&&a.visible&&(l.shape=Object.assign({visible:!0},a.style),Uu(a.space)&&(l.space=a.space)),r&&r.visible&&(l.panel=Object.assign({visible:!0},r.style));const h=new kk(l);h.name=yI.title,this._title=h,this._innerView.add(h)}_adjustLayout(){var t;if(this._title){const e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),n=null===(t=this.attribute.title)||void 0===t?void 0:t.align;"center"===n?this._title.setAttribute("x",(e-i)/2):"end"===n&&this._title.setAttribute("x",e-i)}}}var vI=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};const wI={[gI.focus]:{},[gI.selected]:{},[gI.selectedHover]:{},[gI.unSelected]:{},[gI.unSelectedHover]:{}};class CI extends bI{constructor(t){super(fd({},CI.defaultAttributes,t)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(yI.item)){const t=i.delegate;t.hasState(gI.selected)?this._setLegendItemState(t,gI.selectedHover):this._setLegendItemState(t,gI.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===yI.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(mI.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(yI.item)){const t=i.delegate;let e=!1;(t.hasState(gI.unSelectedHover)||t.hasState(gI.selectedHover))&&(e=!0),t.removeState(gI.unSelectedHover),t.removeState(gI.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(gI.unSelectedHover)&&!t.hasState(gI.selectedHover)||(e=!0),t.removeState(gI.unSelectedHover),t.removeState(gI.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===yI.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(mI.legendItemAttributeUpdate,t),this._dispatchEvent(mI.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,r,o;const s=t.target;if(null===(e=null==s?void 0:s.name)||void 0===e?void 0:e.startsWith(yI.item)){const t=s.delegate;if(s.name===yI.focus){const e=t.hasState(gI.focus);t.toggleState(gI.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[gI.unSelected,gI.unSelectedHover,gI.focus]),this._setLegendItemState(t,gI.selected)})):(this._setLegendItemState(t,gI.selected),this._removeLegendItemState(t,[gI.unSelected,gI.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[gI.selected,gI.selectedHover,gI.focus]),this._setLegendItemState(e,gI.unSelected))})))}else{null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((t=>{t.removeState(gI.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(gI.selected),s=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===s.length)return void this._dispatchEvent(mI.legendItemClick,t);n?(this._removeLegendItemState(t,[gI.selected,gI.selectedHover]),this._setLegendItemState(t,gI.unSelected)):(this._setLegendItemState(t,gI.selected),this._removeLegendItemState(t,[gI.unSelected,gI.unSelectedHover]))}else this._setLegendItemState(t,gI.selected),this._removeLegendItemState(t,[gI.unSelected,gI.unSelectedHover]),null===(o=this._itemsContainer)||void 0===o||o.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[gI.selected,gI.selectedHover]),this._setLegendItemState(e,gI.unSelected))}))}this._dispatchEvent(mI.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,gI.selected),this._removeLegendItemState(e,[gI.unSelected,gI.unSelectedHover])):(this._removeLegendItemState(e,[gI.selected,gI.selectedHover]),this._setLegendItemState(e,gI.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:r=2}=this.attribute;if(!1===t.visible||od(e))return;let o=e;i&&(o=null==e?void 0:e.reverse());const s=JA({x:0,y:0});this._itemsContainer=s;const{layout:a,maxWidth:l,maxHeight:h,defaultSelected:c=[],autoPage:u}=this.attribute,d="horizontal"===a,{spaceCol:p=dI,spaceRow:f=pI,maxWidth:g,width:m,height:y}=t;Uu(g)?Uu(m)?this._itemWidthByUser=Math.min(g,m):this._itemWidthByUser=g:Uu(m)&&(this._itemWidthByUser=m),Uu(y)&&(this._itemHeightByUser=y);let b=!1,v=0,w=0,C=0,x=1,_=1;o.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!od(c)||(null==c?void 0:c.includes(t.label)),e,o),a=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),v=Math.max(a,v),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),d?(x=r,Uu(l)&&(a>=l?(b=!0,e>0&&(w=0,C+=u+f,_+=1)):l<w+a&&(b=!0,w=0,C+=u+f,_+=1)),e>0&&i.setAttributes({x:w,y:C}),w+=p+a):(x=n,Uu(h)&&h<C+u&&(b=!0,C=0,w+=v+p,v=0,_+=1),e>0&&i.setAttributes({x:w,y:C}),C+=f+u),s.add(i)}));let S=!1;b&&u&&_>x&&(S=this._renderPager(d)),S||(s.setAttribute("y",this._title?this._title.AABBBounds.height()+sd(this.attribute,"title.space",8):0),this._innerView.add(s))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:r,label:o,value:s,shape:a}=t,{padding:l=0,focus:h,focusIconStyle:c={}}=this.attribute.item;let{shape:u={},label:d={},value:p={},background:f={}}=this.attribute.item;u=this._handleStyle(u,t,e,i,n),d=this._handleStyle(d,t,e,i,n),p=this._handleStyle(p,t,e,i,n),f=this._handleStyle(f,t,e,i,n);const g=Ip(l);let m;!1===f.visible?(m=JA({x:0,y:0,cursor:(null==f?void 0:f.style).cursor}),this._appendDataToShape(m,yI.item,t,m)):(m=JA(Object.assign({x:0,y:0},null==f?void 0:f.style)),this._appendDataToShape(m,yI.item,t,m,null==f?void 0:f.state)),m.addState(e?gI.selected:gI.unSelected);const y=JA({x:0,y:0,pickable:!1});m.add(y);let b=0;const v=sd(u,"style.size",10),w=sd(u,"space",8),C=nT(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),u.style));let x;Object.keys(u.state||{}).forEach((t=>{const e=u.state[t].fill||u.state[t].stroke;a.fill&&Vu(u.state[t].fill)&&e&&(u.state[t].fill=e),a.stroke&&Vu(u.state[t].stroke)&&e&&(u.state[t].stroke=e)})),this._appendDataToShape(C,yI.itemShape,t,m,null==u?void 0:u.state),C.addState(e?gI.selected:gI.unSelected),y.add(C);let _=0;if(h){const e=sd(c,"size",10);x=nT(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},c),{visible:!1,pickMode:"imprecise",boundsPadding:g})),this._appendDataToShape(x,yI.focus,t,m),_=e}const S=iT(Object.assign(Object.assign({x:v/2+w,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==d?void 0:d.style).fontSize},null==d?void 0:d.style),{text:d.formatMethod?d.formatMethod(o,t,i):o}));this._appendDataToShape(S,yI.itemLabel,t,m,null==d?void 0:d.state),S.addState(e?gI.selected:gI.unSelected),y.add(S);const A=sd(d,"space",8);if(b+=v/2+w+S.AABBBounds.width()+A,Uu(s)){const n=sd(p,"space",h?8:0),r=iT(Object.assign(Object.assign({x:b+A,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==p?void 0:p.style).fontSize},null==p?void 0:p.style),{text:p.formatMethod?p.formatMethod(s,t,i):s}));if(this._appendDataToShape(r,yI.itemValue,t,m,null==p?void 0:p.state),r.addState(e?gI.selected:gI.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-g[1]-g[3]-v-w-A-_-n,e=r.AABBBounds,i=S.AABBBounds,o=e.width(),s=i.width();s>t?(t-o)/s>.4?S.setAttribute("maxLineWidth",t-o):(r.setAttribute("maxLineWidth",.5*t),S.setAttribute("maxLineWidth",.5*t)):r.setAttribute("maxLineWidth",t-s),p.alignRight&&r.setAttributes({textAlign:"right",x:this._itemWidthByUser-v/2-g[1]-g[3]-_-n})}b=r.AABBBounds.x2+n,y.add(r)}else this._itemWidthByUser&&S.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-v-w-_);x&&(x.setAttribute("x",b),y.add(x));const T=y.AABBBounds,B=T.width(),M=T.height(),R=Uu(this.attribute.item.width)?this.attribute.item.width:B+g[1]+g[3],P=this._itemHeightByUser||M+g[0]+g[2];return m.attribute.width=R,m.attribute.height=P,y.translateTo(-T.x1+g[3],-T.y1+g[0]),m}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+sd(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:r=1,maxRow:o=2,item:s={},pager:a={}}=this.attribute,{spaceCol:l=dI,spaceRow:h=pI}=s,c=this._itemsContainer,{animation:u=!0,animationDuration:d=450,animationEasing:p="quadIn",space:f=fI}=a,g=vI(a,["animation","animationDuration","animationEasing","space"]);let m,y=0,b=0,v=0,w=0,C=1;if(t){if(m=new uI(Object.assign({layout:1===o?"horizontal":"vertical",total:99},fd({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},g))),this._pager=m,this._innerView.add(m),y=(o-1)*h+this._itemHeight*o,b=i-m.AABBBounds.width()-f,b<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;b<v+i&&(v=0,w+=n+h,C+=1),e>0&&t.setAttributes({x:v,y:w}),v+=l+i})),m.setAttributes({total:Math.ceil(C/o),x:b,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new uI(Object.assign({layout:"horizontal",total:99},g)),this._pager=m,this._innerView.add(m),b=this._itemMaxWidth*r+(r-1)*l,y=n-m.AABBBounds.height()-f-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y<w+i&&(w=0,v+=this._itemMaxWidth+l,C+=1),e>0&&t.setAttributes({x:v,y:w}),w+=h+i})),m.setAttributes({total:Math.ceil(C/r),x:(b-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}a.defaultCurrent>1&&(t?c.setAttribute("y",-(a.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(a.defaultCurrent-1)*(b+l)));const x=JA({x:0,y:e,width:b,height:y,clip:!0,pickable:!1});x.add(c),this._innerView.add(x);const _=e=>{const{current:i}=e.detail;u?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(b+l)},d,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(b+l))};return this._pager.addEventListener("toPrev",_),this._pager.addEventListener("toNext",_),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==yI.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(mI.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==yI.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(mI.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(gI.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=fd({},wI,r)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const r=n.map((t=>t.label)),o=new Zv(t,{item:e,data:e.data,selected:e.hasState(gI.selected),currentSelectedItems:n,currentSelected:r});o.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(o)}_handleStyle(t,e,i,n,r){const o=fd({},t);return t.style&&Gu(t.style)&&(o.style=t.style(e,i,n,r)),t.state&&Object.keys(t.state).forEach((s=>{t.state[s]&&Gu(t.state[s])&&(o.state[s]=t.state[s](e,i,n,r))})),o}}var xI;function _I(t){switch(t){case xI.Linear:case xI.Log:case xI.Pow:case xI.Sqrt:case xI.Symlog:case xI.Time:return!0;default:return!1}}CI.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:dI,spaceRow:pI,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:fI,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(xI||(xI={}));class SI{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,r=e+i;return this._wholeRange=[n,r],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const AI=Symbol("implicit");class TI extends SI{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=xI.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=AI}clone(){return(new TI).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==AI)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;e<this._ordinalRange.length&&this._ordinalRange[e]!==t;)e++;return this._domain[(e-1)%this._domain.length]}domain(t){if(!t)return this._domain.slice();this._domain=[],this._index=new Map;for(const e of t){const t=`${e}`;this._index.has(t)||this._index.set(t,this._domain.push(e))}return this}range(t){if(!t)return this._ordinalRange.slice();const e=Array.from(t);return this._ordinalRange=e,this}}function BI(t){return t}function MI(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function RI(t,e,i){const n=t[0],r=t[1],o=e[0],s=e[1];let a,l;return r<n?(a=MI(r,n),l=i(s,o)):(a=MI(n,r),l=i(o,s)),t=>l(a(t))}function PI(t,e,i){const n=Math.min(t.length,e.length)-1,r=new Array(n),o=new Array(n);let s=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<n;)r[s]=MI(t[s],t[s+1]),o[s]=i(e[s],e[s+1]);return function(e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(Vu(n)&&(n=t.length);i<n;){const r=i+n>>>1;xd(t[r],e)>0?n=r:i=r+1}return i}(t,e,1,n)-1;return o[i](r[i](e))}}function EI(t,e,i,n){let r;const o=[];let s;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(r=e<t){const i=t;t=e,e=i}let a=Hd(1,e-t+1)(i);if(s=Math.floor((e-t+1)/a),!n)for(;Math.ceil((e-t+1)/s)>i&&a>1;)a-=1,s=Math.floor((e-t)/a);let l=t;for(;l<=e;)o.push(l),l+=s;return r&&o.reverse(),o}class HI extends TI{constructor(t){super(),this.type=xI.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]<e[0];let r=e[Number(n)-0];const o=e[1-Number(n)],s=function(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(o-r)/Math.max(1,s||1),this._round&&(this._step=Math.floor(this._step)),r+=(o-r-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(r=Math.round(r),this._bandwidth=Math.round(this._bandwidth));const a=Cd(i).map((t=>r+this._step*t));return super.range(n?a.reverse():a),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[_d(t[0]),_d(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[_d(t[0]),_d(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():EI(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return EI(0,e.length-1,t,!0).filter((t=>t<e.length)).map((t=>e[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let r;if(i=Hd(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),r=e<t){const i=t;t=e,e=i}let o=t;for(;o<=e;)n.push(o),o+=i;return r&&n.reverse(),n}(0,e.length-1,t).map((t=>e[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,r=this._domain.length,o=this.range(),s=o[0]>o[o.length-1];for(e=0;e<r;e++){const o=this.scale(this._domain[e])+n;if(0===e&&(!s&&!Bd(t,o+i)||s&&!Md(t,o-i)))break;if(e===r-1)break;if(!Md(t,o-i)&&!Bd(t,o+i))break}return e>=0&&e<=r-1?e:r-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new HI(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:LI}=gp;function kI(t,e){const i=typeof e;let n;if(Vu(e)||"boolean"===i)return()=>e;if("number"===i)return kd(t,e);if("string"===i){if(n=pp.parseColorString(e)){const e=LI(pp.parseColorString(t),n);return t=>e(t).formatRgb()}return kd(Number(t),Number(e))}return e instanceof fp?LI(t,e):e instanceof pp?LI(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),r=new Date;return t=>(r.setTime(i*(1-t)+n*t),r)}(t,e):kd(Number(t),Number(e))}class II extends SI{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:BI,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BI;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=BI,this._piecewise=RI,this._interpolate=kI}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kd)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,_d);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Id,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,r=this._range.length;let o=Math.min(n,r);if(n&&n<r&&this._forceAlign){const t=r-n+1,e=i[n-1],s=n>=2?(e-i[n-2])/t:0;for(let r=1;r<=t;r++)i[n-2+r]=e-s*(t-r);o=r}return void 0===this._clamp&&(this._clamp=Hd(i[0],i[o-1])),this._piecewise=o>2?PI:RI,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:BI),this.rescale(i)):this._clamp!==BI}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const OI=Math.sqrt(50),DI=Math.sqrt(10),FI=Math.sqrt(2),zI=[1,2,5,10],WI=(t,e,i)=>{let n=1,r=t;const o=Math.floor((e-1)/2),s=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?r=0:t<0&&t>=-Number.MIN_VALUE?r=-(e-1):!i&&s<1?n=VI(s).step:(i||s>1)&&(r=Math.floor(t)-o*n),n>0?(t>0?r=Math.max(r,0):t<0&&(r=Math.min(r,-(e-1)*n)),Cd(0,e).map((t=>r+t*n))):t>0?NI(0,-(e-1)/n,n):NI((e-1)/n,0,n)},jI=Rd(((t,e,i,n)=>{let r,o,s,a,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((r=e<t)&&(o=t,t=e,e=o),a=UI(t,e,i).step,!isFinite(a))return[];if(a>0){let i=Math.round(t/a),n=Math.round(e/a);for(i*a<t&&++i,n*a>e&&--n,s=new Array(o=n-i+1);++l<o;)s[l]=(i+l)*a}else if(a<0&&(null==n?void 0:n.noDecimals)){a=1;const i=Math.ceil(t),n=Math.floor(e);if(!(i<=n))return[];for(s=new Array(o=n-i+1);++l<o;)s[l]=i+l}else{a=-a;let i=Math.round(t*a),n=Math.round(e*a);for(i/a<t&&++i,n/a>e&&--n,s=new Array(o=n-i+1);++l<o;)s[l]=(i+l)/a}return r&&s.reverse(),s})),NI=(t,e,i)=>{let n,r,o=-1;if(i>0){let s=Math.floor(t/i),a=Math.ceil(e/i);for((s+1)*i<t&&++s,(a-1)*i>e&&--a,r=new Array(n=a-s+1);++o<n;)r[o]=(s+o)*i}else{i=-i;let s=Math.floor(t*i),a=Math.ceil(e*i);for((s+1)/i<t&&++s,(a-1)/i>e&&--a,r=new Array(n=a-s+1);++o<n;)r[o]=(s+o)/i}return r},GI=Rd(((t,e,i,n)=>{let r,o,s;if(i=+i,(t=+t)==(e=+e))return WI(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return WI(t,i,null==n?void 0:n.noDecimals);(r=e<t)&&(s=t,t=e,e=s);const a=UI(t,e,i);let l=a.step;if(!isFinite(l))return[];if(l>0){let n=1;const{power:r,gap:s}=a,h=10===s?2*10**r:1*10**r;for(;n<=5&&(o=NI(t,e,l),o.length>i+1)&&i>2;)l+=h,n+=1;i>2&&o.length<i-1&&(o=((t,e,i)=>{let n;const r=t[0],o=t[t.length-1],s=e-t.length;if(o<=0){const e=[];for(n=s;n>=1;n--)e.push(r-n*i);return e.concat(t)}if(r>=0){for(n=1;n<=s;n++)t.push(o+n*i);return t}let a=[];const l=[];for(n=1;n<=s;n++)n%2==0?a=[r-Math.floor(n/2)*i].concat(a):l.push(o+Math.ceil(n/2)*i);return a.concat(t).concat(l)})(o,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),o=NI(t,e,l);return r&&o.reverse(),o})),VI=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=zI[0];return i>=OI?n=zI[3]:i>=DI?n=zI[2]:i>=FI&&(n=zI[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function UI(t,e,i){const n=(e-t)/Math.max(0,i);return VI(n)}function KI(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const r=new Array(i);for(let e=0;e<i;e++)r[e]=t+e*n;return r}function $I(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=0,o=t.length-1,s=t[r],a=t[o],l=10;for(a<s&&(i=s,s=a,a=i,i=r,r=o,o=i);l-- >0;){if(i=UI(s,a,n).step,i===e)return t[r]=s,t[o]=a,t;if(i>0)s=Math.floor(s/i)*i,a=Math.ceil(a/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,a=Math.floor(a*i)/i}e=i}}class XI extends II{constructor(){super(...arguments),this.type=xI.Linear}clone(){return(new XI).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return jI(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,r=this._domain,o=n[0],s=n[n.length-1];let a=GI(r[0],r[r.length-1],t,e);if(!a.length)return a;if(a[0]!==o&&"max"===this._niceType||a[a.length-1]!==s&&"min"===this._niceType){const t=n.slice();"min"===this._niceType?t[0]=a[0]:t[t.length-1]=a[a.length-1],this._niceDomain=t,this.rescale();const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);a=a.filter((t=>t>=e&&t<=i))}else if("all"!==this._niceType||a[0]===o&&a[a.length-1]===s)this._domainValidator&&(a=a.filter(this._domainValidator));else{const t=n.slice();t[0]=a[0],t[t.length-1]=a[a.length-1],this._niceDomain=t,this.rescale()}return a}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return KI(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,r,o=-1;if(i=+i,(r=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const s=Math.floor((e-t)/i+1),a=new Array(s);for(;++o<s;)a[o]=t+o*i;return r&&a.reverse(),a}(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const r=this._domain;let o=[];if(e){const t=function(t,e){const i=Qu(e.forceMin),n=Qu(e.forceMax);let r=null;const o=[];let s=null;const a=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?o[0]=e.forceMin:Qu(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(o[0]=e.min),n?o[1]=e.forceMax:Qu(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(o[1]=e.max),Qu(o[0])&&Qu(o[1])?(s=t.slice(),s[0]=o[0],s[s.length-1]=o[1]):r=Qu(o[0])||Qu(o[1])?Qu(o[0])?"max":"min":"all",{niceType:r,niceDomain:s,niceMinMax:o,domainValidator:a}}(r,e);if(o=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=$I(r.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=o[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=o[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=$I(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=$I(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}var YI;function qI(t){return qu(t)?t:[t,t]}function ZI(t){return t?"ew-resize":"ns-resize"}!function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(YI||(YI={}));class JI extends Tk{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(t){super(fd({},JI.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===sk.env?(sk.addEventListener("pointermove",this._onHandlerPointerMove),sk.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:r,min:o,max:s}=this.attribute;if(s===o)return;let a,l,h,c=0;this._isHorizontal?(a=t.clientX,c=a-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(a=t.clientY,c=a-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=r);const u=Pd(l+c,0,h),d=u/h*(s-o)+o;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,u,d):this._updateHandler(this._currentHandler,u,d),this._updateTrack(),this._prePos=a,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===sk.env)sk.removeEventListener("pointermove",this._onHandlerPointerMove),sk.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===sk.env?(sk.addEventListener("pointermove",this._onTrackPointerMove),sk.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:r}=this.attribute;if(r===n)return;const{startHandler:o,endHandler:s}=this._getHandlers();let a,l,h;this._isHorizontal?(a=t.clientX,l=this._track.attribute.width,h=e):(a=t.clientY,l=this._track.attribute.height,h=i);const c=a-this._prePos;if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=Pd(t+c,0,h-l),i=e/h*(r-n)+n;this._updateHandler(o,e,i)}if(s){const t=this._isHorizontal?s.attribute.x:s.attribute.y,e=Pd(t+c,l,h),i=e/h*(r-n)+n;this._updateHandler(s,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==o?void 0:o.attribute.x,null==s?void 0:s.attribute.x),width:Math.abs((null==o?void 0:o.attribute.x)-(null==s?void 0:s.attribute.x))}:{y:Math.min(null==o?void 0:o.attribute.y,null==s?void 0:s.attribute.y),height:Math.abs((null==o?void 0:o.attribute.y)-(null==s?void 0:s.attribute.y))})}this._prePos=a,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===sk.env?(sk.removeEventListener("pointermove",this._onTrackPointerMove),sk.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:r}=this.attribute;if(r===n)return;const o=this._startHandler,s=this._endHandler;let a,l,h,c;this._isHorizontal?(a=t.viewX-this._rail.globalAABBBounds.x1,l=null==o?void 0:o.attribute.x,h=null==s?void 0:s.attribute.x,c=e):(a=t.viewY-this._rail.globalAABBBounds.y1,l=null==o?void 0:o.attribute.y,h=null==s?void 0:s.attribute.y,c=i);const u=a/c*(r-n)+n;if(Uu(h)){const t=Math.abs(a-l)>Math.abs(a-h)?s:o;this._updateHandler(t,a,u)}else this._updateHandler(o,a,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:r,max:o}=this.attribute;if(o===r)return;const[s,a]=Uu(d=t)?qu(d)?d:[d]:[],{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,u=(s-r)/(o-r)*c;var d;if(l&&this._updateHandler(l,u,s),h){const t=(a-r)/(o-r)*c;this._updateHandler(h,t,a)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:r,startText:o,endText:s,min:a,max:l,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;Vu(c)&&(c=[a,l]),this._currentValue={startValue:qI(c)[0],endValue:qI(c)[1]};const u="horizontal"===i;this._isHorizontal=u;const d=JA({x:0,y:0});d.name=YI.innerView,this.add(d),this._innerView=d;let p,f=0;if(o&&o.visible){p=iT(Object.assign({x:u?0:n/2,y:u?r/2:0,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:o.text,lineHeight:null===(t=o.style)||void 0===t?void 0:t.fontSize},o.style)),p.name=YI.startText,d.add(p);const e=Uu(o.space)?o.space:0;f+=(u?p.AABBBounds.width():p.AABBBounds.height())+e}const g=JA({x:u?f:0,y:u?0:f});d.add(g);const m=JA({x:0,y:0});let y;if(m.name=YI.railContainer,this._railContainer=m,g.add(m),this._renderRail(m),f+=u?n:r,s&&s.visible){const t=Uu(s.space)?s.space:0;y=iT(Object.assign({x:u?f+t:n/2,y:u?r/2:f+t,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:s.text,lineHeight:null===(e=s.style)||void 0===e?void 0:e.fontSize},s.style)),y.name=YI.endText,d.add(y)}this._renderTrack(m),h&&(this._renderHandlers(g),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:r}=this.attribute;let o="default";!1!==r&&(o="pointer");const s=eT(Object.assign({x:0,y:0,width:e,height:i,cursor:o},n));return s.name=YI.rail,t.add(s),this._rail=s,s}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:r=14,handlerStyle:o,handlerText:s,railHeight:a,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;Vu(c)&&(c=[i,n]);const u=s&&s.visible,d=this._isHorizontal,p=d?l:a,[f,g]=qI(c),m=n===i?e?0:p:(f-i)/(n-i)*p,y=this._renderHandler(Object.assign({x:d?m:l/2,y:d?a/2:m,size:r,strokeBoundsBuffer:0,cursor:!1===h?"default":ZI(d)},o));if(y.name=YI.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=YI.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?p:(g-i)/(n-i)*p,s=this._renderHandler(Object.assign({x:d?e:l/2,y:d?a/2:e,size:r,strokeBoundsBuffer:0,cursor:!1===h?"default":ZI(d)},o));if(s.name=YI.endHandler,this._endHandler=s,t.add(s),this._currentValue.endPos=e,u){const e=this._renderHandlerText(g,"end");e.name=YI.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:r,railWidth:o,trackStyle:s,railStyle:a,slidable:l,value:h}=this.attribute;let c,u;if(Vu(h))e?(c=i,u=n):c=u=i;else if(e){const t=Ed(h,i,n);c=t[0],u=t[1]}else c=i,u=Pd(h,i,n);const d=this._isHorizontal,p=d?o:r;e||(c=i);const f=JA({x:0,y:0,width:o,height:r,cornerRadius:null==a?void 0:a.cornerRadius,clip:!0,pickable:!1});f.name=YI.trackContainer;const g=Ku(e)&&!0===e.draggableTrack;let m;m=!1===l?"default":!1===e||!1===g?"pointer":ZI(d);const y=n===i?p:(u-c)/(n-i)*p,b=n===i?0:(c-i)/(n-i)*p,v=eT(Object.assign({x:d?b:0,y:d?0:b,width:d?y:o,height:d?r:y,cursor:m},s));v.name=YI.track,this._track=v,f.add(v),t.add(f)}_renderHandler(t){return nT(t)}_renderHandlerText(t,e){var i,n,r;const{align:o,min:s,max:a,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:u,slidable:d}=this.attribute,p=this._isHorizontal,f=p?u:c,g=a===s?"start"===e?0:f:(t-s)/(a-s)*f,m=null!==(i=h.space)&&void 0!==i?i:4,y=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(r=h.style)||void 0===r?void 0:r.lineHeight,cursor:!1===d?"default":ZI(p)},h.style);return p?"top"===o?(y.textBaseline="bottom",y.textAlign="center",y.x=g,y.y=(c-l)/2-m):(y.textBaseline="top",y.textAlign="center",y.x=g,y.y=(c+l)/2+m):"left"===o?(y.textBaseline="middle",y.textAlign="end",y.x=(u-l)/2-m,y.y=g):(y.textBaseline="middle",y.textAlign="start",y.x=(u+l)/2+m,y.y=g),iT(y)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),Ku(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const r=this._isHorizontal;t.setAttribute(r?"x":"y",e);const o=t.name===YI.startHandler?this._startHandlerText:this._endHandlerText;if(o){const{handlerText:t}=this.attribute;null==o||o.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[r?"x":"y"]:e})}t.name===YI.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const r=this._isHorizontal,{handlerText:o}=this.attribute;t.setAttributes({[r?"x":"y"]:e,text:(null==o?void 0:o.formatter)?o.formatter(i):i.toFixed(null!==(n=null==o?void 0:o.precision)&&void 0!==n?n:0)});const s=t.name===YI.startHandlerText?this._startHandler:this._endHandler;s&&(null==s||s.setAttributes({[r?"x":"y"]:e})),t.name===YI.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new Zv("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}JI.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class QI extends bI{constructor(t){super(fd({},QI.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:r,max:o,value:s,railWidth:a,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:u,railStyle:d,trackStyle:p,startText:f,endText:g,handlerText:m,showTooltip:y,tooltip:b}=this.attribute,v=[],w=(o-r)/(t.length-1);for(let e=0;e<t.length;e++)v.push(r+w*e);this._colorScale=(new XI).domain(v,!0).range(t),this._color=this._getTrackColor();const C=new JI({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:i,align:n,min:r,max:o,value:s,railWidth:a,railHeight:l,showHandler:h,handlerSize:c,handlerStyle:u,railStyle:d,trackStyle:Object.assign({fill:this._color},p),startText:f,endText:g,handlerText:m,showTooltip:y,tooltip:b});this._innerView.add(C),this._slider=C,C.translateTo(0-C.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+sd(this.attribute,"title.space",12):0)-C.AABBBounds.y1),this._updateColor()}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:t,layout:e}=this.attribute;if(od(t))return;const i=t.length;if(1===i)return t[0];const n=[];for(let e=0;e<i;e++){const r=e/(i-1);n.push({offset:r,color:t[e]})}const r="horizontal"===e;return{gradient:"linear",stops:n,x0:0,y0:0,x1:r?1:0,y1:r?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:n}=this.attribute,{startHandler:r,endHandler:o,track:s}=this._slider,{startValue:a,endValue:l,startPos:h,endPos:c}=this._slider.currentValue,u=this._colorScale.scale(a),d=this._colorScale.scale(l);null==r||r.setAttribute("fill",u),null==o||o.setAttribute("fill",d);const p="horizontal"===t?i:n;if(Math.abs(h-c)!==p&&e&&e.length>1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,r=i/p,o=r-n,u=t.filter((t=>t.offset>n&&t.offset<r)),d=Math.min(a,l),f=Math.max(a,l),g=this._colorScale.scale(d),m=this._colorScale.scale(f),y=[{offset:0,color:g}];u.forEach((t=>{y.push({offset:(t.offset-n)/o,color:t.color})})),y.push({offset:1,color:m}),s.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function tO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QI.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class eO extends bI{constructor(t){super(fd({},eO.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:r,value:o,railWidth:s,railHeight:a,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:u,trackStyle:d,startText:p,endText:f,handlerText:g,showTooltip:m,tooltip:y,sizeBackground:b}=this.attribute,v=JA({x:0,y:0});this._innerView.add(v);const w=new JI({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:r,value:o,railWidth:s,railHeight:a,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tO(i)},c),railStyle:u,trackStyle:d,startText:p,endText:f,handlerText:g,showTooltip:m,tooltip:y});v.add(w);let C,x=0;"horizontal"===e?"top"===i?(C=`M0,0L${s},0L${s},12Z`,x=a):(C=`M0,12L${s},12L${s},0Z`,w.setAttribute("y",12)):"left"===i?C=`M${s},0L${s},0L${s+12},${a}L${s},${a}Z`:(C=`M0,${a}L12,${a}L12,0Z`,w.setAttribute("x",12));const _=tT(Object.assign(Object.assign({x:0,y:x,path:C},b),{zIndex:0}));v.add(_);const S=this._title?this._title.AABBBounds.height()+sd(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,S-v.AABBBounds.y1),this._slider=w}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}eO.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let iO=class t extends Tk{constructor(e){super(fd({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m,y,b,v,w,C,x,_,S,A,T,B,M,R,P,E,H,L,k,I,O,D,F,z,W,j,N,G,V,U,K,$,X,Y,q,Z,J,Q,tt,et,it,nt,rt,ot,st,at;const{text:lt,textStyle:ht,subtext:ct,subtextStyle:ut,width:dt,height:pt,minWidth:ft,maxWidth:gt,minHeight:mt,maxHeight:yt,align:bt,verticalAlign:vt,padding:wt=0}=this.attribute,Ct=Ip(wt),xt=this.createOrUpdateChild("title-container",{x:Ct[3],y:Ct[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&Uu(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(i=ht.y)&&void 0!==i?i:0,width:null!==(r=null!==(n=ht.width)&&void 0!==n?n:dt)&&void 0!==r?r:0,height:null!==(s=null!==(o=ht.height)&&void 0!==o?o:pt)&&void 0!==s?s:0,ellipsis:null===(a=ht.ellipsis)||void 0===a||a,wordBreak:null!==(l=ht.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=xt.createOrUpdateChild("mainTitle",t,"richtext")}else Uu(lt)&&(this._mainTitle=xt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[lt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:dt,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(c=null==ht?void 0:ht.ellipsis)||void 0===c||c,x:0,y:0}),"wrapText"));const _t=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,St=this._mainTitle?null===(d=this._mainTitle)||void 0===d?void 0:d.AABBBounds.width():0;if(!1!==(null===(p=this.attribute)||void 0===p?void 0:p.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&Uu(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(g=ut.y)&&void 0!==g?g:_t,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:dt)&&void 0!==y?y:0,height:null!==(v=null!==(b=ut.height)&&void 0!==b?b:pt)&&void 0!==v?v:0,ellipsis:null===(w=ut.ellipsis)||void 0===w||w,wordBreak:null!==(C=ut.wordBreak)&&void 0!==C?C:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=xt.createOrUpdateChild("subTitle",t,"richtext")}else Uu(ct)&&(this._subTitle=xt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ct]},ut),{maxLineWidth:null!==(x=null==ut?void 0:ut.maxLineWidth)&&void 0!==x?x:dt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(_=null==ut?void 0:ut.ellipsis)||void 0===_||_,x:0,y:_t}),"wrapText"));const At=this._subTitle?null===(S=this._subTitle)||void 0===S?void 0:S.AABBBounds.height():0,Tt=this._subTitle?null===(A=this._subTitle)||void 0===A?void 0:A.AABBBounds.width():0;let Bt=Math.max(St,Tt),Mt=_t+(null!==(T=null==ut?void 0:ut.height)&&void 0!==T?T:At);if(Uu(dt)&&(Bt=dt,null===(B=this._mainTitle)||void 0===B||B.setAttribute("maxLineWidth",dt),null===(M=this._subTitle)||void 0===M||M.setAttribute("maxLineWidth",dt)),Uu(pt)&&(Mt=pt),Uu(ft)&&Bt<ft&&(Bt=ft),Uu(gt)&&(null===(R=this._mainTitle)||void 0===R||R.setAttribute("maxLineWidth",gt),null===(P=this._subTitle)||void 0===P||P.setAttribute("maxLineWidth",gt),null===(E=this._mainTitle)||void 0===E||E.setAttribute("maxWidth",gt),null===(H=this._subTitle)||void 0===H||H.setAttribute("maxWidth",gt),Bt>gt&&(Bt=gt)),Uu(mt)&&Mt<mt&&(Mt=mt),Uu(yt)&&(null===(L=this._mainTitle)||void 0===L||L.setAttribute("maxHeight",yt),null===(k=this._subTitle)||void 0===k||k.setAttribute("maxHeight",yt-_t),Mt>yt&&(Mt=yt)),xt.attribute.width=Bt+Ct[1]+Ct[3],xt.attribute.height=Mt+Ct[0]+Ct[2],Uu(bt)||Uu(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:bt,e=null!==(I=null==ht?void 0:ht.width)&&void 0!==I?I:St;"left"===t?(null===(O=this._mainTitle)||void 0===O||O.setAttribute("x",0),null===(D=this._mainTitle)||void 0===D||D.setAttribute("textAlign","left")):"center"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",e/2),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","center")):"right"===t&&(null===(W=this._mainTitle)||void 0===W||W.setAttribute("x",e),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","right"))}if(Uu(vt)||Uu(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:vt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Bt;"top"===t?(null===(N=this._mainTitle)||void 0===N||N.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(V=this._mainTitle)||void 0===V||V.setAttribute("y",e/2),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(K=this._mainTitle)||void 0===K||K.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(Uu(bt)||Uu(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:bt,e=null!==(X=null==ut?void 0:ut.width)&&void 0!==X?X:Tt;"left"===t?(null===(Y=this._subTitle)||void 0===Y||Y.setAttribute("x",0),null===(q=this._subTitle)||void 0===q||q.setAttribute("textAlign","left")):"center"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",e/2),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","center")):"right"===t&&(null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("x",e),null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("textAlign","right"))}if(Uu(vt)||Uu(null==ht?void 0:ht.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:vt,e=_t,i=null!==(et=null==ut?void 0:ut.height)&&void 0!==et?et:0;"top"===t?(null===(it=this._subTitle)||void 0===it||it.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e+i),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","bottom"))}}};function nO(t){const e={...t};return od(t.style)||(e.textStyle=rO(t.style)),od(t.textStyle)||fd(e.textStyle,rO(t.textStyle)),t.shape?.style&&rO(e.shape.style),t.background?.style&&rO(e.background.style),e}function rO(t){return od(t)||t.angle&&(t.angle=np(t.angle)),t}function oO(t={}){return od(t.style)||(t.style=rO(t.style)),od(t.state)||Object.keys(t.state).forEach((e=>{od(t.state[e])||(t.state[e]=rO(t.state[e]))})),t}function sO(t){return od(t)?null:(Object.keys(t).forEach((e=>{od(t[e])||(t[e]=rO(t[e]))})),t)}iO.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const aO={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}},lO=14,hO=4,cO={domainLine:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:"#EBEDF2",strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#EBEDF2",strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:hO,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,tickSize:hO/2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},label:{visible:!0,space:1,style:{fontSize:lO,fill:"#89909D",fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:lO,fill:"#333333",fontWeight:"normal",fillOpacity:1}}};function uO(t){const e=t;let i,n=e.title?.angle??0;return"left"!==e.orient&&"right"!==e.orient||e.title?.autoRotate&&Vu(e.title.angle)&&(n="left"===e.orient?-90:90,i=aO[e.orient]),{orient:e.orient,select:e.select,hover:e.hover,line:(r=e.domainLine,oO(r),oO(r.startSymbol),oO(r.endSymbol),r),label:{visible:e.label.visible,space:e.label.space,inside:e.label.inside,style:rO(e.label.style),formatMethod:e.label.formatMethod?(t,i,n)=>e.label.formatMethod(i.rawValue,i):null,state:sO(e.label.state),containerAlign:e.label.containerAlign},tick:{visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,style:rO(e.tick.style),state:sO(e.tick.state)},subTick:{visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount,style:rO(e.subTick.style),state:sO(e.subTick.state)},grid:{type:"line",visible:e.grid.visible,alternateColor:e.grid.alternateColor,alignWithLabel:e.grid.alignWithLabel,style:rO(e.grid.style)},subGrid:{type:"line",visible:e.subGrid.visible,alternateColor:e.subGrid.alternateColor,style:rO(e.subGrid.style)},title:{visible:e.title.visible,position:e.title.position,space:e.title.space,autoRotate:!1,angle:n?np(n):null,textStyle:fd({},i,rO(e.title.style)),padding:e.title.padding,shape:{visible:e.title.shape?.visible,space:e.title.shape?.space,style:rO(e.title.shape?.style)},background:{visible:e.title.background?.visible,style:rO(e.title.background?.style)},state:{text:sO(e.title.state),shape:sO(e.title.shape?.state),background:sO(e.title.background?.state)}},panel:{visible:e.background?.visible,style:rO(e.background?.style),state:sO(e.background?.state)}};var r}function dO(t){return"bottom"===t||"top"===t}class pO{_scale;_scales;bandPadding;paddingInner;paddingOuter;constructor(){this._scale=new HI,this._scales=[this._scale]}valueToPosition(t){return this._scale.scale(t)}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;i<n;i++)e+=this._scales[i].scale(t[i]);i=this._scales[n-1]}return{position:e,bandScale:i}}calcScales(t,e){const{bandPadding:i,paddingInner:n,paddingOuter:r}=this,o=qu(i),s=qu(n),a=qu(r);for(let l=0;l<this._scales.length;l++){const h=o?i[l]:i,c=s?n[l]:n,u=a?r[l]:r;this._scales[l].paddingInner(c??h??t,!0).paddingOuter(u??h??e)}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}updateScaleDomain(t){for(let e=0;e<this._scales.length;e++)this._scales[e].domain(t)}updateRange(t){const[e,i]=this._scale.range();t[0]===e&&t[1]===i||this._scale.range(t)}}for(let t=0;t<256;t++)t.toString(16);function fO(){return new gO}function gO(){this.reset()}gO.prototype={constructor:gO,reset:function(){this.s=this.t=0},add:function(t){yO(mO,t,this.t),yO(this,mO.s,this.s),this.s?this.t+=mO.t:this.s=mO.t},valueOf:function(){return this.s}};var mO=new gO;function yO(t,e,i){var n=t.s=e+i,r=n-e,o=n-r;t.t=e-o+(i-r)}var bO=1e-6,vO=Math.PI,wO=vO/2,CO=vO/4,xO=2*vO,_O=180/vO,SO=vO/180,AO=Math.abs,TO=Math.atan,BO=Math.atan2,MO=Math.cos,RO=Math.exp,PO=Math.log,EO=Math.sin,HO=Math.sign||function(t){return t>0?1:t<0?-1:0},LO=Math.sqrt,kO=Math.tan;function IO(t){return t>1?wO:t<-1?-wO:Math.asin(t)}function OO(){}function DO(t,e){t&&zO.hasOwnProperty(t.type)&&zO[t.type](t,e)}var FO={Feature:function(t,e){DO(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,r=i.length;++n<r;)DO(i[n].geometry,e)}},zO={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)t=i[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){WO(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)WO(i[n],e,0)},Polygon:function(t,e){jO(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)jO(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,r=i.length;++n<r;)DO(i[n],e)}};function WO(t,e,i){var n,r=-1,o=t.length-i;for(e.lineStart();++r<o;)n=t[r],e.point(n[0],n[1],n[2]);e.lineEnd()}function jO(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)WO(t[i],e,1);e.polygonEnd()}function NO(t,e){t&&FO.hasOwnProperty(t.type)?FO[t.type](t,e):DO(t,e)}function GO(t){return[BO(t[1],t[0]),IO(t[2])]}function VO(t){var e=t[0],i=t[1],n=MO(i);return[n*MO(e),n*EO(e),EO(i)]}function UO(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function KO(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function $O(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function XO(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function YO(t){var e=LO(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function qO(t,e){function i(i,n){return i=t(i,n),e(i[0],i[1])}return t.invert&&e.invert&&(i.invert=function(i,n){return(i=e.invert(i,n))&&t.invert(i[0],i[1])}),i}function ZO(t,e){return[AO(t)>vO?t+Math.round(-t/xO)*xO:t,e]}function JO(t,e,i){return(t%=xO)?e||i?qO(tD(t),eD(e,i)):tD(t):e||i?eD(e,i):ZO}function QO(t){return function(e,i){return[(e+=t)>vO?e-xO:e<-vO?e+xO:e,i]}}function tD(t){var e=QO(t);return e.invert=QO(-t),e}function eD(t,e){var i=MO(t),n=EO(t),r=MO(e),o=EO(e);function s(t,e){var s=MO(e),a=MO(t)*s,l=EO(t)*s,h=EO(e),c=h*i+a*n;return[BO(l*r-c*o,a*i-h*n),IO(c*r+l*o)]}return s.invert=function(t,e){var s=MO(e),a=MO(t)*s,l=EO(t)*s,h=EO(e),c=h*r-l*o;return[BO(l*r+h*o,a*i+c*n),IO(c*i-a*n)]},s}function iD(t,e){(e=VO(e))[0]-=t,YO(e);var i,n=(i=-e[1])>1?0:i<-1?vO:Math.acos(i);return((-e[2]<0?-n:n)+xO-bO)%xO}function nD(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:OO,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function rD(t,e){return AO(t[0]-e[0])<bO&&AO(t[1]-e[1])<bO}function oD(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function sD(t,e,i,n,r){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],s=t[e];if(rD(n,s)){if(!n[2]&&!s[2]){for(r.lineStart(),o=0;o<e;++o)r.point((n=t[o])[0],n[1]);return void r.lineEnd()}s[0]+=2*bO}a.push(i=new oD(n,t,null,!0)),l.push(i.o=new oD(n,null,i,!1)),a.push(i=new oD(s,t,null,!1)),l.push(i.o=new oD(s,null,i,!0))}})),a.length){for(l.sort(e),aD(a),aD(l),o=0,s=l.length;o<s;++o)l[o].e=i=!i;for(var h,c,u=a[0];;){for(var d=u,p=!0;d.v;)if((d=d.n)===u)return;h=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(o=0,s=h.length;o<s;++o)r.point((c=h[o])[0],c[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(p)for(h=d.p.z,o=h.length-1;o>=0;--o)r.point((c=h[o])[0],c[1]);else n(d.x,d.p.x,-1,r);d=d.p}h=(d=d.o).z,p=!p}while(!d.v);r.lineEnd()}}}function aD(t){if(e=t.length){for(var e,i,n=0,r=t[0];++n<e;)r.n=i=t[n],i.p=r,r=i;r.n=i=t[0],i.p=r}}ZO.invert=ZO;var lD,hD,cD=fO();function uD(t){return AO(t[0])<=vO?t[0]:HO(t[0])*((AO(t[0])+vO)%xO-vO)}function dD(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function pD(t){for(var e,i,n,r=t.length,o=-1,s=0;++o<r;)s+=t[o].length;for(i=new Array(s);--r>=0;)for(e=(n=t[r]).length;--e>=0;)i[--s]=n[e];return i}function fD(t,e,i,n){return function(r){var o,s,a,l=e(r),h=nD(),c=e(h),u=!1,d={point:p,lineStart:g,lineEnd:m,polygonStart:function(){d.point=y,d.lineStart=b,d.lineEnd=v,s=[],o=[]},polygonEnd:function(){d.point=p,d.lineStart=g,d.lineEnd=m,s=pD(s);var t=function(t,e){var i=uD(e),n=e[1],r=EO(n),o=[EO(i),-MO(i),0],s=0,a=0;cD.reset(),1===r?n=wO+bO:-1===r&&(n=-wO-bO);for(var l=0,h=t.length;l<h;++l)if(u=(c=t[l]).length)for(var c,u,d=c[u-1],p=uD(d),f=d[1]/2+CO,g=EO(f),m=MO(f),y=0;y<u;++y,p=v,g=C,m=x,d=b){var b=c[y],v=uD(b),w=b[1]/2+CO,C=EO(w),x=MO(w),_=v-p,S=_>=0?1:-1,A=S*_,T=A>vO,B=g*C;if(cD.add(BO(B*S*EO(A),m*x+B*MO(A))),s+=T?_+S*xO:_,T^p>=i^v>=i){var M=KO(VO(d),VO(b));YO(M);var R=KO(o,M);YO(R);var P=(T^_>=0?-1:1)*IO(R[2]);(n>P||n===P&&(M[0]||M[1]))&&(a+=T^_>=0?1:-1)}}return(s<-bO||s<bO&&cD<-bO)^1&a}(o,n);s.length?(u||(r.polygonStart(),u=!0),sD(s,mD,t,i,r)):t&&(u||(r.polygonStart(),u=!0),r.lineStart(),i(null,null,1,r),r.lineEnd()),u&&(r.polygonEnd(),u=!1),s=o=null},sphere:function(){r.polygonStart(),r.lineStart(),i(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function p(e,i){t(e,i)&&r.point(e,i)}function f(t,e){l.point(t,e)}function g(){d.point=f,l.lineStart()}function m(){d.point=p,l.lineEnd()}function y(t,e){a.push([t,e]),c.point(t,e)}function b(){c.lineStart(),a=[]}function v(){y(a[0][0],a[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),d=h.result(),p=d.length;if(a.pop(),o.push(a),a=null,p)if(1&l){if((e=(i=d[0]).length-1)>0){for(u||(r.polygonStart(),u=!0),r.lineStart(),t=0;t<e;++t)r.point((n=i[t])[0],n[1]);r.lineEnd()}}else p>1&&2&l&&d.push(d.pop().concat(d.shift())),s.push(d.filter(gD))}return d}}function gD(t){return t.length>1}function mD(t,e){return((t=t.x)[0]<0?t[1]-wO-bO:wO-t[1])-((e=e.x)[0]<0?e[1]-wO-bO:wO-e[1])}1===(lD=dD).length&&(hD=lD,lD=function(t,e){return dD(hD(t),e)});var yD=fD((function(){return!0}),(function(t){var e,i=NaN,n=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?vO:-vO,l=AO(o-i);AO(l-vO)<bO?(t.point(i,n=(n+s)/2>0?wO:-wO),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):r!==a&&l>=vO&&(AO(i-r)<bO&&(i-=r*bO),AO(o-a)<bO&&(o-=a*bO),n=function(t,e,i,n){var r,o,s=EO(t-i);return AO(s)>bO?TO((EO(e)*(o=MO(n))*EO(i)-EO(n)*(r=MO(e))*EO(t))/(r*o*s)):(e+n)/2}(i,n,o,s),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(i=o,n=s),r=a},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var r;if(null==t)r=i*wO,n.point(-vO,r),n.point(0,r),n.point(vO,r),n.point(vO,0),n.point(vO,-r),n.point(0,-r),n.point(-vO,-r),n.point(-vO,0),n.point(-vO,r);else if(AO(t[0]-e[0])>bO){var o=t[0]<e[0]?vO:-vO;r=i*o/2,n.point(-o,r),n.point(0,r),n.point(o,r)}else n.point(e[0],e[1])}),[-vO,-wO]);function bD(t){var e=MO(t),i=6*SO,n=e>0,r=AO(e)>bO;function o(t,i){return MO(t)*MO(i)>e}function s(t,i,n){var r=[1,0,0],o=KO(VO(t),VO(i)),s=UO(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var h=e*s/l,c=-e*a/l,u=KO(r,o),d=XO(r,h);$O(d,XO(o,c));var p=u,f=UO(d,p),g=UO(p,p),m=f*f-g*(UO(d,d)-1);if(!(m<0)){var y=LO(m),b=XO(p,(-f-y)/g);if($O(b,d),b=GO(b),!n)return b;var v,w=t[0],C=i[0],x=t[1],_=i[1];C<w&&(v=w,w=C,C=v);var S=C-w,A=AO(S-vO)<bO;if(!A&&_<x&&(v=x,x=_,_=v),A||S<bO?A?x+_>0^b[1]<(AO(b[0]-w)<bO?x:_):x<=b[1]&&b[1]<=_:S>vO^(w<=b[0]&&b[0]<=C)){var T=XO(p,(-f+y)/g);return $O(T,d),[b,GO(T)]}}}function a(e,i){var r=n?t:vO-t,o=0;return e<-r?o|=1:e>r&&(o|=2),i<-r?o|=4:i>r&&(o|=8),o}return fD(o,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(u,d){var p,f=[u,d],g=o(u,d),m=n?g?0:a(u,d):g?a(u+(u<0?vO:-vO),d):0;if(!e&&(h=l=g)&&t.lineStart(),g!==l&&(!(p=s(e,f))||rD(e,p)||rD(f,p))&&(f[2]=1),g!==l)c=0,g?(t.lineStart(),p=s(f,e),t.point(p[0],p[1])):(p=s(e,f),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(r&&e&&n^g){var y;m&i||!(y=s(f,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&rD(e,f)||t.point(f[0],f[1]),e=f,l=g,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,r,o){!function(t,e,i,n,r,o){if(i){var s=MO(e),a=EO(e),l=n*i;null==r?(r=e+n*xO,o=e-l/2):(r=iD(s,r),o=iD(s,o),(n>0?r<o:r>o)&&(r+=n*xO));for(var h,c=r;n>0?c>o:c<o;c-=l)h=GO([s,-a*MO(c),-a*EO(c)]),t.point(h[0],h[1])}}(o,t,i,r,e,n)}),n?[0,-t]:[-vO,t-vO])}var vD=1e9,wD=-vD;function CD(t,e,i,n){function r(r,o){return t<=r&&r<=i&&e<=o&&o<=n}function o(r,o,a,h){var c=0,u=0;if(null==r||(c=s(r,a))!==(u=s(o,a))||l(r,o)<0^a>0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+a+4)%4)!==u);else h.point(o[0],o[1])}function s(n,r){return AO(n[0]-t)<bO?r>0?0:3:AO(n[0]-i)<bO?r>0?2:1:AO(n[1]-e)<bO?r>0?1:0:r>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var i=s(t,1),n=s(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(s){var l,h,c,u,d,p,f,g,m,y,b,v=s,w=nD(),C={point:x,lineStart:function(){C.point=_,h&&h.push(c=[]);y=!0,m=!1,f=g=NaN},lineEnd:function(){l&&(_(u,d),p&&m&&w.rejoin(),l.push(w.result()));C.point=x,m&&v.lineEnd()},polygonStart:function(){v=w,l=[],h=[],b=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,r=h.length;i<r;++i)for(var o,s,a=h[i],l=1,c=a.length,u=a[0],d=u[0],p=u[1];l<c;++l)o=d,s=p,d=(u=a[l])[0],p=u[1],s<=n?p>n&&(d-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(d-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),i=b&&e,r=(l=pD(l)).length;(i||r)&&(s.polygonStart(),i&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),r&&sD(l,a,e,o,s),s.polygonEnd());v=s,l=h=c=null}};function x(t,e){r(t,e)&&v.point(t,e)}function _(o,s){var a=r(o,s);if(h&&c.push([o,s]),y)u=o,d=s,p=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&m)v.point(o,s);else{var l=[f=Math.max(wD,Math.min(vD,f)),g=Math.max(wD,Math.min(vD,g))],w=[o=Math.max(wD,Math.min(vD,o)),s=Math.max(wD,Math.min(vD,s))];!function(t,e,i,n,r,o){var s,a=t[0],l=t[1],h=0,c=1,u=e[0]-a,d=e[1]-l;if(s=i-a,u||!(s>0)){if(s/=u,u<0){if(s<h)return;s<c&&(c=s)}else if(u>0){if(s>c)return;s>h&&(h=s)}if(s=r-a,u||!(s<0)){if(s/=u,u<0){if(s>c)return;s>h&&(h=s)}else if(u>0){if(s<h)return;s<c&&(c=s)}if(s=n-l,d||!(s>0)){if(s/=d,d<0){if(s<h)return;s<c&&(c=s)}else if(d>0){if(s>c)return;s>h&&(h=s)}if(s=o-l,d||!(s<0)){if(s/=d,d<0){if(s>c)return;s>h&&(h=s)}else if(d>0){if(s<h)return;s<c&&(c=s)}return h>0&&(t[0]=a+h*u,t[1]=l+h*d),c<1&&(e[0]=a+c*u,e[1]=l+c*d),!0}}}}}(l,w,t,e,i,n)?a&&(v.lineStart(),v.point(o,s),b=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(w[0],w[1]),a||v.lineEnd(),b=!1)}f=o,g=s,m=a}return C}}function xD(t){return t}var _D,SD,AD,TD,BD=fO(),MD=fO(),RD={point:OO,lineStart:OO,lineEnd:OO,polygonStart:function(){RD.lineStart=PD,RD.lineEnd=LD},polygonEnd:function(){RD.lineStart=RD.lineEnd=RD.point=OO,BD.add(AO(MD)),MD.reset()},result:function(){var t=BD/2;return BD.reset(),t}};function PD(){RD.point=ED}function ED(t,e){RD.point=HD,_D=AD=t,SD=TD=e}function HD(t,e){MD.add(TD*t-AD*e),AD=t,TD=e}function LD(){HD(_D,SD)}var kD=RD,ID=1/0,OD=ID,DD=-ID,FD=DD,zD={point:function(t,e){t<ID&&(ID=t);t>DD&&(DD=t);e<OD&&(OD=e);e>FD&&(FD=e)},lineStart:OO,lineEnd:OO,polygonStart:OO,polygonEnd:OO,result:function(){var t=[[ID,OD],[DD,FD]];return DD=FD=-(OD=ID=1/0),t}};var WD,jD,ND,GD,VD=zD,UD=0,KD=0,$D=0,XD=0,YD=0,qD=0,ZD=0,JD=0,QD=0,tF={point:eF,lineStart:iF,lineEnd:oF,polygonStart:function(){tF.lineStart=sF,tF.lineEnd=aF},polygonEnd:function(){tF.point=eF,tF.lineStart=iF,tF.lineEnd=oF},result:function(){var t=QD?[ZD/QD,JD/QD]:qD?[XD/qD,YD/qD]:$D?[UD/$D,KD/$D]:[NaN,NaN];return UD=KD=$D=XD=YD=qD=ZD=JD=QD=0,t}};function eF(t,e){UD+=t,KD+=e,++$D}function iF(){tF.point=nF}function nF(t,e){tF.point=rF,eF(ND=t,GD=e)}function rF(t,e){var i=t-ND,n=e-GD,r=LO(i*i+n*n);XD+=r*(ND+t)/2,YD+=r*(GD+e)/2,qD+=r,eF(ND=t,GD=e)}function oF(){tF.point=eF}function sF(){tF.point=lF}function aF(){hF(WD,jD)}function lF(t,e){tF.point=hF,eF(WD=ND=t,jD=GD=e)}function hF(t,e){var i=t-ND,n=e-GD,r=LO(i*i+n*n);XD+=r*(ND+t)/2,YD+=r*(GD+e)/2,qD+=r,ZD+=(r=GD*t-ND*e)*(ND+t),JD+=r*(GD+e),QD+=3*r,eF(ND=t,GD=e)}var cF=tF;function uF(t){this._context=t}uF.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,xO)}},result:OO};var dF,pF,fF,gF,mF,yF=fO(),bF={point:OO,lineStart:function(){bF.point=vF},lineEnd:function(){dF&&wF(pF,fF),bF.point=OO},polygonStart:function(){dF=!0},polygonEnd:function(){dF=null},result:function(){var t=+yF;return yF.reset(),t}};function vF(t,e){bF.point=wF,pF=gF=t,fF=mF=e}function wF(t,e){gF-=t,mF-=e,yF.add(LO(gF*gF+mF*mF)),gF=t,mF=e}var CF=bF;function xF(){this._string=[]}function _F(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function SF(t){return function(e){var i=new AF;for(var n in t)i[n]=t[n];return i.stream=e,i}}function AF(){}function TF(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),NO(i,t.stream(VD)),e(VD.result()),null!=n&&t.clipExtent(n),t}function BF(t,e,i){return TF(t,(function(i){var n=e[1][0]-e[0][0],r=e[1][1]-e[0][1],o=Math.min(n/(i[1][0]-i[0][0]),r/(i[1][1]-i[0][1])),s=+e[0][0]+(n-o*(i[1][0]+i[0][0]))/2,a=+e[0][1]+(r-o*(i[1][1]+i[0][1]))/2;t.scale(150*o).translate([s,a])}),i)}xF.prototype={_radius:4.5,_circle:_F(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=_F(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},AF.prototype={constructor:AF,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var MF=16,RF=MO(30*SO);function PF(t,e){return+e?function(t,e){function i(n,r,o,s,a,l,h,c,u,d,p,f,g,m){var y=h-n,b=c-r,v=y*y+b*b;if(v>4*e&&g--){var w=s+d,C=a+p,x=l+f,_=LO(w*w+C*C+x*x),S=IO(x/=_),A=AO(AO(x)-1)<bO||AO(o-u)<bO?(o+u)/2:BO(C,w),T=t(A,S),B=T[0],M=T[1],R=B-n,P=M-r,E=b*R-y*P;(E*E/v>e||AO((y*R+b*P)/v-.5)>.3||s*d+a*p+l*f<RF)&&(i(n,r,o,s,a,l,B,M,A,w/=_,C/=_,x,g,m),m.point(B,M),i(B,M,A,w,C,x,h,c,u,d,p,f,g,m))}}return function(e){var n,r,o,s,a,l,h,c,u,d,p,f,g={point:m,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),g.lineStart=w},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function m(i,n){i=t(i,n),e.point(i[0],i[1])}function y(){c=NaN,g.point=b,e.lineStart()}function b(n,r){var o=VO([n,r]),s=t(n,r);i(c,u,h,d,p,f,c=s[0],u=s[1],h=n,d=o[0],p=o[1],f=o[2],MF,e),e.point(c,u)}function v(){g.point=m,e.lineEnd()}function w(){y(),g.point=C,g.lineEnd=x}function C(t,e){b(n=t,e),r=c,o=u,s=d,a=p,l=f,g.point=b}function x(){i(c,u,h,d,p,f,r,o,n,s,a,l,MF,e),g.lineEnd=v,v()}return g}}(t,e):function(t){return SF({point:function(e,i){e=t(e,i),this.stream.point(e[0],e[1])}})}(t)}var EF=SF({point:function(t,e){this.stream.point(t*SO,e*SO)}});function HF(t,e,i,n,r){function o(o,s){return[e+t*(o*=n),i-t*(s*=r)]}return o.invert=function(o,s){return[(o-e)/t*n,(i-s)/t*r]},o}function LF(t,e,i,n,r,o){var s=MO(o),a=EO(o),l=s*t,h=a*t,c=s/t,u=a/t,d=(a*i-s*e)/t,p=(a*e+s*i)/t;function f(t,o){return[l*(t*=n)-h*(o*=r)+e,i-h*t-l*o]}return f.invert=function(t,e){return[n*(c*t-u*e+d),r*(p-u*t-c*e)]},f}function kF(t){return function(t){var e,i,n,r,o,s,a,l,h,c,u=150,d=480,p=250,f=0,g=0,m=0,y=0,b=0,v=0,w=1,C=1,x=null,_=yD,S=null,A=xD,T=.5;function B(t){return l(t[0]*SO,t[1]*SO)}function M(t){return(t=l.invert(t[0],t[1]))&&[t[0]*_O,t[1]*_O]}function R(){var t=LF(u,0,0,w,C,v).apply(null,e(f,g)),n=(v?LF:HF)(u,d-t[0],p-t[1],w,C,v);return i=JO(m,y,b),a=qO(e,n),l=qO(i,a),s=PF(a,T),P()}function P(){return h=c=null,B}return B.stream=function(t){return h&&c===t?h:h=EF(function(t){return SF({point:function(e,i){var n=t(e,i);return this.stream.point(n[0],n[1])}})}(i)(_(s(A(c=t)))))},B.preclip=function(t){return arguments.length?(_=t,x=void 0,P()):_},B.postclip=function(t){return arguments.length?(A=t,S=n=r=o=null,P()):A},B.clipAngle=function(t){return arguments.length?(_=+t?bD(x=t*SO):(x=null,yD),P()):x*_O},B.clipExtent=function(t){return arguments.length?(A=null==t?(S=n=r=o=null,xD):CD(S=+t[0][0],n=+t[0][1],r=+t[1][0],o=+t[1][1]),P()):null==S?null:[[S,n],[r,o]]},B.scale=function(t){return arguments.length?(u=+t,R()):u},B.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],R()):[d,p]},B.center=function(t){return arguments.length?(f=t[0]%360*SO,g=t[1]%360*SO,R()):[f*_O,g*_O]},B.rotate=function(t){return arguments.length?(m=t[0]%360*SO,y=t[1]%360*SO,b=t.length>2?t[2]%360*SO:0,R()):[m*_O,y*_O,b*_O]},B.angle=function(t){return arguments.length?(v=t%360*SO,R()):v*_O},B.reflectX=function(t){return arguments.length?(w=t?-1:1,R()):w<0},B.reflectY=function(t){return arguments.length?(C=t?-1:1,R()):C<0},B.precision=function(t){return arguments.length?(s=PF(a,T=t*t),P()):LO(T)},B.fitExtent=function(t,e){return BF(B,t,e)},B.fitSize=function(t,e){return function(t,e,i){return BF(t,[[0,0],e],i)}(B,t,e)},B.fitWidth=function(t,e){return function(t,e,i){return TF(t,(function(i){var n=+e,r=n/(i[1][0]-i[0][0]),o=(n-r*(i[1][0]+i[0][0]))/2,s=-r*i[0][1];t.scale(150*r).translate([o,s])}),i)}(B,t,e)},B.fitHeight=function(t,e){return function(t,e,i){return TF(t,(function(i){var n=+e,r=n/(i[1][1]-i[0][1]),o=-r*i[0][0],s=(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([o,s])}),i)}(B,t,e)},function(){return e=t.apply(this,arguments),B.invert=e.invert&&M,R()}}((function(){return t}))()}function IF(t,e){return[t,PO(kO((wO+e)/2))]}IF.invert=function(t,e){return[t,2*TO(RO(e))-wO]},function(t){var e,i,n,r=kF(t),o=r.center,s=r.scale,a=r.translate,l=r.clipExtent,h=null;function c(){var o=vO*s(),a=r(function(t){function e(e){return(e=t(e[0]*SO,e[1]*SO))[0]*=_O,e[1]*=_O,e}return t=JO(t[0]*SO,t[1]*SO,t.length>2?t[2]*SO:0),e.invert=function(e){return(e=t.invert(e[0]*SO,e[1]*SO))[0]*=_O,e[1]*=_O,e},e}(r.rotate()).invert([0,0]));return l(null==h?[[a[0]-o,a[1]-o],[a[0]+o,a[1]+o]]:t===IF?[[Math.max(a[0]-o,h),e],[Math.min(a[0]+o,i),n]]:[[h,Math.max(a[1]-o,e)],[i,Math.min(a[1]+o,n)]])}return r.scale=function(t){return arguments.length?(s(t),c()):s()},r.translate=function(t){return arguments.length?(a(t),c()):a()},r.center=function(t){return arguments.length?(o(t),c()):o()},r.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}(IF).scale(961/xO).translate([0,0]).center([0,0]).scale(63781);var OF=Object.prototype.hasOwnProperty;function DF(t,e,i,n,r,o){3===arguments.length&&(n=o=Array,r=null);for(var s=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),a=new o(t),l=t-1,h=0;h<t;++h)s[h]=r;return{set:function(n,o){for(var h=e(n)&l,c=s[h],u=0;c!=r;){if(i(c,n))return a[h]=o;if(++u>=t)throw new Error("full hashmap");c=s[h=h+1&l]}return s[h]=n,a[h]=o,o},maybeSet:function(n,o){for(var h=e(n)&l,c=s[h],u=0;c!=r;){if(i(c,n))return a[h];if(++u>=t)throw new Error("full hashmap");c=s[h=h+1&l]}return s[h]=n,a[h]=o,o},get:function(n,o){for(var h=e(n)&l,c=s[h],u=0;c!=r;){if(i(c,n))return a[h];if(++u>=t)break;c=s[h=h+1&l]}return o},keys:function(){for(var t=[],e=0,i=s.length;e<i;++e){var n=s[e];n!=r&&t.push(n)}return t}}}function FF(t,e){return t[0]===e[0]&&t[1]===e[1]}var zF=new ArrayBuffer(16),WF=new Float64Array(zF),jF=new Uint32Array(zF);function NF(t){WF[0]=t[0],WF[1]=t[1];var e=jF[0]^jF[1];return 2147483647&(e=e<<5^e>>7^jF[2]^jF[3])}function GF(t){var e,i,n,r,o=t.coordinates,s=t.lines,a=t.rings,l=function(){for(var t=DF(1.4*o.length,C,x,Int32Array,-1,Int32Array),e=new Int32Array(o.length),i=0,n=o.length;i<n;++i)e[i]=t.maybeSet(i,i);return e}(),h=new Int32Array(o.length),c=new Int32Array(o.length),u=new Int32Array(o.length),d=new Int8Array(o.length),p=0;for(e=0,i=o.length;e<i;++e)h[e]=c[e]=u[e]=-1;for(e=0,i=s.length;e<i;++e){var f=s[e],g=f[0],m=f[1];for(n=l[g],r=l[++g],++p,d[n]=1;++g<=m;)w(e,n,n=r,r=l[g]);++p,d[r]=1}for(e=0,i=o.length;e<i;++e)h[e]=-1;for(e=0,i=a.length;e<i;++e){var y=a[e],b=y[0]+1,v=y[1];for(w(e,l[v-1],n=l[b-1],r=l[b]);++b<=v;)w(e,n,n=r,r=l[b])}function w(t,e,i,n){if(h[i]!==t){h[i]=t;var r=c[i];if(r>=0){var o=u[i];r===e&&o===n||r===n&&o===e||(++p,d[i]=1)}else c[i]=e,u[i]=n}}function C(t){return NF(o[t])}function x(t,e){return FF(o[t],o[e])}h=c=u=null;var _,S=function(t,e,i,n,r){3===arguments.length&&(n=Array,r=null);for(var o=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),s=t-1,a=0;a<t;++a)o[a]=r;return{add:function(n){for(var a=e(n)&s,l=o[a],h=0;l!=r;){if(i(l,n))return!0;if(++h>=t)throw new Error("full hashset");l=o[a=a+1&s]}return o[a]=n,!0},has:function(n){for(var a=e(n)&s,l=o[a],h=0;l!=r;){if(i(l,n))return!0;if(++h>=t)break;l=o[a=a+1&s]}return!1},values:function(){for(var t=[],e=0,i=o.length;e<i;++e){var n=o[e];n!=r&&t.push(n)}return t}}}(1.4*p,NF,FF);for(e=0,i=o.length;e<i;++e)d[_=l[e]]&&S.add(o[_]);return S}function VF(t,e,i,n){UF(t,e,i),UF(t,e,e+n),UF(t,e+n,i)}function UF(t,e,i){for(var n,r=e+(i---e>>1);e<r;++e,--i)n=t[e],t[e]=t[i],t[i]=n}function KF(t){var e,i,n={};for(e in t)n[e]=null==(i=t[e])?{type:null}:("FeatureCollection"===i.type?$F:"Feature"===i.type?XF:YF)(i);return n}function $F(t){var e={type:"GeometryCollection",geometries:t.features.map(XF)};return null!=t.bbox&&(e.bbox=t.bbox),e}function XF(t){var e,i=YF(t.geometry);for(e in null!=t.id&&(i.id=t.id),null!=t.bbox&&(i.bbox=t.bbox),t.properties){i.properties=t.properties;break}return i}function YF(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(YF)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return null!=t.bbox&&(e.bbox=t.bbox),e}function qF(t){var e,i=t[0],n=t[1];return n<i&&(e=i,i=n,n=e),i+31*n}function ZF(t,e){var i,n=t[0],r=t[1],o=e[0],s=e[1];return r<n&&(i=n,n=r,r=i),s<o&&(i=o,o=s,s=i),n===o&&r===s}var JF=Object.freeze({__proto__:null,topology:function(t,e){var i=function(t){var e=1/0,i=1/0,n=-1/0,r=-1/0;function o(t){null!=t&&OF.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},Point:function(t){a(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(a)},LineString:function(t){l(t.arcs)},MultiLineString:function(t){t.arcs.forEach(l)},Polygon:function(t){t.arcs.forEach(l)},MultiPolygon:function(t){t.arcs.forEach(h)}};function a(t){var o=t[0],s=t[1];o<e&&(e=o),o>n&&(n=o),s<i&&(i=s),s>r&&(r=s)}function l(t){t.forEach(a)}function h(t){t.forEach(l)}for(var c in t)o(t[c]);return n>=e&&r>=i?[e,i,n,r]:void 0}(t=KF(t)),n=e>0&&i&&function(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=o-n?(i-1)/(o-n):1,l=s-r?(i-1)/(s-r):1;function h(t){return[Math.round((t[0]-n)*a),Math.round((t[1]-r)*l)]}function c(t,e){for(var i,o,s,h,c,u=-1,d=0,p=t.length,f=new Array(p);++u<p;)i=t[u],h=Math.round((i[0]-n)*a),c=Math.round((i[1]-r)*l),h===o&&c===s||(f[d++]=[o=h,s=c]);for(f.length=d;d<e;)d=f.push([f[0][0],f[0][1]]);return f}function u(t){return c(t,2)}function d(t){return c(t,4)}function p(t){return t.map(d)}function f(t){null!=t&&OF.call(g,t.type)&&g[t.type](t)}var g={GeometryCollection:function(t){t.geometries.forEach(f)},Point:function(t){t.coordinates=h(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(h)},LineString:function(t){t.arcs=u(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(u)},Polygon:function(t){t.arcs=p(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(p)}};for(var m in t)f(t[m]);return{scale:[1/a,1/l],translate:[n,r]}}(t,i,e),r=function(t){var e,i,n,r,o=t.coordinates,s=t.lines,a=t.rings,l=s.length+a.length;for(delete t.lines,delete t.rings,n=0,r=s.length;n<r;++n)for(e=s[n];e=e.next;)++l;for(n=0,r=a.length;n<r;++n)for(i=a[n];i=i.next;)++l;var h=DF(2*l*1.4,NF,FF),c=t.arcs=[];for(n=0,r=s.length;n<r;++n){e=s[n];do{u(e)}while(e=e.next)}for(n=0,r=a.length;n<r;++n)if((i=a[n]).next)do{u(i)}while(i=i.next);else d(i);function u(t){var e,i,n,r,s,a,l,u;if(n=h.get(e=o[t[0]]))for(l=0,u=n.length;l<u;++l)if(p(r=n[l],t))return t[0]=r[0],void(t[1]=r[1]);if(s=h.get(i=o[t[1]]))for(l=0,u=s.length;l<u;++l)if(f(a=s[l],t))return t[1]=a[0],void(t[0]=a[1]);n?n.push(t):h.set(e,[t]),s?s.push(t):h.set(i,[t]),c.push(t)}function d(t){var e,i,n,r,s;if(i=h.get(o[t[0]]))for(r=0,s=i.length;r<s;++r){if(g(n=i[r],t))return t[0]=n[0],void(t[1]=n[1]);if(m(n,t))return t[0]=n[1],void(t[1]=n[0])}if(i=h.get(e=o[t[0]+y(t)]))for(r=0,s=i.length;r<s;++r){if(g(n=i[r],t))return t[0]=n[0],void(t[1]=n[1]);if(m(n,t))return t[0]=n[1],void(t[1]=n[0])}i?i.push(t):h.set(e,[t]),c.push(t)}function p(t,e){var i=t[0],n=e[0],r=t[1];if(i-r!=n-e[1])return!1;for(;i<=r;++i,++n)if(!FF(o[i],o[n]))return!1;return!0}function f(t,e){var i=t[0],n=e[0],r=t[1],s=e[1];if(i-r!=n-s)return!1;for(;i<=r;++i,--s)if(!FF(o[i],o[s]))return!1;return!0}function g(t,e){var i=t[0],n=e[0],r=t[1]-i;if(r!==e[1]-n)return!1;for(var s=y(t),a=y(e),l=0;l<r;++l)if(!FF(o[i+(l+s)%r],o[n+(l+a)%r]))return!1;return!0}function m(t,e){var i=t[0],n=e[0],r=t[1],s=e[1],a=r-i;if(a!==s-n)return!1;for(var l=y(t),h=a-y(e),c=0;c<a;++c)if(!FF(o[i+(c+l)%a],o[s-(c+h)%a]))return!1;return!0}function y(t){for(var e=t[0],i=t[1],n=e,r=n,s=o[n];++n<i;){var a=o[n];(a[0]<s[0]||a[0]===s[0]&&a[1]<s[1])&&(r=n,s=a)}return r-e}return t}(function(t){var e,i,n,r=GF(t),o=t.coordinates,s=t.lines,a=t.rings;for(i=0,n=s.length;i<n;++i)for(var l=s[i],h=l[0],c=l[1];++h<c;)r.has(o[h])&&(e={0:h,1:l[1]},l[1]=h,l=l.next=e);for(i=0,n=a.length;i<n;++i)for(var u=a[i],d=u[0],p=d,f=u[1],g=r.has(o[d]);++p<f;)r.has(o[p])&&(g?(e={0:p,1:u[1]},u[1]=p,u=u.next=e):(VF(o,d,f,f-p),o[f]=o[d],g=!0,p=d));return t}(function(t){var e=-1,i=[],n=[],r=[];function o(t){t&&OF.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=a(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(a)},Polygon:function(t){t.arcs=t.arcs.map(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(h)}};function a(t){for(var n=0,o=t.length;n<o;++n)r[++e]=t[n];var s={0:e-o+1,1:e};return i.push(s),s}function l(t){for(var i=0,o=t.length;i<o;++i)r[++e]=t[i];var s={0:e-o+1,1:e};return n.push(s),s}function h(t){return t.map(l)}for(var c in t)o(t[c]);return{type:"Topology",coordinates:r,lines:i,rings:n,objects:t}}(t))),o=r.coordinates,s=DF(1.4*r.arcs.length,qF,ZF);function a(t){t&&OF.call(l,t.type)&&l[t.type](t)}t=r.objects,r.bbox=i,r.arcs=r.arcs.map((function(t,e){return s.set(t,e),o.slice(t[0],t[1]+1)})),delete r.coordinates,o=null;var l={GeometryCollection:function(t){t.geometries.forEach(a)},LineString:function(t){t.arcs=h(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(h)},Polygon:function(t){t.arcs=t.arcs.map(h)},MultiPolygon:function(t){t.arcs=t.arcs.map(c)}};function h(t){var e=[];do{var i=s.get(t);e.push(t[0]<t[1]?i:~i)}while(t=t.next);return e}function c(t){return t.map(h)}for(var u in t)a(t[u]);return n&&(r.transform=n,r.arcs=function(t){for(var e=-1,i=t.length;++e<i;){for(var n,r,o=t[e],s=0,a=1,l=o.length,h=o[0],c=h[0],u=h[1];++s<l;)n=(h=o[s])[0],r=h[1],n===c&&r===u||(o[a++]=[n-c,r-u],c=n,u=r);1===a&&(o[a++]=[0,0]),o.length=a}return t}(r.arcs)),r}}),QF=n(JF);function tz(t){return t}function ez(t){if(null==t)return tz;var e,i,n=t.scale[0],r=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=i=0);var l=2,h=t.length,c=new Array(h);for(c[0]=(e+=t[0])*n+o,c[1]=(i+=t[1])*r+s;l<h;)c[l]=t[l],++l;return c}}function iz(t){var e,i=ez(t.transform),n=1/0,r=n,o=-n,s=-n;function a(t){(t=i(t))[0]<n&&(n=t[0]),t[0]>o&&(o=t[0]),t[1]<r&&(r=t[1]),t[1]>s&&(s=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":a(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(a)}}for(e in t.arcs.forEach((function(t){for(var e,a=-1,l=t.length;++a<l;)(e=i(t[a],a))[0]<n&&(n=e[0]),e[0]>o&&(o=e[0]),e[1]<r&&(r=e[1]),e[1]>s&&(s=e[1])})),t.objects)l(t.objects[e]);return[n,r,o,s]}function nz(t,e){var i=e.id,n=e.bbox,r=null==e.properties?{}:e.properties,o=rz(t,e);return null==i&&null==n?{type:"Feature",properties:r,geometry:o}:null==n?{type:"Feature",id:i,properties:r,geometry:o}:{type:"Feature",id:i,bbox:n,properties:r,geometry:o}}function rz(t,e){var i=ez(t.transform),n=t.arcs;function r(t,e){e.length&&e.pop();for(var r=n[t<0?~t:t],o=0,s=r.length;o<s;++o)e.push(i(r[o],o));t<0&&function(t,e){for(var i,n=t.length,r=n-e;r<--n;)i=t[r],t[r++]=t[n],t[n]=i}(e,s)}function o(t){return i(t)}function s(t){for(var e=[],i=0,n=t.length;i<n;++i)r(t[i],e);return e.length<2&&e.push(e[0]),e}function a(t){for(var e=s(t);e.length<4;)e.push(e[0]);return e}function l(t){return t.map(a)}return function t(e){var i,n=e.type;switch(n){case"GeometryCollection":return{type:n,geometries:e.geometries.map(t)};case"Point":i=o(e.coordinates);break;case"MultiPoint":i=e.coordinates.map(o);break;case"LineString":i=s(e.arcs);break;case"MultiLineString":i=e.arcs.map(s);break;case"Polygon":i=l(e.arcs);break;case"MultiPolygon":i=e.arcs.map(l);break;default:return null}return{type:n,coordinates:i}}(e)}function oz(t,e){var i={},n={},r={},o=[],s=-1;function a(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach((function(t){i[t<0?~t:t]=1})),o.push(r)}}return e.forEach((function(i,n){var r,o=t.arcs[i<0?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(r=e[++s],e[s]=i,e[n]=r)})),e.forEach((function(e){var i,o,s=function(e){var i,n=t.arcs[e<0?~e:e],r=n[0];t.transform?(i=[0,0],n.forEach((function(t){i[0]+=t[0],i[1]+=t[1]}))):i=n[n.length-1];return e<0?[i,r]:[r,i]}(e),a=s[0],l=s[1];if(i=r[a])if(delete r[i.end],i.push(e),i.end=l,o=n[l]){delete n[o.start];var h=o===i?i:i.concat(o);n[h.start=i.start]=r[h.end=o.end]=h}else n[i.start]=r[i.end]=i;else if(i=n[l])if(delete n[i.start],i.unshift(e),i.start=a,o=r[a]){delete r[o.end];var c=o===i?i:o.concat(i);n[c.start=o.start]=r[c.end=i.end]=c}else n[i.start]=r[i.end]=i;else n[(i=[e]).start=a]=r[i.end=l]=i})),a(r,n),a(n,r),e.forEach((function(t){i[t<0?~t:t]||o.push([t])})),o}function sz(t,e,i){var n,r,o;if(arguments.length>1)n=function(t,e,i){var n,r=[],o=[];function s(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:n})}function a(t){t.forEach(s)}function l(t){t.forEach(a)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":a(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),o.forEach(null==i?function(t){r.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&r.push(t[0].i)}),r}(0,e,i);else for(r=0,n=new Array(o=t.arcs.length);r<o;++r)n[r]=r;return{type:"MultiLineString",arcs:oz(t,n)}}function az(t,e){var i={},n=[],r=[];function o(t){t.forEach((function(e){e.forEach((function(e){(i[e=e<0?~e:e]||(i[e]=[])).push(t)}))})),n.push(t)}function s(e){return function(t){for(var e,i=-1,n=t.length,r=t[n-1],o=0;++i<n;)e=r,r=t[i],o+=e[0]*r[1]-e[1]*r[0];return Math.abs(o)}(rz(t,{type:"Polygon",arcs:[e]}).coordinates[0])}return e.forEach((function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":o(e.arcs);break;case"MultiPolygon":e.arcs.forEach(o)}})),n.forEach((function(t){if(!t._){var e=[],n=[t];for(t._=1,r.push(e);t=n.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){i[t<0?~t:t].forEach((function(t){t._||(t._=1,n.push(t))}))}))}))}})),n.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:r.map((function(e){var n,r=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){i[t<0?~t:t].length<2&&r.push(t)}))}))})),(n=(r=oz(t,r)).length)>1)for(var o,a,l=1,h=s(r[0]);l<n;++l)(o=s(r[l]))>h&&(a=r[0],r[0]=r[l],r[l]=a,h=o);return r})).filter((function(t){return t.length>0}))}}function lz(t,e){for(var i=0,n=t.length;i<n;){var r=i+n>>>1;t[r]<e?i=r+1:n=r}return i}function hz(t){if(null==t)return tz;var e,i,n=t.scale[0],r=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=i=0);var l=2,h=t.length,c=new Array(h),u=Math.round((t[0]-o)/n),d=Math.round((t[1]-s)/r);for(c[0]=u-e,e=u,c[1]=d-i,i=d;l<h;)c[l]=t[l],++l;return c}}var cz=Object.freeze({__proto__:null,bbox:iz,feature:function(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return nz(t,e)}))}:nz(t,e)},merge:function(t){return rz(t,az.apply(this,arguments))},mergeArcs:az,mesh:function(t){return rz(t,sz.apply(this,arguments))},meshArcs:sz,neighbors:function(t){var e={},i=t.map((function(){return[]}));function n(t,i){t.forEach((function(t){t<0&&(t=~t);var n=e[t];n?n.push(i):e[t]=[i]}))}function r(t,e){t.forEach((function(t){n(t,e)}))}var o={LineString:n,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach((function(t){r(t,e)}))}};for(var s in t.forEach((function t(e,i){"GeometryCollection"===e.type?e.geometries.forEach((function(e){t(e,i)})):e.type in o&&o[e.type](e.arcs,i)})),e)for(var a=e[s],l=a.length,h=0;h<l;++h)for(var c=h+1;c<l;++c){var u,d=a[h],p=a[c];(u=i[d])[s=lz(u,p)]!==p&&u.splice(s,0,p),(u=i[p])[s=lz(u,d)]!==d&&u.splice(s,0,d)}return i},quantize:function(t,e){if(t.transform)throw new Error("already quantized");if(e&&e.scale)a=t.bbox;else{if(!((i=Math.floor(e))>=2))throw new Error("n must be ≥2");var i,n=(a=t.bbox||iz(t))[0],r=a[1],o=a[2],s=a[3];e={scale:[o-n?(o-n)/(i-1):1,s-r?(s-r)/(i-1):1],translate:[n,r]}}var a,l,h=hz(e),c=t.objects,u={};function d(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:d(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(d)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)u[l]=p(c[l]);return{type:"Topology",bbox:a,transform:e,objects:u,arcs:t.arcs.map((function(t){var e,i=0,n=1,r=t.length,o=new Array(r);for(o[0]=h(t[0],0);++i<r;)((e=h(t[i],i))[0]||e[1])&&(o[n++]=e);return 1===n&&(o[n++]=[0,0]),o.length=n,o}))}},transform:ez,untransform:hz}),uz=n(cz);QF.topology,uz.merge;var dz=function(t,e){this.p1=t,this.p2=e};dz.prototype.rise=function(){return this.p2[1]-this.p1[1]},dz.prototype.run=function(){return this.p2[0]-this.p1[0]},dz.prototype.slope=function(){return this.rise()/this.run()},dz.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},dz.prototype.isVertical=function(){return!isFinite(this.slope())},dz.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},dz.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},dz.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},dz.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},dz.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var pz,fz=dz,gz=function(t,e){for(var i=0,n=0,r=1;r<=t.length-2;r++){var o=new fz(t[0],t[t.length-1]).perpendicularDistance(t[r]);o>i&&(n=r,i=o)}if(i>e)var s=gz(t.slice(0,n),e),a=gz(t.slice(n,t.length),e),l=s.concat(a);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},mz=gz;!function(t){var e=mz;function i(e,i){var n=e.geometry,r=n.type;if("LineString"===r)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===r||"MultiLineString"===r)for(var o=0;o<n.coordinates.length;o++)n.coordinates[o]=t.exports.simplify(n.coordinates[o],i);else if("MultiPolygon"===r)for(var s=0;s<n.coordinates.length;s++)for(var a=0;a<n.coordinates[s].length;a++)n.coordinates[s][a]=t.exports.simplify(n.coordinates[s][a],i);return e}t.exports=function(t,e,n){return n||(t=JSON.parse(JSON.stringify(t))),t.features?function(t,e){for(var n=0;n<t.features.length;n++)t.features[n]=i(t.features[n],e);return t}(t,e):t.type&&"Feature"===t.type?i(t,e):new Error("FeatureCollection or individual Feature required")},t.exports.simplify=function(t,i){return e(t,i)}}({exports:{}}),function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(pz||(pz={}));const yz=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const r=e.fields,o=t[0],s={},a=[];for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const l=r[e];if(!l.type){let n=o;e in o||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:o),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},a.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},s[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(s[e]=l)}return Object.keys(s).length>0&&(t=t.filter((t=>{for(const e in s){const i=s[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]<t[e])return!1}return!0}))),a.sort(((t,e)=>t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n<i.length;n++){const r=i[n];let o=0;if("ordinal"===r.type?(void 0===r.sortIndex[e[r.key]]&&(r.sortIndex[e[r.key]]=r.sortIndexCount++),void 0===r.sortIndex[t[r.key]]&&(r.sortIndex[t[r.key]]=r.sortIndexCount++),o=r.sortIndex[t[r.key]]-r.sortIndex[e[r.key]]):"linear"===r.type&&(o=t[r.key]-e[r.key]),r.sortReverse&&(o=-o),0!==o)return o}return 0}(t,e,a))),t};var bz={
2
2
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
- read:function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,h=l>>1,c=-7,u=i?r-1:0,d=i?-1:1,p=t[e+u];for(u+=d,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+t[e+u],u+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+u],u+=d,c-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)},write:function(t,e,i,n,r,o){var s,a,l,h=8*o-r-1,c=(1<<h)-1,u=c>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(e*l-1)*Math.pow(2,r),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;t[i+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,h+=r;h>0;t[i+p]=255&s,p+=f,s/=256,h-=8);t[i+p-f]|=128*g}},vz=bz;function wz(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}wz.Varint=0,wz.Fixed64=1,wz.Bytes=2,wz.Fixed32=5;var Cz=4294967296,xz=1/Cz,_z="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Sz(t){return t.type===wz.Bytes?t.readVarint()+t.pos:t.pos+1}function Az(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Tz(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function Bz(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Mz(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Rz(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Pz(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Ez(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Hz(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Lz(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function kz(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Iz(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Oz(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Dz(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Fz(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}wz.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Oz(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fz(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Oz(this.buf,this.pos)+Oz(this.buf,this.pos+4)*Cz;return this.pos+=8,t},readSFixed64:function(){var t=Oz(this.buf,this.pos)+Fz(this.buf,this.pos+4)*Cz;return this.pos+=8,t},readFloat:function(){var t=vz.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=vz.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(r=o[i.pos++],n=(112&r)>>4,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return Az(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&_z?function(t,e,i){return _z.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r<i;){var o,s,a,l=t[r],h=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(o=t[r+1]))&&(h=(31&l)<<6|63&o)<=127&&(h=null):3===c?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((h=(15&l)<<12|(63&o)<<6|63&s)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((h=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==wz.Bytes)return t.push(this.readVarint(e));var i=Sz(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==wz.Bytes)return t.push(this.readSVarint());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==wz.Bytes)return t.push(this.readBoolean());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==wz.Bytes)return t.push(this.readFloat());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==wz.Bytes)return t.push(this.readDouble());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==wz.Bytes)return t.push(this.readFixed32());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==wz.Bytes)return t.push(this.readSFixed32());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==wz.Bytes)return t.push(this.readFixed64());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==wz.Bytes)return t.push(this.readSFixed64());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===wz.Varint)for(;this.buf[this.pos++]>127;);else if(e===wz.Bytes)this.pos=this.readVarint()+this.pos;else if(e===wz.Fixed32)this.pos+=4;else{if(e!==wz.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Dz(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Dz(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Dz(this.buf,-1&t,this.pos),Dz(this.buf,Math.floor(t*xz),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Dz(this.buf,-1&t,this.pos),Dz(this.buf,Math.floor(t*xz),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Tz(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),vz.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),vz.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Tz(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,wz.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Bz,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Mz,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ez,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Rz,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Pz,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Hz,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Lz,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,kz,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Iz,e)},writeBytesField:function(t,e){this.writeTag(t,wz.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,wz.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,wz.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,wz.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,wz.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,wz.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,wz.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,wz.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,wz.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,wz.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}},function(t,e){var i,n,r=4.5;function o(t){return t&&("function"==typeof r&&n.pointRadius(+r.apply(this,arguments)),NO(t,i(n))),n.result()}o.area=function(t){return NO(t,i(kD)),kD.result()},o.measure=function(t){return NO(t,i(CF)),CF.result()},o.bounds=function(t){return NO(t,i(VD)),VD.result()},o.centroid=function(t){return NO(t,i(cF)),cF.result()},o.projection=function(e){return arguments.length?(i=null==e?(t=null,xD):(t=e).stream,o):t},o.context=function(t){return arguments.length?(n=null==t?(e=null,new xF):new uF(e=t),"function"!=typeof r&&n.pointRadius(r),o):e},o.pointRadius=function(t){return arguments.length?(r="function"==typeof t?t:(n.pointRadius(+t),+t),o):r},o.projection(t).context(e)}();let zz=0;function Wz(){return zz>1e8&&(zz=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zz++}class jz{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Wu,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Wz("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const Nz="_data-view-diff-rank";class Gz{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Wu,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Wz("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const r=this.cloneParseData(t,e);if(null==e?void 0:e.type){this.parseOption=e,e=cd(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(r,e.options,this);this.rawData=r,this.parserData=t,this.history&&this.historyData.push(r,t),this.latestData=t}else this.parserData=r,this.rawData=r,this.history&&this.historyData.push(r),this.latestData=r;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=cd(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,r=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(r),this.latestData=r,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[Nz]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[Nz]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[Nz]<e&&(this.latestDataAUD.del.push(t),this._diffMap.delete(i))}))}this._diffRank=e}cloneParseData(t,e){let i=!1;return t instanceof Gz||!0!==(null==e?void 0:e.clone)||(i=!0),i?cd(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?fd({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!Vu(this._fields)&&Vu(i)?(this.dataSet.registerTransform("fields",yz),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const Vz=(t,e,i)=>new Lp({defaultFontParams:{fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},getTextBounds:i?void 0:lT,specialCharSet:"-/: .,@%'\"~"+Lp.ALPHABET_CHAR_SET+Lp.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),Uz=(t,e)=>{const i=t.map(((t,e)=>({index:e,value:t})));return i},Kz=(t,e,i=0)=>{const n=new ip(t).expand(i/2),r=new ip(e).expand(i/2);return n.intersects(r)},$z=(t,e)=>{let i=0;t.x2<e.x1?i=e.x1-t.x2:e.x2<t.x1&&(i=t.x1-e.x2);let n=0;return t.y2<e.y1?n=e.y1-t.y2:e.y2<t.y1&&(n=t.y1-e.y2),[i,n]};function Xz(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Yz(t,e){for(let i,n=1,r=t.length,o=t[0];n<r;o=i,++n)if(i=t[n],Xz(o.AABBBounds,i.AABBBounds,e))return!0;return!1}const qz=(t,e,i)=>{const{labelStyle:n,axisOrientType:r,labelFlush:o,labelFormatter:s,startAngle:a=0}=i,l=n.angle??0,h=["bottom","top"].includes(r),c=["left","right"].includes(r);let u=a;h?u=0:c&&(u=(t=>td(t)?np(t):null)(-90));const d=Vz(n),p=e.map(((i,r)=>{const a=s?s(i):`${i}`,{width:p,height:f}=d.quickMeasure(a),g=Math.max(p,12),m=Math.max(f,12),y=t.scale(i);let b,v,w=Math.cos(u)*y,C=-Math.sin(u)*y;b=o&&h&&0===r?"left":o&&h&&r===e.length-1?"right":n.textAlign??"center","right"===b?w-=g:"center"===b&&(w-=g/2),v=o&&c&&0===r?"top":o&&c&&r===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?C-=m:"middle"===v&&(C-=m/2);return(new ip).set(w,C,w+g,C+m).rotate(l,w+g/2,C+m/2)}));return p},Zz=(t,e,i)=>{const{labelStyle:n,getRadius:r,axisSpec:o,labelFormatter:s}=i,a=r?.(),l=n.angle??0,h=Jz(o),c=Vz(n),u=e.map((e=>{const i=s?s(e):`${e}`,{width:n,height:r}=c.quickMeasure(i),o=Math.max(n,12),u=Math.max(r,12),d=t.scale(e);let p=0,f=0;const g=function(t){let e="center",i="middle";t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t),e=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center";i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle";return{align:e,baseline:i}}(d),{x:m,y:y}=function(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}({x:0,y:0},a+h,d);p=m+("right"===g.align?-o:"center"===g.align?-o/2:0),f=y+("bottom"===g.baseline?-u:"middle"===g.baseline?-u/2:0);return(new ip).set(p,f,p+o,f+u).rotate(l,p+o/2,f+u/2)}));return u};function Jz(t){let e=0;return sd(t,"tick.visible")&&(e+=sd(t,"tick.tickSize")),sd(t,"label.visible")&&(e+=sd(t,"label.space")),e}const Qz={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!Xz(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},tW=(t,e,i,n,r,o)=>{let s=o,a=0,l=0,h=0,c=-1,u=Number.MAX_VALUE;do{let o=!0;s++;let d=0;do{d+s<t.length&&Kz(e[d],e[d+s],i)&&(o=!1),d+=s}while(o&&d<t.length);if(o){if(!n){h=s;break}{const n=t.length-1;a=0;do{if(d-=s,d!==n&&!Kz(e[d],e[n],i))break;a++}while(d>0);if(d===n){h=s,l=a;break}{const i=Math.floor(t.length/s)-a+1;if(i<c)break;{c=i;const t=r?0:1,o=$z(e[d],e[n])[t],p=d-s>=0?$z(e[d-s],e[d])[t]:o,f=Math.abs(o-p);f<u&&(u=f,h=s,l=a)}}}}}while(s<=t.length);return{step:h,delCount:l}},eW=(t,e,i,n)=>{let r=n;do{let n=!0;r++;let o=0;do{o+r<t.length&&Kz(e[o],e[o+r],i)&&(n=!1),o+=r}while(n&&o<t.length);if(n)break}while(r<=t.length);let o=0;if(t.length>2){let i=t.length-t.length%r;for(i>=t.length&&(i-=r);i>0&&Kz(e[0],e[i]);)o++,i-=r}return{step:r,delCount:o}},iW=(t,e)=>{if(_I(t.type))return((t,e)=>{if(!_I(t.type))return Uz(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return Uz([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:o,noDecimals:s=!1}=e;let a;if(a=Uu(o)?t.stepTicks(o):Uu(r)?t.forceTicks(r):"d3"===e.tickMode?t.d3Ticks(n??5,{noDecimals:s}):t.ticks(n??5,{noDecimals:s}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let r=qz(t,a,e).map(((t,e)=>({AABBBounds:t,value:a[e]})));for(;r.length>=3&&Yz(r,i);)r=Qz.parity(r);const o=r.map((t=>t.value));o.length<3&&n&&(o.length>1&&o.pop(),vd(o)!==vd(a)&&o.push(vd(a))),a=o}return Uz(a)})(t,e);if(function(t){switch(t){case xI.Ordinal:case xI.Point:case xI.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const i=t.domain();if(!i.length)return[];const{tickCount:n,forceTickCount:r,tickStep:o,labelGap:s=4,axisOrientType:a}=e,l=["bottom","top"].includes(a),h=t.range(),c=Math.abs(h[h.length-1]-h[0]);if(c<2)return e.labelLastVisible?Uz([i[i.length-1]]):Uz([i[0]]);let u;if(Uu(o))u=t.stepTicks(o);else if(Uu(r))u=t.forceTicks(r);else if(Uu(n))u=t.ticks(n);else if(e.sampling){let n;const r=(e.labelStyle.fontSize??12)+2;if(i.length<=c/r)n=qz(t,i,e);else{const r=[i[0],i[Math.floor(i.length/2)],i[i.length-1]],o=qz(t,r,e);let s=null,a=0;o.forEach(((t,e)=>{if(!s)return s=t,void(a=e);l?s.width()<t.width()&&(s=t,a=e):s.height()<t.height()&&(s=t,a=e)}));const h=0===a?0:2===a?i.length-1:Math.floor(i.length/2),c=t.scale(i[h]);n=new Array(i.length);for(let e=0;e<n.length;e++){n[e]=s.clone();const r=t.scale(i[e]);l?n[e].translate(r-c,0):n[e].translate(0,r-c)}}const o=n.map((t=>l?t.width():t.height())),a=Math.min(...h),d=(Math.max(...h)-a)/i.length,p=tW(i,n,s,e.labelLastVisible,l,Math.floor(Math.min(...o)/d));u=t.stepTicks(p.step),e.labelLastVisible&&(u=u.slice(0,u.length-p.delCount),u.push(i[i.length-1]))}else u=t.domain();return Uz(u)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:r,getRadius:o,axisSpec:s,labelGap:a=0}=e,l=o?.();if(!l)return Uz(t.domain());let h;if(Uu(r))h=t.stepTicks(r);else if(Uu(n))h=t.forceTicks(n);else if(Uu(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),r=Jz(s),o=Zz(t,i,e),c=Math.min(...n),u=Math.max(...n),d=Math.abs(u-c)*(l+r)/i.length,{step:p,delCount:f}=eW(i,o,a,Math.floor(o.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));h=t.stepTicks(p),h=h.slice(0,h.length-f)}else h=t.domain();return Uz(h)})(t,e)}return Uz(t.domain())},nW=Math.sqrt(50),rW=Math.sqrt(10),oW=Math.sqrt(2);class sW{_extend={};_scale;_scales;nice;zero;domain;expand;forceTickCount;tickCount;niceType;constructor(){this._scale=new XI,this._scales=[this._scale]}setExtraAttrFromSpec(t,e,i,n){this.nice=t,this.zero=e,this.zero&&(i.min=Math.min(i.min,0),i.max=Math.max(i.max,0)),this.domain=i,this.expand=n}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),Vu(this.domain?.min)&&Vu(this.domain?.max)?this.nice&&this._scale.nice(t):Uu(this.domain?.min)&&Vu(this.domain?.max)?this.nice&&this._scale.niceMax(t):Vu(this.domain?.min)&&Uu(this.domain?.max)&&this.nice&&this._scale.niceMin(t)}dataToPosition(t){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this.expand)return;const e=t[0],i=t[t.length-1];Uu(this.expand.min)&&(t[0]=e-(i-e)*this.expand.min),Uu(this.expand.max)&&(t[t.length-1]=i+(i-e)*this.expand.max)}niceDomain(t){if(Math.abs(function(t){if(t&&qu(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)}(t)-function(t){if(t&&qu(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),r=i/Math.pow(10,n);i=(r>=nW?10:r>=rW?5:r>=oW?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this.nice){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),Vu(this.domain?.min)&&Vu(this.domain?.max)?this._scale.nice(t):Uu(this.domain?.min)&&Vu(this.domain?.max)?this._scale.niceMax(t):Vu(this.domain?.min)&&Uu(this.domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this.zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this.nice),this.niceMinMax()}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,r=n?i:0,o=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[o]&&(t[o]=e),e<t[r]&&(t[r]=e)}setDomainMinMax(t){if(!this.domain)return;const{min:e,max:i}=this.domain;Uu(e)&&(t[0]=e),Uu(i)&&(t[1]=i)}setZero(t){this.zero!==t&&(this.zero=t,this.updateScaleDomain())}updateScaleDomain(){const t=this.computeDomain([this.domain]);this.updateScaleDomainByModel(t)}computeDomain(t){return this.computeLinearDomain(t)}updateScaleDomainByModel(t){t=t??this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this.nice),this.niceMinMax()}updateRange(t){const[e,i]=this._scale.range();t[0]===e&&t[1]===i||this._scale.range(t)}}function aW(t,e){const i=e.option;od(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),r=dO(e.orient),o=!0===e.option.inverse,s=t[0],a=vd(t);if(r)if(o){const t=i,e=0,n=s.AABBBounds.x2,r=a.AABBBounds.x1;n>t&&s.setAttributes({x:t,textAlign:"right"}),r<e&&a.setAttributes({x:e,textAlign:"left"})}else{const t=0,e=i,n=s.AABBBounds.x1,r=a.AABBBounds.x2;n<t&&s.setAttributes({x:t,textAlign:"left"}),r>e&&a.setAttributes({x:e,textAlign:"right"})}else if(o){const t=s.AABBBounds.y1,e=a.AABBBounds.y2,i=0,r=n;t<i&&s.setAttributes({y:i,textBaseline:"top"}),e>r&&a.setAttributes({y:r,textBaseline:"bottom"})}else{const t=n,e=0,i=s.AABBBounds.y2,r=a.AABBBounds.y1;i>t&&s.setAttributes({y:t,textBaseline:"bottom"}),r<e&&a.setAttributes({y:e,textBaseline:"top"})}}(t,e)}const lW=t=>t;class hW{width;height;table;option;orient;visible;type;inverse;data;tickData;scale;component;constructor(t,e,i,n){this.table=n,this.width=e,this.height=i,this.option=fd({},cO,t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.type=t.type??"band",this.inverse="inverse"in t&&!!t.inverse,"band"===t.type&&(this.data=t.domain),this.initScale(),this.initData(),this.createComponent(),this.initEvent()}initScale(){const t=this.option;"band"===this.type?(this.scale=new pO,this.scale.bandPadding=t.bandPadding,this.scale.paddingInner=t.paddingInner,this.scale.paddingOuter=t.paddingOuter,this.scale.calcScales(.1,.3),this.scale.updateScaleDomain(this.data),this.updateScaleRange()):"linear"!==this.type&&"time"!==this.type||(this.scale=new sW,this.scale.setExtraAttrFromSpec(t.nice,t.zero,t.range,t.expand),this.scale.transformScaleDomain(),this.scale.updateScaleDomain(),this.updateScaleRange())}initData(){!function(t,e,i){t.getParser(e)||t.registerParser(e,i)}(this.table._vDataSet,"scale",lW),function(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}(this.table._vDataSet,"ticks",iW);const t=this.option.label||{},e=this.option.tick||{},i=new Gz(this.table._vDataSet).parse(this.scale._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this.option.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this.orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this.tickData=i,this.computeData()}computeData(){this.tickData.reRunAllTransform()}initEvent(){}createComponent(){const t=uO(this.option),e=this.getUpdateAttribute();e.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component=new hI(fd({},t,e)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.component.originAxis=this}resize(t,e){this.width=t,this.height=e,this.updateScaleRange(),this.computeData();const i=uO(this.option),n=this.getUpdateAttribute();n.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component.setAttributes(fd({},i,n)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.overlap()}overlap(){!function(t,e){const i=t.find((t=>"axis-label-container-layer-0"===t.name),!0),n=t.find((t=>"axis-label-container-layer-1"===t.name),!0);aW(i?i.getChildren():[],e),aW(n?n.getChildren():[],e)}(this.component,this)}getLayoutRect(){return{width:this.width,height:this.height}}getUpdateAttribute(){this.table.tableNoFrameHeight,this.table.tableNoFrameWidth;const{width:t,height:e}=this.getLayoutRect(),i=dO(this.orient),n="left"===(r=this.orient)||"right"===r;var r;let o={x:0,y:0},s=0;i?(o={x:t,y:0},s=t):n&&(o={x:0,y:e},s=e);return{start:{x:0,y:0},end:o,title:{text:this.option.title.text,maxWidth:this._getTitleLimit(i)},items:this.getLabelItems(s)}}getLabelItems(t){return[this.tickData.latestData.map((e=>({id:e.value,label:e.value,value:0===t?0:this.scale.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]}updateScaleRange(){const{width:t,height:e}=this.getLayoutRect(),i=this.option.inverse||!1;let n=[0,0];dO(this.orient)?td(t)&&(n=i?[t,0]:[0,t]):td(e)&&(n=i?[0,e]:[e,0]),this.scale.updateRange(n)}setLayoutStartPosition(t){let{x:e,y:i}=t;return td(e)&&(e+=Number("left"===this.orient)*this.getLayoutRect().width),td(i)&&(i+=Number("top"===this.orient)*this.getLayoutRect().height),{x:e,y:i}}_getTitleLimit(t){if(this.option.title.visible&&Vu(this.option.title.style?.maxLineWidth)){let e=this.option.title.style?.angle||0;if(this.option.title?.autoRotate&&Vu(this.option.title.angle)&&(e="left"===this.option.orient?-90:90),t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(np(e)));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(np(e)));return n<1e-6?1/0:i/n}return null}getScale(){return this.scale._scale}getDomainSpec(){return this.scale.domain}}function cW(t,e,i,n,r,o){const s=function(t,e){const i=new Array(e);for(let n=0;n<e;n++)i[n]=t(n);return i}(t,i);s.sort(((t,e)=>n(o(t),o(e),r)));for(let t=0;t<i;t++)e(t,s[t])}function uW(t,e){if(typeof t!=typeof e)return!1;if("number"==typeof t&&"number"==typeof e&&t!==e)return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const dW={SOURCE_LENGTH_UPDATE:"source_length_update",CHANGE_ORDER:"change_order"};function pW(t,e){const i=Xp(t);if(Yp(i)){const t=i.then((t=>(e(t),t)));return e(t),t}return i}function fW(t,e,i){if(null===t)return;if(Yp(t))return t.then((t=>fW(t,e,i)));const n=function(t){if(tf.isObject(t)){const e=t;if(bu(e.get)&&bu(e.set))return!0}return!1}(e)?e.get:e;if(n in t){return pW(t[n],i)}if("function"==typeof n){return pW(n(t),i)}if(Array.isArray(n)){const e=function(t,e){let i,n=t;for(;i=e.shift();)n=n[i];return n}(t,[...n]);return pW(e,i)}const r=`${n}`.split(".");if(r.length<=1){return pW(t[n],i)}return pW(Kp(t,((t,e)=>fW(t,e,of)),...r),i)}function gW(t,e){if(!t)return e;const i=t[e];return bu(i)?i:e}class mW extends Su{_get;_sourceLength;_source;sortedIndexMap;lastOrder;lastOrderFn;lastOrderField;currentIndexedData=[];pagination;_currentPagerIndexedData;enableHierarchyState=!1;static get EVENT_TYPE(){return dW}treeDataHierarchyState=new Map;constructor(t,e,i){if(super(),this._get=t?.get.bind(t)||void 0,this._sourceLength=t?.length||0,this._source=t?.source??t,this.sortedIndexMap=new Map,this._currentPagerIndexedData=[],this.pagination=e||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},i>=1&&(this.enableHierarchyState=!0),this.currentIndexedData=Array.from({length:this._sourceLength},((t,e)=>e)),this.enableHierarchyState)for(let t=0;t<this._sourceLength;t++){this.getOriginalRecord(t).children&&this.treeDataHierarchyState.set(t,Xc.collapse)}if(i>1){let t=this._sourceLength;for(let e=0;e<t;e++){const n=this.currentIndexedData[e],r=this.getOriginalRecord(n);if(r.children?.length>0){this.treeDataHierarchyState.set(Array.isArray(n)?n.join(","):n,Xc.expand);const o=this.initChildrenNodeHierarchy(n,i,2,r);e+=o,t+=o}}}this.updatePagerData()}initChildrenNodeHierarchy(t,e,i,n){if(i>e)return 0;let r=0;const o=n.children?.length??0;for(let s=0;s<o;s++){r+=1;const o=n.children[s],a=Array.isArray(t)?t.concat(s):[t,s];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+r,0,a),o.children?.length>0&&(i<e?this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,Xc.expand):this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,Xc.collapse)),r+=this.initChildrenNodeHierarchy(a,e,i+1,o)}return r}updatePagination(t){this.pagination=t||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},this.updatePagerData()}updatePagerData(){const{currentIndexedData:t}=this,{perPageCount:e,currentPage:i}=this.pagination,n=e*(i||0),r=n+e;if(this._currentPagerIndexedData.length=0,t&&t.length>0){let e=-1;for(let i=0;i<t.length;i++)if((Array.isArray(t[i])&&1===t[i].length||!Array.isArray(t[i]))&&e++,e>=n&&e<r)this._currentPagerIndexedData.push(t[i]);else if(e>=r)break}else if(this._sourceLength>0)throw new Error("currentIndexedData should has values!")}get source(){return this._source}get(t){return this.getOriginalRecord(gW(this.currentPagerIndexedData,t))}getIndexKey(t){return gW(this.currentPagerIndexedData,t)}getField(t,e){return this.getOriginalField(gW(this.currentPagerIndexedData,t),e)}hasField(t,e){return this.hasOriginalField(gW(this.currentPagerIndexedData,t),e)}getHierarchyState(t){const e=this.getIndexKey(t);return this.treeDataHierarchyState.get(Array.isArray(e)?e.join(","):e)??null}toggleHierarchyState(t){const e=this.currentIndexedData.slice(0),i=this.getIndexKey(t),n=this.getHierarchyState(t),r=this.getOriginalRecord(i);if(this.clearSortedIndexMap(),n===Xc.collapse)this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,Xc.expand),this.pushChildrenNode(i,Xc.expand,r);else if(n===Xc.expand){let t=0;const e=(i,n,r)=>{if(n&&n!==Xc.collapse&&n!==Xc.none&&r.children)for(let n=0;n<r.children.length;n++){t+=1;const o=Array.isArray(i)?i.concat([n]):[i,n];e(o,this.treeDataHierarchyState.get(o.join(",")),r.children[n])}};e(i,n,r),this.currentIndexedData.splice(this.currentIndexedData.indexOf(i)+1,t),this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,Xc.collapse)}return this.updatePagerData(),function(t,e){const i=[],n=[];for(let i=0;i<t.length;i++){let r=!0;for(let n=0;n<e.length;n++)if(uW(t[i],e[n])){r=!1;break}r&&n.push(i)}for(let n=0;n<e.length;n++){let r=!0;for(let i=0;i<t.length;i++)if(uW(t[i],e[n])){r=!1;break}r&&i.push(n)}return{add:i,remove:n}}(e,this.currentIndexedData)}pushChildrenNode(t,e,i){if(!e||e===Xc.collapse||e===Xc.none)return 0;let n=0;if(i.children){const e=Array.from({length:i.children.length},((t,e)=>e));this.lastOrder&&"normal"!==this.lastOrder&&this.lastOrderField&&cW((t=>bu(e[t])?e[t]:e[t]=t),((t,i)=>{e[t]=i}),i.children.length,this.lastOrderFn,this.lastOrder,(e=>this.getOriginalField(Array.isArray(t)?t.concat([e]):[t,e],this.lastOrderField)));for(let r=0;r<e.length;r++){n+=1;const o=Array.isArray(t)?t.concat([e[r]]):[t,e[r]];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+n,0,o);const s=this.treeDataHierarchyState.get(o.join(",")),a=this.getOriginalRecord(o);!s&&a.children&&this.treeDataHierarchyState.set(o.join(","),Xc.collapse),n+=this.pushChildrenNode(o,this.treeDataHierarchyState.get(o.join(",")),i.children[e[r]])}}return n}setRecord(t,e){const i=this.getIndexKey(e);if(Array.isArray(i)){const e=i[i.length-1];this.getOriginalRecord(i.slice(0,i.length-1)).children.splice(e,1,t)}else this.source.splice(i,1,t)}sort(t,e,i=("desc"!==e?(t,e)=>t===e?0:t>e?1:-1:(t,e)=>t===e?0:t<e?1:-1)){this.lastOrderField=t,this.lastOrder=e,this.lastOrderFn=i;let n,r=this.sortedIndexMap.get(t);if(r&&(n=r[e],n&&n.length>0))return this.currentIndexedData=n,this.updatePagerData(),void this.fireListeners(dW.CHANGE_ORDER,null);const o=[];if("normal"===e)for(let t=0;t<this._sourceLength;t++)o[t]=t;else cW((t=>bu(o[t])?o[t]:o[t]=t),((t,e)=>{o[t]=e}),this._sourceLength,i,e,(e=>this.getOriginalField(e,t)));if(this.currentIndexedData=o,this.enableHierarchyState){let t=o.length;window.performance.now();for(let e=0;e<t;e++){const i=this.pushChildrenNode(o[e],this.treeDataHierarchyState.get(o[e]),this.getOriginalRecord(o[e]));t+=i,e+=i}}r||(r={asc:[],desc:[],normal:[]},this.sortedIndexMap.set(t,r)),r[e]=o,this.updatePagerData(),this.fireListeners(dW.CHANGE_ORDER,null)}clearSortedIndexMap(){this.lastOrderField&&this.lastOrder&&this.sortedIndexMap.forEach(((t,e)=>{e!==this.lastOrderField?this.sortedIndexMap.delete(e):"asc"===this.lastOrder?(t.desc=[],t.normal=[]):"desc"===this.lastOrder?(t.asc=[],t.normal=[]):(t.desc=[],t.asc=[])}))}get sourceLenght(){return this._sourceLength}set sourceLength(t){this._sourceLength!==t&&(this._sourceLength=t,this.fireListeners(dW.SOURCE_LENGTH_UPDATE,this._sourceLength))}get length(){return this.currentPagerIndexedData.length}get dataSource(){return this}get currentPagerIndexedData(){return this._currentPagerIndexedData.length>0?this._currentPagerIndexedData:[]}release(){super.release?.()}clearSortedMap(){this.currentIndexedData&&(this.currentIndexedData.length=0),this.currentIndexedData=null,this.sortedIndexMap.forEach((t=>{t.asc&&(t.asc.length=0),t.desc&&(t.desc.length=0)})),this.sortedIndexMap.clear()}clearCurrentIndexedData(){this.currentIndexedData=null,this.currentPagerIndexedData.length=0}getOriginalRecord(t){return pW(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getOriginalField(t,e){if(null===e)return;return fW(this.getOriginalRecord(t),e,(i=>{this.fieldPromiseCallBack(t,e,i)}))}hasOriginalField(t,e){if(null===e)return!1;if("function"==typeof e)return!0;const i=this.getOriginalRecord(t);return Boolean(i&&e in i)}fieldPromiseCallBack(t,e,i){}recordPromiseCallBack(t,e){}static EMPTY=new mW({get(){},length:0})}class yW extends mW{_recordCache;_fieldCache;static get EVENT_TYPE(){return mW.EVENT_TYPE}static ofArray(t,e,i){return new yW({get:e=>Array.isArray(e)?function(t,e){let i=t;for(let t=0;t<e.length;t++){const n=e[t];if(!i[n])return;i=i[n],i&&i.children&&t+1<e.length&&(i=i.children)}return i}(t,e):t[e],length:t.length,source:t},e,i)}constructor(t,e,i){super(t,e,i),this._recordCache={},this._fieldCache={}}getOriginalRecord(t){return this._recordCache&&this._recordCache[t]?this._recordCache[t]:super.getOriginalRecord(t)}getOriginalField(t,e){const i=this._fieldCache&&this._fieldCache[t];if(i){const t=i.get(e);if(t)return t}return super.getOriginalField(t,e)}clearCache(){this._recordCache&&(this._recordCache={}),this._fieldCache&&(this._fieldCache={})}fieldPromiseCallBack(t,e,i){!function(t,e,i,n){(t[e]||(t[e]=new Map)).set(i,n)}(this._fieldCache,t,e,i)}recordPromiseCallBack(t,e){this._recordCache[t]=e}release(){super.release?.()}}var bW=Object.freeze({__proto__:null,CachedDataSource:yW,DataSource:mW}),vW={exports:{}},wW={},CW=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),xW=["style","variant","weight","size","lineHeight","family"],_W=/([\.0-9]+)(.*)/,SW=function(t,e,i){var n=t.match(_W);if(n){t=parseFloat(n[1]);var r=n[2].toLowerCase().trim(),o=Math.round(t);switch(o===t&&(t=o),r){case"em":if(null===e)return;return t*e;case"px":return t;case"pt":return t/(72/i);case"pc":return t/(6/i);case"mm":return t*(i/25.4);case"cm":return t*(i/2.54);case"in":return t*i;case"%":if(null===e)return;return e*(t/100)}}},AW={size:SW,lineHeight:SW},TW={serif:1,"sans-serif":1,cursive:1,fantasy:1,monospace:1},BW=vW.exports=function(t,e,i){var n=t+"-"+(e||"null")+"@"+i;if(i=i||96,void 0!==wW[n])return wW[n];if(e&&(e=BW(e,null,i)),"inherit"===t)return e;var r=CW.exec(t);if(r){r.shift();for(var o={},s=0;s<r.length;s++){var a=xW[s],l=r[s];if(AW[a]&&l){var h=e&&e[a]||null,c=AW[a](l,h,i);l=void 0===c&&"lineHeight"===a&&l?o.size*parseFloat(l):c}if(l&&"normal"!==l){if("inherit"===l){if(!e)return;l=e[a]}l.trim&&(l=l.trim()),o[a]=l}}Object.keys(o).length||(o=null),wW[n]=o;var u=[];o.style&&u.push(o.style),o.variant&&u.push(o.variant),o.weight&&"400"!==o.weight&&"normal"!==o.weight&&u.push(o.weight),u.push(o.size+"px"),o.lineHeight&&(u[u.length-1]+="/"+o.lineHeight+"px");var d=o.family.split(",");return o.family=d.map((function(t){return t=t.trim(),TW[t.toLowerCase()]&&(t=t.toLowerCase()),t})),u.push(o.family),Object.defineProperty(o,"toString",{value:function(){return u.map((function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(" ")>-1?'"'+t.replace(/["']/g,"")+'"':t})).join(", "):t})).join(" ")}}),o}wW[n]=null};vW.exports.generics=TW;var MW=i(vW.exports);function RW(t){let e=Cw(t);return"number"==typeof e||"string"==typeof e?e=[e,e,e,e]:Array.isArray(e)&&(e=e.slice(0)),e}const PW=0,EW=1,HW=2,LW=3,kW=10,IW=11,OW=12,DW=9,FW=13,zW=10,WW=12,jW=32,NW=37,GW=46,VW=48,UW=57,KW=65,$W=90,XW=97,YW=122;function qW(t){return function(t){return t>=XW&&t<=YW}(t)||function(t){return t>=KW&&t<=$W}(t)}function ZW(t){return t===DW||t===zW||t===WW||t===FW||t===jW}function JW(t){return t>=VW&&t<=UW}function QW(t){return t===GW}function tj(t){return qW(t)||t===NW}function ej(t){return new Error(`calc parse error: ${t}`)}const ij={"*":3,"/":3,"+":2,"-":2};function nj(t,e){function i(t){const i=t.pop(),n=t.pop(),r=t.pop();if(!(r&&r.nodeType&&n&&n.type===HW&&i&&i.nodeType))throw ej(e);return{nodeType:IW,left:r,op:n,right:i}}const n=[];for(;t.length;){const r=t.shift();if(r.type===PW&&"("===r.value){let i=0;const r=zp.findIndex(t,(t=>{if(t.type===PW&&"("===t.value)i++;else if(t.type===PW&&")"===t.value){if(!i)return!0;i--}return!1}));if(-1===r)throw ej(e);n.push(nj(t.splice(0,r),e)),t.shift()}else if(r.type===HW){if(n.length>=3){const t=n[n.length-2].value;ij[r.value]<=ij[t]&&n.push(i(n))}n.push(r)}else if(r.type===EW){const{value:t,unit:e}=r;n.push({nodeType:kW,value:t,unit:e})}else r.type===LW&&n.push({nodeType:OW,value:r.value})}for(;n.length>1;)n.push(i(n));return n[0]}function rj(t){const e=function(t){const e=t.replace(/calc\(/g,"(").trim(),i=[],n=e.length;for(let s=0;s<n;s++){const n=e[s],a=n.charCodeAt(0);if("("===n||")"===n)i.push({value:n,type:PW});else if("*"===n||"/"===n)i.push({value:n,type:HW});else if("+"===n||"-"===n)s=r(n,s+1)-1;else if(JW(a)||QW(a))s=o(n,s+1)-1;else if(!ZW(a))throw ej(t)}function r(t,r){if(r<n){const i=e[r],n=i.charCodeAt(0);if(JW(n)||QW(n))return o(t+i,r+1)}return i.push({value:t,type:HW}),r}function o(r,o){let a=o;for(;a<n;a++){const i=e[a],n=i.charCodeAt(0);if(JW(n))r+=i;else{if("."!==i){if(tj(n))return s(r,i,a+1);break}if(r.indexOf(".")>=0)throw ej(t);r+=i}}if("."===r)throw ej(t);return i.push({value:parseFloat(r),type:LW}),a}function s(t,r,o){let s=o;for(;s<n;s++){const t=e[s];if(!tj(t.charCodeAt(0)))break;r+=t}return i.push({value:parseFloat(t),unit:r,type:EW}),s}return i}(t);return nj(e,t)}function oj(t,e){if(t.nodeType===IW){const i=oj(t.left,e),n=oj(t.right,e);switch(t.op.value){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n;default:throw new Error(`calc error. unknown operator: ${t.op.value}`)}}else if(t.nodeType===kW)switch(t.unit){case"%":return t.value*e.full/100;case"px":return t.value;default:throw new Error(`calc error. unknown unit: ${t.unit}`)}else if(t.nodeType===OW)return t.value;throw new Error("calc error.")}function sj(t,e){return oj(rj(t),e)}function aj(t,e){return"string"==typeof t?sj(t.trim(),e):t-0}function lj(t){return!!Yu(t)&&(!!t.endsWith("%")&&function(t){return!(Vu(t)||!Qu(t)&&+t!=+t)}(t.substring(0,t.length-1)))}function hj(t,e){const{dataSourceEventIds:i}=t.internalProps;i&&i.forEach((e=>t.internalProps.handler.off(e))),e(t),t.internalProps.dataSourceEventIds=[t.internalProps.handler.on(t.internalProps.dataSource,mW.EVENT_TYPE.CHANGE_ORDER,(()=>{t.dataSource.enableHierarchyState&&t.refreshRowColCount(),t.render()}))]}function cj(t,e=[]){hj(t,(()=>{const i=e;t.internalProps.records=e;const n=t.internalProps.dataSource=yW.ofArray(i,t.pagination,t.options.hierarchyExpandLevel??(t.hasHierarchyTreeHeader?.()?1:void 0));t.addReleaseObj(n)}))}function uj(t,e){hj(t,(()=>{if(e)if(e instanceof mW)t.internalProps.dataSource=e;else{const i=t.internalProps.dataSource=new yW(e);t.addReleaseObj(i)}else t.internalProps.dataSource=mW.EMPTY;t.internalProps.records=null}))}function dj(t,e){return Math.round(aj(e,t.internalProps.calcWidthContext))}function pj(t,e,i,n,r,o=!0){const s=RW(r("padding",t,i,n,e)),a=r("bgColor",t,i,n,e),l=r("font",t,i,n,e);let h,c,u;if(l){const{family:t,size:e,weight:i}=function(t){return MW(t)}(l);h=t.join(" "),c=e,u=i}else h=r("fontFamily",t,i,n,e),c=r("fontSize",t,i,n,e),u=r("fontWeight",t,i,n,e);const d=r("textAlign",t,i,n,e),p=r("textBaseline",t,i,n,e),f=r("color",t,i,n,e),g=r("lineHeight",t,i,n,e),m=r("underline",t,i,n,e),y=r("lineThrough",t,i,n,e),b=Math.max(1,Math.floor(c/10)),v=r("textOverflow",t,i,n,e),w=r("borderColor",t,i,n,e),C=r("borderLineWidth",t,i,n,e),x=r("borderLineDash",t,i,n,e),_=r("marked",t,i,n,e),S=r("cursor",t,i,n,e),A=!(s&&a&&l&&d&&p&&f&&v&&w&&C&&x&&"boolean"==typeof m&&"boolean"==typeof y&&"boolean"==typeof _);if(!o)return{hasFunctionPros:A};const T={text:{fontFamily:h,fontSize:c,fontWeight:u,fill:f,textAlign:d,textBaseline:p,lineHeight:g??c,underline:m?b:void 0,lineThrough:y?b:void 0,ellipsis:v&&"clip"!==v?"ellipsis"===v?"...":v:void 0},group:{fill:a,lineDash:x,lineWidth:C,stroke:w,cursor:"auto"===S||"default"===S?void 0:S},_vtable:{padding:s,marked:_}};if(Array.isArray(C)&&(T.group.strokeArrayWidth=RW(C)),Array.isArray(w)){const t=RW(w);T.group.stroke=!t.every((t=>!t))&&t,T.group.strokeArrayColor=RW(w)}return{theme:T,hasFunctionPros:A}}const fj={};class gj{static cache=new Map;static setIcon(t,e){this.cache.set(t,e)}static getIcon(t){return this.cache.has(t)?this.cache.get(t):null}static hasIcon(t){return this.cache.has(t)}static clear(t){return this.cache.delete(t)}static clearAll(){this.cache=new Map}}const mj={get sort_downward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#416EFF"/> </svg>',width:16,height:16,funcType:Jc.sort,name:"sort_downward",positionType:Zc.contentRight,marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_upward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#416EFF"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:Jc.sort,positionType:Zc.contentRight,name:"sort_upward",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_normal(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:Jc.sort,positionType:Zc.contentRight,name:"sort_normal",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get freeze(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><path d="M17.1313 8.42047C17.1932 8.48238 17.2423 8.55587 17.2759 8.63676C17.3094 8.71764 17.3266 8.80434 17.3266 8.89189C17.3266 8.97944 17.3094 9.06613 17.2759 9.14702C17.2423 9.2279 17.1932 9.3014 17.1313 9.3633L13.3843 13.1103C13.7007 14.3048 13.5305 15.4443 12.8388 16.2395C12.8104 16.2781 12.7778 16.3136 12.7417 16.3451L12.712 16.3755C12.6501 16.4374 12.5766 16.4865 12.4957 16.52C12.4148 16.5535 12.3281 16.5707 12.2406 16.5707C12.153 16.5707 12.0663 16.5535 11.9854 16.52C11.9046 16.4865 11.8311 16.4374 11.7692 16.3755L9.17633 13.7826L6.05316 16.9058L5.11983 17.0925C5.09291 17.0979 5.06508 17.0965 5.03881 17.0886C5.01254 17.0806 4.98863 17.0663 4.96923 17.0469C4.94982 17.0275 4.9355 17.0036 4.92755 16.9773C4.9196 16.951 4.91827 16.9232 4.92366 16.8963L5.11033 15.963L8.23333 12.8396L5.64066 10.2471C5.57875 10.1852 5.52964 10.1117 5.49614 10.0309C5.46263 9.94997 5.44539 9.86327 5.44539 9.77572C5.44539 9.68817 5.46263 9.60148 5.49614 9.52059C5.52964 9.43971 5.57875 9.36621 5.64066 9.3043C5.65066 9.2943 5.66066 9.2843 5.67099 9.27464C5.70266 9.2383 5.73833 9.20547 5.77766 9.17664C6.57283 8.48564 7.71199 8.31564 8.90599 8.63197L12.6528 4.88497C12.7147 4.82306 12.7882 4.77395 12.8691 4.74045C12.95 4.70694 13.0367 4.6897 13.1242 4.6897C13.2118 4.6897 13.2985 4.70694 13.3794 4.74045C13.4603 4.77395 13.5338 4.82306 13.5957 4.88497L17.1312 8.42047H17.1313ZM15.7172 8.8918L13.1243 6.29914L9.56483 9.8588C9.47574 9.94788 9.36323 10.0099 9.24034 10.0376C9.11746 10.0654 8.98922 10.0578 8.87049 10.0156C8.22783 9.78764 7.63899 9.7553 7.17749 9.89814L12.1182 14.8388C12.261 14.3771 12.2287 13.7885 12.0007 13.146C11.9585 13.0272 11.9509 12.899 11.9787 12.7761C12.0064 12.6532 12.0684 12.5407 12.1575 12.4516L15.7172 8.89164V8.8918Z" fill="#282F38" fill-opacity="0.2"/></g><defs><clipPath id="clip0"><rect width="22" height="22" fill="white"/></clipPath></defs></svg>',width:22,height:22,name:"freeze",funcType:Jc.frozen,positionType:Zc.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozen(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#282F38" fill-opacity="0.35"/></svg>',width:22,height:22,name:"frozen",funcType:Jc.frozen,positionType:Zc.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozenCurrent(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#416EFF"/></svg>',width:22,height:22,funcType:Jc.frozen,positionType:Zc.right,name:"frozenCurrent",marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get dropdownIcon(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="white"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#959DA5"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="#4F5965"/></svg>',width:24,height:24,funcType:Jc.dropDown,positionType:Zc.absoluteRight,name:"dropdownIcon",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)",image:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="#1E54C9"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#141414" stroke-opacity="0.2"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="white"/></svg>'},cursor:"pointer",visibleTime:"mouseenter_cell"}},get play(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="48" height="48" fill="white" fill-opacity="0.01" /><path d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /><path d="M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /></svg>',width:24,height:24,funcType:Jc.play,positionType:Zc.right,name:"play",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get damage_pic(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 10V38C5 39.1046 5.89543 40 7 40H14H18L15 29L22 27L21 20L29 16L27 13L30 8H7C5.89543 8 5 8.89543 5 10Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M43 38V10C43 8.89543 42.1046 8 41 8H38L34 14L37 19L28 23L29 31L22 33L24 40H41C42.1046 40 43 39.1046 43 38Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 18C15.3284 18 16 17.3284 16 16.5C16 15.6716 15.3284 15 14.5 15C13.6716 15 13 15.6716 13 16.5C13 17.3284 13.6716 18 14.5 18Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>',width:24,height:24,funcType:Jc.damagePic,positionType:Zc.left,name:"damage_pic",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get expand(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M4.64988 6.81235C4.38797 6.48497 4.62106 6 5.04031 6L10.9597 6C11.3789 6 11.612 6.48497 11.3501 6.81235L8.39043 10.512C8.19027 10.7622 7.80973 10.7622 7.60957 10.512L4.64988 6.81235Z" fill="#141414" fill-opacity="0.65"/>\n </svg>',width:16,height:16,funcType:Jc.expand,name:"expand",positionType:Zc.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get collapse(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M5.81235 11.3501C5.48497 11.612 5 11.3789 5 10.9597L5 5.04031C5 4.62106 5.48497 4.38797 5.81235 4.64988L9.51196 7.60957C9.76216 7.80973 9.76216 8.19027 9.51196 8.39044L5.81235 11.3501Z" fill="#141414" fill-opacity="0.65"/>\n </svg>',width:16,height:16,funcType:Jc.collapse,name:"collapse",positionType:Zc.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get drillDown(){return{name:"drillDown",type:"svg",positionType:Zc.absolute,funcType:Jc.drillDown,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM549.333333 288a5.333333 5.333333 0 0 1 5.333334 5.333333V469.333333h176a5.333333 5.333333 0 0 1 5.333333 5.333334v74.666666a5.333333 5.333333 0 0 1-5.333333 5.333334H554.666667v176a5.333333 5.333333 0 0 1-5.333334 5.333333h-74.666666a5.333333 5.333333 0 0 1-5.333334-5.333333V554.666667H293.333333a5.333333 5.333333 0 0 1-5.333333-5.333334v-74.666666a5.333333 5.333333 0 0 1 5.333333-5.333334H469.333333V293.333333a5.333333 5.333333 0 0 1 5.333334-5.333333h74.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}},get drillUp(){return{name:"drillUp",type:"svg",positionType:Zc.absolute,funcType:Jc.drillUp,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM693.333333 469.333333a42.666667 42.666667 0 1 1 0 85.333334H330.666667a42.666667 42.666667 0 1 1 0-85.333334h362.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}}};function yj(){return Up(mj,fj)}class bj extends Xx{role;col;row;mergeCol;mergeRow;rowNumber;colHeight;border;needUpdate;clear(){this.removeAllChild()}getChildByName(t,e){let i=null;return this.forEachChildren((e=>e.name===t&&(i=e,!0))),e&&this.forEachChildren((e=>{if(e.getChildByName){const n=e.getChildByName(t,!0);if(n)return i=n,!0}return!1})),i}get width(){let t=this.AABBBounds.width();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.width??0)}get height(){let t=this.AABBBounds.height();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.height??0)}setDeltaWidth(t){this.setAttribute("width",(this.attribute.width??0)+t),this.border&&this.border.setAttribute("width",this.border.attribute.width+t)}setDeltaHeight(t){this.setAttribute("height",(this.attribute.height??0)+t),this.border&&this.border.setAttribute("height",this.border.attribute.height+t)}setDeltaX(t){this.setAttribute("x",this.attribute.x+t)}setDeltaY(t){this.setAttribute("y",this.attribute.y+t)}forEachChildrenSkipChild(t,e="border-rect",i=!1){if(i){let i=this._lastChild,n=0;for(;i;){if(i.name!==e){if(t(i,n++))return}i=i._prev}}else{let i=this._firstChild,n=0;for(;i;){if(i.name!==e){if(t(i,n++))return}i=i._next}}}getColGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.col===t)return e;e=e._next}return null}getRowGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.row===t)return e;e=e._next}return null}getChildAt(t){const e=super.getChildAt(t);return e&&"border-rect"===e.name?e._next:e}updateColumnRowNumber(t){this.rowNumber?this.rowNumber=Math.max(this.rowNumber,t):this.rowNumber=t}updateColumnHeight(t){this.colHeight?this.colHeight+=t:this.colHeight=t}}function vj(t,e,i,n){let r=t,o=e;return r>i&&(r=i,o=r*e/t),o>n&&(o=n,r=o*t/e),{width:r,height:o}}function wj(t,e,i,n,r,o,s="left",a="middle",l=[0,0,0,0],h=0,c=0,u=0,d=0){const p=t+i,f=e+n;let g=t+l[3]+h;"right"===s||"end"===s?g=p-r-l[1]-c:"center"===s&&(g=t+(i-r+h-c)/2);let m=e+l[0]+u;return"bottom"===a||"alphabetic"===a||"ideographic"===a?m=f-o-l[2]-d:"middle"===a&&(m=e+(n-o+u-d)/2),{x:g,y:m}}function Cj(t,e,i,n,r){const o=e&&bu(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:n,table:r,value:r.getCellValue(i,n),dataValue:r.getCellOriginValue(i,n),cellHeaderPaths:r.getCellHeaderPaths(i,n)})}return o}function xj(t,e,i,n,r){const o=e&&bu(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:n,table:r,value:r.getCellValue(i,n),dataValue:r.getCellOriginValue(i,n),cellHeaderPaths:r.getCellHeaderPaths(i,n)})}}function _j(t,e,i,n,r,o){let s=!1,a=null,l=null;return r.table.getColWidth(t)<i+o[1]+o[3]&&(a=i+o[1]+o[3],s=!0),r.table.getRowHeight(e)<n+o[2]+o[0]&&(l=n+o[2]+o[0],s=!0),!!s&&("number"==typeof a&&r.setColWidth(t,a),"number"==typeof l&&r.setRowHeight(e,l),r.component.updateScrollBar(),!0)}function Sj(t,e,i,n){const r=t.getChildByName("image"),o="string"!=typeof r.attribute.image&&r.attribute.image||r.resources?.get(r.attribute.image).data;if(!o)return;const s=n._getCellStyle(e,i),a=Cj("textAlign",s,e,i,n)??"left",l=Cj("textBaseline",s,e,i,n)??"middle",h=RW(Cj("padding",s,e,i,n))??[0,0,0,0];if(r.keepAspectRatio){const{width:e,height:i}=vj(o.width||o.videoWidth,o.height||o.videoHeight,t.attribute.width-(h[1]+h[3]),t.attribute.height-(h[0]+h[2])),n=wj(0,0,t.attribute.width,t.attribute.height,e,i,a,l,h);r.setAttributes({x:n.x,y:n.y,width:e,height:i})}else r.setAttributes({x:h[3],y:h[0],width:t.attribute.width-h[1]-h[3],height:t.attribute.height-h[0]-h[2]});const c=t.getChildByName("play-icon");if(c){const e=0,i=0,n=t.attribute.width,o=t.attribute.height,s=Math.floor(Math.min(n-h[1]-h[3],o-h[2]-h[0])/2),a=e+(n>r.attribute.width?r.attribute.x-e+r.attribute.width/2:n/2),l=i+(o>r.attribute.height?r.attribute.y-i+r.attribute.height/2:o/2);c.setAttributes({x:a-s/2,y:l-s/2,width:s,height:s})}}function Aj(t,e,i,n,r,o,s,a,l){t.dependField&&(r=l.getCellOriginRecord(o,s)?.[t.dependField]??r),t.barType=t.barType??"default",t.min=t.min??0,t.max=t.max??t.min+100;const h=l.getRowHeight(s);let c=i,u=h;const d=new bj({x:0,y:0,width:c,height:u});d.name="progress-bar";const{showBar:p,barColor:f,barBgColor:g,barPositiveColor:m,barNegativeColor:y,barAxisColor:b,barRightToLeft:v,showBarMark:w,barMarkPositiveColor:C,barMarkNegativeColor:x,barMarkWidth:_,barMarkPosition:S}=e;let{barHeight:A,barBottom:T,barPadding:B}=e;1===B.length?B=[B[0],B[0],B[0],B[0]]:2===B.length?B=[B[0],B[1],B[0],B[1]]:3===B.length&&(B=[B[0],B[1],B[2],B[1]]),B=B.map(((t,e)=>{if("string"==typeof t&&ef.endsWith(t,"%")){const n=Number(t.substr(0,t.length-1));return 0===e||2===e?h*n/100:i*n/100}return Number(t)}));const M=c,R=u,P=RW(Cj("borderLineWidth",e,o,s,l));let E=Math.max(B[0],P[0]);const H=Math.max(B[1],P[1]),L=Math.max(B[2],P[2]);let k=Math.max(B[3],P[3]);c-=H+k,u-=L+E,1&E&&(E+=.5),1&k&&(k+=.5),"string"==typeof A&&ef.endsWith(A,"%")?(A=Number(A.substr(0,A.length-1)),A=u*A/100):A=Number(A),"string"==typeof T&&ef.endsWith(T,"%")?(T=Number(T.substr(0,T.length-1)),T=u*T/100):T=Number(T);if(Xp(p,{col:o,row:s,table:l,context:null,value:n,dataValue:r})){let e=`${r}`;ef.endsWith(e,"%")&&(e=e.substr(0,e.length-1));const a=Number(e);if(isNaN(a))return d;if("default"===(t.barType??"default")){const e=a<t.min?0:a>t.max?1:(a-t.min)/(t.max-t.min),i=c,h=E+u-A-T,p=0+k,m=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e});if(m){const t=eT({x:p,y:h,width:i,height:A,fill:m});d.addChild(t)}const y=eT({x:p,y:h,width:Math.min(i*e,i),height:A,fill:Xp(f,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e})||"#20a8d8"});d.addChild(y)}else if("negative"===t.barType){const e=t.min<0?-t.min:0,i=t.max>0?t.max:0,p=e/(e+i),f=1-p,B=a>0?a/i:0,M=a<0?-a/e:0,R=c,P=E+u-A-T,H=0+k,L=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B});if(L){const t=eT({x:H,y:P,width:R,height:A,fill:L});d.addChild(t)}const I=v?f*R:p*R,O=Math.min(R*p*M,R),D=v?{left:H+I,top:P,width:O,height:A}:{left:H+I-O,top:P,width:O,height:A},F=Xp(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:M})||"#20a8d8",z=eT({x:D.left,y:D.top,width:D.width,height:D.height,fill:F});d.addChild(z);const W=Math.min(R*f*B,R),j=v?{left:H+I-W,top:P,width:W,height:A}:{left:H+I,top:P,width:W,height:A},N=Xp(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8",G=eT({x:j.left,y:j.top,width:j.width,height:j.height,fill:N});d.addChild(G);const V=v?D.left:j.left,U=QA({x:0,y:0,stroke:Xp(b),lineWidth:1,lineDash:[2,2],points:[{x:V,y:0},{x:V,y:h}]});if(d.addChild(U),w&&(B||M)){const t=_,e=[];let i;if(B>0)if(i=Xp(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8","right"===S){const t=v?j.left+_/2:j.left+j.width-_/2;e.push({x:t,y:j.top}),e.push({x:t,y:j.top+j.height})}else"bottom"===S&&(e.push({x:j.left,y:j.top+j.height-_/2}),e.push({x:j.left+j.width,y:j.top+j.height-_/2}));else if(M>0)if(i=Xp(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:M})||"#20a8d8","right"===S){const t=v?D.left+D.width-_/2:D.left+_/2;e.push({x:t,y:D.top}),e.push({x:t,y:D.top+D.height})}else"bottom"===S&&(e.push({x:D.left,y:D.top+D.height-_/2}),e.push({x:D.left+D.width,y:D.top+D.height-_/2}));const a=QA({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(a)}}else if("negative_no_axis"===t.barType){const e=t.min<0?-t.min:0,h=t.max>0?t.max:0,c=Math.max(e,h),u=0===c?0:Math.abs(a)/c,p=i-k-H-1,f=Math.min(p*u,p),b=R-L-A-T-1,B=v?M-H-f:0+k,P=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u});if(P){const t=eT({x:B,y:b,width:p,height:A,fill:P});d.addChild(t)}const E={left:B,top:b,width:f,height:A};let I;I=a>=0?Xp(m,{col:o,row:s,table:l,context:null,value:n,percentile:u,dataValue:r})||"#20a8d8":Xp(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8";const O=eT({x:E.left,y:E.top,width:E.width,height:E.height,fill:I});if(d.addChild(O),w&&a){const t=_,e=[];let i;if(i=a>=0?Xp(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8":Xp(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8","right"===S){const t=v?E.left+_/2:E.left+E.width-_/2;e.push({x:t,y:E.top}),e.push({x:t,y:E.top+E.height})}else"bottom"===S&&(e.push({x:E.left,y:E.top+E.height-_/2}),e.push({x:E.left+E.width,y:E.top+E.height-_/2}));const h=QA({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(h)}}}return d}yj();const Tj=new class extends HI{constructor(t){super(!1),this.type=xI.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},Bj=new XI;function Mj(t,e,i,n,r,o,s,a,l,h,c){t||((t=new bj({x:i,y:n,width:s,height:a,lineWidth:c?.group?.lineWidth??void 0,fill:c?.group?.fill??void 0,stroke:c?.group?.stroke??void 0,strokeArrayWidth:c?.group?.strokeArrayWidth??void 0,strokeArrayColor:c?.group?.strokeArrayColor??void 0,cursor:c?.group?.cursor??void 0,lineCap:"square",clip:!0})).role="cell",t.col=r,t.row=o,e?.addChild(t));const u=function(t,e,i,n,r,o){let s,a;const l=o.internalProps.layoutMap.getBody(t,e).sparklineSpec,h=o.getCellValue(t,e);if(!Array.isArray(h))return;const c=r[3],u=r[0];i-=r[1]+r[3],n-=r[0]+r[2];const d=0,p=n;if("function"==typeof l){const r={col:t,row:e,dataValue:o.getCellOriginValue(t,e)||"",value:o.getCellValue(t,e)||"",rect:o.getCellRangeRelativeRect(o.getCellRange(t,e)),table:o};s=l(r),a=Rj(s,c,u,i,n)}else s=l,a=Rj(l,c,u,i,n);const f=[],g=[];let m,y;if("object"==typeof s.xField)Tj.domain(s.xField.domain),m=s.xField.field;else if("string"==typeof s.xField){const t=h.map((t=>t[s.xField]));Tj.domain(t),m=s.xField}else Array.isArray(h)&&(Tj.domain(Array.from({length:h.length},((t,e)=>e))),m=s.xField);if(Tj.range([0,i]),"object"==typeof s.yField)Bj.domain(s.yField.domain),y=s.yField.field;else if("string"==typeof s.yField){const t=h.map((t=>t[s.yField]));Bj.domain([Math.min(...t),Math.max(...t)]),y=s.yField}else Array.isArray(h)&&h.every((t=>"number"==typeof t))&&(Bj.domain([Math.min(...h),Math.max(...h)]),y=s.yField);if(Bj.range([0,n]),"object"==typeof s.xField&&Array.isArray(s.xField.domain)){const t=h.map((t=>t[s.xField.field])),e=s.xField.domain;for(let i=0;i<e.length;i++){let n=!1;for(let r=0;r<t.length;r++)if(e[i]==t[r]){const t=h[r];if(!bu(t[m])||!bu(t[y]))break;f.push({x:d+Tj.scale(t[m]),y:p-Bj.scale(t[y]),defined:bu(t[y])}),g.push(t),n=!0;break}n||(f.push({x:d+Tj.scale(e[i]),y:0,defined:!1}),g.push({[m]:e[i],[y]:null}))}}else for(let t=0;t<h.length;t++){const e=h[t];f.push({x:d+Tj.scale(m?e[m]:t),y:p-Bj.scale(y?e[y]:e),defined:bu(y?e[y]:e),rawData:e}),g.push(e)}const b=a.getChildByName("sparkline-line");b&&b.setAttribute("points",f);b.bandwidth=Tj.step(),b.min=Bj.range()[0],b.max=Bj.range()[1];const v=a.getChildByName("sparkline-symbol-group");if(v){const t="isolatedPoint"===s.pointShowRule;if("all"===s.pointShowRule)for(let t=0;t<f.length;t++){const{x:e,y:i,defined:n}=f[t];if(n){const t=nT({x:e,y:i});v.appendChild(t)}}else if(t)for(let t=0;t<f.length;t++){const{x:e,y:i,defined:n}=f[t];if(n&&(!f[t-1]||!f[t-1].defined)&&(!f[t+1]||!f[t+1].defined)){const t=nT({x:e,y:i});v.appendChild(t)}}}return a}(r,o,s,a,l,h);return u&&t.appendChild(u),t}function Rj(t,e,i,n,r){let o;o="function"==typeof t?t(null):t;const s=new bj({x:e,y:i,width:n,height:r,stroke:!1,fill:!1});if(s.name="sparkline","line"===o.type){const t=QA({x:0,y:0,curveType:o.smooth?"monotoneX":"linear",stroke:o.line?.style?.stroke??"blue",lineWidth:o.line?.style?.strokeWidth??2});t.name="sparkline-line",s.addChild(t),o.crosshair&&(t.hover=o.crosshair?.style??{stroke:"#000",interpolate:"linear"});const e=new bj({x:0,y:0,width:n,height:r,stroke:!1,fill:!1});e.name="sparkline-symbol-group",e.setTheme({symbol:{stroke:o.point?.style?.stroke??"#000",lineWidth:o.point?.style?.strokeWidth??1,fill:o.point?.style?.fill??"#000",size:2*(o.point?.style?.size??3),symbolType:"circle"}}),s.addChild(e),e.hover=o.point?.hover??!1}return s}let Pj=class extends lA{role;tooltip;constructor(t){super(t),"mouseenter_cell"!==this.attribute.visibleTime&&"click_cell"!==this.attribute.visibleTime||(this.attribute.visible=!1),this.attribute.hoverImage&&(this.attribute.originImage=this.attribute.image)}get backgroundWidth(){return this.attribute.backgroundWidth??this.attribute.width}get backgroundHeight(){return this.attribute.backgroundHeight??this.attribute.height}};class Ej extends bj{_leftGroup;_rightGroup;_centerGroup;_autoWidth=!1;_autoHeight=!1;_cellWidth;_cellHeight;_align;_baseline;constructor(t){super(t),this._leftGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._leftGroup.role="content-left",this._rightGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._rightGroup.role="content-right",this._centerGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._centerGroup.role="content-center",this.appendChild(this._leftGroup),this.appendChild(this._rightGroup),this.appendChild(this._centerGroup)}setCellContentOption(t){this._autoWidth=t.autoWidth,this._autoHeight=t.autoHeight,this._cellWidth=t.cellWidth,this._cellHeight=t.cellHeight,this._align=t.align,this._baseline=t.baseline}addLeftOccupyingIcon(t){t.setAttribute("x",this._leftGroup.width+(t.attribute.marginLeft??0)),this._leftGroup.appendChild(t),this._leftGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addRightOccupyingIcon(t){t.setAttribute("x",this._rightGroup.width+(t.attribute.marginLeft??0)),this._rightGroup.appendChild(t),this._rightGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addContent(t){const e=this._centerGroup.lastChild;e&&t.setAttributes({x:e.attribute.x+e.AABBBounds.width()}),this._centerGroup.appendChild(t),t instanceof J_&&(this._centerGroup.setAttribute("pickable",!1),t.setAttribute("textAlign","left"))}layout(){let t=this._leftGroup.width;t===1/0&&(t=0);let e=this._rightGroup.width;if(e===-1/0&&(e=0),this._autoWidth){const i=this._centerGroup.width;this._cellWidth=t+e+i,this.setAttribute("width",this._cellWidth)}else{const i=this._cellWidth-t-e;this.updateCenterLayout(i);const n=this._centerGroup.width;this._cellWidth=t+e+n,this.setAttribute("width",this._cellWidth)}this.updateHorizontalPos();const i=this._leftGroup.height,n=this._rightGroup.height,r=this._centerGroup.height;this._cellHeight=Math.max(i,n,r),this.setAttribute("height",this._cellHeight),this.updateVerticalPos()}updateCenterLayout(t){let e=t;this._centerGroup.forEachChildren((t=>{t instanceof Pj&&(e-=t.AABBBounds.width())}));const i=this._centerGroup.getChildByName("text");i instanceof dA?i.setAttribute("width",e):i instanceof J_&&i.setAttribute("maxLineWidth",e);let n=0;this._centerGroup.forEachChildren((t=>{t.setAttribute("x",n),n+=t.AABBBounds.width()}))}updateHorizontalPos(){this._leftGroup.setAttribute("x",0),this._rightGroup.setAttribute("x",this._cellWidth-this._rightGroup.width),this._centerGroup.setAttribute("x",this._leftGroup.width),"left"===this._align||"start"===this._align?this.setAttribute("dx",0):"center"===this._align?this.setAttribute("dx",-this.attribute.width/2):"right"!==this._align&&"end"!==this._align||this.setAttribute("dx",-this.attribute.width)}updateVerticalPos(){"top"===this._baseline?(this._leftGroup.setAttribute("y",0),this._rightGroup.setAttribute("y",0),this._centerGroup.setAttribute("y",0)):"middle"===this._baseline?(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",(this._leftGroup.height-t.AABBBounds.height())/2)})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",(this._rightGroup.height-t.AABBBounds.height())/2)})),this._leftGroup.setAttribute("y",this._cellHeight/2-this._leftGroup.height/2),this._rightGroup.setAttribute("y",this._cellHeight/2-this._rightGroup.height/2),this._centerGroup.setAttribute("y",this._cellHeight/2-this._centerGroup.height/2)):"bottom"===this._baseline&&(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",this._leftGroup.height-t.AABBBounds.height())})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",this._rightGroup.height-t.AABBBounds.height())})),this._leftGroup.setAttribute("y",this._cellHeight-this._leftGroup.height),this._rightGroup.setAttribute("y",this._cellHeight-this._rightGroup.height),this._centerGroup.setAttribute("y",this._cellHeight-this._centerGroup.height))}updateWidth(t){this._cellWidth=t,this.layout()}updateHeight(t){this._cellHeight=t,this.layout()}}function Hj(t,e,i){let n=0;const r=i.internalProps.layoutMap;if(r.isHeader(t,e)){const i=r.getHeader(t,e);i?.hierarchyLevel&&(n=(i.hierarchyLevel??0)*(r.rowHierarchyIndent??0))}else{const o=i.getBodyColumnDefine(t,e);if(o?.tree){const o=i.dataSource.getIndexKey(i.getRecordIndexByRow(t,e));n=Array.isArray(o)&&i.getHierarchyState(t,e)!==Xc.none?(o.length-1)*(r.hierarchyIndent??0):0}}return n}function Lj(t,e,i,n,r){const o={};"image"===t.type?o.image=t.src:("svg"===t.type||"svg"in t)&&(o.image=t.svg),o.width=t.width,o.height=t.height,o.visibleTime=t.visibleTime??"always",o.funcType=t.funcType,o.interactive=t.interactive;let s=0;if(Qu(i)&&Qu(n)&&r&&(t.funcType===Jc.collapse||t.funcType===Jc.expand)&&(s=Hj(i,n,r)),o.marginLeft=(t.marginLeft??0)+s,o.marginRight=t.marginRight??0,t.interactive&&(o.pickable=!1),t.hover&&(o.backgroundWidth=t.hover.width??t.width,o.backgroundHeight=t.hover.width??t.width,o.backgroundColor=t.hover.bgColor??"rgba(22,44,66,0.2)",o.hoverImage=t.hover.image),t.cursor&&(o.cursor=t.cursor),"shape"in t&&"circle"===t.shape&&(o.shape=t.shape),e)return e.setAttributes(o),e.loadImage(o.image),e;const a=new Pj(o);return a.tooltip=t.tooltip,a}function kj(t){const e={};return"image"===t.type?e.image=t.src:("svg"===t.type||"svg"in t)&&(e.image=t.svg),e.visibleTime=t.visibleTime??"always",e.funcType=t.funcType,e.id=t.name,e.width=t.width,e.height=t.height,(t.marginRight||t.marginLeft)&&(e.margin=[0,t.marginRight??0,0,t.marginLeft??0]),t.hover&&(e.backgroundWidth=t.hover.width??t.width,e.backgroundHeight=t.hover.height??t.height,e.backgroundShowMode="hover",e.hoverImage=t.hover.image,e.backgroundStroke=!1,e.backgroundFill=t.hover.bgColor??"rgba(22,44,66,0.2)"),t.cursor&&(e.cursor=t.cursor),e.tooltip=t.tooltip,e}function Ij(t,e,i,n,r,o,s,a){let l,h=0,c=0,u=0,d=0;t.forEachChildren((t=>{"icon-left"===t.role?(h+=t.AABBBounds.width(),c=Math.max(c,t.AABBBounds.height())):"icon-right"===t.role&&(u+=t.AABBBounds.width(),d=Math.max(d,t.AABBBounds.height()))}));const p=t.getChildByName("text"),f=t.getChildByName("content");let g;p instanceof J_?(l=p.AABBBounds.height(),p.setAttribute("maxLineWidth",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):p instanceof dA?(l=p.AABBBounds.height(),p.setAttribute("width",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):f&&(l=f.AABBBounds.height(),f.updateWidth(e-h-d-(r[1]+r[3])),g=f.AABBBounds.height());const m=Math.max(c,d,l)+r[0]+r[2];if(t.forEachChildren((n=>{"icon-left"===n.role||("icon-right"===n.role||"icon-absolute-right"===n.role?n.setAttribute("x",n.attribute.x+i):"content"===n.name||"text"===n.name?(n.AABBBounds.width(),"center"===o?n.setAttribute("x",r[3]+h+(e-(r[1]+r[3])-h-u)/2):"right"===o&&n.setAttribute("x",r[3]+e-(r[1]+r[3])-u)):"mark"===n.name&&n.setAttribute("x",t.attribute.width))})),n){let e=Math.max(c,g,d);if(function(t,e,i,n){const r=t.table,o=Sk(r,e.col,e.row);if(o&&o.end.row-o.start.row){n/=o.end.row-o.start.row+1,i/=o.end.row-o.start.row+1;for(let t=o.start.row;t<=o.end.row;t++){const e=r.getRowHeight(t);if(e===n&&i!==e)return!0;if(i>e)return!0}}else{const t=r.getRowHeight(e.row);if(t===n&&i!==t)return!0;if(i>t)return!0}return!1}(a,t,e+r[0]+r[2],m))return!0;e=t.attribute.height-(r[0]+r[2]),t.forEachChildren((t=>{"rect"!==t.type&&"chart"!==t.type&&("mark"===t.name?t.setAttribute("y",0):"middle"===s?t.setAttribute("y",r[0]+(e-t.AABBBounds.height())/2):"bottom"===s?t.setAttribute("y",r[0]+e-t.AABBBounds.height()):t.setAttribute("y",r[0]))}))}else"middle"!==s&&"bottom"!==s||t.forEachChildren((e=>{"rect"!==e.type&&"chart"!==e.type&&("mark"===e.name?e.setAttribute("y",0):"middle"===s?e.setAttribute("y",(t.attribute.height-r[2]+r[0]-e.AABBBounds.height())/2):"bottom"===s?e.setAttribute("y",t.attribute.height-e.AABBBounds.height()-r[2]):e.setAttribute("y",r[0]))}));return!1}function Oj(t,e,i,n,r,o,s,a,l){let h,c,u,d,p=!0;if("function"==typeof t){const e=t({col:i,row:n,dataValue:l.getCellOriginValue(i,n),value:l.getCellValue(i,n)||"",rect:{left:0,top:0,right:r,bottom:o,width:r,height:o},table:l});u=e.rootContainer.getElements(void 0,!1,!1),p=e.renderDefault}else if("function"==typeof e){const t=e({col:i,row:n,dataValue:l.getCellOriginValue(i,n),value:l.getCellValue(i,n)||"",rect:{left:0,top:0,right:r,bottom:o,width:r,height:o},table:l});t&&(u=t.elements,p=t.renderDefault,h=t.expectedWidth,c=t.expectedHeight)}else e&&(h=e.expectedWidth,c=e.expectedHeight,u=e.elements,p=e.renderDefault);if(u){d=function(t,e,i,n){const r=new bj({x:0,y:0,width:e,height:i,fill:!1,stroke:!1,pickable:!1});r.name="custom-container";const o=function(t,e,i,n){const r=[],o=0,s=0,a=[0,0,0,0];for(let l=0;l<t.length;l++){const h=t[l],c=Object.assign({},h);for(const t in c)c.hasOwnProperty(t)&&su(c[t])&&(c[t]=c[t](n));const u=c;bu(u.x)&&(u.x=au(u.x)?Dj(u.x,e-a[1]):Number(u.x),u.y=au(u.y)?Dj(u.y,i-a[2]):Number(u.y)),"width"in c&&(c.width=au(c.width)?Dj(c.width,e-a[1]):Number(c.width)),"height"in c&&(c.height=au(c.height)?Dj(c.height,i-a[2]):Number(c.height)),"radius"in c&&(c.radius=au(c.radius)?Dj(c.radius,Math.min(e-a[1],i-a[2])):Number(c.radius)),"hover"in c&&(c.hover.x=au(c.hover.x)?Dj(c.hover.x,e-a[1]):Number(c.hover.x),c.hover.y=au(c.hover.y)?Dj(c.hover.y,i-a[2]):Number(c.hover.y),c.hover.width=au(c.hover.width)?Dj(c.hover.width,e-a[1]):Number(c.hover.width),c.hover.height=au(c.hover.height)?Dj(c.hover.height,i-a[2]):Number(c.hover.height),c.hover.x+=o,c.hover.y+=s),u.x=u.x+o,u.y=u.y+s,r.push(c)}return r}(t,e,i,n);return o.forEach((t=>{switch(t.type){case"arc":const e=qA({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,fill:t.fill,stroke:t.stroke,outerRadius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(e);break;case"text":if(t.background){const e=t.background?.expandX??0,i=t.background?.expandY??0,n=eT({x:t.x-e,y:t.y-i,dx:t.dx??0,dy:t.dy??0,width:t.width+2*e,height:t.height+2*i,cornerRadius:t.background?.cornerRadius??0,fill:t.background?.fill??"#888"});r.appendChild(n)}const i=new J_(Object.assign({pickable:!!t.clickable,fill:t.color??t.fill},t));r.appendChild(i);break;case"rect":const n=eT({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,cornerRadius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(n);break;case"circle":const o=ZA({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,radius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(o);break;case"icon":const s=new Pj({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.svg,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.clickable,cursor:t.cursor});s.role="icon-custom",r.appendChild(s);break;case"image":const a=new Pj({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.src,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.clickable,cursor:t.cursor,shape:t.shape});a.role="image-custom",r.appendChild(a);break;case"line":const l=QA({points:t.points,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(l)}})),r}(u,s?h:r,a?c:o,l.getCellValue(i,n))}return{elementsGroup:d,renderDefault:p}}function Dj(t,e){return t.endsWith("px")?parseInt(t,10):t.endsWith("%")&&e?parseInt(t,10)/100*e:parseInt(t,10)}function Fj(t,e,i,n,r,o,s){let a,l;const h=Sk(t.table,i,n);if(h&&h.end.col-h.start.col&&h.start.col===i){const e=t.getCell(h.start.col,h.start.row),i=e.attribute.height;e.setAttribute("height",i+o),a=e,l=e.attribute.height}else h?(e.setAttribute("height",r+o),a=e,l=r+o):h||(e.setAttribute("height",r+o),a=e,l=r+o);a&&function(t,e,i,n,r,o,s){const a=t.table.isHeader(i,n)?t.table._getHeaderLayoutMap(i,n).headerType:t.table.getBodyColumnType(i,n);if("progressbar"===a){const r=t.table.getBodyColumnDefine(i,n),o=t.table._getCellStyle(i,n),s=t.table.getCellValue(i,n),a=t.table.getCellOriginValue(i,n),l=(RW(Cj("padding",o,i,n,t.table)),Aj(r,o,e.attribute.width,s,a,i,n,0,t.table)),h=e.getChildByName("progress-bar");e.insertBefore(l,h),e.removeChild(h),h.removeAllChild(),h.release()}else if("sparkline"===a){e.removeAllChild();const r=t.table._getCellStyle(i,n),o=RW(Cj("padding",r,i,n,t.table));Mj(e,e.parent,e.attribute.x,e.attribute.y,i,n,e.attribute.width,e.attribute.height,o,t.table,pj(r,t.table,i,n,Cj).theme)}else if("image"===a||"video"===a)Sj(e,i,n,t.table);else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{const o=t.table._getCellStyle(i,n);!function(t,e,i,n,r,o,s){const a=e-(r[0]+r[2]),l=t.getChildByName("text");l instanceof J_&&!n?l.setAttribute("heightLimit",a):l instanceof dA&&!n?l.setAttribute("height",a):t.getChildByName("content")&&t.getChildByName("content").updateHeight(a);t.forEachChildren((t=>{"rect"===t.type||"chart"===t.type||("mark"===t.name?t.setAttribute("y",0):"middle"===s?t.setAttribute("y",r[0]+(a-t.AABBBounds.height())/2):"bottom"===s?t.setAttribute("y",r[0]+a-t.AABBBounds.height()):t.setAttribute("y",r[0]))}))}(e,r,0,"autoHeight"===t.table.heightMode,RW(o.padding),o.textAlign,o.textBaseline);const s=e.getChildByName("custom-container");if(s){let r,o;s.clear(),e.removeChild(s);if("body"!==t.table.getCellLocation(i,n)){const e=t.table.getHeaderDefine(i,n);r=e?.headerCustomRender,o=e?.headerCustomLayout}else{const e=t.table.getBodyColumnDefine(i,n);r=e?.customRender||t.table.customRender,o=e?.customLayout}const a=Oj(o,r,i,n,e.attribute.width,e.attribute.height,!1,!1,t.table);e.childrenCount>0?e.insertBefore(a.elementsGroup,e.firstChild):e.appendChild(a.elementsGroup)}}}(t,a,i,n,l)}function zj(t,e,i,n,r){let o=!1;const s=t?.attribute.width??0;if(t?.setAttribute("width",s+e),t?.forEachChildren(((t,a)=>{const l=function(t,e,i,n,r,o,s,a){let l,h;const c=Sk(t.table,i,n);if(c&&c.end.col-c.start.col){const e=t.getCell(c.start.col,c.start.row),r=e.attribute.width;e.setAttribute("width",r+o),l=e,h=e.attribute.width,i=l.col,n=l.row}else c&&c.start.row===n?(e.setAttribute("width",r+o),l=e,h=r+o,i=l.col,n=l.row):c||(e.setAttribute("width",r+o),l=e,h=r+o);if(!l)return!1;const u=t.table.isHeader(i,n)?t.table._getHeaderLayoutMap(i,n).headerType:t.table.getBodyColumnType(i,n);let d=!1;if("progressbar"===u){const e=t.table.getBodyColumnDefine(i,n),r=t.table._getCellStyle(i,n),o=t.table.getCellValue(i,n),s=t.table.getCellOriginValue(i,n),a=(RW(Cj("padding",r,i,n,t.table)),Aj(e,r,l.attribute.width,o,s,i,n,0,t.table)),h=l.getChildByName("progress-bar");l.insertBefore(a,h),l.removeChild(h),h.removeAllChild(),h.release()}else if("sparkline"===u){l.removeAllChild();const e=t.table._getCellStyle(i,n),r=RW(Cj("padding",e,i,n,t.table));Mj(l,l.parent,l.attribute.x,l.attribute.y,i,n,l.attribute.width,l.attribute.height,r,t.table,pj(e,t.table,i,n,Cj).theme)}else if("image"===u||"video"===u)Sj(l,i,n,t.table);else if("axis"===l.firstChild?.name){const e=t.table.internalProps.layoutMap.getAxisConfigInPivotChart(i,n);if(e){const i=new hW(e,l.attribute.width,l.attribute.height,t.table);l.clear(),l.appendChild(i.component),i.overlap()}}else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{const e=t.table._getCellStyle(i,n);d=Ij(l,h,o,a,RW(e.padding),e.textAlign,e.textBaseline,t)}return d}(r,t,t.col,t.row,s,e,"row-body"!==n||(t.col,r.table.rowHeaderLevelCount),i);if(l){const e=Sk(r.table,t.col,t.row);if(e&&e.end.row-e.start.row)for(let t=e.start.row;t<=e.end.row;t++)Wj(r,t);else Wj(r,t.row);o=!0}})),o){let t,e,i,o=0;for(let s=0;s<r.table.colCount;s++){"col-corner"===n?(i=0,t=r.getColGroup(s,!0),e=r.colHeaderGroup.attribute.height??0):"row-body"===n?(i=r.table.frozenRowCount,t=r.getColGroup(s,!1),e=r.bodyGroup.attribute.height??0):"bottom"===n?(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInBottom(s),e=r.bottomFrozenGroup.attribute.height??0):"left-bottom"===n?(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInLeftBottomCorner(s),e=r.leftBottomCornerGroup.attribute.height??0):"right-bottom"===n&&(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInRightBottomCorner(s),e=r.rightBottomCornerGroup.attribute.height??0);let a=0;t.forEachChildren((t=>{t.setAttribute("y",a),a+=r.table.getRowHeight(t.row)??0})),o=a}r.updateContainerHeight(i,o-e)}}function Wj(t,e){let i=0;for(let n=0;n<t.table.colCount;n++){const r=t.highPerformanceGetCell(n,e);if("empty"===r.role)return;let o=jj(r,t);const s=Sk(t.table,n,e);s&&s.end.row-s.start.row&&(o/=s.end.row-s.start.row+1),i=Math.max(i,o)}for(let n=0;n<t.table.colCount;n++){let r=i;const o=t.highPerformanceGetCell(n,e);if("empty"===o.role)return;const s=Sk(t.table,n,e);if(s&&s.end.row-s.start.row)for(let i=s.start.row;i<=s.end.row;i++)i!==e&&(r+=t.table.getRowHeight(i));Fj(t,o,n,e,r,0,t.table.isHeader(n,e))}t.table.setRowHeight(e,i,!0)}function jj(t,e){let i=0;t.forEachChildren((t=>{"icon-left"!==t.role&&"icon-right"!==t.role&&"text"!==t.name&&"content"!==t.name||(i=Math.max(i,t.AABBBounds.height()))}));const n=RW(e.table._getCellStyle(t.col,t.row).padding);return i+n[0]+n[2]}var Nj;!function(t){t.dropDown="dropDown",t.contextmenu="contextmenu",t.custom="custom"}(Nj||(Nj={}));const Gj={fontSize:12,color:"#000",highlightColor:"#2E68CF",hoverBgColor:"#EEE",lineHeight:30,bgColor:"#FFF",cornerRadius:4,borderWidth:.5,borderColor:"#CCC",menuPadding:6,menuItemPadding:9,maxLineWidth:200};const Vj=yj();class Uj{icon;constructor(){const t=Vj.drillDown;this.icon=new Pj({x:-1e3,y:-1e3,image:t.svg,width:t.width,height:t.height,dx:-t.width/2,dy:-t.height/2,visible:!1,funcType:t.funcType,cursor:t.cursor}),this.icon.role="icon-drill"}appand(t){t.appendChild(this.icon)}update(t,e,i,n,r,o){if(!t||n&&r)return this.icon.setAttributes({x:-1e3,y:-1e3,visible:!1}),void o.updateNextFrame();const s=Vj.drillDown,a=Vj.drillUp;this.icon.setAttributes({x:e,y:i,image:n?s.svg:a.svg,visible:!0}),this.icon.loadImage(this.icon.attribute.image),o.updateNextFrame()}}class Kj{columnMoverLabel;columnMoverLine;columnMoverBack;table;x;constructor(t){const e=t.theme.dragHeaderSplitLine.lineWidth,i=t.theme.dragHeaderSplitLine.lineColor,n=t.theme.dragHeaderSplitLine.shadowBlockColor;this.columnMoverLabel=nT({visible:!1,pickable:!1,x:0,y:0,symbolType:"triangle",fill:i}),this.columnMoverLine=QA({visible:!1,pickable:!1,stroke:i,lineWidth:e,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnMoverBack=eT({visible:!1,pickable:!1,fill:n,x:0,y:0,width:0,height:0}),this.table=t}appand(t){t.appendChild(this.columnMoverLabel),t.appendChild(this.columnMoverLine),t.appendChild(this.columnMoverBack)}show(t,e,i){const n=this.table.getCellLocation(t,e),r=Sk(this.table,t,e);r&&(t=r.start.col,e=r.start.row);let o=0,s=0,a=0,l=0,h=0,c=0,u=0,d=0,p=Math.PI;const f=[];"columnHeader"===n?(o=this.table.getColsWidth(0,t-1)-this.table.stateManeger.scroll.horizontalBarPos,s=this.table.getRowsHeight(0,this.table.frozenRowCount-1),l=this.table.tableNoFrameHeight,a=r?this.table.getColsWidth(r.start.col,r.end.col):this.table.getColWidth(t),h=o-i,u=o+a,d=2,f.push({x:0,y:0}),f.push({x:0,y:this.table.tableNoFrameHeight})):"rowHeader"===n&&(s=this.table.getRowsHeight(0,e-1)-this.table.stateManeger.scroll.verticalBarPos,o=this.table.getColsWidth(0,this.table.frozenColCount-1),a=this.table.tableNoFrameWidth,l=r?this.table.getRowsHeight(r.start.row,r.end.row):this.table.getRowHeight(e),c=s-i,u=2,d=s+l,p=Math.PI/2,f.push({x:0,y:0}),f.push({x:this.table.tableNoFrameWidth,y:0})),this.columnMoverBack.setAttributes({visible:!0,x:o-h,y:s-c,width:a,height:l,dx:h,dy:c}),this.columnMoverLine.setAttributes({x:u,y:d,visible:!0,points:f}),this.columnMoverLabel.setAttributes({visible:!0,x:u,y:d,angle:p})}hide(){this.columnMoverLabel.setAttribute("visible",!1),this.columnMoverLine.setAttribute("visible",!1),this.columnMoverBack.setAttribute("visible",!1)}update(t,e,i,n){"number"==typeof t&&"number"==typeof e?(this.columnMoverLabel.setAttribute("x",e-this.table.stateManeger.scroll.horizontalBarPos),this.columnMoverLine.setAttribute("x",e-this.table.stateManeger.scroll.horizontalBarPos),this.columnMoverBack.setAttribute("x",t)):"number"==typeof i&&"number"==typeof n&&(this.columnMoverLabel.setAttribute("y",n-this.table.stateManeger.scroll.verticalBarPos),this.columnMoverLine.setAttribute("y",n-this.table.stateManeger.scroll.verticalBarPos),this.columnMoverBack.setAttribute("y",i))}}function $j(t,e,i){if(i)return e.tableNoFrameWidth-e.getColsWidth(t,e.colCount-1);let n=e.getColsWidth(0,t);return t>=e.frozenColCount&&(n-=e.scrollLeft),n}class Xj{table;border;columnResizeLine;columnResizeBgLine;columnResizeLabel;menu;vScrollBar;hScrollBar;frozenShadowLine;drillIcon;cellMover;constructor(t){this.table=t;const e=this.table.theme;this.createScrollBar();const i=e.columnResize?.lineColor,n=e.columnResize?.lineWidth,r=e.columnResize?.bgColor,o=e.columnResize?.width;this.columnResizeLine=QA({visible:!1,pickable:!1,stroke:i,lineWidth:n,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnResizeBgLine=QA({visible:!1,pickable:!1,stroke:r,lineWidth:o,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]});const s=iT({visible:!1,pickable:!1,x:0,y:0,fontSize:10,fill:"#FFF",text:"",textBaseline:"top",dx:16,dy:-6}),a=eT({visible:!1,pickable:!1,fill:"#3073F2",x:0,y:0,width:38,height:16,cornerRadius:5,dx:12,dy:-8});this.columnResizeLabel=JA({visible:!1,pickable:!1,x:0,y:0}),this.columnResizeLabel.appendChild(a),this.columnResizeLabel.appendChild(s),this.cellMover=new Kj(this.table);const l=e.frozenColumnLine?.shadow?.width,h=e.frozenColumnLine?.shadow?.startColor,c=e.frozenColumnLine?.shadow?.endColor;this.frozenShadowLine=eT({visible:!0,pickable:!1,x:0,y:0,width:l,height:0,fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:[{color:h,offset:0},{color:c,offset:1}]}}),this.menu=new class{_table;_menuInstance;_menuInfo;constructor(t){this._table=t,this._menuInstance=new bj({x:0,y:0,fill:Gj.bgColor,stroke:Gj.borderColor,cornerRadius:Gj.cornerRadius,lineWidth:Gj.borderWidth}),this._menuInfo={x:-1,y:-1,col:-1,row:-1,type:Nj.dropDown,menuInfo:[],highlightIndex:-1}}bindTableComponent(t){t.appendChild(this._menuInstance),this.bindEvent()}release(){}attach(t,e,i,n,r,o){if(r===Nj.dropDown&&this.checkDropDownMenuChange(i,n)){const t=this.getMenuInfo(i,n,r);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,n,r,e,o),this.updateMenuInstance(e,o)}else if(r===Nj.contextmenu&&this.checkContextMenuChange(t,e)){const t=this.getMenuInfo(i,n,r);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,n,r,e,o),this.updateMenuInstance(e,o)}this.updatePosition(t-this._table.scenegraph.x,e-this._table.scenegraph.y),this.addToScene()}updateMenuInfo(t,e,i,n,r){this._menuInfo.col=t,this._menuInfo.row=e,this._menuInfo.type=i,this._menuInfo.menuInfo=n,this._menuInfo.highlightIndex=r}checkDropDownMenuChange(t,e){const{type:i,col:n,row:r}=this._menuInfo;return i!==Nj.dropDown||t!==n||e!==r}checkContextMenuChange(t,e){const{type:i,menuInfo:n}=this._menuInfo;return i!==Nj.contextmenu||n!==this._table.internalProps.menu?.contextMenuItems}updateMenuInstance(t,e){this._menuInstance.removeAllChild();let i=Gj.menuPadding;const n=Gj.menuPadding;let r=0;t.forEach(((t,o)=>{const s=e===o;let a,l;"string"==typeof t?l=t:"object"==typeof t&&(l=t.text,a=s?t.selectedIcon:t.icon);const h=new bj({y:i,x:n,height:Gj.lineHeight,fill:Gj.bgColor});h.role="menu-item",this._menuInstance.appendChild(h),h.stateProxy=t=>"hover"===t?{fill:Gj.hoverBgColor}:{fill:Gj.bgColor},h.addEventListener("pointerenter",(t=>{h.addState("hover",!0,!1),this._table.scenegraph.updateNextFrame()})),h.addEventListener("pointerleave",(t=>{h.removeState("hover",!1),this._table.scenegraph.updateNextFrame()}));const c=new q_({x:Gj.menuItemPadding,y:Gj.menuItemPadding,fill:s?Gj.highlightColor:Gj.color,text:l,textBaseline:"top",fontSize:Gj.fontSize,pickable:!1,maxLineWidth:Gj.maxLineWidth,ellipsis:"…"});if(h.addChild(c),a){c.AABBBounds.height();const t=a.width??16,e=a.height??16,i=new Pj({x:Gj.menuItemPadding,y:(Gj.lineHeight-e)/2,width:t,height:e,image:a.svg,pickable:!1});i.role="menu-icon",h.insertBefore(i,c),c.setAttribute("x",t+Gj.menuItemPadding)}r=Math.max(h.AABBBounds.width(),r),i+=Gj.lineHeight})),this._menuInstance.setAttributes({width:r+2*Gj.menuItemPadding+2*Gj.menuPadding,height:i+Gj.menuPadding}),this._menuInstance.forEachChildren((t=>{t.setAttribute("width",r+2*Gj.menuItemPadding)}))}updatePosition(t,e){this._menuInstance.setAttributes({x:this._menuInfo.type===Nj.dropDown?t-this._menuInstance.attribute.width:t,y:e}),this._menuInfo.x=Nj.dropDown?t-this._menuInstance.attribute.width:t,this._menuInfo.y=e}addToScene(){this._table.scenegraph.updateNextFrame()}detach(){this._menuInstance.setAttributes({x:-1e3,y:-1e3}),this._table.scenegraph.updateNextFrame()}getMenuInfo(t,e,i){if(i===Nj.dropDown){const{dropDownMenu:i=this._table.globalDropDownMenu,pivotInfo:n}=this._table._getHeaderLayoutMap(t,e);let r=-1;if(Array.isArray(i))for(let n=0;n<i.length;n++)if(this._table._dropDownMenuIsHighlight(t,e,n)){r=n;break}return{menuInfo:i,highlightIndex:r}}if(i===Nj.contextmenu){const i=this._table.internalProps.menu?.contextMenuItems;let n;if(Array.isArray(i))n=i;else if("function"==typeof i){const{field:r}=this._table.isHeader(t,e)?this._table.getHeaderDefine(t,e):this._table.getBodyColumnDefine(t,e);n=i(r,e)}return{menuInfo:n,highlightIndex:-1}}}bindEvent(){this._menuInstance.addEventListener("click",(t=>{const{target:e}=t;if(e&&"menu-item"===e.role){const t=this.getEventInfo(e),i=this._table.getMenuInfo(this._menuInfo.col,this._menuInfo.row,this._menuInfo.type),n=Object.assign(t,i);this._table.fireListeners(sf.DROPDOWNMENU_CLICK,n)}}))}getEventInfo(t){const e=t.parent;let i=0;e.forEachChildren(((e,n)=>e===t&&(i=n-1,!0)));const n="string"==typeof this._menuInfo.menuInfo[i]?this._menuInfo.menuInfo[i]:this._menuInfo.menuInfo[i].text,r="string"==typeof this._menuInfo.menuInfo[i]?n:this._menuInfo.menuInfo[i].menuKey||n;return{col:this._menuInfo.col,row:this._menuInfo.row,dropDownIndex:i,highlight:i===this._menuInfo.highlightIndex,text:n,menuKey:r}}get bounds(){return this._menuInstance.globalAABBBounds}}(this.table),this.drillIcon=new Uj}addToGroup(t){t.addChild(this.frozenShadowLine),t.addChild(this.columnResizeBgLine),t.addChild(this.columnResizeLine),t.addChild(this.columnResizeLabel),this.table.theme.scrollStyle.hoverOn?(t.addChild(this.hScrollBar),t.addChild(this.vScrollBar)):(t.stage.defaultLayer.addChild(this.hScrollBar),t.stage.defaultLayer.addChild(this.vScrollBar)),this.menu.bindTableComponent(t),this.drillIcon.appand(t),this.cellMover.appand(t)}createScrollBar(){const t=this.table.theme,e=t.scrollStyle?.scrollRailColor,i=t.scrollStyle?.scrollSliderColor,n=t.scrollStyle?.width;this.hScrollBar=new Bk({direction:"horizontal",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:this.table.tableNoFrameWidth,height:n,padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new Bk({direction:"vertical",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:n,height:this.table.tableNoFrameHeight-this.table.getFrozenRowsHeight(),padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.vScrollBar.render(),this.vScrollBar.hideAll()}updateScrollBar(){const t=this.table.stateManeger.scroll.horizontalBarPos,e=this.table.stateManeger.scroll.verticalBarPos,i=this.table.theme,n=i.scrollStyle?.width,r=i.scrollStyle?.visible,o=Math.ceil(this.table.scenegraph.tableGroup.attribute.width),s=Math.ceil(this.table.scenegraph.tableGroup.attribute.height),a=this.table.getAllRowsHeight(),l=this.table.getAllColsWidth(),h=this.table.getFrozenRowsHeight(),c=this.table.getFrozenColsWidth(),u=this.table.getBottomFrozenRowsHeight(),d=this.table.getRightFrozenColsWidth();if(l>o){const t=Math.min(s,a),e=Math.max(.05,(o-c)/(l-c));this.hScrollBar.setAttributes({x:c+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.x),y:t-(this.table.theme.scrollStyle.hoverOn?n:-this.table.scenegraph.tableGroup.attribute.y),width:o-c-d,range:[0,e],visible:"always"===r});const i=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===r&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:0,visible:!1});if(a>s){const t=Math.min(o,l),e=Math.max(.05,(s-h)/(a-h));this.vScrollBar.setAttributes({x:t-(this.table.theme.scrollStyle.hoverOn?n:-this.table.scenegraph.tableGroup.attribute.x),y:h+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.y),height:s-h-u,range:[0,e],visible:"always"===r});const i=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===r&&this.vScrollBar.showAll()}else this.vScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,height:0,visible:!1});this.table.stateManeger.setScrollLeft(t),this.table.stateManeger.setScrollTop(e)}hideResizeCol(){this.columnResizeLine.setAttribute("visible",!1),this.columnResizeBgLine.setAttribute("visible",!1),this.columnResizeLabel.setAttribute("visible",!1),this.columnResizeLabel.hideAll()}showResizeCol(t,e,i){const n=$j(t,this.table,i);this.columnResizeLine.setAttributes({visible:!0,x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({visible:!0,x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.showAll(),this.columnResizeLabel.setAttributes({visible:!0,x:n,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${this.table.getColWidth(t)}px`)}updateResizeCol(t,e,i){const n=$j(t,this.table,i);this.columnResizeLine.setAttributes({x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.setAttributes({x:n,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${Math.floor(this.table.getColWidth(t))}px`)}hideMoveCol(){this.cellMover.hide()}showMoveCol(t,e,i){this.cellMover.show(t,e,i)}updateMoveCol(t,e,i,n){this.cellMover.update(t,e,i,n)}setFrozenColumnShadow(t,e){if(t<0)this.frozenShadowLine.setAttributes({visible:!1});else{const i=$j(t,this.table,e);this.frozenShadowLine.setAttributes({visible:!0,x:i,height:this.table.getRowsHeight(0,this.table.rowCount-1)})}}hideVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!1),this.vScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!0),this.vScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}hideHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!1),this.hScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!0),this.hScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}updateVerticalScrollBarPos(t){const e=this.vScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.vScrollBar.setAttribute("range",[n,n+i]);const r=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:r.x1,y:r.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,i=e[1]-e[0];this.hScrollBar.setAttribute("range",[t,t+i]);const n=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:n.x1,y:n.y1}}}function Yj(t,e,i,n,r){if(!e)return;const o="table"===i,{shadowBlur:s,shadowOffsetX:a,shadowOffsetY:l,shadowColor:h,cornerRadius:c,borderColor:u,borderLineWidth:d,borderLineDash:p}=e,f={},g={pickable:!1};s&&o&&(g.shadowBlur=s,g.shadowOffsetX=a,g.shadowOffsetY=l,g.shadowColor=h,g.stroke=!0,g.stroke=h,g.lineWidth=1,g.fill=!0,g.fillOpacity=.01),d&&(g.stroke=!0,g.fill=!1,g.stroke=Zj(u,n),g.lineWidth=d,p&&(g.lineDash=p),g.lineCap="square"),Array.isArray(u)&&(g.strokeArrayColor=RW(u)),Array.isArray(d)&&(g.strokeArrayWidth=RW(d),g.lineWidth=1),c&&(g.cornerRadius=c,f.cornerRadius=c);const m=g.strokeArrayWidth?g.strokeArrayWidth[0]:g.lineWidth??0,y=g.strokeArrayWidth?g.strokeArrayWidth[1]:g.lineWidth??0,b=g.strokeArrayWidth?g.strokeArrayWidth[2]:g.lineWidth??0,v=g.strokeArrayWidth?g.strokeArrayWidth[3]:g.lineWidth??0;if(t.setAttributes(f),!r&&g.stroke)if(g.x=v/2,g.y=m/2,g.pickable=!1,o){g.x=t.attribute.x-v/2,g.y=t.attribute.y-m/2,g.width=t.attribute.width+v/2+y/2,g.height=t.attribute.height+m/2+b/2;const e=eT(g);e.name="table-border-rect",t.parent.insertBefore(e,t),t.border=e}else{g.width=t.attribute.width-v/2-y/2,g.height=t.attribute.height-m/2-b/2;const e=eT(g);e.name="border-rect",t.addChild(e),t.border=e}}function qj(t,e,i){const{borderColor:n}=e;t.border?.setAttribute("stroke",Zj(n,i))}function Zj(t,e){let i=!0;return e&&!qu(t)?i=e.map((e=>!!e&&t)):e?i=e:e||qu(t)?qu(t)&&(i=!0):i=t,i}function Jj(t){if(!t.border)return;const e=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[0]:t.border.attribute.lineWidth??0,i=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[1]:t.border.attribute.lineWidth??0,n=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[2]:t.border.attribute.lineWidth??0,r=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[3]:t.border.attribute.lineWidth??0;t.border.setAttributes({width:t.attribute.width-r/2-i/2,height:t.attribute.height-e/2-n/2})}
3
+ read:function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,h=l>>1,c=-7,u=i?r-1:0,d=i?-1:1,p=t[e+u];for(u+=d,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+t[e+u],u+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+u],u+=d,c-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)},write:function(t,e,i,n,r,o){var s,a,l,h=8*o-r-1,c=(1<<h)-1,u=c>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(e*l-1)*Math.pow(2,r),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;t[i+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,h+=r;h>0;t[i+p]=255&s,p+=f,s/=256,h-=8);t[i+p-f]|=128*g}},vz=bz;function wz(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}wz.Varint=0,wz.Fixed64=1,wz.Bytes=2,wz.Fixed32=5;var Cz=4294967296,xz=1/Cz,_z="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Sz(t){return t.type===wz.Bytes?t.readVarint()+t.pos:t.pos+1}function Az(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Tz(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function Bz(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Mz(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Rz(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Pz(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Ez(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Hz(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Lz(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function kz(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Iz(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Oz(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Dz(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Fz(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}wz.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Oz(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fz(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Oz(this.buf,this.pos)+Oz(this.buf,this.pos+4)*Cz;return this.pos+=8,t},readSFixed64:function(){var t=Oz(this.buf,this.pos)+Fz(this.buf,this.pos+4)*Cz;return this.pos+=8,t},readFloat:function(){var t=vz.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=vz.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(r=o[i.pos++],n=(112&r)>>4,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return Az(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return Az(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&_z?function(t,e,i){return _z.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r<i;){var o,s,a,l=t[r],h=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(o=t[r+1]))&&(h=(31&l)<<6|63&o)<=127&&(h=null):3===c?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((h=(15&l)<<12|(63&o)<<6|63&s)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((h=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==wz.Bytes)return t.push(this.readVarint(e));var i=Sz(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==wz.Bytes)return t.push(this.readSVarint());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==wz.Bytes)return t.push(this.readBoolean());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==wz.Bytes)return t.push(this.readFloat());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==wz.Bytes)return t.push(this.readDouble());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==wz.Bytes)return t.push(this.readFixed32());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==wz.Bytes)return t.push(this.readSFixed32());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==wz.Bytes)return t.push(this.readFixed64());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==wz.Bytes)return t.push(this.readSFixed64());var e=Sz(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===wz.Varint)for(;this.buf[this.pos++]>127;);else if(e===wz.Bytes)this.pos=this.readVarint()+this.pos;else if(e===wz.Fixed32)this.pos+=4;else{if(e!==wz.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Dz(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Dz(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Dz(this.buf,-1&t,this.pos),Dz(this.buf,Math.floor(t*xz),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Dz(this.buf,-1&t,this.pos),Dz(this.buf,Math.floor(t*xz),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Tz(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),vz.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),vz.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Tz(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,wz.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Bz,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Mz,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ez,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Rz,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Pz,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Hz,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Lz,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,kz,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Iz,e)},writeBytesField:function(t,e){this.writeTag(t,wz.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,wz.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,wz.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,wz.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,wz.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,wz.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,wz.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,wz.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,wz.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,wz.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}},function(t,e){var i,n,r=4.5;function o(t){return t&&("function"==typeof r&&n.pointRadius(+r.apply(this,arguments)),NO(t,i(n))),n.result()}o.area=function(t){return NO(t,i(kD)),kD.result()},o.measure=function(t){return NO(t,i(CF)),CF.result()},o.bounds=function(t){return NO(t,i(VD)),VD.result()},o.centroid=function(t){return NO(t,i(cF)),cF.result()},o.projection=function(e){return arguments.length?(i=null==e?(t=null,xD):(t=e).stream,o):t},o.context=function(t){return arguments.length?(n=null==t?(e=null,new xF):new uF(e=t),"function"!=typeof r&&n.pointRadius(r),o):e},o.pointRadius=function(t){return arguments.length?(r="function"==typeof t?t:(n.pointRadius(+t),+t),o):r},o.projection(t).context(e)}();let zz=0;function Wz(){return zz>1e8&&(zz=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zz++}class jz{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Wu,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Wz("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const Nz="_data-view-diff-rank";class Gz{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Wu,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Wz("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const r=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=cd(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(r,e.options,this);this.rawData=r,this.parserData=t,this.history&&this.historyData.push(r,t),this.latestData=t}else this.parserData=r,this.rawData=r,this.history&&this.historyData.push(r),this.latestData=r;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=cd(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,r=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(r),this.latestData=r,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[Nz]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[Nz]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[Nz]<e&&(this.latestDataAUD.del.push(t),this._diffMap.delete(i))}))}this._diffRank=e}cloneParseData(t,e){let i=!1;return t instanceof Gz||!0!==(null==e?void 0:e.clone)||(i=!0),i?cd(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?fd({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!Vu(this._fields)&&Vu(i)?(this.dataSet.registerTransform("fields",yz),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const Vz=(t,e,i)=>new Lp({defaultFontParams:{fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},getTextBounds:i?void 0:lT,specialCharSet:"-/: .,@%'\"~"+Lp.ALPHABET_CHAR_SET+Lp.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),Uz=(t,e)=>{const i=t.map(((t,e)=>({index:e,value:t})));return i},Kz=(t,e,i=0)=>{const n=new ip(t).expand(i/2),r=new ip(e).expand(i/2);return n.intersects(r)},$z=(t,e)=>{let i=0;t.x2<e.x1?i=e.x1-t.x2:e.x2<t.x1&&(i=t.x1-e.x2);let n=0;return t.y2<e.y1?n=e.y1-t.y2:e.y2<t.y1&&(n=t.y1-e.y2),[i,n]};function Xz(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Yz(t,e){for(let i,n=1,r=t.length,o=t[0];n<r;o=i,++n)if(i=t[n],Xz(o.AABBBounds,i.AABBBounds,e))return!0;return!1}const qz=(t,e,i)=>{const{labelStyle:n,axisOrientType:r,labelFlush:o,labelFormatter:s,startAngle:a=0}=i,l=n.angle??0,h=["bottom","top"].includes(r),c=["left","right"].includes(r);let u=a;h?u=0:c&&(u=(t=>td(t)?np(t):null)(-90));const d=Vz(n),p=e.map(((i,r)=>{const a=s?s(i):`${i}`,{width:p,height:f}=d.quickMeasure(a),g=Math.max(p,12),m=Math.max(f,12),y=t.scale(i);let b,v,w=Math.cos(u)*y,C=-Math.sin(u)*y;b=o&&h&&0===r?"left":o&&h&&r===e.length-1?"right":n.textAlign??"center","right"===b?w-=g:"center"===b&&(w-=g/2),v=o&&c&&0===r?"top":o&&c&&r===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?C-=m:"middle"===v&&(C-=m/2);return(new ip).set(w,C,w+g,C+m).rotate(l,w+g/2,C+m/2)}));return p},Zz=(t,e,i)=>{const{labelStyle:n,getRadius:r,axisSpec:o,labelFormatter:s}=i,a=r?.(),l=n.angle??0,h=Jz(o),c=Vz(n),u=e.map((e=>{const i=s?s(e):`${e}`,{width:n,height:r}=c.quickMeasure(i),o=Math.max(n,12),u=Math.max(r,12),d=t.scale(e);let p=0,f=0;const g=function(t){let e="center",i="middle";t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t),e=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center";i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle";return{align:e,baseline:i}}(d),{x:m,y:y}=function(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}({x:0,y:0},a+h,d);p=m+("right"===g.align?-o:"center"===g.align?-o/2:0),f=y+("bottom"===g.baseline?-u:"middle"===g.baseline?-u/2:0);return(new ip).set(p,f,p+o,f+u).rotate(l,p+o/2,f+u/2)}));return u};function Jz(t){let e=0;return sd(t,"tick.visible")&&(e+=sd(t,"tick.tickSize")),sd(t,"label.visible")&&(e+=sd(t,"label.space")),e}const Qz={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!Xz(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},tW=(t,e,i,n,r,o)=>{let s=o,a=0,l=0,h=0,c=-1,u=Number.MAX_VALUE;do{let o=!0;s++;let d=0;do{d+s<t.length&&Kz(e[d],e[d+s],i)&&(o=!1),d+=s}while(o&&d<t.length);if(o){if(!n){h=s;break}{const n=t.length-1;a=0;do{if(d-=s,d!==n&&!Kz(e[d],e[n],i))break;a++}while(d>0);if(d===n){h=s,l=a;break}{const i=Math.floor(t.length/s)-a+1;if(i<c)break;{c=i;const t=r?0:1,o=$z(e[d],e[n])[t],p=d-s>=0?$z(e[d-s],e[d])[t]:o,f=Math.abs(o-p);f<u&&(u=f,h=s,l=a)}}}}}while(s<=t.length);return{step:h,delCount:l}},eW=(t,e,i,n)=>{let r=n;do{let n=!0;r++;let o=0;do{o+r<t.length&&Kz(e[o],e[o+r],i)&&(n=!1),o+=r}while(n&&o<t.length);if(n)break}while(r<=t.length);let o=0;if(t.length>2){let i=t.length-t.length%r;for(i>=t.length&&(i-=r);i>0&&Kz(e[0],e[i]);)o++,i-=r}return{step:r,delCount:o}},iW=(t,e)=>{if(_I(t.type))return((t,e)=>{if(!_I(t.type))return Uz(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return Uz([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:o,noDecimals:s=!1}=e;let a;if(a=Uu(o)?t.stepTicks(o):Uu(r)?t.forceTicks(r):"d3"===e.tickMode?t.d3Ticks(n??5,{noDecimals:s}):t.ticks(n??5,{noDecimals:s}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let r=qz(t,a,e).map(((t,e)=>({AABBBounds:t,value:a[e]})));for(;r.length>=3&&Yz(r,i);)r=Qz.parity(r);const o=r.map((t=>t.value));o.length<3&&n&&(o.length>1&&o.pop(),vd(o)!==vd(a)&&o.push(vd(a))),a=o}return Uz(a)})(t,e);if(function(t){switch(t){case xI.Ordinal:case xI.Point:case xI.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const i=t.domain();if(!i.length)return[];const{tickCount:n,forceTickCount:r,tickStep:o,labelGap:s=4,axisOrientType:a}=e,l=["bottom","top"].includes(a),h=t.range(),c=Math.abs(h[h.length-1]-h[0]);if(c<2)return e.labelLastVisible?Uz([i[i.length-1]]):Uz([i[0]]);let u;if(Uu(o))u=t.stepTicks(o);else if(Uu(r))u=t.forceTicks(r);else if(Uu(n))u=t.ticks(n);else if(e.sampling){let n;const r=(e.labelStyle.fontSize??12)+2;if(i.length<=c/r)n=qz(t,i,e);else{const r=[i[0],i[Math.floor(i.length/2)],i[i.length-1]],o=qz(t,r,e);let s=null,a=0;o.forEach(((t,e)=>{if(!s)return s=t,void(a=e);l?s.width()<t.width()&&(s=t,a=e):s.height()<t.height()&&(s=t,a=e)}));const h=0===a?0:2===a?i.length-1:Math.floor(i.length/2),c=t.scale(i[h]);n=new Array(i.length);for(let e=0;e<n.length;e++){n[e]=s.clone();const r=t.scale(i[e]);l?n[e].translate(r-c,0):n[e].translate(0,r-c)}}const o=n.map((t=>l?t.width():t.height())),a=Math.min(...h),d=(Math.max(...h)-a)/i.length,p=tW(i,n,s,e.labelLastVisible,l,Math.floor(Math.min(...o)/d));u=t.stepTicks(p.step),e.labelLastVisible&&(u=u.slice(0,u.length-p.delCount),u.push(i[i.length-1]))}else u=t.domain();return Uz(u)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:r,getRadius:o,axisSpec:s,labelGap:a=0}=e,l=o?.();if(!l)return Uz(t.domain());let h;if(Uu(r))h=t.stepTicks(r);else if(Uu(n))h=t.forceTicks(n);else if(Uu(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),r=Jz(s),o=Zz(t,i,e),c=Math.min(...n),u=Math.max(...n),d=Math.abs(u-c)*(l+r)/i.length,{step:p,delCount:f}=eW(i,o,a,Math.floor(o.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));h=t.stepTicks(p),h=h.slice(0,h.length-f)}else h=t.domain();return Uz(h)})(t,e)}return Uz(t.domain())},nW=Math.sqrt(50),rW=Math.sqrt(10),oW=Math.sqrt(2);class sW{_extend={};_scale;_scales;nice;zero;domain;expand;forceTickCount;tickCount;niceType;constructor(){this._scale=new XI,this._scales=[this._scale]}setExtraAttrFromSpec(t,e,i,n){this.nice=t,this.zero=e,this.zero&&(i.min=Math.min(i.min,0),i.max=Math.max(i.max,0)),this.domain=i,this.expand=n}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),Vu(this.domain?.min)&&Vu(this.domain?.max)?this.nice&&this._scale.nice(t):Uu(this.domain?.min)&&Vu(this.domain?.max)?this.nice&&this._scale.niceMax(t):Vu(this.domain?.min)&&Uu(this.domain?.max)&&this.nice&&this._scale.niceMin(t)}dataToPosition(t){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this.expand)return;const e=t[0],i=t[t.length-1];Uu(this.expand.min)&&(t[0]=e-(i-e)*this.expand.min),Uu(this.expand.max)&&(t[t.length-1]=i+(i-e)*this.expand.max)}niceDomain(t){if(Math.abs(function(t){if(t&&qu(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)}(t)-function(t){if(t&&qu(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),r=i/Math.pow(10,n);i=(r>=nW?10:r>=rW?5:r>=oW?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this.nice){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),Vu(this.domain?.min)&&Vu(this.domain?.max)?this._scale.nice(t):Uu(this.domain?.min)&&Vu(this.domain?.max)?this._scale.niceMax(t):Vu(this.domain?.min)&&Uu(this.domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this.zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this.nice),this.niceMinMax()}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,r=n?i:0,o=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[o]&&(t[o]=e),e<t[r]&&(t[r]=e)}setDomainMinMax(t){if(!this.domain)return;const{min:e,max:i}=this.domain;Uu(e)&&(t[0]=e),Uu(i)&&(t[1]=i)}setZero(t){this.zero!==t&&(this.zero=t,this.updateScaleDomain())}updateScaleDomain(){const t=this.computeDomain([this.domain]);this.updateScaleDomainByModel(t)}computeDomain(t){return this.computeLinearDomain(t)}updateScaleDomainByModel(t){t=t??this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this.nice),this.niceMinMax()}updateRange(t){const[e,i]=this._scale.range();t[0]===e&&t[1]===i||this._scale.range(t)}}function aW(t,e){const i=e.option;od(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),r=dO(e.orient),o=!0===e.option.inverse,s=t[0],a=vd(t);if(r)if(o){const t=i,e=0,n=s.AABBBounds.x2,r=a.AABBBounds.x1;n>t&&s.setAttributes({x:t,textAlign:"right"}),r<e&&a.setAttributes({x:e,textAlign:"left"})}else{const t=0,e=i,n=s.AABBBounds.x1,r=a.AABBBounds.x2;n<t&&s.setAttributes({x:t,textAlign:"left"}),r>e&&a.setAttributes({x:e,textAlign:"right"})}else if(o){const t=s.AABBBounds.y1,e=a.AABBBounds.y2,i=0,r=n;t<i&&s.setAttributes({y:i,textBaseline:"top"}),e>r&&a.setAttributes({y:r,textBaseline:"bottom"})}else{const t=n,e=0,i=s.AABBBounds.y2,r=a.AABBBounds.y1;i>t&&s.setAttributes({y:t,textBaseline:"bottom"}),r<e&&a.setAttributes({y:e,textBaseline:"top"})}}(t,e)}const lW=t=>t;class hW{width;height;table;option;orient;visible;type;inverse;data;tickData;scale;component;constructor(t,e,i,n){this.table=n,this.width=e,this.height=i,this.option=fd({},cO,t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.type=t.type??"band",this.inverse="inverse"in t&&!!t.inverse,"band"===t.type&&(this.data=t.domain),this.initScale(),this.initData(),this.createComponent(),this.initEvent()}initScale(){const t=this.option;"band"===this.type?(this.scale=new pO,this.scale.bandPadding=t.bandPadding,this.scale.paddingInner=t.paddingInner,this.scale.paddingOuter=t.paddingOuter,this.scale.calcScales(.1,.3),this.scale.updateScaleDomain(this.data),this.updateScaleRange()):"linear"!==this.type&&"time"!==this.type||(this.scale=new sW,this.scale.setExtraAttrFromSpec(t.nice,t.zero,t.range,t.expand),this.scale.transformScaleDomain(),this.scale.updateScaleDomain(),this.updateScaleRange())}initData(){!function(t,e,i){t.getParser(e)||t.registerParser(e,i)}(this.table._vDataSet,"scale",lW),function(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}(this.table._vDataSet,"ticks",iW);const t=this.option.label||{},e=this.option.tick||{},i=new Gz(this.table._vDataSet).parse(this.scale._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this.option.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this.orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this.tickData=i,this.computeData()}computeData(){this.tickData.reRunAllTransform()}initEvent(){}createComponent(){const t=uO(this.option),e=this.getUpdateAttribute();e.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component=new hI(fd({},t,e)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.component.originAxis=this}resize(t,e){this.width=t,this.height=e,this.updateScaleRange(),this.computeData();const i=uO(this.option),n=this.getUpdateAttribute();n.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component.setAttributes(fd({},i,n)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.overlap()}overlap(){!function(t,e){const i=t.find((t=>"axis-label-container-layer-0"===t.name),!0),n=t.find((t=>"axis-label-container-layer-1"===t.name),!0);aW(i?i.getChildren():[],e),aW(n?n.getChildren():[],e)}(this.component,this)}getLayoutRect(){return{width:this.width,height:this.height}}getUpdateAttribute(){this.table.tableNoFrameHeight,this.table.tableNoFrameWidth;const{width:t,height:e}=this.getLayoutRect(),i=dO(this.orient),n="left"===(r=this.orient)||"right"===r;var r;let o={x:0,y:0},s=0;i?(o={x:t,y:0},s=t):n&&(o={x:0,y:e},s=e);return{start:{x:0,y:0},end:o,title:{text:this.option.title.text,maxWidth:this._getTitleLimit(i)},items:this.getLabelItems(s)}}getLabelItems(t){return[this.tickData.latestData.map((e=>({id:e.value,label:e.value,value:0===t?0:this.scale.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]}updateScaleRange(){const{width:t,height:e}=this.getLayoutRect(),i=this.option.inverse||!1;let n=[0,0];dO(this.orient)?td(t)&&(n=i?[t,0]:[0,t]):td(e)&&(n=i?[0,e]:[e,0]),this.scale.updateRange(n)}setLayoutStartPosition(t){let{x:e,y:i}=t;return td(e)&&(e+=Number("left"===this.orient)*this.getLayoutRect().width),td(i)&&(i+=Number("top"===this.orient)*this.getLayoutRect().height),{x:e,y:i}}_getTitleLimit(t){if(this.option.title.visible&&Vu(this.option.title.style?.maxLineWidth)){let e=this.option.title.style?.angle||0;if(this.option.title?.autoRotate&&Vu(this.option.title.angle)&&(e="left"===this.option.orient?-90:90),t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(np(e)));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(np(e)));return n<1e-6?1/0:i/n}return null}getScale(){return this.scale._scale}getDomainSpec(){return this.scale.domain}}function cW(t,e,i,n,r,o){const s=function(t,e){const i=new Array(e);for(let n=0;n<e;n++)i[n]=t(n);return i}(t,i);s.sort(((t,e)=>n(o(t),o(e),r)));for(let t=0;t<i;t++)e(t,s[t])}function uW(t,e){if(typeof t!=typeof e)return!1;if("number"==typeof t&&"number"==typeof e&&t!==e)return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const dW={SOURCE_LENGTH_UPDATE:"source_length_update",CHANGE_ORDER:"change_order"};function pW(t,e){const i=Xp(t);if(Yp(i)){const t=i.then((t=>(e(t),t)));return e(t),t}return i}function fW(t,e,i){if(null===t)return;if(Yp(t))return t.then((t=>fW(t,e,i)));const n=function(t){if(tf.isObject(t)){const e=t;if(bu(e.get)&&bu(e.set))return!0}return!1}(e)?e.get:e;if(n in t){return pW(t[n],i)}if("function"==typeof n){return pW(n(t),i)}if(Array.isArray(n)){const e=function(t,e){let i,n=t;for(;i=e.shift();)n=n[i];return n}(t,[...n]);return pW(e,i)}const r=`${n}`.split(".");if(r.length<=1){return pW(t[n],i)}return pW(Kp(t,((t,e)=>fW(t,e,of)),...r),i)}function gW(t,e){if(!t)return e;const i=t[e];return bu(i)?i:e}class mW extends Su{_get;_sourceLength;_source;sortedIndexMap;lastOrder;lastOrderFn;lastOrderField;currentIndexedData=[];pagination;_currentPagerIndexedData;enableHierarchyState=!1;static get EVENT_TYPE(){return dW}treeDataHierarchyState=new Map;constructor(t,e,i){if(super(),this._get=t?.get.bind(t)||void 0,this._sourceLength=t?.length||0,this._source=t?.source??t,this.sortedIndexMap=new Map,this._currentPagerIndexedData=[],this.pagination=e||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},i>=1&&(this.enableHierarchyState=!0),this.currentIndexedData=Array.from({length:this._sourceLength},((t,e)=>e)),this.enableHierarchyState)for(let t=0;t<this._sourceLength;t++){this.getOriginalRecord(t).children&&this.treeDataHierarchyState.set(t,Xc.collapse)}if(i>1){let t=this._sourceLength;for(let e=0;e<t;e++){const n=this.currentIndexedData[e],r=this.getOriginalRecord(n);if(r.children?.length>0){this.treeDataHierarchyState.set(Array.isArray(n)?n.join(","):n,Xc.expand);const o=this.initChildrenNodeHierarchy(n,i,2,r);e+=o,t+=o}}}this.updatePagerData()}initChildrenNodeHierarchy(t,e,i,n){if(i>e)return 0;let r=0;const o=n.children?.length??0;for(let s=0;s<o;s++){r+=1;const o=n.children[s],a=Array.isArray(t)?t.concat(s):[t,s];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+r,0,a),o.children?.length>0&&(i<e?this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,Xc.expand):this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,Xc.collapse)),r+=this.initChildrenNodeHierarchy(a,e,i+1,o)}return r}updatePagination(t){this.pagination=t||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},this.updatePagerData()}updatePagerData(){const{currentIndexedData:t}=this,{perPageCount:e,currentPage:i}=this.pagination,n=e*(i||0),r=n+e;if(this._currentPagerIndexedData.length=0,t&&t.length>0){let e=-1;for(let i=0;i<t.length;i++)if((Array.isArray(t[i])&&1===t[i].length||!Array.isArray(t[i]))&&e++,e>=n&&e<r)this._currentPagerIndexedData.push(t[i]);else if(e>=r)break}else if(this._sourceLength>0)throw new Error("currentIndexedData should has values!")}get source(){return this._source}get(t){return this.getOriginalRecord(gW(this.currentPagerIndexedData,t))}getIndexKey(t){return gW(this.currentPagerIndexedData,t)}getField(t,e){return this.getOriginalField(gW(this.currentPagerIndexedData,t),e)}hasField(t,e){return this.hasOriginalField(gW(this.currentPagerIndexedData,t),e)}getHierarchyState(t){const e=this.getIndexKey(t);return this.treeDataHierarchyState.get(Array.isArray(e)?e.join(","):e)??null}toggleHierarchyState(t){const e=this.currentIndexedData.slice(0),i=this.getIndexKey(t),n=this.getHierarchyState(t),r=this.getOriginalRecord(i);if(this.clearSortedIndexMap(),n===Xc.collapse)this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,Xc.expand),this.pushChildrenNode(i,Xc.expand,r);else if(n===Xc.expand){let t=0;const e=(i,n,r)=>{if(n&&n!==Xc.collapse&&n!==Xc.none&&r.children)for(let n=0;n<r.children.length;n++){t+=1;const o=Array.isArray(i)?i.concat([n]):[i,n];e(o,this.treeDataHierarchyState.get(o.join(",")),r.children[n])}};e(i,n,r),this.currentIndexedData.splice(this.currentIndexedData.indexOf(i)+1,t),this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,Xc.collapse)}return this.updatePagerData(),function(t,e){const i=[],n=[];for(let i=0;i<t.length;i++){let r=!0;for(let n=0;n<e.length;n++)if(uW(t[i],e[n])){r=!1;break}r&&n.push(i)}for(let n=0;n<e.length;n++){let r=!0;for(let i=0;i<t.length;i++)if(uW(t[i],e[n])){r=!1;break}r&&i.push(n)}return{add:i,remove:n}}(e,this.currentIndexedData)}pushChildrenNode(t,e,i){if(!e||e===Xc.collapse||e===Xc.none)return 0;let n=0;if(i.children){const e=Array.from({length:i.children.length},((t,e)=>e));this.lastOrder&&"normal"!==this.lastOrder&&this.lastOrderField&&cW((t=>bu(e[t])?e[t]:e[t]=t),((t,i)=>{e[t]=i}),i.children.length,this.lastOrderFn,this.lastOrder,(e=>this.getOriginalField(Array.isArray(t)?t.concat([e]):[t,e],this.lastOrderField)));for(let r=0;r<e.length;r++){n+=1;const o=Array.isArray(t)?t.concat([e[r]]):[t,e[r]];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+n,0,o);const s=this.treeDataHierarchyState.get(o.join(",")),a=this.getOriginalRecord(o);!s&&a.children&&this.treeDataHierarchyState.set(o.join(","),Xc.collapse),n+=this.pushChildrenNode(o,this.treeDataHierarchyState.get(o.join(",")),i.children[e[r]])}}return n}setRecord(t,e){const i=this.getIndexKey(e);if(Array.isArray(i)){const e=i[i.length-1];this.getOriginalRecord(i.slice(0,i.length-1)).children.splice(e,1,t)}else this.source.splice(i,1,t)}sort(t,e,i=("desc"!==e?(t,e)=>t===e?0:t>e?1:-1:(t,e)=>t===e?0:t<e?1:-1)){this.lastOrderField=t,this.lastOrder=e,this.lastOrderFn=i;let n,r=this.sortedIndexMap.get(t);if(r&&(n=r[e],n&&n.length>0))return this.currentIndexedData=n,this.updatePagerData(),void this.fireListeners(dW.CHANGE_ORDER,null);const o=[];if("normal"===e)for(let t=0;t<this._sourceLength;t++)o[t]=t;else cW((t=>bu(o[t])?o[t]:o[t]=t),((t,e)=>{o[t]=e}),this._sourceLength,i,e,(e=>this.getOriginalField(e,t)));if(this.currentIndexedData=o,this.enableHierarchyState){let t=o.length;window.performance.now();for(let e=0;e<t;e++){const i=this.pushChildrenNode(o[e],this.treeDataHierarchyState.get(o[e]),this.getOriginalRecord(o[e]));t+=i,e+=i}}r||(r={asc:[],desc:[],normal:[]},this.sortedIndexMap.set(t,r)),r[e]=o,this.updatePagerData(),this.fireListeners(dW.CHANGE_ORDER,null)}clearSortedIndexMap(){this.lastOrderField&&this.lastOrder&&this.sortedIndexMap.forEach(((t,e)=>{e!==this.lastOrderField?this.sortedIndexMap.delete(e):"asc"===this.lastOrder?(t.desc=[],t.normal=[]):"desc"===this.lastOrder?(t.asc=[],t.normal=[]):(t.desc=[],t.asc=[])}))}get sourceLenght(){return this._sourceLength}set sourceLength(t){this._sourceLength!==t&&(this._sourceLength=t,this.fireListeners(dW.SOURCE_LENGTH_UPDATE,this._sourceLength))}get length(){return this.currentPagerIndexedData.length}get dataSource(){return this}get currentPagerIndexedData(){return this._currentPagerIndexedData.length>0?this._currentPagerIndexedData:[]}release(){super.release?.()}clearSortedMap(){this.currentIndexedData&&(this.currentIndexedData.length=0),this.currentIndexedData=null,this.sortedIndexMap.forEach((t=>{t.asc&&(t.asc.length=0),t.desc&&(t.desc.length=0)})),this.sortedIndexMap.clear()}clearCurrentIndexedData(){this.currentIndexedData=null,this.currentPagerIndexedData.length=0}getOriginalRecord(t){return pW(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getOriginalField(t,e){if(null===e)return;return fW(this.getOriginalRecord(t),e,(i=>{this.fieldPromiseCallBack(t,e,i)}))}hasOriginalField(t,e){if(null===e)return!1;if("function"==typeof e)return!0;const i=this.getOriginalRecord(t);return Boolean(i&&e in i)}fieldPromiseCallBack(t,e,i){}recordPromiseCallBack(t,e){}static EMPTY=new mW({get(){},length:0})}class yW extends mW{_recordCache;_fieldCache;static get EVENT_TYPE(){return mW.EVENT_TYPE}static ofArray(t,e,i){return new yW({get:e=>Array.isArray(e)?function(t,e){let i=t;for(let t=0;t<e.length;t++){const n=e[t];if(!i[n])return;i=i[n],i&&i.children&&t+1<e.length&&(i=i.children)}return i}(t,e):t[e],length:t.length,source:t},e,i)}constructor(t,e,i){super(t,e,i),this._recordCache={},this._fieldCache={}}getOriginalRecord(t){return this._recordCache&&this._recordCache[t]?this._recordCache[t]:super.getOriginalRecord(t)}getOriginalField(t,e){const i=this._fieldCache&&this._fieldCache[t];if(i){const t=i.get(e);if(t)return t}return super.getOriginalField(t,e)}clearCache(){this._recordCache&&(this._recordCache={}),this._fieldCache&&(this._fieldCache={})}fieldPromiseCallBack(t,e,i){!function(t,e,i,n){(t[e]||(t[e]=new Map)).set(i,n)}(this._fieldCache,t,e,i)}recordPromiseCallBack(t,e){this._recordCache[t]=e}release(){super.release?.()}}var bW=Object.freeze({__proto__:null,CachedDataSource:yW,DataSource:mW}),vW={exports:{}},wW={},CW=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),xW=["style","variant","weight","size","lineHeight","family"],_W=/([\.0-9]+)(.*)/,SW=function(t,e,i){var n=t.match(_W);if(n){t=parseFloat(n[1]);var r=n[2].toLowerCase().trim(),o=Math.round(t);switch(o===t&&(t=o),r){case"em":if(null===e)return;return t*e;case"px":return t;case"pt":return t/(72/i);case"pc":return t/(6/i);case"mm":return t*(i/25.4);case"cm":return t*(i/2.54);case"in":return t*i;case"%":if(null===e)return;return e*(t/100)}}},AW={size:SW,lineHeight:SW},TW={serif:1,"sans-serif":1,cursive:1,fantasy:1,monospace:1},BW=vW.exports=function(t,e,i){var n=t+"-"+(e||"null")+"@"+i;if(i=i||96,void 0!==wW[n])return wW[n];if(e&&(e=BW(e,null,i)),"inherit"===t)return e;var r=CW.exec(t);if(r){r.shift();for(var o={},s=0;s<r.length;s++){var a=xW[s],l=r[s];if(AW[a]&&l){var h=e&&e[a]||null,c=AW[a](l,h,i);l=void 0===c&&"lineHeight"===a&&l?o.size*parseFloat(l):c}if(l&&"normal"!==l){if("inherit"===l){if(!e)return;l=e[a]}l.trim&&(l=l.trim()),o[a]=l}}Object.keys(o).length||(o=null),wW[n]=o;var u=[];o.style&&u.push(o.style),o.variant&&u.push(o.variant),o.weight&&"400"!==o.weight&&"normal"!==o.weight&&u.push(o.weight),u.push(o.size+"px"),o.lineHeight&&(u[u.length-1]+="/"+o.lineHeight+"px");var d=o.family.split(",");return o.family=d.map((function(t){return t=t.trim(),TW[t.toLowerCase()]&&(t=t.toLowerCase()),t})),u.push(o.family),Object.defineProperty(o,"toString",{value:function(){return u.map((function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(" ")>-1?'"'+t.replace(/["']/g,"")+'"':t})).join(", "):t})).join(" ")}}),o}wW[n]=null};vW.exports.generics=TW;var MW=i(vW.exports);function RW(t){let e=Cw(t);return"number"==typeof e||"string"==typeof e?e=[e,e,e,e]:Array.isArray(e)&&(e=e.slice(0)),e}const PW=0,EW=1,HW=2,LW=3,kW=10,IW=11,OW=12,DW=9,FW=13,zW=10,WW=12,jW=32,NW=37,GW=46,VW=48,UW=57,KW=65,$W=90,XW=97,YW=122;function qW(t){return function(t){return t>=XW&&t<=YW}(t)||function(t){return t>=KW&&t<=$W}(t)}function ZW(t){return t===DW||t===zW||t===WW||t===FW||t===jW}function JW(t){return t>=VW&&t<=UW}function QW(t){return t===GW}function tj(t){return qW(t)||t===NW}function ej(t){return new Error(`calc parse error: ${t}`)}const ij={"*":3,"/":3,"+":2,"-":2};function nj(t,e){function i(t){const i=t.pop(),n=t.pop(),r=t.pop();if(!(r&&r.nodeType&&n&&n.type===HW&&i&&i.nodeType))throw ej(e);return{nodeType:IW,left:r,op:n,right:i}}const n=[];for(;t.length;){const r=t.shift();if(r.type===PW&&"("===r.value){let i=0;const r=zp.findIndex(t,(t=>{if(t.type===PW&&"("===t.value)i++;else if(t.type===PW&&")"===t.value){if(!i)return!0;i--}return!1}));if(-1===r)throw ej(e);n.push(nj(t.splice(0,r),e)),t.shift()}else if(r.type===HW){if(n.length>=3){const t=n[n.length-2].value;ij[r.value]<=ij[t]&&n.push(i(n))}n.push(r)}else if(r.type===EW){const{value:t,unit:e}=r;n.push({nodeType:kW,value:t,unit:e})}else r.type===LW&&n.push({nodeType:OW,value:r.value})}for(;n.length>1;)n.push(i(n));return n[0]}function rj(t){const e=function(t){const e=t.replace(/calc\(/g,"(").trim(),i=[],n=e.length;for(let s=0;s<n;s++){const n=e[s],a=n.charCodeAt(0);if("("===n||")"===n)i.push({value:n,type:PW});else if("*"===n||"/"===n)i.push({value:n,type:HW});else if("+"===n||"-"===n)s=r(n,s+1)-1;else if(JW(a)||QW(a))s=o(n,s+1)-1;else if(!ZW(a))throw ej(t)}function r(t,r){if(r<n){const i=e[r],n=i.charCodeAt(0);if(JW(n)||QW(n))return o(t+i,r+1)}return i.push({value:t,type:HW}),r}function o(r,o){let a=o;for(;a<n;a++){const i=e[a],n=i.charCodeAt(0);if(JW(n))r+=i;else{if("."!==i){if(tj(n))return s(r,i,a+1);break}if(r.indexOf(".")>=0)throw ej(t);r+=i}}if("."===r)throw ej(t);return i.push({value:parseFloat(r),type:LW}),a}function s(t,r,o){let s=o;for(;s<n;s++){const t=e[s];if(!tj(t.charCodeAt(0)))break;r+=t}return i.push({value:parseFloat(t),unit:r,type:EW}),s}return i}(t);return nj(e,t)}function oj(t,e){if(t.nodeType===IW){const i=oj(t.left,e),n=oj(t.right,e);switch(t.op.value){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n;default:throw new Error(`calc error. unknown operator: ${t.op.value}`)}}else if(t.nodeType===kW)switch(t.unit){case"%":return t.value*e.full/100;case"px":return t.value;default:throw new Error(`calc error. unknown unit: ${t.unit}`)}else if(t.nodeType===OW)return t.value;throw new Error("calc error.")}function sj(t,e){return oj(rj(t),e)}function aj(t,e){return"string"==typeof t?sj(t.trim(),e):t-0}function lj(t){return!!Yu(t)&&(!!t.endsWith("%")&&function(t){return!(Vu(t)||!Qu(t)&&+t!=+t)}(t.substring(0,t.length-1)))}function hj(t,e){const{dataSourceEventIds:i}=t.internalProps;i&&i.forEach((e=>t.internalProps.handler.off(e))),e(t),t.internalProps.dataSourceEventIds=[t.internalProps.handler.on(t.internalProps.dataSource,mW.EVENT_TYPE.CHANGE_ORDER,(()=>{t.dataSource.enableHierarchyState&&t.refreshRowColCount(),t.render()}))]}function cj(t,e=[]){hj(t,(()=>{const i=e;t.internalProps.records=e;const n=t.internalProps.dataSource=yW.ofArray(i,t.pagination,t.options.hierarchyExpandLevel??(t.hasHierarchyTreeHeader?.()?1:void 0));t.addReleaseObj(n)}))}function uj(t,e){hj(t,(()=>{if(e)if(e instanceof mW)t.internalProps.dataSource=e;else{const i=t.internalProps.dataSource=new yW(e);t.addReleaseObj(i)}else t.internalProps.dataSource=mW.EMPTY;t.internalProps.records=null}))}function dj(t,e){return Math.round(aj(e,t.internalProps.calcWidthContext))}function pj(t,e,i,n,r,o=!0){const s=RW(r("padding",t,i,n,e)),a=r("bgColor",t,i,n,e),l=r("font",t,i,n,e);let h,c,u;if(l){const{family:t,size:e,weight:i}=function(t){return MW(t)}(l);h=t.join(" "),c=e,u=i}else h=r("fontFamily",t,i,n,e),c=r("fontSize",t,i,n,e),u=r("fontWeight",t,i,n,e);const d=r("textAlign",t,i,n,e),p=r("textBaseline",t,i,n,e),f=r("color",t,i,n,e),g=r("lineHeight",t,i,n,e),m=r("underline",t,i,n,e),y=r("lineThrough",t,i,n,e),b=Math.max(1,Math.floor(c/10)),v=r("textOverflow",t,i,n,e),w=r("borderColor",t,i,n,e),C=r("borderLineWidth",t,i,n,e),x=r("borderLineDash",t,i,n,e),_=r("marked",t,i,n,e),S=r("cursor",t,i,n,e),A=!(s&&a&&l&&d&&p&&f&&v&&w&&C&&x&&"boolean"==typeof m&&"boolean"==typeof y&&"boolean"==typeof _);if(!o)return{hasFunctionPros:A};const T={text:{fontFamily:h,fontSize:c,fontWeight:u,fill:f,textAlign:d,textBaseline:p,lineHeight:g??c,underline:m?b:void 0,lineThrough:y?b:void 0,ellipsis:v&&"clip"!==v?"ellipsis"===v?"...":v:void 0},group:{fill:a,lineDash:x,lineWidth:C,stroke:w,cursor:"auto"===S||"default"===S?void 0:S},_vtable:{padding:s,marked:_}};if(Array.isArray(C)&&(T.group.strokeArrayWidth=RW(C)),Array.isArray(w)){const t=RW(w);T.group.stroke=!t.every((t=>!t))&&t,T.group.strokeArrayColor=RW(w)}return{theme:T,hasFunctionPros:A}}const fj={};class gj{static cache=new Map;static setIcon(t,e){this.cache.set(t,e)}static getIcon(t){return this.cache.has(t)?this.cache.get(t):null}static hasIcon(t){return this.cache.has(t)}static clear(t){return this.cache.delete(t)}static clearAll(){this.cache=new Map}}const mj={get sort_downward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#416EFF"/> </svg>',width:16,height:16,funcType:Jc.sort,name:"sort_downward",positionType:Zc.contentRight,marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_upward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#416EFF"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:Jc.sort,positionType:Zc.contentRight,name:"sort_upward",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_normal(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:Jc.sort,positionType:Zc.contentRight,name:"sort_normal",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get freeze(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><path d="M17.1313 8.42047C17.1932 8.48238 17.2423 8.55587 17.2759 8.63676C17.3094 8.71764 17.3266 8.80434 17.3266 8.89189C17.3266 8.97944 17.3094 9.06613 17.2759 9.14702C17.2423 9.2279 17.1932 9.3014 17.1313 9.3633L13.3843 13.1103C13.7007 14.3048 13.5305 15.4443 12.8388 16.2395C12.8104 16.2781 12.7778 16.3136 12.7417 16.3451L12.712 16.3755C12.6501 16.4374 12.5766 16.4865 12.4957 16.52C12.4148 16.5535 12.3281 16.5707 12.2406 16.5707C12.153 16.5707 12.0663 16.5535 11.9854 16.52C11.9046 16.4865 11.8311 16.4374 11.7692 16.3755L9.17633 13.7826L6.05316 16.9058L5.11983 17.0925C5.09291 17.0979 5.06508 17.0965 5.03881 17.0886C5.01254 17.0806 4.98863 17.0663 4.96923 17.0469C4.94982 17.0275 4.9355 17.0036 4.92755 16.9773C4.9196 16.951 4.91827 16.9232 4.92366 16.8963L5.11033 15.963L8.23333 12.8396L5.64066 10.2471C5.57875 10.1852 5.52964 10.1117 5.49614 10.0309C5.46263 9.94997 5.44539 9.86327 5.44539 9.77572C5.44539 9.68817 5.46263 9.60148 5.49614 9.52059C5.52964 9.43971 5.57875 9.36621 5.64066 9.3043C5.65066 9.2943 5.66066 9.2843 5.67099 9.27464C5.70266 9.2383 5.73833 9.20547 5.77766 9.17664C6.57283 8.48564 7.71199 8.31564 8.90599 8.63197L12.6528 4.88497C12.7147 4.82306 12.7882 4.77395 12.8691 4.74045C12.95 4.70694 13.0367 4.6897 13.1242 4.6897C13.2118 4.6897 13.2985 4.70694 13.3794 4.74045C13.4603 4.77395 13.5338 4.82306 13.5957 4.88497L17.1312 8.42047H17.1313ZM15.7172 8.8918L13.1243 6.29914L9.56483 9.8588C9.47574 9.94788 9.36323 10.0099 9.24034 10.0376C9.11746 10.0654 8.98922 10.0578 8.87049 10.0156C8.22783 9.78764 7.63899 9.7553 7.17749 9.89814L12.1182 14.8388C12.261 14.3771 12.2287 13.7885 12.0007 13.146C11.9585 13.0272 11.9509 12.899 11.9787 12.7761C12.0064 12.6532 12.0684 12.5407 12.1575 12.4516L15.7172 8.89164V8.8918Z" fill="#282F38" fill-opacity="0.2"/></g><defs><clipPath id="clip0"><rect width="22" height="22" fill="white"/></clipPath></defs></svg>',width:22,height:22,name:"freeze",funcType:Jc.frozen,positionType:Zc.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozen(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#282F38" fill-opacity="0.35"/></svg>',width:22,height:22,name:"frozen",funcType:Jc.frozen,positionType:Zc.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozenCurrent(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#416EFF"/></svg>',width:22,height:22,funcType:Jc.frozen,positionType:Zc.right,name:"frozenCurrent",marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get dropdownIcon(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="white"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#959DA5"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="#4F5965"/></svg>',width:24,height:24,funcType:Jc.dropDown,positionType:Zc.absoluteRight,name:"dropdownIcon",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)",image:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="#1E54C9"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#141414" stroke-opacity="0.2"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="white"/></svg>'},cursor:"pointer",visibleTime:"mouseenter_cell"}},get play(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="48" height="48" fill="white" fill-opacity="0.01" /><path d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /><path d="M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /></svg>',width:24,height:24,funcType:Jc.play,positionType:Zc.right,name:"play",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get damage_pic(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 10V38C5 39.1046 5.89543 40 7 40H14H18L15 29L22 27L21 20L29 16L27 13L30 8H7C5.89543 8 5 8.89543 5 10Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M43 38V10C43 8.89543 42.1046 8 41 8H38L34 14L37 19L28 23L29 31L22 33L24 40H41C42.1046 40 43 39.1046 43 38Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 18C15.3284 18 16 17.3284 16 16.5C16 15.6716 15.3284 15 14.5 15C13.6716 15 13 15.6716 13 16.5C13 17.3284 13.6716 18 14.5 18Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>',width:24,height:24,funcType:Jc.damagePic,positionType:Zc.left,name:"damage_pic",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get expand(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M4.64988 6.81235C4.38797 6.48497 4.62106 6 5.04031 6L10.9597 6C11.3789 6 11.612 6.48497 11.3501 6.81235L8.39043 10.512C8.19027 10.7622 7.80973 10.7622 7.60957 10.512L4.64988 6.81235Z" fill="#141414" fill-opacity="0.65"/>\n </svg>',width:16,height:16,funcType:Jc.expand,name:"expand",positionType:Zc.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get collapse(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M5.81235 11.3501C5.48497 11.612 5 11.3789 5 10.9597L5 5.04031C5 4.62106 5.48497 4.38797 5.81235 4.64988L9.51196 7.60957C9.76216 7.80973 9.76216 8.19027 9.51196 8.39044L5.81235 11.3501Z" fill="#141414" fill-opacity="0.65"/>\n </svg>',width:16,height:16,funcType:Jc.collapse,name:"collapse",positionType:Zc.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get drillDown(){return{name:"drillDown",type:"svg",positionType:Zc.absolute,funcType:Jc.drillDown,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM549.333333 288a5.333333 5.333333 0 0 1 5.333334 5.333333V469.333333h176a5.333333 5.333333 0 0 1 5.333333 5.333334v74.666666a5.333333 5.333333 0 0 1-5.333333 5.333334H554.666667v176a5.333333 5.333333 0 0 1-5.333334 5.333333h-74.666666a5.333333 5.333333 0 0 1-5.333334-5.333333V554.666667H293.333333a5.333333 5.333333 0 0 1-5.333333-5.333334v-74.666666a5.333333 5.333333 0 0 1 5.333333-5.333334H469.333333V293.333333a5.333333 5.333333 0 0 1 5.333334-5.333333h74.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}},get drillUp(){return{name:"drillUp",type:"svg",positionType:Zc.absolute,funcType:Jc.drillUp,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM693.333333 469.333333a42.666667 42.666667 0 1 1 0 85.333334H330.666667a42.666667 42.666667 0 1 1 0-85.333334h362.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}}};function yj(){return Up(mj,fj)}class bj extends Xx{role;col;row;mergeCol;mergeRow;rowNumber;colHeight;border;needUpdate;clear(){this.removeAllChild()}getChildByName(t,e){let i=null;return this.forEachChildren((e=>e.name===t&&(i=e,!0))),e&&this.forEachChildren((e=>{if(e.getChildByName){const n=e.getChildByName(t,!0);if(n)return i=n,!0}return!1})),i}get width(){let t=this.AABBBounds.width();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.width??0)}get height(){let t=this.AABBBounds.height();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.height??0)}setDeltaWidth(t){this.setAttribute("width",(this.attribute.width??0)+t),this.border&&this.border.setAttribute("width",this.border.attribute.width+t)}setDeltaHeight(t){this.setAttribute("height",(this.attribute.height??0)+t),this.border&&this.border.setAttribute("height",this.border.attribute.height+t)}setDeltaX(t){this.setAttribute("x",this.attribute.x+t)}setDeltaY(t){this.setAttribute("y",this.attribute.y+t)}forEachChildrenSkipChild(t,e="border-rect",i=!1){if(i){let i=this._lastChild,n=0;for(;i;){if(i.name!==e){if(t(i,n++))return}i=i._prev}}else{let i=this._firstChild,n=0;for(;i;){if(i.name!==e){if(t(i,n++))return}i=i._next}}}getColGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.col===t)return e;e=e._next}return null}getRowGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.row===t)return e;e=e._next}return null}getChildAt(t){const e=super.getChildAt(t);return e&&"border-rect"===e.name?e._next:e}updateColumnRowNumber(t){this.rowNumber?this.rowNumber=Math.max(this.rowNumber,t):this.rowNumber=t}updateColumnHeight(t){this.colHeight?this.colHeight+=t:this.colHeight=t}}function vj(t,e,i,n){let r=t,o=e;return r>i&&(r=i,o=r*e/t),o>n&&(o=n,r=o*t/e),{width:r,height:o}}function wj(t,e,i,n,r,o,s="left",a="middle",l=[0,0,0,0],h=0,c=0,u=0,d=0){const p=t+i,f=e+n;let g=t+l[3]+h;"right"===s||"end"===s?g=p-r-l[1]-c:"center"===s&&(g=t+(i-r+h-c)/2);let m=e+l[0]+u;return"bottom"===a||"alphabetic"===a||"ideographic"===a?m=f-o-l[2]-d:"middle"===a&&(m=e+(n-o+u-d)/2),{x:g,y:m}}function Cj(t,e,i,n,r){const o=e&&bu(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:n,table:r,value:r.getCellValue(i,n),dataValue:r.getCellOriginValue(i,n),cellHeaderPaths:r.getCellHeaderPaths(i,n)})}return o}function xj(t,e,i,n,r){const o=e&&bu(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:n,table:r,value:r.getCellValue(i,n),dataValue:r.getCellOriginValue(i,n),cellHeaderPaths:r.getCellHeaderPaths(i,n)})}}function _j(t,e,i,n,r,o){let s=!1,a=null,l=null;return r.table.getColWidth(t)<i+o[1]+o[3]&&(a=i+o[1]+o[3],s=!0),r.table.getRowHeight(e)<n+o[2]+o[0]&&(l=n+o[2]+o[0],s=!0),!!s&&("number"==typeof a&&r.setColWidth(t,a),"number"==typeof l&&r.setRowHeight(e,l),r.component.updateScrollBar(),!0)}function Sj(t,e,i,n){const r=t.getChildByName("image"),o="string"!=typeof r.attribute.image&&r.attribute.image||r.resources?.get(r.attribute.image).data;if(!o)return;const s=n._getCellStyle(e,i),a=Cj("textAlign",s,e,i,n)??"left",l=Cj("textBaseline",s,e,i,n)??"middle",h=RW(Cj("padding",s,e,i,n))??[0,0,0,0];if(r.keepAspectRatio){const{width:e,height:i}=vj(o.width||o.videoWidth,o.height||o.videoHeight,t.attribute.width-(h[1]+h[3]),t.attribute.height-(h[0]+h[2])),n=wj(0,0,t.attribute.width,t.attribute.height,e,i,a,l,h);r.setAttributes({x:n.x,y:n.y,width:e,height:i})}else r.setAttributes({x:h[3],y:h[0],width:t.attribute.width-h[1]-h[3],height:t.attribute.height-h[0]-h[2]});const c=t.getChildByName("play-icon");if(c){const e=0,i=0,n=t.attribute.width,o=t.attribute.height,s=Math.floor(Math.min(n-h[1]-h[3],o-h[2]-h[0])/2),a=e+(n>r.attribute.width?r.attribute.x-e+r.attribute.width/2:n/2),l=i+(o>r.attribute.height?r.attribute.y-i+r.attribute.height/2:o/2);c.setAttributes({x:a-s/2,y:l-s/2,width:s,height:s})}}function Aj(t,e,i,n,r,o,s,a,l){t.dependField&&(r=l.getCellOriginRecord(o,s)?.[t.dependField]??r),t.barType=t.barType??"default",t.min=t.min??0,t.max=t.max??t.min+100;const h=l.getRowHeight(s);let c=i,u=h;const d=new bj({x:0,y:0,width:c,height:u});d.name="progress-bar";const{showBar:p,barColor:f,barBgColor:g,barPositiveColor:m,barNegativeColor:y,barAxisColor:b,barRightToLeft:v,showBarMark:w,barMarkPositiveColor:C,barMarkNegativeColor:x,barMarkWidth:_,barMarkPosition:S}=e;let{barHeight:A,barBottom:T,barPadding:B}=e;1===B.length?B=[B[0],B[0],B[0],B[0]]:2===B.length?B=[B[0],B[1],B[0],B[1]]:3===B.length&&(B=[B[0],B[1],B[2],B[1]]),B=B.map(((t,e)=>{if("string"==typeof t&&ef.endsWith(t,"%")){const n=Number(t.substr(0,t.length-1));return 0===e||2===e?h*n/100:i*n/100}return Number(t)}));const M=c,R=u,P=RW(Cj("borderLineWidth",e,o,s,l));let E=Math.max(B[0],P[0]);const H=Math.max(B[1],P[1]),L=Math.max(B[2],P[2]);let k=Math.max(B[3],P[3]);c-=H+k,u-=L+E,1&E&&(E+=.5),1&k&&(k+=.5),"string"==typeof A&&ef.endsWith(A,"%")?(A=Number(A.substr(0,A.length-1)),A=u*A/100):A=Number(A),"string"==typeof T&&ef.endsWith(T,"%")?(T=Number(T.substr(0,T.length-1)),T=u*T/100):T=Number(T);if(Xp(p,{col:o,row:s,table:l,context:null,value:n,dataValue:r})){let e=`${r}`;ef.endsWith(e,"%")&&(e=e.substr(0,e.length-1));const a=Number(e);if(isNaN(a))return d;if("default"===(t.barType??"default")){const e=a<t.min?0:a>t.max?1:(a-t.min)/(t.max-t.min),i=c,h=E+u-A-T,p=0+k,m=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e});if(m){const t=eT({x:p,y:h,width:i,height:A,fill:m});d.addChild(t)}const y=eT({x:p,y:h,width:Math.min(i*e,i),height:A,fill:Xp(f,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e})||"#20a8d8"});d.addChild(y)}else if("negative"===t.barType){const e=t.min<0?-t.min:0,i=t.max>0?t.max:0,p=e/(e+i),f=1-p,B=a>0?a/i:0,M=a<0?-a/e:0,R=c,P=E+u-A-T,H=0+k,L=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B});if(L){const t=eT({x:H,y:P,width:R,height:A,fill:L});d.addChild(t)}const I=v?f*R:p*R,O=Math.min(R*p*M,R),D=v?{left:H+I,top:P,width:O,height:A}:{left:H+I-O,top:P,width:O,height:A},F=Xp(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:M})||"#20a8d8",z=eT({x:D.left,y:D.top,width:D.width,height:D.height,fill:F});d.addChild(z);const W=Math.min(R*f*B,R),j=v?{left:H+I-W,top:P,width:W,height:A}:{left:H+I,top:P,width:W,height:A},N=Xp(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8",G=eT({x:j.left,y:j.top,width:j.width,height:j.height,fill:N});d.addChild(G);const V=v?D.left:j.left,U=QA({x:0,y:0,stroke:Xp(b),lineWidth:1,lineDash:[2,2],points:[{x:V,y:0},{x:V,y:h}]});if(d.addChild(U),w&&(B||M)){const t=_,e=[];let i;if(B>0)if(i=Xp(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8","right"===S){const t=v?j.left+_/2:j.left+j.width-_/2;e.push({x:t,y:j.top}),e.push({x:t,y:j.top+j.height})}else"bottom"===S&&(e.push({x:j.left,y:j.top+j.height-_/2}),e.push({x:j.left+j.width,y:j.top+j.height-_/2}));else if(M>0)if(i=Xp(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:M})||"#20a8d8","right"===S){const t=v?D.left+D.width-_/2:D.left+_/2;e.push({x:t,y:D.top}),e.push({x:t,y:D.top+D.height})}else"bottom"===S&&(e.push({x:D.left,y:D.top+D.height-_/2}),e.push({x:D.left+D.width,y:D.top+D.height-_/2}));const a=QA({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(a)}}else if("negative_no_axis"===t.barType){const e=t.min<0?-t.min:0,h=t.max>0?t.max:0,c=Math.max(e,h),u=0===c?0:Math.abs(a)/c,p=i-k-H-1,f=Math.min(p*u,p),b=R-L-A-T-1,B=v?M-H-f:0+k,P=Xp(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u});if(P){const t=eT({x:B,y:b,width:p,height:A,fill:P});d.addChild(t)}const E={left:B,top:b,width:f,height:A};let I;I=a>=0?Xp(m,{col:o,row:s,table:l,context:null,value:n,percentile:u,dataValue:r})||"#20a8d8":Xp(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8";const O=eT({x:E.left,y:E.top,width:E.width,height:E.height,fill:I});if(d.addChild(O),w&&a){const t=_,e=[];let i;if(i=a>=0?Xp(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8":Xp(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8","right"===S){const t=v?E.left+_/2:E.left+E.width-_/2;e.push({x:t,y:E.top}),e.push({x:t,y:E.top+E.height})}else"bottom"===S&&(e.push({x:E.left,y:E.top+E.height-_/2}),e.push({x:E.left+E.width,y:E.top+E.height-_/2}));const h=QA({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(h)}}}return d}yj();const Tj=new class extends HI{constructor(t){super(!1),this.type=xI.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},Bj=new XI;function Mj(t,e,i,n,r,o,s,a,l,h,c){t||((t=new bj({x:i,y:n,width:s,height:a,lineWidth:c?.group?.lineWidth??void 0,fill:c?.group?.fill??void 0,stroke:c?.group?.stroke??void 0,strokeArrayWidth:c?.group?.strokeArrayWidth??void 0,strokeArrayColor:c?.group?.strokeArrayColor??void 0,cursor:c?.group?.cursor??void 0,lineCap:"square",clip:!0})).role="cell",t.col=r,t.row=o,e?.addChild(t));const u=function(t,e,i,n,r,o){let s,a;const l=o.internalProps.layoutMap.getBody(t,e).sparklineSpec,h=o.getCellValue(t,e);if(!Array.isArray(h))return;const c=r[3],u=r[0];i-=r[1]+r[3],n-=r[0]+r[2];const d=0,p=n;if("function"==typeof l){const r={col:t,row:e,dataValue:o.getCellOriginValue(t,e)||"",value:o.getCellValue(t,e)||"",rect:o.getCellRangeRelativeRect(o.getCellRange(t,e)),table:o};s=l(r),a=Rj(s,c,u,i,n)}else s=l,a=Rj(l,c,u,i,n);const f=[],g=[];let m,y;if("object"==typeof s.xField)Tj.domain(s.xField.domain),m=s.xField.field;else if("string"==typeof s.xField){const t=h.map((t=>t[s.xField]));Tj.domain(t),m=s.xField}else Array.isArray(h)&&(Tj.domain(Array.from({length:h.length},((t,e)=>e))),m=s.xField);if(Tj.range([0,i]),"object"==typeof s.yField)Bj.domain(s.yField.domain),y=s.yField.field;else if("string"==typeof s.yField){const t=h.map((t=>t[s.yField]));Bj.domain([Math.min(...t),Math.max(...t)]),y=s.yField}else Array.isArray(h)&&h.every((t=>"number"==typeof t))&&(Bj.domain([Math.min(...h),Math.max(...h)]),y=s.yField);if(Bj.range([0,n]),"object"==typeof s.xField&&Array.isArray(s.xField.domain)){const t=h.map((t=>t[s.xField.field])),e=s.xField.domain;for(let i=0;i<e.length;i++){let n=!1;for(let r=0;r<t.length;r++)if(e[i]==t[r]){const t=h[r];if(!bu(t[m])||!bu(t[y]))break;f.push({x:d+Tj.scale(t[m]),y:p-Bj.scale(t[y]),defined:bu(t[y])}),g.push(t),n=!0;break}n||(f.push({x:d+Tj.scale(e[i]),y:0,defined:!1}),g.push({[m]:e[i],[y]:null}))}}else for(let t=0;t<h.length;t++){const e=h[t];f.push({x:d+Tj.scale(m?e[m]:t),y:p-Bj.scale(y?e[y]:e),defined:bu(y?e[y]:e),rawData:e}),g.push(e)}const b=a.getChildByName("sparkline-line");b&&b.setAttribute("points",f);b.bandwidth=Tj.step(),b.min=Bj.range()[0],b.max=Bj.range()[1];const v=a.getChildByName("sparkline-symbol-group");if(v){const t="isolatedPoint"===s.pointShowRule;if("all"===s.pointShowRule)for(let t=0;t<f.length;t++){const{x:e,y:i,defined:n}=f[t];if(n){const t=nT({x:e,y:i});v.appendChild(t)}}else if(t)for(let t=0;t<f.length;t++){const{x:e,y:i,defined:n}=f[t];if(n&&(!f[t-1]||!f[t-1].defined)&&(!f[t+1]||!f[t+1].defined)){const t=nT({x:e,y:i});v.appendChild(t)}}}return a}(r,o,s,a,l,h);return u&&t.appendChild(u),t}function Rj(t,e,i,n,r){let o;o="function"==typeof t?t(null):t;const s=new bj({x:e,y:i,width:n,height:r,stroke:!1,fill:!1});if(s.name="sparkline","line"===o.type){const t=QA({x:0,y:0,curveType:o.smooth?"monotoneX":"linear",stroke:o.line?.style?.stroke??"blue",lineWidth:o.line?.style?.strokeWidth??2});t.name="sparkline-line",s.addChild(t),o.crosshair&&(t.hover=o.crosshair?.style??{stroke:"#000",interpolate:"linear"});const e=new bj({x:0,y:0,width:n,height:r,stroke:!1,fill:!1});e.name="sparkline-symbol-group",e.setTheme({symbol:{stroke:o.point?.style?.stroke??"#000",lineWidth:o.point?.style?.strokeWidth??1,fill:o.point?.style?.fill??"#000",size:2*(o.point?.style?.size??3),symbolType:"circle"}}),s.addChild(e),e.hover=o.point?.hover??!1}return s}let Pj=class extends lA{role;tooltip;constructor(t){super(t),"mouseenter_cell"!==this.attribute.visibleTime&&"click_cell"!==this.attribute.visibleTime||(this.attribute.visible=!1),this.attribute.hoverImage&&(this.attribute.originImage=this.attribute.image)}get backgroundWidth(){return this.attribute.backgroundWidth??this.attribute.width}get backgroundHeight(){return this.attribute.backgroundHeight??this.attribute.height}};class Ej extends bj{_leftGroup;_rightGroup;_centerGroup;_autoWidth=!1;_autoHeight=!1;_cellWidth;_cellHeight;_align;_baseline;constructor(t){super(t),this._leftGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._leftGroup.role="content-left",this._rightGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._rightGroup.role="content-right",this._centerGroup=new bj({pickable:!1,fill:!1,stroke:!1}),this._centerGroup.role="content-center",this.appendChild(this._leftGroup),this.appendChild(this._rightGroup),this.appendChild(this._centerGroup)}setCellContentOption(t){this._autoWidth=t.autoWidth,this._autoHeight=t.autoHeight,this._cellWidth=t.cellWidth,this._cellHeight=t.cellHeight,this._align=t.align,this._baseline=t.baseline}addLeftOccupyingIcon(t){t.setAttribute("x",this._leftGroup.width+(t.attribute.marginLeft??0)),this._leftGroup.appendChild(t),this._leftGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addRightOccupyingIcon(t){t.setAttribute("x",this._rightGroup.width+(t.attribute.marginLeft??0)),this._rightGroup.appendChild(t),this._rightGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addContent(t){const e=this._centerGroup.lastChild;e&&t.setAttributes({x:e.attribute.x+e.AABBBounds.width()}),this._centerGroup.appendChild(t),t instanceof J_&&(this._centerGroup.setAttribute("pickable",!1),t.setAttribute("textAlign","left"))}layout(){let t=this._leftGroup.width;t===1/0&&(t=0);let e=this._rightGroup.width;if(e===-1/0&&(e=0),this._autoWidth){const i=this._centerGroup.width;this._cellWidth=t+e+i,this.setAttribute("width",this._cellWidth)}else{const i=this._cellWidth-t-e;this.updateCenterLayout(i);const n=this._centerGroup.width;this._cellWidth=t+e+n,this.setAttribute("width",this._cellWidth)}this.updateHorizontalPos();const i=this._leftGroup.height,n=this._rightGroup.height,r=this._centerGroup.height;this._cellHeight=Math.max(i,n,r),this.setAttribute("height",this._cellHeight),this.updateVerticalPos()}updateCenterLayout(t){let e=t;this._centerGroup.forEachChildren((t=>{t instanceof Pj&&(e-=t.AABBBounds.width())}));const i=this._centerGroup.getChildByName("text");i instanceof dA?i.setAttribute("width",e):i instanceof J_&&i.setAttribute("maxLineWidth",e);let n=0;this._centerGroup.forEachChildren((t=>{t.setAttribute("x",n),n+=t.AABBBounds.width()}))}updateHorizontalPos(){this._leftGroup.setAttribute("x",0),this._rightGroup.setAttribute("x",this._cellWidth-this._rightGroup.width),this._centerGroup.setAttribute("x",this._leftGroup.width),"left"===this._align||"start"===this._align?this.setAttribute("dx",0):"center"===this._align?this.setAttribute("dx",-this.attribute.width/2):"right"!==this._align&&"end"!==this._align||this.setAttribute("dx",-this.attribute.width)}updateVerticalPos(){"top"===this._baseline?(this._leftGroup.setAttribute("y",0),this._rightGroup.setAttribute("y",0),this._centerGroup.setAttribute("y",0)):"middle"===this._baseline?(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",(this._leftGroup.height-t.AABBBounds.height())/2)})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",(this._rightGroup.height-t.AABBBounds.height())/2)})),this._leftGroup.setAttribute("y",this._cellHeight/2-this._leftGroup.height/2),this._rightGroup.setAttribute("y",this._cellHeight/2-this._rightGroup.height/2),this._centerGroup.setAttribute("y",this._cellHeight/2-this._centerGroup.height/2)):"bottom"===this._baseline&&(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",this._leftGroup.height-t.AABBBounds.height())})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",this._rightGroup.height-t.AABBBounds.height())})),this._leftGroup.setAttribute("y",this._cellHeight-this._leftGroup.height),this._rightGroup.setAttribute("y",this._cellHeight-this._rightGroup.height),this._centerGroup.setAttribute("y",this._cellHeight-this._centerGroup.height))}updateWidth(t){this._cellWidth=t,this.layout()}updateHeight(t){this._cellHeight=t,this.layout()}}function Hj(t,e,i){let n=0;const r=i.internalProps.layoutMap;if(r.isHeader(t,e)){const i=r.getHeader(t,e);i?.hierarchyLevel&&(n=(i.hierarchyLevel??0)*(r.rowHierarchyIndent??0))}else{const o=i.getBodyColumnDefine(t,e);if(o?.tree){const o=i.dataSource.getIndexKey(i.getRecordIndexByRow(t,e));n=Array.isArray(o)&&i.getHierarchyState(t,e)!==Xc.none?(o.length-1)*(r.hierarchyIndent??0):0}}return n}function Lj(t,e,i,n,r){const o={};"image"===t.type?o.image=t.src:("svg"===t.type||"svg"in t)&&(o.image=t.svg),o.width=t.width,o.height=t.height,o.visibleTime=t.visibleTime??"always",o.funcType=t.funcType,o.interactive=t.interactive;let s=0;if(Qu(i)&&Qu(n)&&r&&(t.funcType===Jc.collapse||t.funcType===Jc.expand)&&(s=Hj(i,n,r)),o.marginLeft=(t.marginLeft??0)+s,o.marginRight=t.marginRight??0,t.interactive&&(o.pickable=!1),t.hover&&(o.backgroundWidth=t.hover.width??t.width,o.backgroundHeight=t.hover.width??t.width,o.backgroundColor=t.hover.bgColor??"rgba(22,44,66,0.2)",o.hoverImage=t.hover.image),t.cursor&&(o.cursor=t.cursor),"shape"in t&&"circle"===t.shape&&(o.shape=t.shape),e)return e.setAttributes(o),e.loadImage(o.image),e;const a=new Pj(o);return a.tooltip=t.tooltip,a}function kj(t){const e={};return"image"===t.type?e.image=t.src:("svg"===t.type||"svg"in t)&&(e.image=t.svg),e.visibleTime=t.visibleTime??"always",e.funcType=t.funcType,e.id=t.name,e.width=t.width,e.height=t.height,(t.marginRight||t.marginLeft)&&(e.margin=[0,t.marginRight??0,0,t.marginLeft??0]),t.hover&&(e.backgroundWidth=t.hover.width??t.width,e.backgroundHeight=t.hover.height??t.height,e.backgroundShowMode="hover",e.hoverImage=t.hover.image,e.backgroundStroke=!1,e.backgroundFill=t.hover.bgColor??"rgba(22,44,66,0.2)"),t.cursor&&(e.cursor=t.cursor),e.tooltip=t.tooltip,e}function Ij(t,e,i,n,r,o,s,a){let l,h=0,c=0,u=0,d=0;t.forEachChildren((t=>{"icon-left"===t.role?(h+=t.AABBBounds.width(),c=Math.max(c,t.AABBBounds.height())):"icon-right"===t.role&&(u+=t.AABBBounds.width(),d=Math.max(d,t.AABBBounds.height()))}));const p=t.getChildByName("text"),f=t.getChildByName("content");let g;p instanceof J_?(l=p.AABBBounds.height(),p.setAttribute("maxLineWidth",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):p instanceof dA?(l=p.AABBBounds.height(),p.setAttribute("width",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):f&&(l=f.AABBBounds.height(),f.updateWidth(e-h-d-(r[1]+r[3])),g=f.AABBBounds.height());const m=Math.max(c,d,l)+r[0]+r[2];if(t.forEachChildren((n=>{"icon-left"===n.role||("icon-right"===n.role||"icon-absolute-right"===n.role?n.setAttribute("x",n.attribute.x+i):"content"===n.name||"text"===n.name?(n.AABBBounds.width(),"center"===o?n.setAttribute("x",r[3]+h+(e-(r[1]+r[3])-h-u)/2):"right"===o&&n.setAttribute("x",r[3]+e-(r[1]+r[3])-u)):"mark"===n.name&&n.setAttribute("x",t.attribute.width))})),n){let e=Math.max(c,g,d);if(function(t,e,i,n){const r=t.table,o=Sk(r,e.col,e.row);if(o&&o.end.row-o.start.row){n/=o.end.row-o.start.row+1,i/=o.end.row-o.start.row+1;for(let t=o.start.row;t<=o.end.row;t++){const e=r.getRowHeight(t);if(e===n&&i!==e)return!0;if(i>e)return!0}}else{const t=r.getRowHeight(e.row);if(t===n&&i!==t)return!0;if(i>t)return!0}return!1}(a,t,e+r[0]+r[2],m))return!0;e=t.attribute.height-(r[0]+r[2]),t.forEachChildren((t=>{"rect"!==t.type&&"chart"!==t.type&&("mark"===t.name?t.setAttribute("y",0):"middle"===s?t.setAttribute("y",r[0]+(e-t.AABBBounds.height())/2):"bottom"===s?t.setAttribute("y",r[0]+e-t.AABBBounds.height()):t.setAttribute("y",r[0]))}))}else"middle"!==s&&"bottom"!==s||t.forEachChildren((e=>{"rect"!==e.type&&"chart"!==e.type&&("mark"===e.name?e.setAttribute("y",0):"middle"===s?e.setAttribute("y",(t.attribute.height-r[2]+r[0]-e.AABBBounds.height())/2):"bottom"===s?e.setAttribute("y",t.attribute.height-e.AABBBounds.height()-r[2]):e.setAttribute("y",r[0]))}));return!1}function Oj(t,e,i,n,r,o,s,a,l){let h,c,u,d,p=!0;if("function"==typeof t){const e=t({col:i,row:n,dataValue:l.getCellOriginValue(i,n),value:l.getCellValue(i,n)||"",rect:{left:0,top:0,right:r,bottom:o,width:r,height:o},table:l});u=e.rootContainer.getElements(void 0,!1,!1),p=e.renderDefault}else if("function"==typeof e){const t=e({col:i,row:n,dataValue:l.getCellOriginValue(i,n),value:l.getCellValue(i,n)||"",rect:{left:0,top:0,right:r,bottom:o,width:r,height:o},table:l});t&&(u=t.elements,p=t.renderDefault,h=t.expectedWidth,c=t.expectedHeight)}else e&&(h=e.expectedWidth,c=e.expectedHeight,u=e.elements,p=e.renderDefault);if(u){d=function(t,e,i,n){const r=new bj({x:0,y:0,width:e,height:i,fill:!1,stroke:!1,pickable:!1});r.name="custom-container";const o=function(t,e,i,n){const r=[],o=0,s=0,a=[0,0,0,0];for(let l=0;l<t.length;l++){const h=t[l],c=Object.assign({},h);for(const t in c)c.hasOwnProperty(t)&&su(c[t])&&(c[t]=c[t](n));const u=c;bu(u.x)&&(u.x=au(u.x)?Dj(u.x,e-a[1]):Number(u.x),u.y=au(u.y)?Dj(u.y,i-a[2]):Number(u.y)),"width"in c&&(c.width=au(c.width)?Dj(c.width,e-a[1]):Number(c.width)),"height"in c&&(c.height=au(c.height)?Dj(c.height,i-a[2]):Number(c.height)),"radius"in c&&(c.radius=au(c.radius)?Dj(c.radius,Math.min(e-a[1],i-a[2])):Number(c.radius)),"hover"in c&&(c.hover.x=au(c.hover.x)?Dj(c.hover.x,e-a[1]):Number(c.hover.x),c.hover.y=au(c.hover.y)?Dj(c.hover.y,i-a[2]):Number(c.hover.y),c.hover.width=au(c.hover.width)?Dj(c.hover.width,e-a[1]):Number(c.hover.width),c.hover.height=au(c.hover.height)?Dj(c.hover.height,i-a[2]):Number(c.hover.height),c.hover.x+=o,c.hover.y+=s),u.x=u.x+o,u.y=u.y+s,r.push(c)}return r}(t,e,i,n);return o.forEach((t=>{switch(t.type){case"arc":const e=qA({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,fill:t.fill,stroke:t.stroke,outerRadius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(e);break;case"text":if(t.background){const e=t.background?.expandX??0,i=t.background?.expandY??0,n=eT({x:t.x-e,y:t.y-i,dx:t.dx??0,dy:t.dy??0,width:t.width+2*e,height:t.height+2*i,cornerRadius:t.background?.cornerRadius??0,fill:t.background?.fill??"#888"});r.appendChild(n)}const i=new J_(Object.assign({pickable:!!t.clickable,fill:t.color??t.fill},t));r.appendChild(i);break;case"rect":const n=eT({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,cornerRadius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(n);break;case"circle":const o=ZA({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,radius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(o);break;case"icon":const s=new Pj({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.svg,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.clickable,cursor:t.cursor});s.role="icon-custom",r.appendChild(s);break;case"image":const a=new Pj({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.src,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.clickable,cursor:t.cursor,shape:t.shape});a.role="image-custom",r.appendChild(a);break;case"line":const l=QA({points:t.points,stroke:t.stroke,pickable:!!t.clickable,cursor:t.cursor});r.appendChild(l)}})),r}(u,s?h:r,a?c:o,l.getCellValue(i,n))}return{elementsGroup:d,renderDefault:p}}function Dj(t,e){return t.endsWith("px")?parseInt(t,10):t.endsWith("%")&&e?parseInt(t,10)/100*e:parseInt(t,10)}function Fj(t,e,i,n,r,o,s){let a,l;const h=Sk(t.table,i,n);if(h&&h.end.col-h.start.col&&h.start.col===i){const e=t.getCell(h.start.col,h.start.row),i=e.attribute.height;e.setAttribute("height",i+o),a=e,l=e.attribute.height}else h?(e.setAttribute("height",r+o),a=e,l=r+o):h||(e.setAttribute("height",r+o),a=e,l=r+o);a&&function(t,e,i,n,r,o,s){const a=t.table.isHeader(i,n)?t.table._getHeaderLayoutMap(i,n).headerType:t.table.getBodyColumnType(i,n);if("progressbar"===a){const r=t.table.getBodyColumnDefine(i,n),o=t.table._getCellStyle(i,n),s=t.table.getCellValue(i,n),a=t.table.getCellOriginValue(i,n),l=(RW(Cj("padding",o,i,n,t.table)),Aj(r,o,e.attribute.width,s,a,i,n,0,t.table)),h=e.getChildByName("progress-bar");e.insertBefore(l,h),e.removeChild(h),h.removeAllChild(),h.release()}else if("sparkline"===a){e.removeAllChild();const r=t.table._getCellStyle(i,n),o=RW(Cj("padding",r,i,n,t.table));Mj(e,e.parent,e.attribute.x,e.attribute.y,i,n,e.attribute.width,e.attribute.height,o,t.table,pj(r,t.table,i,n,Cj).theme)}else if("image"===a||"video"===a)Sj(e,i,n,t.table);else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{const o=t.table._getCellStyle(i,n);!function(t,e,i,n,r,o,s){const a=e-(r[0]+r[2]),l=t.getChildByName("text");l instanceof J_&&!n?l.setAttribute("heightLimit",a):l instanceof dA&&!n?l.setAttribute("height",a):t.getChildByName("content")&&t.getChildByName("content").updateHeight(a);t.forEachChildren((t=>{"rect"===t.type||"chart"===t.type||("mark"===t.name?t.setAttribute("y",0):"middle"===s?t.setAttribute("y",r[0]+(a-t.AABBBounds.height())/2):"bottom"===s?t.setAttribute("y",r[0]+a-t.AABBBounds.height()):t.setAttribute("y",r[0]))}))}(e,r,0,"autoHeight"===t.table.heightMode,RW(o.padding),o.textAlign,o.textBaseline);const s=e.getChildByName("custom-container");if(s){let r,o;s.clear(),e.removeChild(s);if("body"!==t.table.getCellLocation(i,n)){const e=t.table.getHeaderDefine(i,n);r=e?.headerCustomRender,o=e?.headerCustomLayout}else{const e=t.table.getBodyColumnDefine(i,n);r=e?.customRender||t.table.customRender,o=e?.customLayout}const a=Oj(o,r,i,n,e.attribute.width,e.attribute.height,!1,!1,t.table);e.childrenCount>0?e.insertBefore(a.elementsGroup,e.firstChild):e.appendChild(a.elementsGroup)}}}(t,a,i,n,l)}function zj(t,e,i,n,r){let o=!1;const s=t?.attribute.width??0;if(t?.setAttribute("width",s+e),t?.forEachChildren(((t,a)=>{const l=function(t,e,i,n,r,o,s,a){let l,h;const c=Sk(t.table,i,n);if(c&&c.end.col-c.start.col){const e=t.getCell(c.start.col,c.start.row),r=e.attribute.width;e.setAttribute("width",r+o),l=e,h=e.attribute.width,i=l.col,n=l.row}else c&&c.start.row===n?(e.setAttribute("width",r+o),l=e,h=r+o,i=l.col,n=l.row):c||(e.setAttribute("width",r+o),l=e,h=r+o);if(!l)return!1;const u=t.table.isHeader(i,n)?t.table._getHeaderLayoutMap(i,n).headerType:t.table.getBodyColumnType(i,n);let d=!1;if("progressbar"===u){const e=t.table.getBodyColumnDefine(i,n),r=t.table._getCellStyle(i,n),o=t.table.getCellValue(i,n),s=t.table.getCellOriginValue(i,n),a=(RW(Cj("padding",r,i,n,t.table)),Aj(e,r,l.attribute.width,o,s,i,n,0,t.table)),h=l.getChildByName("progress-bar");l.insertBefore(a,h),l.removeChild(h),h.removeAllChild(),h.release()}else if("sparkline"===u){l.removeAllChild();const e=t.table._getCellStyle(i,n),r=RW(Cj("padding",e,i,n,t.table));Mj(l,l.parent,l.attribute.x,l.attribute.y,i,n,l.attribute.width,l.attribute.height,r,t.table,pj(e,t.table,i,n,Cj).theme)}else if("image"===u||"video"===u)Sj(l,i,n,t.table);else if("axis"===l.firstChild?.name){const e=t.table.internalProps.layoutMap.getAxisConfigInPivotChart(i,n);if(e){const i=new hW(e,l.attribute.width,l.attribute.height,t.table);l.clear(),l.appendChild(i.component),i.overlap()}}else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{const e=t.table._getCellStyle(i,n);d=Ij(l,h,o,a,RW(e.padding),e.textAlign,e.textBaseline,t)}return d}(r,t,t.col,t.row,s,e,"row-body"!==n||(t.col,r.table.rowHeaderLevelCount),i);if(l){const e=Sk(r.table,t.col,t.row);if(e&&e.end.row-e.start.row)for(let t=e.start.row;t<=e.end.row;t++)Wj(r,t);else Wj(r,t.row);o=!0}})),o){let t,e,i,o=0;for(let s=0;s<r.table.colCount;s++){"col-corner"===n?(i=0,t=r.getColGroup(s,!0),e=r.colHeaderGroup.attribute.height??0):"row-body"===n?(i=r.table.frozenRowCount,t=r.getColGroup(s,!1),e=r.bodyGroup.attribute.height??0):"bottom"===n?(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInBottom(s),e=r.bottomFrozenGroup.attribute.height??0):"left-bottom"===n?(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInLeftBottomCorner(s),e=r.leftBottomCornerGroup.attribute.height??0):"right-bottom"===n&&(i=r.table.rowCount-r.table.bottomFrozenRowCount,t=r.getColGroupInRightBottomCorner(s),e=r.rightBottomCornerGroup.attribute.height??0);let a=0;t.forEachChildren((t=>{t.setAttribute("y",a),a+=r.table.getRowHeight(t.row)??0})),o=a}r.updateContainerHeight(i,o-e)}}function Wj(t,e){let i=0;for(let n=0;n<t.table.colCount;n++){const r=t.highPerformanceGetCell(n,e);if("empty"===r.role)return;let o=jj(r,t);const s=Sk(t.table,n,e);s&&s.end.row-s.start.row&&(o/=s.end.row-s.start.row+1),i=Math.max(i,o)}for(let n=0;n<t.table.colCount;n++){let r=i;const o=t.highPerformanceGetCell(n,e);if("empty"===o.role)return;const s=Sk(t.table,n,e);if(s&&s.end.row-s.start.row)for(let i=s.start.row;i<=s.end.row;i++)i!==e&&(r+=t.table.getRowHeight(i));Fj(t,o,n,e,r,0,t.table.isHeader(n,e))}t.table.setRowHeight(e,i,!0)}function jj(t,e){let i=0;t.forEachChildren((t=>{"icon-left"!==t.role&&"icon-right"!==t.role&&"text"!==t.name&&"content"!==t.name||(i=Math.max(i,t.AABBBounds.height()))}));const n=RW(e.table._getCellStyle(t.col,t.row).padding);return i+n[0]+n[2]}var Nj;!function(t){t.dropDown="dropDown",t.contextmenu="contextmenu",t.custom="custom"}(Nj||(Nj={}));const Gj={fontSize:12,color:"#000",highlightColor:"#2E68CF",hoverBgColor:"#EEE",lineHeight:30,bgColor:"#FFF",cornerRadius:4,borderWidth:.5,borderColor:"#CCC",menuPadding:6,menuItemPadding:9,maxLineWidth:200};const Vj=yj();class Uj{icon;constructor(){const t=Vj.drillDown;this.icon=new Pj({x:-1e3,y:-1e3,image:t.svg,width:t.width,height:t.height,dx:-t.width/2,dy:-t.height/2,visible:!1,funcType:t.funcType,cursor:t.cursor}),this.icon.role="icon-drill"}appand(t){t.appendChild(this.icon)}update(t,e,i,n,r,o){if(!t||n&&r)return this.icon.setAttributes({x:-1e3,y:-1e3,visible:!1}),void o.updateNextFrame();const s=Vj.drillDown,a=Vj.drillUp;this.icon.setAttributes({x:e,y:i,image:n?s.svg:a.svg,visible:!0}),this.icon.loadImage(this.icon.attribute.image),o.updateNextFrame()}}class Kj{columnMoverLabel;columnMoverLine;columnMoverBack;table;x;constructor(t){const e=t.theme.dragHeaderSplitLine.lineWidth,i=t.theme.dragHeaderSplitLine.lineColor,n=t.theme.dragHeaderSplitLine.shadowBlockColor;this.columnMoverLabel=nT({visible:!1,pickable:!1,x:0,y:0,symbolType:"triangle",fill:i}),this.columnMoverLine=QA({visible:!1,pickable:!1,stroke:i,lineWidth:e,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnMoverBack=eT({visible:!1,pickable:!1,fill:n,x:0,y:0,width:0,height:0}),this.table=t}appand(t){t.appendChild(this.columnMoverLabel),t.appendChild(this.columnMoverLine),t.appendChild(this.columnMoverBack)}show(t,e,i){const n=this.table.getCellLocation(t,e),r=Sk(this.table,t,e);r&&(t=r.start.col,e=r.start.row);let o=0,s=0,a=0,l=0,h=0,c=0,u=0,d=0,p=Math.PI;const f=[];"columnHeader"===n?(o=this.table.getColsWidth(0,t-1)-this.table.stateManeger.scroll.horizontalBarPos,s=this.table.getRowsHeight(0,this.table.frozenRowCount-1),l=this.table.tableNoFrameHeight,a=r?this.table.getColsWidth(r.start.col,r.end.col):this.table.getColWidth(t),h=o-i,u=o+a,d=2,f.push({x:0,y:0}),f.push({x:0,y:this.table.tableNoFrameHeight})):"rowHeader"===n&&(s=this.table.getRowsHeight(0,e-1)-this.table.stateManeger.scroll.verticalBarPos,o=this.table.getColsWidth(0,this.table.frozenColCount-1),a=this.table.tableNoFrameWidth,l=r?this.table.getRowsHeight(r.start.row,r.end.row):this.table.getRowHeight(e),c=s-i,u=2,d=s+l,p=Math.PI/2,f.push({x:0,y:0}),f.push({x:this.table.tableNoFrameWidth,y:0})),this.columnMoverBack.setAttributes({visible:!0,x:o-h,y:s-c,width:a,height:l,dx:h,dy:c}),this.columnMoverLine.setAttributes({x:u,y:d,visible:!0,points:f}),this.columnMoverLabel.setAttributes({visible:!0,x:u,y:d,angle:p})}hide(){this.columnMoverLabel.setAttribute("visible",!1),this.columnMoverLine.setAttribute("visible",!1),this.columnMoverBack.setAttribute("visible",!1)}update(t,e,i,n){"number"==typeof t&&"number"==typeof e?(this.columnMoverLabel.setAttribute("x",e-this.table.stateManeger.scroll.horizontalBarPos),this.columnMoverLine.setAttribute("x",e-this.table.stateManeger.scroll.horizontalBarPos),this.columnMoverBack.setAttribute("x",t)):"number"==typeof i&&"number"==typeof n&&(this.columnMoverLabel.setAttribute("y",n-this.table.stateManeger.scroll.verticalBarPos),this.columnMoverLine.setAttribute("y",n-this.table.stateManeger.scroll.verticalBarPos),this.columnMoverBack.setAttribute("y",i))}}function $j(t,e,i){if(i)return e.tableNoFrameWidth-e.getColsWidth(t,e.colCount-1);let n=e.getColsWidth(0,t);return t>=e.frozenColCount&&(n-=e.scrollLeft),n}class Xj{table;border;columnResizeLine;columnResizeBgLine;columnResizeLabel;menu;vScrollBar;hScrollBar;frozenShadowLine;drillIcon;cellMover;constructor(t){this.table=t;const e=this.table.theme;this.createScrollBar();const i=e.columnResize?.lineColor,n=e.columnResize?.lineWidth,r=e.columnResize?.bgColor,o=e.columnResize?.width;this.columnResizeLine=QA({visible:!1,pickable:!1,stroke:i,lineWidth:n,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnResizeBgLine=QA({visible:!1,pickable:!1,stroke:r,lineWidth:o,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]});const s=iT({visible:!1,pickable:!1,x:0,y:0,fontSize:10,fill:"#FFF",text:"",textBaseline:"top",dx:16,dy:-6}),a=eT({visible:!1,pickable:!1,fill:"#3073F2",x:0,y:0,width:38,height:16,cornerRadius:5,dx:12,dy:-8});this.columnResizeLabel=JA({visible:!1,pickable:!1,x:0,y:0}),this.columnResizeLabel.appendChild(a),this.columnResizeLabel.appendChild(s),this.cellMover=new Kj(this.table);const l=e.frozenColumnLine?.shadow?.width,h=e.frozenColumnLine?.shadow?.startColor,c=e.frozenColumnLine?.shadow?.endColor;this.frozenShadowLine=eT({visible:!0,pickable:!1,x:0,y:0,width:l,height:0,fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:[{color:h,offset:0},{color:c,offset:1}]}}),this.menu=new class{_table;_menuInstance;_menuInfo;constructor(t){this._table=t,this._menuInstance=new bj({x:0,y:0,fill:Gj.bgColor,stroke:Gj.borderColor,cornerRadius:Gj.cornerRadius,lineWidth:Gj.borderWidth}),this._menuInfo={x:-1,y:-1,col:-1,row:-1,type:Nj.dropDown,menuInfo:[],highlightIndex:-1}}bindTableComponent(t){t.appendChild(this._menuInstance),this.bindEvent()}release(){}attach(t,e,i,n,r,o){if(r===Nj.dropDown&&this.checkDropDownMenuChange(i,n)){const t=this.getMenuInfo(i,n,r);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,n,r,e,o),this.updateMenuInstance(e,o)}else if(r===Nj.contextmenu&&this.checkContextMenuChange(t,e)){const t=this.getMenuInfo(i,n,r);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,n,r,e,o),this.updateMenuInstance(e,o)}this.updatePosition(t-this._table.scenegraph.x,e-this._table.scenegraph.y),this.addToScene()}updateMenuInfo(t,e,i,n,r){this._menuInfo.col=t,this._menuInfo.row=e,this._menuInfo.type=i,this._menuInfo.menuInfo=n,this._menuInfo.highlightIndex=r}checkDropDownMenuChange(t,e){const{type:i,col:n,row:r}=this._menuInfo;return i!==Nj.dropDown||t!==n||e!==r}checkContextMenuChange(t,e){const{type:i,menuInfo:n}=this._menuInfo;return i!==Nj.contextmenu||n!==this._table.internalProps.menu?.contextMenuItems}updateMenuInstance(t,e){this._menuInstance.removeAllChild();let i=Gj.menuPadding;const n=Gj.menuPadding;let r=0;t.forEach(((t,o)=>{const s=e===o;let a,l;"string"==typeof t?l=t:"object"==typeof t&&(l=t.text,a=s?t.selectedIcon:t.icon);const h=new bj({y:i,x:n,height:Gj.lineHeight,fill:Gj.bgColor});h.role="menu-item",this._menuInstance.appendChild(h),h.stateProxy=t=>"hover"===t?{fill:Gj.hoverBgColor}:{fill:Gj.bgColor},h.addEventListener("pointerenter",(t=>{h.addState("hover",!0,!1),this._table.scenegraph.updateNextFrame()})),h.addEventListener("pointerleave",(t=>{h.removeState("hover",!1),this._table.scenegraph.updateNextFrame()}));const c=new q_({x:Gj.menuItemPadding,y:Gj.menuItemPadding,fill:s?Gj.highlightColor:Gj.color,text:l,textBaseline:"top",fontSize:Gj.fontSize,pickable:!1,maxLineWidth:Gj.maxLineWidth,ellipsis:"…"});if(h.addChild(c),a){c.AABBBounds.height();const t=a.width??16,e=a.height??16,i=new Pj({x:Gj.menuItemPadding,y:(Gj.lineHeight-e)/2,width:t,height:e,image:a.svg,pickable:!1});i.role="menu-icon",h.insertBefore(i,c),c.setAttribute("x",t+Gj.menuItemPadding)}r=Math.max(h.AABBBounds.width(),r),i+=Gj.lineHeight})),this._menuInstance.setAttributes({width:r+2*Gj.menuItemPadding+2*Gj.menuPadding,height:i+Gj.menuPadding}),this._menuInstance.forEachChildren((t=>{t.setAttribute("width",r+2*Gj.menuItemPadding)}))}updatePosition(t,e){this._menuInstance.setAttributes({x:this._menuInfo.type===Nj.dropDown?t-this._menuInstance.attribute.width:t,y:e}),this._menuInfo.x=Nj.dropDown?t-this._menuInstance.attribute.width:t,this._menuInfo.y=e}addToScene(){this._table.scenegraph.updateNextFrame()}detach(){this._menuInstance.setAttributes({x:-1e3,y:-1e3}),this._table.scenegraph.updateNextFrame()}getMenuInfo(t,e,i){if(i===Nj.dropDown){const{dropDownMenu:i=this._table.globalDropDownMenu,pivotInfo:n}=this._table._getHeaderLayoutMap(t,e);let r=-1;if(Array.isArray(i))for(let n=0;n<i.length;n++)if(this._table._dropDownMenuIsHighlight(t,e,n)){r=n;break}return{menuInfo:i,highlightIndex:r}}if(i===Nj.contextmenu){const i=this._table.internalProps.menu?.contextMenuItems;let n;if(Array.isArray(i))n=i;else if("function"==typeof i){const{field:r}=this._table.isHeader(t,e)?this._table.getHeaderDefine(t,e):this._table.getBodyColumnDefine(t,e);n=i(r,e)}return{menuInfo:n,highlightIndex:-1}}}bindEvent(){this._menuInstance.addEventListener("click",(t=>{const{target:e}=t;if(e&&"menu-item"===e.role){const t=this.getEventInfo(e),i=this._table.getMenuInfo(this._menuInfo.col,this._menuInfo.row,this._menuInfo.type),n=Object.assign(t,i);this._table.fireListeners(sf.DROPDOWNMENU_CLICK,n)}}))}getEventInfo(t){const e=t.parent;let i=0;e.forEachChildren(((e,n)=>e===t&&(i=n-1,!0)));const n="string"==typeof this._menuInfo.menuInfo[i]?this._menuInfo.menuInfo[i]:this._menuInfo.menuInfo[i].text,r="string"==typeof this._menuInfo.menuInfo[i]?n:this._menuInfo.menuInfo[i].menuKey||n;return{col:this._menuInfo.col,row:this._menuInfo.row,dropDownIndex:i,highlight:i===this._menuInfo.highlightIndex,text:n,menuKey:r}}get bounds(){return this._menuInstance.globalAABBBounds}}(this.table),this.drillIcon=new Uj}addToGroup(t){t.addChild(this.frozenShadowLine),t.addChild(this.columnResizeBgLine),t.addChild(this.columnResizeLine),t.addChild(this.columnResizeLabel),this.table.theme.scrollStyle.hoverOn?(t.addChild(this.hScrollBar),t.addChild(this.vScrollBar)):(t.stage.defaultLayer.addChild(this.hScrollBar),t.stage.defaultLayer.addChild(this.vScrollBar)),this.menu.bindTableComponent(t),this.drillIcon.appand(t),this.cellMover.appand(t)}createScrollBar(){const t=this.table.theme,e=t.scrollStyle?.scrollRailColor,i=t.scrollStyle?.scrollSliderColor,n=t.scrollStyle?.width;this.hScrollBar=new Bk({direction:"horizontal",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:this.table.tableNoFrameWidth,height:n,padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new Bk({direction:"vertical",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:n,height:this.table.tableNoFrameHeight-this.table.getFrozenRowsHeight(),padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.vScrollBar.render(),this.vScrollBar.hideAll()}updateScrollBar(){const t=this.table.stateManeger.scroll.horizontalBarPos,e=this.table.stateManeger.scroll.verticalBarPos,i=this.table.theme,n=i.scrollStyle?.width,r=i.scrollStyle?.visible,o=Math.ceil(this.table.scenegraph.tableGroup.attribute.width),s=Math.ceil(this.table.scenegraph.tableGroup.attribute.height),a=this.table.getAllRowsHeight(),l=this.table.getAllColsWidth(),h=this.table.getFrozenRowsHeight(),c=this.table.getFrozenColsWidth(),u=this.table.getBottomFrozenRowsHeight(),d=this.table.getRightFrozenColsWidth();if(l>o){const t=Math.min(s,a),e=Math.max(.05,(o-c)/(l-c));this.hScrollBar.setAttributes({x:c+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.x),y:t-(this.table.theme.scrollStyle.hoverOn?n:-this.table.scenegraph.tableGroup.attribute.y),width:o-c-d,range:[0,e],visible:"always"===r});const i=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===r&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:0,visible:!1});if(a>s){const t=Math.min(o,l),e=Math.max(.05,(s-h)/(a-h));this.vScrollBar.setAttributes({x:t-(this.table.theme.scrollStyle.hoverOn?n:-this.table.scenegraph.tableGroup.attribute.x),y:h+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.y),height:s-h-u,range:[0,e],visible:"always"===r});const i=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===r&&this.vScrollBar.showAll()}else this.vScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,height:0,visible:!1});this.table.stateManeger.setScrollLeft(t),this.table.stateManeger.setScrollTop(e)}hideResizeCol(){this.columnResizeLine.setAttribute("visible",!1),this.columnResizeBgLine.setAttribute("visible",!1),this.columnResizeLabel.setAttribute("visible",!1),this.columnResizeLabel.hideAll()}showResizeCol(t,e,i){const n=$j(t,this.table,i);this.columnResizeLine.setAttributes({visible:!0,x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({visible:!0,x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.showAll(),this.columnResizeLabel.setAttributes({visible:!0,x:n,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${this.table.getColWidth(t)}px`)}updateResizeCol(t,e,i){const n=$j(t,this.table,i);this.columnResizeLine.setAttributes({x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({x:n,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.setAttributes({x:n,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${Math.floor(this.table.getColWidth(t))}px`)}hideMoveCol(){this.cellMover.hide()}showMoveCol(t,e,i){this.cellMover.show(t,e,i)}updateMoveCol(t,e,i,n){this.cellMover.update(t,e,i,n)}setFrozenColumnShadow(t,e){if(t<0)this.frozenShadowLine.setAttributes({visible:!1});else{const i=$j(t,this.table,e);this.frozenShadowLine.setAttributes({visible:!0,x:i,height:this.table.getRowsHeight(0,this.table.rowCount-1)})}}hideVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!1),this.vScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!0),this.vScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}hideHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!1),this.hScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!0),this.hScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}updateVerticalScrollBarPos(t){const e=this.vScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.vScrollBar.setAttribute("range",[n,n+i]);const r=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:r.x1,y:r.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,i=e[1]-e[0];this.hScrollBar.setAttribute("range",[t,t+i]);const n=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:n.x1,y:n.y1}}}function Yj(t,e,i,n,r){if(!e)return;const o="table"===i,{shadowBlur:s,shadowOffsetX:a,shadowOffsetY:l,shadowColor:h,cornerRadius:c,borderColor:u,borderLineWidth:d,borderLineDash:p}=e,f={},g={pickable:!1};s&&o&&(g.shadowBlur=s,g.shadowOffsetX=a,g.shadowOffsetY=l,g.shadowColor=h,g.stroke=!0,g.stroke=h,g.lineWidth=1,g.fill=!0,g.fillOpacity=.01),d&&(g.stroke=!0,g.fill=!1,g.stroke=Zj(u,n),g.lineWidth=d,p&&(g.lineDash=p),g.lineCap="square"),Array.isArray(u)&&(g.strokeArrayColor=RW(u)),Array.isArray(d)&&(g.strokeArrayWidth=RW(d),g.lineWidth=1),c&&(g.cornerRadius=c,f.cornerRadius=c);const m=g.strokeArrayWidth?g.strokeArrayWidth[0]:g.lineWidth??0,y=g.strokeArrayWidth?g.strokeArrayWidth[1]:g.lineWidth??0,b=g.strokeArrayWidth?g.strokeArrayWidth[2]:g.lineWidth??0,v=g.strokeArrayWidth?g.strokeArrayWidth[3]:g.lineWidth??0;if(t.setAttributes(f),!r&&g.stroke)if(g.x=v/2,g.y=m/2,g.pickable=!1,o){g.x=t.attribute.x-v/2,g.y=t.attribute.y-m/2,g.width=t.attribute.width+v/2+y/2,g.height=t.attribute.height+m/2+b/2;const e=eT(g);e.name="table-border-rect",t.parent.insertBefore(e,t),t.border=e}else{g.width=t.attribute.width-v/2-y/2,g.height=t.attribute.height-m/2-b/2;const e=eT(g);e.name="border-rect",t.addChild(e),t.border=e}}function qj(t,e,i){const{borderColor:n}=e;t.border?.setAttribute("stroke",Zj(n,i))}function Zj(t,e){let i=!0;return e&&!qu(t)?i=e.map((e=>!!e&&t)):e?i=e:e||qu(t)?qu(t)&&(i=!0):i=t,i}function Jj(t){if(!t.border)return;const e=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[0]:t.border.attribute.lineWidth??0,i=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[1]:t.border.attribute.lineWidth??0,n=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[2]:t.border.attribute.lineWidth??0,r=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[3]:t.border.attribute.lineWidth??0;t.border.setAttributes({width:t.attribute.width-r/2-i/2,height:t.attribute.height-e/2-n/2})}
4
4
  /*! *****************************************************************************
5
5
  Copyright (c) Microsoft Corporation.
6
6
 
@@ -14,4 +14,4 @@ read:function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,h=l>>1,c=-7,u=i?r-1:0,d=i?
14
14
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
15
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
16
  PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */function Qj(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}const tN=Cx();class eN extends Xx{type="chart";chartInstance;activeChartInstance;active;cacheCanvas;constructor(t){super(t),this.numberType=tN,t.chartInstance?this.chartInstance=t.chartInstance:(t.chartInstance=this.chartInstance=new t.ClassType(t.spec,{renderCanvas:t.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:{x1:0,x2:0,y1:0,y2:0},interactive:!1,animation:!1,autoFit:!1}),this.chartInstance.renderSync())}activate(t){this.active=!0;const{x1:e,y1:i,x2:n,y2:r}=this.getViewBox(),o=t.scenegraph.tableGroup.globalAABBBounds,s=new ep;s.x1=o.x1+t.getFrozenColsWidth(),s.x2=o.x2-t.getRightFrozenColsWidth(),s.y1=o.y1+t.getFrozenRowsHeight(),s.y2=o.y2-t.getBottomFrozenRowsHeight();const a=s.intersect({x1:e-t.scrollLeft,x2:n-t.scrollLeft,y1:i-t.scrollTop,y2:r-t.scrollTop});this.activeChartInstance=new this.attribute.ClassType(this.attribute.spec,{renderCanvas:this.attribute.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:{x1:e-t.scrollLeft,x2:n-t.scrollLeft,y1:i-t.scrollTop,y2:r-t.scrollTop},animation:!1,interactive:!0,autoFit:!1,beforeRender:t=>{const e=t.window.getContext();e.inuse=!0,e.clearMatrix(),e.setTransformForCurrent(!0),e.beginPath(),e.rect(a.x1,a.y1,a.x2-a.x1,a.y2-a.y1),e.clip()},afterRender(t){t.window.getContext().inuse=!1}}),this.activeChartInstance.renderSync(),t.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance),this.activeChartInstance.on("click",(e=>{console.log("click captured",e),eN.temp&&t.scenegraph.updateChartState(e?.datum)})),this.activeChartInstance.on("brushEnd",(e=>{console.log("brushEnd captured",e),t.scenegraph.updateChartState(e?.value?.inBrushData),eN.temp=0,setTimeout((()=>{eN.temp=1}),0)})),t._bindChartEvent?.(this.activeChartInstance),console.log("active")}static temp=1;deactivate(){this.active=!1,this.activeChartInstance.release(),this.activeChartInstance=null,console.log("deactivate")}updateData(t){this.attribute.data=t}getViewBox(){const t=this.parent,e=this.attribute.cellPadding,i=this.stage.table;return{x1:Math.ceil(t.globalAABBBounds.x1+e[3]+i.scrollLeft),x2:Math.ceil(t.globalAABBBounds.x1+t.attribute.width-e[1]+i.scrollLeft),y1:Math.ceil(t.globalAABBBounds.y1+e[0]+i.scrollTop),y2:Math.ceil(t.globalAABBBounds.y1+t.attribute.height-e[2]+i.scrollTop)}}}const iN=[],nN=[];let rN=5,oN=!1;function sN(t){bu(t)&&(rN=t)}function aN(t){const{axes:e,dataId:i,data:n,spec:r}=t.attribute,{chartInstance:o}=t,s=t.getViewBox();if(e.forEach(((t,e)=>{if("linear"===t.type){o._chart._components[e]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const i=o._chart._components[e];i._spec.domain=t.domain.slice(0),i.updateScaleDomain()}})),o.updateViewBox({x1:s.x1-t.getRootNode().table.scrollLeft,x2:s.x2-t.getRootNode().table.scrollLeft,y1:s.y1-t.getRootNode().table.scrollTop,y2:s.y2-t.getRootNode().table.scrollTop},!1,!1),"string"==typeof i)o.updateDataSync(i,n??[]);else{const t=[];for(const e in i){const s=i[e],a=r.series.find((t=>t?.data?.id===e));t.push({id:e,values:s?n?.filter((t=>t.hasOwnProperty(s)))??[]:n??[],fields:a?.data?.fields}),o.updateFullDataSync||o.updateDataSync(e,s?n?.filter((t=>t.hasOwnProperty(s)))??[]:n??[])}o.updateFullDataSync?.(t)}const a=o.getStage();t.cacheCanvas=a.toCanvas()}function lN(t){oN=!0,nN.length>0?requestAnimationFrame((()=>{const e=nN.splice(0,rN);iN.splice(0,rN),e.forEach((t=>{aN(t),t.addUpdateBoundTag()})),t.render(),lN(t)})):oN=!1}const hN=Symbol.for("ChartRender");let cN=class{type;numberType=tN;drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,o?.theme).group,{dataId:h,data:c,spec:u}=t.attribute;t.getViewBox();const{width:d=l.width,height:p=l.height}=t.attribute,{chartInstance:f,active:g,cacheCanvas:m,activeChartInstance:y}=t;if(!g&&m)e.drawImage(m,i,n,d,p);else if(y)if("string"==typeof h)y.updateDataSync(h,c??[]);else{const t=[];for(const e in h){const i=h[e],n=u.series.find((t=>t?.data?.id===e));t.push({id:e,values:i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[],fields:n?.data?.fields}),f.updateFullDataSync||y.updateDataSync(e,i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[])}y.updateFullDataSync?.(t)}else t.getRootNode().table.internalProps.renderChartAsync?(-1===iN.indexOf(`${t.parent.col}+${t.parent.row}`)&&(iN.push(`${t.parent.col}+${t.parent.row}`),nN.push(t)),oN||lN(t.getRootNode().table)):aN(t)}draw(t,e,i,n){const{context:r}=i;if(!r)return;const{clip:o}=t.attribute;o?r.save():r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),r.beginPath(),n.skipDraw?this.drawShape(t,r,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,r,0,0,i),o?r.restore():r.highPerformanceRestore()}};cN=Qj([Vm()],cN);let uN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{shape:p}=t.attribute;if("circle"===p){const{width:r=l.width,height:o=l.height}=t.attribute;e.beginPath(),e.arc(i+r/2,n+o/2,Math.min(r,o)/2,0,2*Math.PI),e.closePath(),e.save(),e.clip()}}};uN=Qj([Vm()],uN);let dN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{shape:p}=t.attribute;"circle"===p&&e.restore()}};function pN(t,e,i){const{highlightScope:n,disableHeader:r,cellPos:o}=t.hover;if(!t.table.isHeader(e,i)||!r){if(n===Kc.single&&o.col===e&&o.row===i)return"cellBgColor";if(n===Kc.column&&o.col===e)return"inlineColumnBgColor";if(n===Kc.row&&o.row===i)return"inlineRowBgColor";if(n===Kc.cross){if(o.col===e&&o.row===i)return"cellBgColor";if(o.col===e)return"inlineColumnBgColor";if(o.row===i)return"inlineRowBgColor"}}}dN=Qj([Vm()],dN);let fN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{stroke:p=l.stroke,strokeArrayWidth:f=l.strokeArrayWidth,strokeArrayColor:g=l.strokeArrayColor}=t.attribute;p&&(Array.isArray(f)||Array.isArray(g))&&(d.doStroke=!1)}};fN=Qj([Vm()],fN);let gN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{width:d=l.width,height:p=l.height,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:y=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;if(!f||!Array.isArray(m)&&0===y)return;let v,w;if(Array.isArray(g)||Array.isArray(m)){if("number"==typeof y&&1&y||Array.isArray(m)&&m.some((t=>1&t))){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=_N(t,Math.ceil(d),Math.ceil(p));v=e,w=r}else v=Math.ceil(d),w=Math.ceil(p);mN(t,e,i,n,l,f,m||y,g||b,v,w)}}};function mN(t,e,i,n,r,o,s,a,l,h,c,u){const d=function(t){if(!Array.isArray(t))return{isSplitDraw:!1,width:t};let e;for(let i=0;i<t.length;i++){const n=t[i];if(n)if(e){if(n!==e)return{isSplitDraw:!0}}else e=n}return{isSplitDraw:!1,width:e}}(s),p=!Array.isArray(s),f=!Array.isArray(o),g=Array.isArray(u),m=Array.isArray(a)||d.isSplitDraw;e.setStrokeStyle(t,t.attribute,i,n,r);let y=!1;e.getLineDash().length&&(y=!0),e.beginPath(),e.moveTo(i,n),(f||o[0])&&(p||s[0])?(g&&Array.isArray(u[0])?(e.moveTo(i+l*u[0][0],n),e.lineTo(i+l*(u[0][1]-u[0][0]),n),e.moveTo(i+l,n)):(e.moveTo(i,n),e.lineTo(i+l,n)),!m&&!y||a&&!a[0]||(a&&(e.strokeStyle=a[0]),p||(e.lineWidth=s[0]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+l,n))):e.moveTo(i+l,n),(f||o[1])&&(p||s[1])?(g&&Array.isArray(u[1])?(e.moveTo(i+l,n+h*u[1][0]),e.lineTo(i+l,n+h*(u[1][1]-u[1][0])),e.moveTo(i+l,n+h)):(e.moveTo(i+l,n),e.lineTo(i+l,n+h)),!m&&!y||a&&!a[1]||(a&&(e.strokeStyle=a[1]),p||(e.lineWidth=s[1]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i+l,n+h))):e.moveTo(i+l,n+h),(f||o[2])&&(p||s[2])?(g&&Array.isArray(u[2])?(e.moveTo(i+l*u[2][0],n+h),e.lineTo(i+l*(u[2][1]-u[2][0]),n+h),e.moveTo(i,n+h)):(e.moveTo(i,n+h),e.lineTo(i+l,n+h)),!m&&!y||a&&!a[2]||(a&&(e.strokeStyle=a[2]),p||(e.lineWidth=s[2]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,n+h))):e.moveTo(i,n+h),(f||o[3])&&(p||s[3])?(g&&Array.isArray(u[3])?(e.moveTo(i,n+h*u[3][0]),e.lineTo(i,n+h*(u[3][1]-u[3][0])),e.moveTo(i,n)):(e.moveTo(i,n),e.lineTo(i,n+h)),!m&&!y||a&&!a[3]||(a&&(e.strokeStyle=a[3]),p||(e.lineWidth=s[3]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n))):e.moveTo(i,n),m||y||(!p&&d.width&&(e.lineWidth=d.width),e.stroke())}gN=Qj([Vm()],gN);let yN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{lineDash:p=l.lineDash,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth}=t.attribute;f&&Array.isArray(p)&&p.length&&!Array.isArray(g)&&!Array.isArray(m)&&(d.doStroke=!1)}};yN=Qj([Vm()],yN);let bN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{lineDash:d=l.lineDash,stroke:p=l.stroke,strokeArrayColor:f=l.strokeArrayColor,strokeArrayWidth:g=l.strokeArrayWidth,lineWidth:m=l.lineWidth}=t.attribute;if(!p||!Array.isArray(d)||!d.length||Array.isArray(f)||Array.isArray(g))return;let y,b,{width:v=l.width,height:w=l.height}=t.attribute;if(v=Math.ceil(v),w=Math.ceil(w),1&m){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=_N(t,Math.ceil(v),Math.ceil(w));y=e,b=r}else y=Math.ceil(v),b=Math.ceil(w);e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),e.lineTo(i+y,n),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+y,n),e.lineTo(i+y,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n+b),e.lineTo(i+y,n+b),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,n),e.lineTo(i,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke()}};bN=Qj([Vm()],bN);let vN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{lineWidth:p=l.lineWidth,stroke:f=l.stroke,lineDash:g=l.lineDash,strokeArrayWidth:m=l.strokeArrayWidth,strokeArrayColor:y=l.strokeArrayColor}=t.attribute;f&&Array.isArray(g)&&!g.length&&!Array.isArray(y)&&!Array.isArray(m)&&1&p&&(d.doStroke=!1)}};vN=Qj([Vm()],vN);let wN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{lineWidth:d=l.lineWidth,stroke:p=l.stroke,lineDash:f=l.lineDash,strokeArrayWidth:g=l.strokeArrayWidth,strokeArrayColor:m=l.strokeArrayColor}=t.attribute,{width:y=l.width,height:b=l.height}=t.attribute;if(p&&Array.isArray(f)&&!f.length&&!Array.isArray(m)&&!Array.isArray(g)&&1&d){const{width:r,height:o}=_N(t,Math.ceil(y),Math.ceil(b));e.beginPath(),i=Math.floor(i)+.5,n=Math.floor(n)+.5,e.rect(i,n,r,o),e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()}}};wN=Qj([Vm()],wN);let CN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){if("cell"===t.role){const e=t.stage.table;if(e.stateManeger.interactionState!==Uc.scrolling){const i=function(t,e){let i,n;if("cell"===t.role&&"number"==typeof t.mergeCol&&"number"==typeof t.mergeRow)for(let n=t.col;n<=t.mergeCol;n++)for(let r=t.row;r<=t.mergeRow;r++){const t=pN(e.stateManeger,n,r);!t||i&&"cellBgColor"!==t||(i=t)}else"cell"===t.role&&(i=pN(e.stateManeger,t.col,t.row));if(!i)return;const r=e.internalProps.layoutMap;return r.isCornerHeader(t.col,t.row)?n=e.theme.cornerHeaderStyle?.hover:r.isColumnHeader(t.col,t.row)?n=e.theme.headerStyle?.hover:r.isRowHeader(t.col,t.row)?n=e.theme.rowHeaderStyle?.hover:r.isBottomFrozenRow(t.col,t.row)?n=e.theme.bottomFrozenStyle?.hover||e.theme.headerStyle?.hover:r.isRightFrozenColumn(t.col,t.row)?n=e.theme.rightFrozenStyle?.hover||e.theme.rowHeaderStyle?.hover:e.isHeader(t.col,t.row)||(n=e.theme.bodyStyle?.hover),Cj(i,n,t.col,t.row,e)}(t,e);i&&(t.oldColor=t.attribute.fill,t.attribute.fill=i)}}}};CN=Qj([Vm()],CN);let xN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){"oldColor"in t&&(t.attribute.fill=t.oldColor,delete t.oldColor)}};function _N(t,e,i){const n=t.stage.table;if("cell"===t.role){let r=t.col,o=t.row;const s=Sk(n,r,o);s&&(r=s.end.col,o=s.end.row),(n&&r===n.colCount-1||n&&r===n.frozenColCount-1&&n.scrollLeft)&&(e-=1),(n&&o===n.rowCount-1||n&&o===n.frozenRowCount-1&&n.scrollTop)&&(i-=1)}else"corner-frozen"===t.role&&(n.scrollLeft&&(e-=1),n.scrollTop&&(i-=1));return{width:e,height:i}}xN=Qj([Vm()],xN);let SN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{stroke:p=l.stroke,strokeArrayWidth:f=l.strokeArrayWidth,strokeArrayColor:g=l.strokeArrayColor}=t.attribute;p&&(Array.isArray(p)||Array.isArray(f)||Array.isArray(g))&&(d.doStroke=!1)}};SN=Qj([Vm()],SN);let AN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{width:d=l.width,height:p=l.height,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:y=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;f&&(Array.isArray(m)||0!==y)&&(Array.isArray(f)||Array.isArray(g)||Array.isArray(m))&&(("number"==typeof y&&1&y||Array.isArray(m)&&m.some((t=>1&t)))&&(i=Math.floor(i)+.5,n=Math.floor(n)+.5),mN(t,e,i,n,l,f,m||y,g||b,Math.ceil(d),Math.ceil(p)))}};AN=Qj([Vm()],AN);var TN=new zm(((t,e,i,n)=>{i(KB)?n(KB).to(SN).inSingletonScope():(t(SN).toSelf().inSingletonScope(),t(E_).toService(SN)),i($B)?n($B).to(AN).inSingletonScope():(t(AN).toSelf().inSingletonScope(),t(E_).toService(AN)),t(gN).toSelf().inSingletonScope(),t(B_).toService(gN),t(fN).toSelf().inSingletonScope(),t(B_).toService(fN),t(cN).toSelf().inSingletonScope(),t(hN).to(cN),t(sB).to(cN),t(uN).toSelf().inSingletonScope(),t(M_).toService(uN),t(dN).toSelf().inSingletonScope(),t(M_).toService(dN),t(yN).toSelf().inSingletonScope(),t(B_).toService(yN),t(bN).toSelf().inSingletonScope(),t(B_).toService(bN),t(vN).toSelf().inSingletonScope(),t(B_).toService(vN),t(wN).toSelf().inSingletonScope(),t(B_).toService(wN),t(CN).toSelf().inSingletonScope(),t(B_).toService(CN),t(xN).toSelf().inSingletonScope(),t(B_).toService(xN)}));function BN(t,e,i){if(i._table.isPivotChart())if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let n=i.getIndicatorKeyInChartSpec(t,i.columnHeaderLevelCount-1)[1];if(qu(n)&&(n=n[0]),!n)return;const r=RN(t,e,"top",i),o=i.dataset.collectedValues[n+(r?"_align":"")]?i.dataset.collectedValues[n+(r?"_align":"")]:i.dataset.collectedValues[n],s=i.getRecordIndexByCol(t),a=o?o[i.getColKeysPath()[s][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]:{max:1,min:0},l=MN(t,e,"top",i);if(!1===l?.visible)return;return Qu(l?.min)&&(a.min=l.min),Qu(l?.max)&&(a.max=l.max),fd({range:a},l,{orient:"top",type:"linear",label:{flush:!0}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];qu(r)&&(r=r[0]);const o=RN(t,e,"bottom",i),s=i.dataset.collectedValues[r+(o?"_align":"")]?i.dataset.collectedValues[r+(o?"_align":"")]:i.dataset.collectedValues[r],a=i.getRecordIndexByCol(t),l=s?.[i.getColKeysPath()[a][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]??{min:0,max:1};let h=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(h=e)}));const c=MN(t,e,"bottom",i);if(!1===c?.visible)return;return Qu(c?.min)&&(l.min=c.min),Qu(c?.max)&&(l.max=c.max),fd({title:{visible:!0,text:h?.title},range:l},c,{orient:"bottom",type:"linear",label:{flush:!0}})}if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let n=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)[0];qu(n)&&(n=n[0]);const r=i.dataset.collectedValues[n]??[],o=i.getRecordIndexByRow(e),s=i.getRowKeysPath()[o],a=r[s[s.length-1]]??[],l=MN(t,e,"left",i);if(!1===l?.visible)return;return fd({domain:Array.from(a).reverse(),title:{autoRotate:!0}},l,{orient:"left",type:"band"})}}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];qu(r)&&(r=r[0]);const o=RN(t,e,"left",i),s=i.dataset.collectedValues[r+(o?"_align":"")]?i.dataset.collectedValues[r+(o?"_align":"")]:i.dataset.collectedValues[r],a=i.getRecordIndexByRow(e),l=s?.[i.getRowKeysPath()[a][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]]??{min:0,max:1};let h=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(h=e)}));const c=MN(t,e,"left",i);if(!1===c?.visible)return;return Qu(c?.min)&&(l.min=c.min),Qu(c?.max)&&(l.max=c.max),fd({title:{visible:!0,text:h?.title,autoRotate:!0},range:l},c,{orient:"left",type:"linear",label:{flush:!0}})}if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let n=i.getIndicatorKeyInChartSpec(i.rowHeaderLevelCount-1,e)[1];if(qu(n)&&(n=n[0]),!n)return;const r=RN(t,e,"right",i),o=i.dataset.collectedValues[n+(r?"_align":"")]?i.dataset.collectedValues[n+(r?"_align":"")]:i.dataset.collectedValues[n],s=i.getRecordIndexByRow(e),a=o?.[i.getRowKeysPath()[s][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]]??{min:0,max:1},l=MN(t,e,"right",i);if(!1===l?.visible)return;return Qu(l?.min)&&(a.min=l.min),Qu(l?.max)&&(a.max=l.max),fd({range:a,title:{autoRotate:!0}},l,{orient:"right",type:"linear",label:{flush:!0}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let n=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];qu(n)&&(n=n[0]);const r=i.dataset.collectedValues[n]??[],o=i.getRecordIndexByCol(t),s=i.getColKeysPath()[o],a=r?.[s[s.length-1]]??[],l=MN(t,e,"bottom",i);if(!1===l?.visible)return;return fd({domain:Array.from(a)},l,{orient:"bottom",type:"band"})}}}function MN(t,e,i,n){const r=n.getRawChartSpec(t,e);if(r&&qu(r.axes)){const t=r.axes.find((t=>t.orient===i));if(t)return t}return n._table.pivotChartAxes.find((t=>t.orient===i))}function RN(t,e,i,n){const r=[];"left"===i||"right"===i?r.push("left","right"):"top"!==i&&"bottom"!==i||r.push("top","bottom");const o=n.getRawChartSpec(t,e);let s;if(s=o&&qu(o.axes)?o.axes:n._table.pivotChartAxes,qu(s)){const t=[];s.forEach((e=>{r.includes(e.orient)&&t.push(e)}));for(let e=0;e<t.length;e++){const i=t[e];if(i.sync&&i.sync.zeroAlign&&i.sync.axisId&&t.find((t=>t.id===i.sync.axisId)))return!0}}return!1}function PN(t,e){const i=fd({},cO,t);let n=0;!1!==i.tick.visible&&(n=i.tick.width??4);let r=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).width)}))}else{const t=i.range,n=Math.abs(t.min)>1?Math.round(t.min):t.min,o=Math.abs(t.max)>1?Math.round(t.max):t.max;[HN(n),HN(o)].forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).width)}))}r+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:n,height:r}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize,fontWeight:i.title?.style?.fontWeight,fontFamily:i.title?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0,a=LN(Math.min(n,s),r,i.title?.style?.angle);o="left"!==t.orient&&"right"!==t.orient||!i.title.autoRotate?a.width:a.height,o+=i.title.space??4}return n+r+o+2}function EN(t,e){const i=fd({},cO,t);let n=0;!1!==i.tick.visible&&(n=i.tick.width??4);let r=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).height)}))}else{const t=i.range,n=Math.abs(t.min)>1?Math.round(t.min):t.min,o=Math.abs(t.max)>1?Math.round(t.max):t.max;[HN(n),HN(o)].forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).height)}))}r+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:n,height:r}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize,fontWeight:i.title?.style?.fontWeight,fontFamily:i.title?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0,a=LN(Math.min(n,s),r,i.title?.style?.angle);o="bottom"!==t.orient&&"top"!==t.orient||!i.title.autoRotate?a.height:a.width,o+=i.title.space??4}return n+r+o+2}function HN(t){return"number"!=typeof t&&(t=Number(t)),Number(t.toPrecision(1)).toString()}function LN(t,e,i=0){const n=i*Math.PI/180,r=-t/2,o=-e/2,s=t/2,a=-e/2,l=t/2,h=e/2,c=-t/2,u=e/2,d={x:r*Math.cos(n)-o*Math.sin(n),y:r*Math.sin(n)+o*Math.cos(n)},p={x:s*Math.cos(n)-a*Math.sin(n),y:s*Math.sin(n)+a*Math.cos(n)},f={x:l*Math.cos(n)-h*Math.sin(n),y:l*Math.sin(n)+h*Math.cos(n)},g={x:c*Math.cos(n)-u*Math.sin(n),y:c*Math.sin(n)+u*Math.cos(n)},m=Math.min(d.x,p.x,f.x,g.x),y=Math.max(d.x,p.x,f.x,g.x),b=Math.min(d.y,p.y,f.y,g.y);return{width:y-m,height:Math.max(d.y,p.y,f.y,g.y)-b}}function kN(t,e,i,n){"undefined"!=typeof window&&window.performance.now(),e=e??0,i=i??t.colCount-1,0===e&&i===t.colCount-1&&t._clearColRangeWidthsMap();const r=[];if(n)for(let e=0;e<t.colCount;e++)r.push(t.getColWidth(e));for(let n=e;n<=i;n++){let e;if(!t.internalProps.transpose&&"only-header"===t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode&&"showHeader"in t.internalProps.layoutMap){const i=t.internalProps.layoutMap.showHeader;t.internalProps.layoutMap.showHeader=!0,e=IN(n,0,t.internalProps.layoutMap.headerLevelCount,t,!1),t.internalProps.layoutMap.showHeader=i}else e=t.internalProps.transpose||"only-body"!==t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode?IN(n,0,t.rowCount-1,t,!1):IN(n,t.internalProps.layoutMap.getBodyRange().start.row,t.internalProps.layoutMap.getBodyRange().end.row,t,!1);t._setColContentWidth(n,e);t.getColWidth(n)!==e&&t._clearColRangeWidthsMap(n),t.setColWidth(n,e,!1,!0)}if("adaptive"===t.widthMode){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth-t.getFrozenColsWidth()-t.getRightFrozenColsWidth();let i=0;for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)i+=t.getColWidth(e);const n=e/i;for(let i=t.frozenColCount;i<t.colCount-t.rightFrozenColCount;i++){let r;r=i===t.colCount-t.rightFrozenColCount-1?e-t.getColsWidth(t.frozenColCount,t.colCount-t.rightFrozenColCount-2):Math.round(t.getColWidth(i)*n),t.setColWidth(i,r,!1,!0)}}else if(t.autoFillWidth){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0,n=0;for(let e=0;e<t.colCount;e++){const r=t.getColWidth(e);(e<t.frozenColCount||e>=t.colCount-t.rightFrozenColCount)&&(n+=r),i+=r}if(i<e&&i-n>0){const r=(e-n)/(i-n);for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)t.setColWidth(e,t.getColWidth(e)*r,!1,!0)}}if(n)for(let e=0;e<t.colCount;e++){const i=t.getColWidth(e);i!==r[e]&&t.scenegraph.updateColWidth(e,i-r[e])}}function IN(t,e,i,n,r){const o=function(t,e){const i=e.getColWidthDefined(t);if(e.internalProps._widthResizedColMap.has(t))return e.getColWidth(t);return i}(t,n);return"number"==typeof o?o:"auto"!==o&&"string"==typeof o?aj(o,n.internalProps.calcWidthContext):function(t,e,i,n,r,o){let s=0,a=1;n-i>5e3&&(a=Math.ceil((n-i)/5e3));if(o.isPivotChart()&&e>=o.rowHeaderLevelCount){if(o.internalProps.layoutMap.indicatorsAsCol)return o.defaultColWidth;{const t=o.internalProps.layoutMap.getOptimunWidthForChart(e);if(t>0)return t}}for(let r=i;r<=n;r+=a){if(o.isPivotChart()){const t=o.internalProps.layoutMap,i=BN(e,r,t);if(i){const t=PN(i,o);if("number"==typeof t){s=Math.max(t,s);continue}}else if(t.isLeftBottomCorner(e,r)||t.isRightTopCorner(e,r)||t.isRightBottomCorner(e,r))continue}const i=ON(e,r,o);if("number"==typeof i){s=Math.max(i,s);continue}const n=t;if("number"==typeof n&&"standard"===o.widthMode){s=Math.max(n,s);continue}const a=o.isHeader(e,r)?o._getHeaderLayoutMap(e,r)?.headerType:o.getBodyColumnType(e,r);if("text"!==a&&"link"!==a&&"progressbar"!==a){s=Math.max(s,o.getColWidth(e)||0);continue}let l=0;const h=o.internalProps.layoutMap;if(h.isHeader(e,r)){const t=h.getHeader(e,r);if("only-body"===t?.define?.columnWidthComputeMode)continue;t?.hierarchyLevel&&(l=(t.hierarchyLevel??0)*(h.rowHierarchyIndent??0))}else{const t=o.getBodyColumnDefine(e,r);if(t?.tree){const t=o.dataSource.getIndexKey(o.getRecordIndexByRow(e,r));l=Array.isArray(t)&&o.getHierarchyState(e,r)!==Xc.none?(t.length-1)*(h.hierarchyIndent??0):0}}const c=DN(e,r,o);s=Math.max(c+l,s)}const l=o.getMinColWidth(e),h=o.getMaxColWidth(e);if(s<l)return l;if(s>h)return h;return s}(o,t,e,i,0,n)}function ON(t,e,i){const n=i.getCustomRender(t,e),r=i.getCustomLayout(t,e);if(n||r){let o=1,s=0;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);o=n.end.col-n.start.col+1}const a={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:FN(t,e,i),table:i};if(r){const t=r(a);t.rootContainer.isRoot=!0;s=t.rootContainer.getContentSize().width??0}else if("function"==typeof n){const t=n(a);s=t?.expectedWidth??0}else s=n?.expectedWidth??0;return s/o}}function DN(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0;const a=i.getBodyColumnDefine(t,e);if("body"!==i.getCellLocation(t,e)||(!!a?.icon||!!a?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==Zc.absoluteRight&&(s+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0))}))}let l=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);l=n.end.col-n.start.col+1}const h=RW(Cj("padding",o,t,e,i)),c=h[1]+h[3],u=Cj("fontSize",o,t,e,i),d=Cj("fontFamily",o,t,e,i),p=Cj("fontWeight",o,t,e,i),f=vu(r).split("\n")||[];return f.length>=1?f.forEach((t=>{const e=i.measureText(t.slice(0,i.options.maxCharactersNumber||200),{fontSize:u,fontFamily:d,fontWeight:p}).width;n=Math.max((e+c+4+s)/l,n)})):n=Math.max((c+4+s)/l,n),!1!==i.internalProps.limitMaxAutoWidth&&(n=Math.min("number"==typeof i.internalProps.limitMaxAutoWidth?i.internalProps.limitMaxAutoWidth:450,n)),n}function FN(t,e,i){return{left:0,top:0,right:i.getColWidth(t),bottom:i.getRowHeight(e),width:i.getColWidth(t),height:i.getRowHeight(e)}}const zN=new J_({ignoreBuf:!0}),WN=new dA({width:0,height:0,textConfig:[]});function jN(t,e,i,n=!0,r){"undefined"!=typeof window&&window.performance.now();const o=[];if(r)for(let e=0;e<t.rowCount;e++)o.push(t.getRowHeight(e));if("autoHeight"===t.heightMode||"adaptive"===t.heightMode){e=e??0,i=i??t.rowCount-1,(0===e&&i===t.rowCount-1||n)&&t._clearRowRangeHeightsMap();for(let i=e;i<t.columnHeaderLevelCount;i++){const e=NN(i,0,t.colCount-1,t);t.setRowHeight(i,e)}if(i<t.columnHeaderLevelCount)return;if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol||!function(t){const{layoutMap:e}=t.internalProps,i=t.columnHeaderLevelCount;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;for(let n=0;n<t.colCount;n++){const r=e.getBody(n,i);if("function"==typeof r.style||"function"==typeof r.icon||r.define?.customRender||"function"==typeof r.define?.icon)return!1;const o=t._getCellStyle(n,i);if("function"==typeof o.padding||"function"==typeof o.fontSize||"function"==typeof o.lineHeight||!0===o.autoWrapText)return!1}return!0}(t))if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol)for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){let e;e=GN(t,n)?NN(n,0,t.rowHeaderLevelCount,t):NN(n,0,t.colCount-1,t),t.setRowHeight(n,e)}else for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){const e=NN(n,0,t.colCount-1,t);t.setRowHeight(n,e)}else{!function(t,e,i,n){for(let r=e;r<=i;r++)n.setRowHeight(r,t)}(NN(t.columnHeaderLevelCount,0,t.colCount-1,t),t.columnHeaderLevelCount,t.rowCount-1-t.bottomFrozenRowCount,t);for(let e=t.rowCount-t.bottomFrozenRowCount;e<=i;e++){const i=NN(e,0,t.colCount-1,t);t.setRowHeight(e,i)}}}if("adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight-t.getFrozenRowsHeight()-t.getBottomFrozenRowsHeight();let i=0;for(let e=t.frozenRowCount;e<t.rowCount-t.bottomFrozenRowCount;e++)i+=t.getRowHeight(e);const n=e/i;for(let i=t.frozenRowCount;i<t.rowCount-t.bottomFrozenRowCount;i++){let r;r=i===t.rowCount-t.bottomFrozenRowCount-1?e-t.getRowsHeight(t.frozenRowCount,t.rowCount-t.bottomFrozenRowCount-2):Math.round(t.getRowHeight(i)*n),t.setRowHeight(i,r,!1)}}if(r)for(let e=0;e<t.rowCount;e++){const i=t.getRowHeight(e);i!==o[e]&&t.scenegraph.updateRowHeight(e,i-o[e])}}function NN(t,e,i,n){let r=0;if(n.isPivotChart()&&t>=n.columnHeaderLevelCount&&t<n.rowCount-n.bottomFrozenRowCount){if(!n.internalProps.layoutMap.indicatorsAsCol)return n.getRowHeight(t);{const e=n.internalProps.layoutMap.getOptimunHeightForChart(t);if(e>0)return e}}for(let o=e;o<=i;o++){const e=VN(o,t,n);if("number"==typeof e){r=Math.max(e,r);continue}if(n.isPivotChart()){const e=BN(o,t,n.internalProps.layoutMap);if(e){const t=EN(e,n);if("number"==typeof t){r=Math.max(t,r);continue}}}const i=UN(o,t,n);r=Math.max(i,r)}return r}function GN(t,e){const{layoutMap:i}=t.internalProps;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;const n=i.getBody(t.rowHeaderLevelCount,e);if("function"==typeof n.style||"function"==typeof n.icon||n.define?.customRender||"function"==typeof n.define?.icon)return!1;const r=t._getCellStyle(t.rowHeaderLevelCount,e);return"function"!=typeof r.padding&&"function"!=typeof r.fontSize&&"function"!=typeof r.lineHeight&&!0!==r.autoWrapText}function VN(t,e,i){const n=i.getCustomRender(t,e),r=i.getCustomLayout(t,e);if(n||r){let o=1,s=0;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);o=n.end.col-n.start.col+1}const a={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:FN(t,e,i),table:i};if(r){const t=r(a);t.rootContainer.isRoot=!0;s=t.rootContainer.getContentSize().height??0}else if("function"==typeof n){const t=n(a);s=t?.expectedHeight??0}else s=n?.expectedHeight??0;return s/o}}function UN(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0,a=0;const l=[];let h=0;const c=[];let u=0;const d=i.getBodyColumnDefine(t,e);if("body"!==i.getCellLocation(t,e)||(!!d?.icon||!!d?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==Zc.absoluteRight&&t.positionType!==Zc.inlineFront&&t.positionType!==Zc.inlineEnd?(a+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0),s=Math.max(s,t.height??0)):t.positionType===Zc.inlineFront?(l.push(t),h=Math.max(h,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0))):t.positionType===Zc.inlineEnd&&(c.push(t),u=Math.max(u,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0)))}))}let p=1,f=t;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);p=n.end.row-n.start.row+1,t=n.start.col,f=n.end.col}const g=RW(Cj("padding",o,t,e,i)),m=Cj("fontSize",o,t,e,i),y=Cj("fontStyle",o,t,e,i),b=Cj("fontWeight",o,t,e,i),v=Cj("lineHeight",o,t,e,i)??m,w=Cj("fontFamily",o,t,e,i),C=Cj("autoWrapText",o,t,e,i),x=vu(r).split("\n")||[],_=i.getColsWidth(t,f);if(l.length||c.length){const t=Object.assign({text:r?.toString(),fontFamily:w,fontSize:m,fontStyle:y,fontWeight:b,lineHeight:v});t.textBaseline="middle";const e=[...l.map((t=>kj(t))),t,...c.map((t=>kj(t)))];WN.setAttributes({width:_-(g[1]+g[3])-a,height:0,textConfig:e}),n=WN.AABBBounds.height()}else if(C){const t=_-(g[1]+g[3])-a;zN.setAttributes({maxLineWidth:t,text:x,fontSize:m,fontStyle:y,fontWeight:b,fontFamily:w,lineHeight:v}),n=zN.AABBBounds.height()}else n=x.length*v;return(Math.max(n,s)+g[0]+g[2])/p}const KN=new bj({});KN.role="empty";const $N={},XN={};function YN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const m=Up(XN,$N)[c],y=xj("padding",f._getCellStyle(r,o),r,o,f);bu(y)&&(l=y),t||((t=new bj({x:i,y:n,width:s,height:a,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0})).role="cell",t.col=r,t.row=o,e?.addChild(t)),t.AABBBounds.width();const b=new eN({stroke:!1,x:l[3],y:l[0],canvas:f.canvas,spec:u,ClassType:m,width:s-l[3]-l[1],height:a-l[2]-l[0],chartInstance:d,dataId:p,data:f.getCellValue(r,o),cellPadding:l,axes:f.internalProps.layoutMap.getChartAxes(r,o)});return t.appendChild(b),f.internalProps.layoutMap.setChartInstance(r,o,b.chartInstance),t}function qN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const m=t._getCellStyle(r,o),y=xj("padding",m,r,o,t);bu(y)&&(h=y),g?.text?.textAlign&&(c=g?.text?.textAlign),g?.text?.textBaseline&&(u=g?.text?.textBaseline);const b="autoHeight"===t.heightMode,v="auto"===s,w=m.autoWrapText??t.internalProps.autoWrapText,C=m.lineClamp,x=new bj({x:i,y:n,width:a,height:l,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0});if(x.role="cell",x.col=r,x.row=o,e?.addChild(x),p&&x.appendChild(p),f){const e=t.getCellValue(r,o);let i;if(d&&(i=t.getCellIcons(r,o)),function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=[],g=[],m=[],y=[],b=[],v=[],w=[],C=[];let x,_=0,S=0,A=0,T=0,B=0,M=0;if(Array.isArray(e)&&0!==e.length){let R;if(e.forEach((t=>{switch(t.positionType){case Zc.left:f.push(t);break;case Zc.right:g.push(t);break;case Zc.contentLeft:m.push(t);break;case Zc.contentRight:y.push(t);break;case Zc.absoluteRight:C.push(t);break;case Zc.inlineFront:b.push(t);break;case Zc.inlineEnd:v.push(t)}})),f.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-left",i.name=e.name,i.setAttribute("x",_+(i.attribute.marginLeft??0)),_+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),S=Math.max(S,i.AABBBounds.height()),t.appendChild(i)})),g.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-right",i.name=e.name,i.setAttribute("x",A+(i.attribute.marginLeft??0)),A+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),T=Math.max(T,i.AABBBounds.height()),t.appendChild(i)})),w.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-absolute-left",i.name=e.name,i.setAttribute("x",B+(i.attribute.marginLeft??0)),B+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),C.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-absolute-right",i.name=e.name,i.setAttribute("x",M+(i.attribute.marginLeft??0)),M+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),0===b.length&&0===v.length){const t=pu(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),e={text:1!==t.length||s?t:t[0],maxLineWidth:r?1/0:l-(n[1]+n[3])-_-A,textBaseline:"top",heightLimit:o?-1:h-(n[0]+n[2]),pickable:!1,autoWrapText:s,lineClamp:a,wordBreak:"break-word"},c=new J_(p.text?Object.assign({},p.text,e):e);c.name="text",R=c}else{const e=Object.assign({text:i?.toString()},t.parent?.theme?.userTheme?.text||{});p.text&&Object.assign(e,p.text),e.textBaseline="middle";const s=[...b.map((t=>kj(t))),e,...v.map((t=>kj(t)))];s[0].textAlign=c;const a=new dA({width:r?0:l-(n[1]+n[3])-_-A,height:o?0:h-(n[0]+n[2]),textConfig:s,verticalDirection:o?"top":u});a.name="text",R=a,a.bindIconEvent()}if(0!==m.length||0!==y.length){const e=new Ej({x:0,y:0,fill:!1,stroke:!1});e.name="content",e.setCellContentOption({autoWidth:r,autoHeight:o,cellWidth:l-(n[1]+n[3])-_-A,cellHeight:h-(n[0]+n[2]),align:c,baseline:u}),m.forEach((i=>{const n=Lj(i,void 0,t.col,t.row,d);n.role="icon-content-left",n.name=i.name,e.addLeftOccupyingIcon(n)})),y.forEach((i=>{const n=Lj(i,void 0,t.col,t.row,d);n.role="icon-content-right",n.name=i.name,e.addRightOccupyingIcon(n)})),e.addContent(R),t.appendChild(e),e.layout(),x=e.AABBBounds.width(),e.AABBBounds.height()}else t.firstChild?t.insertBefore(R,t.firstChild):t.appendChild(R),x=R.AABBBounds.width(),R.AABBBounds.height()}else if(i){const e=pu(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),c=Hj(t.col,t.row,d),u={text:1!==e.length||s?e:e[0],maxLineWidth:r?1/0:l-(n[1]+n[3]+c),textBaseline:"top",autoWrapText:s,lineClamp:a,wordBreak:"break-word",heightLimit:o?-1:h-(n[0]+n[2]),pickable:!1,dx:c},f=new J_(p.text?Object.assign({},p.text,u):u);f.name="text",t.appendChild(f),x=f.AABBBounds.width(),f.AABBBounds.height()}const R=r?_+x+A:l-(n[1]+n[3]),P=h-(n[0]+n[2]);t.forEachChildren((t=>{"icon-left"===t.role?t.setAttribute("x",t.attribute.x+n[3]):"icon-right"===t.role?t.setAttribute("x",t.attribute.x+R-A+n[3]):"icon-absolute-right"===t.role?t.setAttribute("x",t.attribute.x+R-M+n[3]+n[1]):"content"!==t.name&&"text"!==t.name||("center"===c&&"richtext"!==t.type?t.setAttribute("x",n[3]+_+(R-_-A)/2):"right"===c&&"richtext"!==t.type?t.setAttribute("x",n[3]+R-A):t.setAttribute("x",n[3]+_))})),t.forEachChildren((t=>{"middle"===u?t.setAttribute("y",n[0]+(P-t.AABBBounds.height())/2):"bottom"===u?t.setAttribute("y",n[0]+P-t.AABBBounds.height()):t.setAttribute("y",n[0])})),t.setAttributes({width:R+n[1]+n[3],height:P+n[0]+n[2]})}(x,i,e,h,v,b,w,"number"==typeof C?C:void 0,a,l,c,u,t,g),g?._vtable?.marked){const t=qA({x:x.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});t.name="mark",x.appendChild(t)}}return p&&x.setAttributes({width:Math.max(x.attribute.width,p.attribute.width),height:Math.max(x.attribute.height,p.attribute.height)}),x}const ZN=yj();function JN(t,e,i){t.then((()=>{i(),e.scenegraph.updateNextFrame()})).catch((t=>{console.error(t)}))}function QN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m){let y,b;if(i.internalProps?.dataConfig?.mappingRules&&!i.isHeader(n,r)&&i.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&i.internalProps.layoutMap.getIndicatorKey(n,r)===t.bgColor.indicatorKey&&(y=t.bgColor.mapping)})),"text"===t||"link"===t){if("link"===t){const o=i.getCellValue(n,r),s=i._getCellStyle(n,r);"link"===t&&("templateLink"in e&&e.templateLink||!("linkDetect"in e)||!e.linkDetect||_f.test(o))&&(m?(m.text.fill=Cj("linkColor",s,n,r,i),m.group.cursor="pointer"):m={text:{fill:Cj("linkColor",s,n,r,i)},group:{cursor:"pointer"}})}if(y){const t=i.getCellOriginValue(n,r),e=y(i,t);e&&(m?m.group.fill=e:m={group:{fill:e}})}let v,w,C,x=!0;if("body"!==i.getCellLocation(n,r)?(w=e?.headerCustomRender,C=e?.headerCustomLayout):(w=e?.customRender||i.customRender,C=e?.customLayout),C||w){const t=Oj(C,w,n,r,i.getColWidth(n),i.getRowHeight(r),!1,"autoHeight"===i.heightMode,i);v=t.elementsGroup,x=t.renderDefault}b=qN(i,l,0,h,n,r,o,s,a,c,u,d,p,v,x,m),f&&(b.mergeCol=g.end.col,b.mergeRow=g.end.row);const _=i.internalProps.layoutMap.getAxisConfigInPivotChart(n,r);if(_){const t=new hW(_,b.attribute.width,b.attribute.height,i);b.clear(),b.appendChild(t.component),t.overlap()}else i.internalProps.layoutMap.isEmpty(n,r)&&b.clear()}else if("image"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=xj("padding",d._getCellStyle(n,r),n,r,d);bu(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new bj({x:e,y:i,width:o,height:s,lineWidth:p?.group?.lineWidth??void 0,fill:p?.group?.fill??void 0,stroke:p?.group?.stroke??void 0,strokeArrayWidth:p?.group?.strokeArrayWidth??void 0,strokeArrayColor:p?.group?.strokeArrayColor??void 0,cursor:p?.group?.cursor??void 0,lineCap:"square",clip:!0});g.role="cell",g.col=n,g.row=r,t?.addChild(g);const m=d.getCellValue(n,r),y=rT({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[0]-h[2],image:m,cursor:"pointer"});return y.name="image",y.keepAspectRatio=a,y.successCallback=a||l?()=>{const t=y.resources.get(y.attribute.image).data;if(l&&_j(n,r,t.width,t.height,d.scenegraph,h),a){const{width:e,height:i}=vj(t.width,t.height,g.attribute.width-h[1]-h[3],g.attribute.height-h[0]-h[2]),n=wj(0,0,g.attribute.width,g.attribute.height,e,i,c,u,h);y.setAttributes({x:n.x,y:n.y,width:e,height:i})}d.scenegraph.updateNextFrame()}:()=>{Sj(g,n,r,d)},y.failCallback=()=>{const t=yj();y.image=t.damage_pic.svg},g.appendChild(y),g}(l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,c,u,d,i,m);else if("video"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=xj("padding",d._getCellStyle(n,r),n,r,d);bu(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new bj({x:e,y:i,width:o,height:s,lineWidth:p?.group?.lineWidth??void 0,fill:p?.group?.fill??void 0,stroke:p?.group?.stroke??void 0,strokeArrayWidth:p?.group?.strokeArrayWidth??void 0,strokeArrayColor:p?.group?.strokeArrayColor??void 0,cursor:p?.group?.cursor??void 0,lineCap:"square",clip:!0});g.role="cell",g.col=n,g.row=r,t?.addChild(g);const m=d.getCellValue(n,r),y=document.createElement("video");y.addEventListener("loadeddata",(()=>{l&&_j(n,r,y.videoWidth,y.videoHeight,d.scenegraph,h);const t=g.attribute.width,e=g.attribute.height;if(a){const{width:i,height:n}=vj(y.videoWidth,y.videoHeight,t-h[1]-h[3],e-h[0]-h[2]),r=wj(0,0,t,e,i,n,c,u,h);b.setAttributes({width:i,height:n,x:r.x,y:r.y})}else b.setAttributes({x:h[3],y:h[0],width:t-h[1]-h[3],height:e-h[2]-h[0]});const i=Math.floor(Math.min(t-h[1]-h[3],e-h[2]-h[0])/2),o=0+(t>b.attribute.width?b.attribute.x-0+b.attribute.width/2:t/2),s=0+(e>b.attribute.height?b.attribute.y-0+b.attribute.height/2:e/2),p=new Pj({x:o-i/2,y:s-i/2,width:i,height:i,image:ZN.play.svg,cursor:ZN.play.cursor});p.name="play-icon",g.appendChild(p),d.scenegraph.updateNextFrame()})),y.onerror=()=>{b.image=ZN.damage_pic.svg},y.src=m,y.setAttribute("preload","auto");const b=rT({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[2]-h[0],image:y,cursor:"pointer"});return b.name="image",g.appendChild(b),g}(l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,c,u,d,i,m);else if("chart"===t){const t=i.internalProps.layoutMap.getChartInstance(n,r);b=YN(null,l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),c,i.getCellValue(n,r),e.chartModule,i.isPivotChart()?i.internalProps.layoutMap.getChartSpec(n,r):e.chartSpec,t,i.internalProps.layoutMap?.getChartDataId(n,r)??"data",i,m)}else if("progressbar"===t){const t=i._getCellStyle(n,r),p=i.getCellValue(n,r),f=i.getCellOriginValue(n,r);b=qN(i,l,0,h,n,r,o,s,a,c,u,d,!1,null,!0,m);const g=Aj(e,t,o,p,f,n,r,0,i);b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g)}else"sparkline"===t&&(b=Mj(null,l,0,h,n,r,s,a,c,i,m));return b}function tG(t,e,i,n){const r=i.scenegraph.highPerformanceGetCell(t,e,!0);if(!n&&"empty"===r.role)return;const o=i.isHeader(t,e)?i._getHeaderLayoutMap(t,e).headerType:i.getBodyColumnType(t,e),s=i.getCellLocation(t,e),a="body"!==s?i.getHeaderDefine(t,e):i.getBodyColumnDefine(t,e);let l,h,c;if(("body"!==s||a?.mergeCell)&&(h=i.getCellRange(t,e),l=h.start.col!==h.end.col||h.start.row!==h.end.row),!l||t===h.start.col&&e===h.start.row){const u="body"!==s||(!!a?.icon||!!a?.tree),d=pj(i._getCellStyle(t,e),i,t,e,Cj).theme,p=d._vtable.padding,f=d._vtable.textAlign,g=d._vtable.textBaseline;let m,y,b;i.internalProps?.dataConfig?.mappingRules&&!i.isHeader(t,e)&&i.internalProps?.dataConfig?.mappingRules?.forEach(((n,r)=>{n.bgColor&&i.internalProps.layoutMap.getIndicatorKey(t,e)===n.bgColor.indicatorKey&&(m=n.bgColor.mapping)})),"body"!==s?(a?.headerCustomRender,a?.headerCustomLayout):(a?.customRender||i.customRender,a?.customLayout),h?(y=i.getColsWidth(h.start.col,h.end.col),b=i.getRowsHeight(h.start.row,h.end.row)):(y=i.getColWidth(t),b=i.getRowHeight(e));const v=i.getCellValue(t,e);Yp(v)?(r.removeAllChild(),JN(v,i,eG.bind(null,o,a,i,t,e,m,y,b,r,p,f,g,u,l,h,n,d))):c=eG(o,a,i,t,e,m,y,b,r,p,f,g,u,l,h,n,d)}else c=new bj({x:0,y:n?0:r.attribute.y,width:0,height:0,visible:!1,pickable:!1}),c.role="shadow-cell",c.col=t,c.row=e,c.mergeCol=h.start.col,c.mergeRow=h.start.row,n||(r.parent.insertAfter(c,r),r.parent.removeChild(r),tG(h.start.col,h.start.row,i,!1));return c}function eG(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m){const y=QN(t,e,i,n,r,i.getColWidth(n),s,a,g?i.scenegraph.getColGroup(n):l.parent,g?0:l.attribute.y,h,c,u,d,p,f,m);return g||(l.parent.insertAfter(y,l),l.parent.removeChild(l),i.scenegraph?.proxy.cellCache.get(n)&&i.scenegraph?.proxy.cellCache.set(n,y)),y}function iG(t,e,i,n,r,o,s,a,l,h){let c,u,d,p=0,f=0;t.colHeight&&(f=t.colHeight);for(let g=n;g<=r;g++){const n=g,r="body"!==l?a.getHeaderDefine(e,n):a.getBodyColumnDefine(e,n),m="body"!==l||(!!r?.icon||!!r?.tree),y=pj(a._getCellStyle(e,n),a,e,n,Cj).theme;y.group.width=i,y.group.height=Array.isArray(s)?s[n]:s,y._vtable.padding&&(c=y._vtable.padding),y.text.textAlign&&(u=y.text.textAlign),y.text.textBaseline&&(d=y.text.textBaseline),"body"===l||y.group.fill||(y.group.fill="#fff");let b=i,v=a.getRowHeight(n);const w=(a.isHeader(e,n)?a._getHeaderLayoutMap(e,n).headerType:a.getBodyColumnType(e,n))||"text";let C,x,_;if(("body"!==l||r?.mergeCell)&&(x=a.getCellRange(e,n),_=x.start.col!==x.end.col||x.start.row!==x.end.row,_&&(b=0,v=0,C=o.get(`${x.start.col},${x.start.row};${x.end.col},${x.end.row}`),!C))){for(let t=x.start.col;t<=x.end.col;t++)b+=a.getColWidth(t);for(let t=x.start.row;t<=x.end.row;t++)v+=a.getRowHeight(t);o.set(`${x.start.col},${x.start.row};${x.end.col},${x.end.row}`,{x:0,y:f,cellWidth:b,cellHeight:v})}if(C){const i=C.cellHeight/(x.end.row-x.start.row+1),r=new bj({x:0,y:f,width:0,height:i,visible:!1,pickable:!1});r.role="shadow-cell",r.col=e,r.row=n,r.mergeCol=x.start.col,r.mergeRow=x.start.row,t?.addChild(r),t.updateColumnRowNumber(n),t.updateColumnHeight(i),x=a.getCellRange(e,n),f+=i,p=Math.max(p,C.cellWidth)}else{const o=a.getCellValue(e,n);if(Yp(o)){JN(o,a,QN.bind(null,w,r,a,e,n,i,b,v,t,f,c,u,d,m,_,x,y)),t.updateColumnRowNumber(n);const s=_?a.getRowHeight(n)/(x.end.row-x.start.row+1):a.getRowHeight(n);t.updateColumnHeight(s),f+=s}else{const o=QN(w,r,a,e,n,i,b,v,t,f,c,u,d,m,_,x,y);t.updateColumnRowNumber(n);const s=_?o.attribute.height/(x.end.row-x.start.row+1):o.attribute.height;t.updateColumnHeight(s),f+=s}}if(h&&n>h)break}return t.setAttribute("width",i),{width:i,height:f}}function nG(t,e,i,n,r,o,s,a,l,h){if(n>r||o>s)return;const{layoutMap:c,defaultRowHeight:u,defaultHeaderRowHeight:d,defaultColWidth:p}=l.internalProps;let f=0,g=0;for(let c=n;c<=r;c++){const n=c,r=l.getColWidth(n),p=new bj({x:e+f,y:i,width:r,height:0,clip:!1,pickable:!1});p.role="column",p.col=c,t.addChild(p);const{width:m,height:y}=iG(p,n,r,o,s,l.scenegraph.mergeMap,"columnHeader"===a?d??u:u,l,a,h);f+=m,g=Math.max(g,y)}t.setAttribute("width",f),t.setAttribute("height",g)}function rG(t,e){for(let i=0;i<e.table.colCount;i++){if(i>=e.table.rowHeaderLevelCount&&i<e.colStart||i>e.colEnd&&i<e.table.colCount-e.table.rightFrozenColCount)continue;const n=Sk(e.table,i,t);if(n&&n.start.row!==t){const r=e.highPerformanceGetCell(i,t,!0),o=tG(n.start.col,n.start.row,e.table,!0);o.col=i,o.row=t,o.setAttribute("y",e.table.getRowsHeight(e.table.columnHeaderLevelCount,n.start.row-1)),r.parent.insertAfter(o,r),r.parent.removeChild(r),r.needUpdate=!1,o.needUpdate=!1,e.cellCache.get(i)&&e.cellCache.set(i,o)}}}function oG(t,e,i){for(let n=0;n<i.table.rowCount;n++){if(n>=i.table.columnHeaderLevelCount&&n<i.rowStart||n>i.rowEnd&&n<i.table.rowCount-i.table.bottomFrozenRowCount)continue;const r=Sk(i.table,t,n);if(r&&r.start.col!==t){if(e&&sG(r.start.col,r.end.col,n,i))continue;const o=i.highPerformanceGetCell(t,n,!0),s=tG(r.start.col,r.start.row,i.table,!0);s.col=t,s.row=n,s.setAttribute("x",i.table.getColsWidth(i.table.rowHeaderLevelCount,r.start.col-1)-o.parent.attribute.x),o.parent.insertAfter(s,o),o.parent.removeChild(o),o.needUpdate=!1,s.needUpdate=!1,i.cellCache.get(t)&&i.cellCache.set(t,s)}}}function sG(t,e,i,n){for(let r=t;r<=e;r++)if("shadow-cell"!==n.highPerformanceGetCell(r,i,!0).role&&"empty"!==n.highPerformanceGetCell(r,i,!0).role)return!0;return!1}function aG(t){let e=t.firstChild;for(;"group"!==e.type;)e=e._next;return e}function lG(t){let e=t.lastChild;for(;"group"!==e.type;)e=e._prev;return e}function hG(t,e,i,n="left"){for(let r=t;r<=e;r++){const t=i.scenegraph.getColGroup(r);t&&cG(t,i,n);const e=i.scenegraph.getColGroup(r,!0);e&&cG(e,i,n);const o=i.scenegraph.getColGroupInBottom(r);o&&cG(o,i,n)}const r=Math.min(i.scenegraph.proxy.colLimit,i.scenegraph.proxy.bodyRightCol-i.scenegraph.proxy.bodyLeftCol+1),o=i.getColsWidth(i.rowHeaderLevelCount,i.rowHeaderLevelCount+r),s=i.getColsWidth(i.rowHeaderLevelCount,i.colCount-1);i.scenegraph.proxy.xLimitLeft=o/2,i.scenegraph.proxy.xLimitRight=s-o/2}function cG(t,e,i="left"){if("left"===i){let i;const n=function(t){let e=t._prev;for(;e&&"group"!==e.type;)e=e._prev;return e}(t);i=n?n.attribute.x+e.getColWidth(t._prev.col):e.getColsWidth(e.rowHeaderLevelCount,t.col-1),t.setAttribute("x",i)}else{let i;const n=function(t){let e=t._next;for(;e&&"group"!==e.type;)e=e._next;return e}(t);i=n?n.attribute.x-e.getColWidth(t.col):e.getColsWidth(e.rowHeaderLevelCount,t.col-1),t.setAttribute("x",i)}}async function uG(t,e,i,n,r){if("left"===e&&r.colEnd+t>r.bodyRightCol?t=r.bodyRightCol-r.colEnd:"right"===e&&r.colStart-t<r.bodyLeftCol&&(t=r.colStart-r.bodyLeftCol),!(t<=0))if(t<r.colEnd-r.colStart){const o="left"===e?r.colStart:r.colEnd-t+1,s="left"===e?r.colStart+t-1:r.colEnd,a="left"===e?r.colEnd+1:r.colStart-t,l="left"===e?r.colEnd+t:r.colStart-1;kN(r.table,a,l),function(t,e,i,n){for(let r=t;r<=e;r++)n.table.scenegraph.bodyGroup.childrenCount>0&&fG(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.colHeaderGroup.childrenCount>0&&fG(n.table.scenegraph.colHeaderGroup,i,n),n.table.scenegraph.bottomFrozenGroup.childrenCount>0&&fG(n.table.scenegraph.bottomFrozenGroup,i,n)}(o,s,e,r);const h=a,c=l;r.colStart="left"===e?r.colStart+t:r.colStart-t,r.colEnd="left"===e?r.colEnd+t:r.colEnd-t,oG(a,!0,r),gG(h,c,r),hG(h,c,r.table,e);const u=n-(r.table.scenegraph.getColGroup(i).attribute.x+r.table.getFrozenColsWidth()+r.table.scenegraph.proxy.deltaX);r.table.scenegraph.proxy.deltaX+=u,r.currentCol="left"===e?r.currentCol+t:r.currentCol-t,r.totalCol="left"===e?r.totalCol+t:r.totalCol-t,r.referenceCol=r.colStart+Math.floor((r.colEnd-r.colStart)/2),r.colUpdatePos=a,r.colUpdateDirection=e,r.table.scenegraph.updateNextFrame(),await r.progress()}else{const i="left"===e?r.colStart+t:r.colStart-t,n="left"===e?r.colEnd+t:r.colEnd-t;kN(r.table,i,n);!function(t,e,i,n){n.table.scenegraph.colHeaderGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))})),n.table.scenegraph.bottomFrozenGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))})),n.table.scenegraph.bodyGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))}))}(r.table.getColsWidth(r.bodyLeftCol,i-1),t,e,r);const o=i,s=n;r.colStart=i,r.colEnd=n,oG(i,!1,r),gG(o,s,r),hG(o,s,r.table,n>r.bodyRightCol-(r.colEnd-r.colStart+1)?"right":"left"),r.table.scenegraph.proxy.deltaX=0,r.currentCol="left"===e?r.currentCol+t:r.currentCol-t,r.totalCol="left"===e?r.totalCol+t:r.totalCol-t,r.referenceCol=r.colStart+Math.floor((r.colEnd-r.colStart)/2),r.colUpdatePos=r.colStart,r.colUpdateDirection=n>r.bodyRightCol-(r.colEnd-r.colStart+1)?"right":"left",r.table.scenegraph.updateNextFrame(),await r.progress()}}function dG(t,e,i){t.col=e,t.forEachChildren((t=>{t.col=e,t.needUpdate=!0})),t.setAttribute("x",i),t.needUpdate=!0}function pG(t,e){if(!t)return;let i=t.firstChild;for(;i;){i=e.updateCellGroupContent(i)._next}t.needUpdate=!1,t.setAttribute("width",e.table.getColWidth(t.col))}function fG(t,e,i){if("left"===e){const e=aG(t),n=lG(t);dG(e,n.col+1,n.attribute.x+i.table.getColWidth(n.col)),t.appendChild(e),t.border&&t.appendChild(t.border)}else{const e=lG(t),n=aG(t);dG(e,n.col-1,n.attribute.x-i.table.getColWidth(n.col-1)),t.insertBefore(e,t.firstChild)}}function gG(t,e,i){for(let n=t;n<=e;n++){const t=i.table.scenegraph.getColGroup(n);t&&pG(t,i);const e=i.table.scenegraph.getColGroup(n,!0);e&&pG(e,i);const r=i.table.scenegraph.getColGroupInBottom(n);r&&pG(r,i)}}function mG(t,e,i,n,r,o="up"){if("up"===o)for(let o=t;o<=e;o++)for(let t=i;t<=n;t++){const e=r.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._prev?e._prev?.attribute.y+r.getRowHeight(e._prev.row):r.getRowsHeight(r.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}else for(let o=t;o<=e;o++)for(let t=n;t>=i;t--){const e=r.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._next?e._next?.attribute.y-r.getRowHeight(e.row):r.getRowsHeight(r.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}const s=Math.min(r.scenegraph.proxy.rowLimit,r.scenegraph.proxy.bodyBottomRow-r.scenegraph.proxy.bodyTopRow+1),a=r.getRowsHeight(r.columnHeaderLevelCount,r.columnHeaderLevelCount+s),l=r.getRowsHeight(r.columnHeaderLevelCount,r.rowCount-1);r.scenegraph.proxy.yLimitTop=a/2,r.scenegraph.proxy.yLimitBottom=l-a/2}async function yG(t,e,i,n,r){if("up"===e&&r.rowEnd+t>r.bodyBottomRow?t=r.bodyBottomRow-r.rowEnd:"down"===e&&r.rowStart-t<r.bodyTopRow&&(t=r.rowStart-r.bodyTopRow),t<r.rowEnd-r.rowStart){!function(t,e,i,n){for(let r=0;r<n.table.rowHeaderLevelCount;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}for(let r=n.table.colCount-n.table.rightFrozenColCount;r<n.table.colCount;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}for(let r=n.bodyLeftCol;r<=n.bodyRightCol;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}}("up"===e?r.rowStart:r.rowEnd-t+1,"up"===e?r.rowStart+t-1:r.rowEnd,e,r);const o="up"===e?r.rowEnd+1:r.rowStart-t,s="up"===e?r.rowEnd+t:r.rowStart-1;let a,l;if("autoHeight"===r.table.heightMode)a=o,l=s;else{const t=Math.max(r.bodyTopRow,i-1*r.screenRowCount),e=Math.min(r.bodyBottomRow,i+2*r.screenRowCount);a=Math.max(o,t),l=Math.min(s,e)}if(jN(r.table,a,l),r.rowStart="up"===e?r.rowStart+t:r.rowStart-t,r.rowEnd="up"===e?r.rowEnd+t:r.rowEnd-t,rG(a,r),vG(a,l,r),"autoHeight"===r.table.heightMode){mG(r.bodyLeftCol,r.bodyRightCol,a,l,r.table,e);const t=n-(r.table.scenegraph.highPerformanceGetCell(r.bodyLeftCol,i,!0).attribute.y+r.table.getFrozenRowsHeight()+r.table.scenegraph.proxy.deltaY);r.table.scenegraph.proxy.deltaY+=t}r.currentRow="up"===e?r.currentRow+t:r.currentRow-t,r.totalRow="up"===e?r.totalRow+t:r.totalRow-t,r.referenceRow=r.rowStart+Math.floor((r.rowEnd-r.rowStart)/2),r.rowUpdatePos=o,r.rowUpdateDirection=e,r.table.scenegraph.updateNextFrame(),"autoHeight"!==r.table.heightMode&&await r.progress()}else{const n="up"===e?r.rowStart+t:r.rowStart-t,o="up"===e?r.rowEnd+t:r.rowEnd-t;let s,a;!function(t,e,i,n){for(let r=0;r<n.table.rowHeaderLevelCount;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}for(let r=n.table.colCount-n.table.rightFrozenColCount;r<n.table.colCount;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}for(let r=n.bodyLeftCol;r<=n.bodyRightCol;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}}(r.table.getRowsHeight(r.bodyTopRow,n-1),t,e,r),"autoHeight"===r.table.heightMode?(s=n,a=o):(s=Math.max(r.bodyTopRow,i-1*r.screenRowCount),a=Math.min(r.bodyBottomRow,i+2*r.screenRowCount)),jN(r.table,s,a),r.rowStart=n,r.rowEnd=o,rG(s,r),vG(s,a,r),"autoHeight"===r.table.heightMode&&mG(r.bodyLeftCol,r.bodyRightCol,s,a,r.table,o>r.bodyBottomRow-(r.rowEnd-r.rowStart+1)?"down":"up"),r.table.scenegraph.proxy.deltaY=0,r.currentRow="up"===e?r.currentRow+t:r.currentRow-t,r.totalRow="up"===e?r.totalRow+t:r.totalRow-t,r.referenceRow=r.rowStart+Math.floor((r.rowEnd-r.rowStart)/2),r.rowUpdatePos=r.rowStart,r.rowUpdateDirection=o>r.bodyBottomRow-(r.rowEnd-r.rowStart+1)?"down":"up",r.table.scenegraph.updateNextFrame(),"autoHeight"!==r.table.heightMode&&await r.progress()}}function bG(t,e,i){if("up"===e){const e=t.firstChild;i.updateCellGroupPosition(e,t.lastChild.row+1,t.lastChild.attribute.y+i.table.getRowHeight(t.lastChild.row)),t.appendChild(e)}else{const e=t.lastChild;i.updateCellGroupPosition(e,t.firstChild.row-1,t.firstChild.attribute.y-i.table.getRowHeight(e.row)),t.insertBefore(e,t.firstChild)}}function vG(t,e,i){for(let n=0;n<i.table.rowHeaderLevelCount;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r,!0);i.updateCellGroupContent(t)}for(let n=i.table.colCount-i.table.rightFrozenColCount;n<i.table.colCount;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r);i.updateCellGroupContent(t)}for(let n=i.bodyLeftCol;n<=i.bodyRightCol;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r);i.updateCellGroupContent(t)}}class wG{table;mode="column";rowLimit=1e3;currentRow=0;totalRow;yLimitTop;yLimitBottom;rowStart=0;rowEnd=0;referenceRow=0;bodyTopRow;bodyBottomRow;screenRowCount;firstScreenRowLimit;taskRowCount;rowUpdatePos;rowUpdateDirection;screenTopRow=0;deltaY=0;colLimit=100;bodyLeftCol;bodyRightCol;totalCol;colStart;colEnd;taskColCount;xLimitLeft;xLimitRight;screenColCount;firstScreenColLimit;colUpdatePos;currentCol;referenceCol;screenLeftCol=0;colUpdateDirection;deltaX=0;cellCache=new Map;constructor(t){this.table=t,this.table.isPivotChart()?(this.rowLimit=100,this.colLimit=100):"autoHeight"===this.table.heightMode?this.rowLimit=100:"autoWidth"===this.table.widthMode&&(this.colLimit=100),this.table.internalProps.transpose?this.mode="row":this.table.isPivotTable()&&(this.mode="pivot"),this.table.options.maintainedDataCount&&(this.rowLimit=this.table.options.maintainedDataCount)}setParamsForColumn(){this.bodyLeftCol=this.table.rowHeaderLevelCount,this.bodyRightCol=this.table.colCount-1-this.table.rightFrozenColCount;const t=Math.min(this.colLimit,this.bodyRightCol-this.bodyLeftCol+1);this.totalCol=this.bodyLeftCol+t-1,this.colStart=this.bodyLeftCol;const e=this.table.defaultColWidth;this.taskColCount=1*Math.ceil(this.table.tableNoFrameWidth/e);const i=e*t,n=e*(this.bodyRightCol-this.bodyLeftCol+1);this.xLimitLeft=i/2,this.xLimitRight=n-i/2;const r=5*this.table.tableNoFrameWidth;this.screenColCount=Math.ceil(this.table.tableNoFrameWidth/e),this.firstScreenColLimit=this.bodyLeftCol+Math.ceil(r/e),this.colUpdatePos=this.bodyRightCol}setParamsForRow(){this.bodyTopRow=this.table.columnHeaderLevelCount,this.bodyBottomRow=this.table.rowCount-1-this.table.bottomFrozenRowCount;const t=Math.min(this.rowLimit,this.bodyBottomRow-this.bodyTopRow+1);this.totalRow=this.bodyTopRow+t-1,this.rowStart=this.bodyTopRow;const e=this.table.defaultRowHeight;this.taskRowCount=1*Math.ceil(this.table.tableNoFrameHeight/e);const i=e*t,n=e*(this.bodyBottomRow-this.bodyTopRow+1);this.yLimitTop=i/2,this.yLimitBottom=n-i/2;const r=5*this.table.tableNoFrameHeight;this.screenRowCount=Math.ceil(this.table.tableNoFrameHeight/e),this.firstScreenRowLimit=this.bodyTopRow+Math.ceil(r/e),this.rowUpdatePos=this.bodyBottomRow}async createGroupForFirstScreen(t,e,i,n,r,o,s,a){await async function(t,e,i,n,r,o,s,a,l){const{leftBottomCornerGroup:h,rightTopCornerGroup:c,rightBottomCornerGroup:u}=l.table.scenegraph;l.setParamsForRow(),l.setParamsForColumn(),kN(l.table,0,Math.min(l.firstScreenColLimit,l.table.colCount-1)),jN(l.table,0,Math.min(l.firstScreenRowLimit,l.table.rowCount-1)),l.table.rightFrozenColCount>0&&l.table.colCount-1>l.firstScreenColLimit&&kN(l.table,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1),l.table.bottomFrozenRowCount>0&&l.table.rowCount-1>l.firstScreenRowLimit&&kN(l.table,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1),l.table.scenegraph.colHeaderGroup.setAttribute("x",l.table.getFrozenColsWidth()),l.table.scenegraph.rowHeaderGroup.setAttribute("y",l.table.getFrozenRowsHeight()),l.table.scenegraph.bottomFrozenGroup.setAttribute("x",l.table.getFrozenColsWidth()),l.table.scenegraph.rightFrozenGroup.setAttribute("y",l.table.getFrozenRowsHeight()),l.table.scenegraph.bodyGroup.setAttributes({x:l.table.getFrozenColsWidth(),y:l.table.getFrozenRowsHeight()}),nG(t,s,a,0,l.table.rowHeaderLevelCount-1,0,l.table.columnHeaderLevelCount-1,"cornerHeader",l.table),nG(e,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),0,l.table.columnHeaderLevelCount-1,"columnHeader",l.table),nG(i,s,a,0,l.table.rowHeaderLevelCount-1,l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"rowHeader",l.table),l.table.bottomFrozenRowCount>0&&(l.table.isPivotChart()||nG(h,s,a,0,l.table.rowHeaderLevelCount-1,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"rowHeader",l.table),nG(r,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"body",l.table)),l.table.rightFrozenColCount>0&&(l.table.isPivotChart()||nG(c,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,0,l.table.columnHeaderLevelCount-1,"columnHeader",l.table),nG(n,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"body",l.table)),l.table.bottomFrozenRowCount>0&&l.table.rightFrozenColCount>0&&!l.table.isPivotChart()&&nG(u,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"body",l.table),nG(o,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"body",l.table),o.firstChild?(l.currentRow=o.firstChild?.rowNumber??l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=o.lastChild?.col??l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2),await l.progress()):(l.currentRow=l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2))}(t,e,i,n,r,o,s,a,this)}async progress(){return new Promise(((t,e)=>{setTimeout((async()=>{this.colUpdatePos<this.colEnd?(await this.updateColCellGroupsAsync(),await this.progress()):this.rowUpdatePos<this.rowEnd?(await this.updateRowCellGroupsAsync(),await this.progress()):this.currentCol<this.totalCol?(await this.createCol(),await this.progress()):this.currentRow<this.totalRow&&(await this.createRow(),await this.progress()),t()}),0)}))}async createRow(){this.taskRowCount&&(console.log("createRow",this.currentRow,this.currentRow+this.taskRowCount),this.createRowCellGroup(this.taskRowCount))}async createCol(){this.taskColCount&&(console.log("createCol",this.currentCol,this.currentCol+this.taskColCount),this.createColGroup(this.taskRowCount))}createRowCellGroup(t){const e=Math.min(this.totalRow,this.currentRow+t);if(jN(this.table,this.currentRow+1,e,!1),this.table.rowHeaderLevelCount){let t=0;for(let i=0;i<this.table.rowHeaderLevelCount;i++){const n=this.table.scenegraph.getColGroup(i),r="rowHeader",{height:o}=iG(n,i,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);t=Math.max(t,o),this.table.scenegraph.rowHeaderGroup.setAttribute("height",t)}}if(this.table.rightFrozenColCount){let t=0;for(let i=this.table.colCount-this.table.rightFrozenColCount;i<this.table.colCount;i++){const n=this.table.scenegraph.getColGroup(i),r="rowHeader",{height:o}=iG(n,i,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);t=Math.max(t,o),this.table.scenegraph.rightFrozenGroup.setAttribute("height",t)}}let i=0;for(let t=this.bodyLeftCol;t<=this.bodyRightCol;t++){const n=this.table.scenegraph.getColGroup(t),r="body",{height:o}=iG(n,t,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);i=Math.max(i,o)}this.table.scenegraph.bodyGroup.setAttribute("height",i),this.currentRow=e,this.rowEnd=e,this.rowUpdatePos=this.rowEnd,this.referenceRow=this.rowStart+Math.floor((e-this.rowStart)/2),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}createColGroup(t){const e=Math.min(this.totalCol,this.currentCol+t);kN(this.table,this.currentCol+1,e);for(let t=0;t<this.table.rowCount;t++){const e=this.highPerformanceGetCell(this.currentCol,t);Qu(e.mergeCol)&&e.mergeCol>this.currentCol&&this.table.scenegraph.updateCellContent(e.col,e.row)}if(this.table.columnHeaderLevelCount){const t=this.table.scenegraph.colHeaderGroup.lastChild instanceof bj?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;nG(this.table.scenegraph.colHeaderGroup,i,n,this.currentCol+1,e,0,this.table.columnHeaderLevelCount-1,"columnHeader",this.table)}if(this.table.bottomFrozenRowCount){const t=this.table.scenegraph.bottomFrozenGroup.lastChild instanceof bj?this.table.scenegraph.bottomFrozenGroup.lastChild:this.table.scenegraph.bottomFrozenGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;nG(this.table.scenegraph.bottomFrozenGroup,i,n,this.currentCol+1,e,this.table.rowCount-this.table.bottomFrozenRowCount,this.table.rowCount-1,"columnHeader",this.table)}const i=this.table.scenegraph.bodyGroup.lastChild instanceof bj?this.table.scenegraph.bodyGroup.lastChild:this.table.scenegraph.bodyGroup.lastChild._prev,n=i.attribute.x+i.attribute.width,r=i.attribute.y;nG(this.table.scenegraph.bodyGroup,n,r,this.currentCol+1,e,this.rowStart,this.rowEnd,"body",this.table),this.currentCol=e,this.colEnd=e,this.colUpdatePos=this.colEnd,this.referenceCol=this.colStart+Math.floor((e-this.colStart)/2),console.log("async",this.referenceCol,this.colStart,this.colEnd),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}async setY(t){t<this.yLimitTop&&this.rowStart===this.bodyTopRow||t>this.yLimitBottom&&this.rowEnd===this.bodyBottomRow?this.table.scenegraph.setBodyAndRowHeaderY(-t):this.dynamicSetY(t)}async setX(t){t<this.xLimitLeft&&this.colStart===this.bodyLeftCol||t>this.xLimitRight&&this.colEnd===this.bodyRightCol?this.table.scenegraph.setBodyAndColHeaderX(-t):this.dynamicSetX(t)}async dynamicSetY(t){!async function(t,e){const i=e.table.getTargetRowAt(t+e.table.scenegraph.colHeaderGroup.attribute.height);if(!i)return;const n=i.row,r=i.top;e.screenTopRow=n;const o=n-e.referenceRow;o>0?(yG(o,"up",n,r,e),e.updateBody(t-e.deltaY)):o<0?(yG(-o,"down",n,r,e),e.updateBody(t-e.deltaY)):e.updateBody(t-e.deltaY),e.table.scenegraph.updateNextFrame()}(t,this)}async dynamicSetX(t){!async function(t,e){const i=e.table.getTargetColAt(t+e.table.scenegraph.rowHeaderGroup.attribute.width);if(!i)return;const n=i.col,r=i.left;e.screenLeftCol=n;const o=e.screenLeftCol-e.referenceCol;o>0?(uG(o,"left",e.screenLeftCol,r,e),e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX)):o<0?(uG(-o,"right",e.screenLeftCol,r,e),e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX)):e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX),e.table.scenegraph.updateNextFrame()}(t,this)}updateBody(t){this.table.scenegraph.setBodyAndRowHeaderY(-t)}async updateRowCellGroupsAsync(){this.updateCellGroups(this.taskRowCount)}updateCellGroups(t){const e=Math.min(this.bodyBottomRow,this.rowUpdatePos+t);"autoHeight"===this.table.heightMode&&jN(this.table,this.rowUpdatePos,e,!1),vG(this.rowUpdatePos,e,this),"autoHeight"===this.table.heightMode&&mG(this.bodyLeftCol,this.bodyRightCol,this.rowUpdatePos,e,this.table,this.rowUpdateDirection),this.rowUpdatePos=e+1}async updateColCellGroupsAsync(){this.updateColGroups(this.taskRowCount)}updateColGroups(t){const e=Math.min(this.bodyRightCol,this.colUpdatePos+t);kN(this.table,this.colUpdatePos,e),gG(this.colUpdatePos,e,this),this.colUpdatePos=e+1}updateCellGroupPosition(t,e,i){t.row=e,t.setAttribute("y",i),t.needUpdate=!0,t.needUpdateForAutoRowHeight=!0}updateCellGroupContent(t){if(!t.needUpdate)return t;const e=this.table.scenegraph.updateCellContent(t.col,t.row);return t.needUpdate=!1,e||t}async sortCellVertical(){await async function(t){for(let e=t.bodyLeftCol;e<=t.bodyRightCol;e++)for(let i=t.rowStart;i<=t.rowEnd;i++)t.highPerformanceGetCell(e,i).needUpdate=!0;let e,i;"autoHeight"===t.table.heightMode?(e=t.rowStart,i=t.rowEnd):(e=Math.max(t.bodyTopRow,t.screenTopRow-1*t.screenRowCount),i=Math.min(t.bodyBottomRow,t.screenTopRow+2*t.screenRowCount)),jN(t.table,e,i),vG(e,i,t),"autoHeight"===t.table.heightMode&&mG(t.bodyLeftCol,t.bodyRightCol,e,i,t.table,t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up"),t.rowUpdatePos=t.rowStart,t.rowUpdateDirection=t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up",t.table.scenegraph.updateNextFrame(),"autoHeight"!==t.table.heightMode&&await t.progress()}(this)}async sortCellHorizontal(){await async function(t){for(let e=t.colStart;e<=t.colEnd;e++){const i=t.table.scenegraph.getColGroup(e);i.needUpdate=!0,i?.forEachChildren((t=>{t.needUpdate=!0}))}const e=Math.max(t.bodyLeftCol,t.screenLeftCol-1*t.screenColCount),i=Math.min(t.bodyRightCol,t.screenLeftCol+2*t.screenColCount);kN(t.table,e,i),gG(e,i,t),t.colUpdatePos=t.colStart,t.colUpdateDirection=t.colEnd>t.bodyRightCol-(t.colEnd-t.colStart+1)?"right":"left",t.table.scenegraph.updateNextFrame(),await t.progress()}(this)}highPerformanceGetCell(t,e,i){if(e>=this.table.columnHeaderLevelCount&&e<this.table.rowCount-this.table.bottomFrozenRowCount&&(e<this.rowStart||e>this.rowEnd))return KN;if(t>=this.table.rowHeaderLevelCount&&t<this.table.colCount-this.table.rightFrozenColCount&&(t<this.colStart||t>this.colEnd))return KN;if(this.cellCache.get(t)){const n=this.cellCache.get(t);if((n._next||n._prev)&&Math.abs(n.row-e)<e){let r=CG(n,e);return r&&(i||"shadow-cell"!==r.role)||(r=this.table.scenegraph.getCell(t,e,i)),r.row&&this.cellCache.set(t,r),r}const r=this.table.scenegraph.getCell(t,e,i);return r.col===t&&r.row&&this.cellCache.set(t,r),r}const n=this.table.scenegraph.getCell(t,e,i);return n.col===t&&n.row&&this.cellCache.set(t,n),n}}function CG(t,e){return t?t.row===e?t:t.row>e?CG(t._prev,e):CG(t._next,e):null}function xG(t,e,i){const[n,r,o,s]=e.split("-"),a=parseInt(n,10),l=parseInt(r,10),h=parseInt(o,10),c=parseInt(s,10);let u;for(let t=a;t<=h;t++)for(let e=l;e<=c;e++){const n=i.highPerformanceGetCell(t,e);if("cell"!==n.role)continue;n.AABBBounds.width();const r=n.globalAABBBounds;u?u.union(r):u=r}u?t.rect.setAttributes({x:u.x1-i.tableGroup.attribute.x,y:u.y1-i.tableGroup.attribute.y,width:u.width(),height:u.height(),visible:!0}):t.rect.setAttributes({visible:!1});const d=a===i.table.frozenColCount,p=l===i.table.frozenRowCount;d&&t.rect.attribute.stroke[3]||p&&t.rect.attribute.stroke[0]?(d&&i.tableGroup.insertAfter(t.rect,"columnHeader"===t.role?i.cornerHeaderGroup:i.rowHeaderGroup),p&&i.tableGroup.insertAfter(t.rect,"rowHeader"===t.role?i.cornerHeaderGroup:i.colHeaderGroup),t.rect.attribute.x<i.rowHeaderGroup.attribute.width&&i.table.scrollLeft>0&&("body"===t.role||"columnHeader"===t.role)&&t.rect.setAttributes({x:t.rect.attribute.x+(i.rowHeaderGroup.attribute.width-t.rect.attribute.x),width:t.rect.attribute.width-(i.rowHeaderGroup.attribute.width-t.rect.attribute.x)}),t.rect.attribute.y<i.colHeaderGroup.attribute.height&&i.table.scrollTop>0&&("body"===t.role||"rowHeader"===t.role)&&t.rect.setAttributes({y:t.rect.attribute.y+(i.colHeaderGroup.attribute.height-t.rect.attribute.y),height:t.rect.attribute.height-(i.colHeaderGroup.attribute.height-t.rect.attribute.y)})):i.tableGroup.insertAfter(t.rect,"body"===t.role?i.bodyGroup:"columnHeader"===t.role?i.colHeaderGroup:"rowHeader"===t.role?i.rowHeaderGroup:i.cornerHeaderGroup)}function _G(t,e,i){const n=i.scenegraph,r=SG(t.map((t=>t.row))).sort(((t,e)=>t-e)),o=SG(e.map((t=>t.row))).sort(((t,e)=>t-e));r.forEach((t=>{!function(t,e){for(let i=0;i<e.table.colCount;i++){const n=e.getColGroup(i,!1);let r;n.forEachChildren((e=>e.row===t&&(r=e,!0))),r&&n.removeChild(r)}}(t,n)})),r.length&&function(t){for(let e=0;e<t.table.colCount;e++){const i=t.getColGroup(e,!0),n=t.getColGroup(e,!1);let r=i.firstChild?.row;i.forEachChildren((t=>{t.row=r,r++})),r=n.firstChild?.row,n.forEachChildren((t=>{t.row=r,r++}))}}(n),o.forEach((t=>{!function(t,e){for(let i=0;i<e.table.colCount;i++){const n=tG(i,t,e.table,!0);if(!n)continue;const r=e.getColGroup(i);if(r.firstChild&&t<r.firstChild.row)r.insertBefore(n,r.firstChild);else if(r.lastChild&&t>r.lastChild.row)r.appendChild(n);else{let e;r.forEachChildren((i=>i.row===t&&(e=i,!0))),e!==n&&r.insertBefore(n,e)}let o=r.firstChild?.row;r.forEachChildren((t=>{t.row=o,o++}))}}(t,n)})),function(t){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!0),r=t.getColGroup(i,!1);let o=n.firstChild?.row,s=0;o=r.firstChild?.row,s=0,r.forEachChildren((t=>{t.row=o,o++,"cell"===t.role&&(t.setAttribute("y",s),s+=t.attribute.height)})),e=s}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}(n)}function SG(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}new Xx({});const AG=[];function TG(t){AG.forEach((e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((t=>{t.setAttributes({dy:0,dx:0})}))})),AG.length=0;const{scrollTop:e,scrollLeft:i,frozenRowCount:n,frozenColCount:r}=t,o=t.getFrozenRowsHeight(),s=t.getFrozenColsWidth(),{row:a}=t.getRowAt(e+o+1),{col:l}=t.getColAt(i+s+1),h=t.getAllRowsHeight()>t.tableNoFrameHeight?t.getRowAt(e+t.tableNoFrameHeight-1).row:t.rowCount-1,c=t.getAllColsWidth()>t.tableNoFrameWidth?t.getColAt(i+t.tableNoFrameWidth-1).col:t.colCount-1;for(let e=0;e<n;e++)for(let i=l;i<=c;i++)if(t._getCellStyle(i,e)?.textStick){MG(t.scenegraph.getCell(i,e),s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),AG.push({col:i,row:e})}if(-1!==a){for(let e=a;e<=h;e++)for(let i=0;i<r;i++)if(t._getCellStyle(i,e)?.textStick&&"tree"!==t.internalProps.layoutMap.rowHierarchyType){BG(t.scenegraph.getCell(i,e),o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),AG.push({col:i,row:e})}for(let e=a;e<=h;e++)for(let i=l;i<=c;i++)if(t._getCellStyle(i,e)?.textStick){const n=t.scenegraph.getCell(i,e);BG(n,o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),MG(n,s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),AG.push({col:i,row:e})}}}function BG(t,e,i){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const r=n.globalAABBBounds.y1,o=n.globalAABBBounds.y2;if(r<e){const i=r-e;t.forEachChildren((t=>{t.setAttribute("dy",2-i)}))}else if(o>i){const e=o-i;t.forEachChildren((t=>{t.setAttribute("dy",-e)}))}}function MG(t,e,i){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const r=n.globalAABBBounds.x1,o=n.globalAABBBounds.x2;if(r<e){const i=r-e;t.forEachChildren((t=>{t.setAttribute("dx",2-i)}))}else if(o>i){const e=o-i;t.forEachChildren((t=>{t.setAttribute("dx",-e)}))}}function RG(t){const e=t.bodyGroup.firstChild instanceof bj?t.bodyGroup.firstChild:null;e&&(t.rowHeaderGroup.appendChild(e),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width+e.attribute.width),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width-e.attribute.width))}function PG(t){const e=t.colHeaderGroup.firstChild instanceof bj?t.colHeaderGroup.firstChild:null;e&&(t.cornerHeaderGroup.appendChild(e),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width+e.attribute.width),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width-e.attribute.width))}function EG(t){const e=t.rowHeaderGroup.lastChild instanceof bj?t.rowHeaderGroup.lastChild:t.rowHeaderGroup.lastChild?._prev;e&&(LG(t.bodyGroup,e,t.bodyGroup.firstChild),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width+e.attribute.width),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width-e.attribute.width))}function HG(t){const e=t.cornerHeaderGroup.lastChild instanceof bj?t.cornerHeaderGroup.lastChild:t.cornerHeaderGroup.lastChild?._prev;e&&(LG(t.colHeaderGroup,e,t.colHeaderGroup.firstChild),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width+e.attribute.width),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width-e.attribute.width))}function LG(t,e,i){e&&t&&(i?t.insertBefore(e,i):t.appendChild(e))}function kG(t){for(let e=t.proxy.colStart;e<=t.proxy.colEnd;e++){t.getColGroup(e).getChildren().forEach((t=>{t.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null)}))}))}}function IG(t,e){t.forEachChildren((t=>{"column"===t.role&&t.forEachChildren((t=>{if("cell"===t.role){let i=!1;if(t.forEachChildren((t=>"axis"===t.name&&(i=!0,!0))),i){const i=e.internalProps.layoutMap.getAxisConfigInPivotChart(t.col,t.row),n=new hW(i,t.attribute.width,t.attribute.height,e);t.clear(),t.appendChild(n.component),n.overlap()}}}))}))}function OG(t,e){const{bgColor:i,borderColor:n,borderLineWidth:r,borderLineDash:o}=e,s={x:0,y:0,width:0,height:0,visible:!1,pickable:!0,fill:i};return s.stroke=Zj(n,void 0),s.lineWidth=r,o&&(s.lineDash=o),s.lineCap="square",Array.isArray(n)&&(s.strokeArrayColor=RW(n)),Array.isArray(r)&&(s.strokeArrayWidth=RW(r),s.lineWidth=1),t.setAttributes(s),t.role="corner-frozen",t}function DG(t,e){return new bj({x:0,y:0,width:t,height:e,clip:!1,pickable:!1})}function FG(t){let e=0;return t.forEachChildrenSkipChild(((t,i)=>{t.setAttribute("x",e),e+=t.attribute.width})),e}qb.load(Uk),qb.load(TN);const zG={visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}};class WG{proxy;tableGroup;colHeaderGroup;cornerHeaderGroup;rowHeaderGroup;bodyGroup;rightFrozenGroup;bottomFrozenGroup;rightTopCornerGroup;leftBottomCornerGroup;rightBottomCornerGroup;componentGroup;selectedRangeComponents;selectingRangeComponents;lastSelectId;component;stage;table;isPivot;transpose;hasFrozen;frozenColCount;frozenRowCount;clear;mergeMap;constructor(t){var e;this.table=t,this.hasFrozen=!1,this.clear=!0,this.mergeMap=new Map,e=zG,fd(zk.poptip,Fk,e),this.stage=function(t){return new xk(t)}({canvas:t.canvas,width:t.canvas.width,height:t.canvas.height,disableDirtyBounds:!1,background:t.theme.underlayBackgroundColor,dpr:t.internalProps.pixelRatio,pluginList:t.isPivotChart()?["poptipForText"]:void 0}),this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"},text:{ignoreBuf:!0}}),this.initSceneGraph(),this.stage.defaultLayer.add(this.tableGroup),this.stage.table=this.table,this.createComponent()}get width(){return this.tableGroup.attribute?.width??0}get height(){return this.tableGroup.attribute?.height??0}get x(){return this.tableGroup.attribute?.x??0}get y(){return this.tableGroup.attribute?.y??0}get bodyRowStart(){return this.transpose||this.isPivot?this.table.columnHeaderLevelCount:this.proxy.rowStart??0}get bodyRowEnd(){return this.transpose||this.isPivot?this.table.rowCount-1:this.proxy.rowEnd??0}initSceneGraph(){this.isPivot=this.table.isPivotTable(),this.transpose=this.table.options.transpose,function(t){const e=t.table.tableNoFrameWidth,i=t.table.tableNoFrameHeight;t.tableGroup=new bj({x:0,y:0,width:e,height:i,clip:!0,pickable:!1}),t.tableGroup.role="table";const n=DG(0,0);n.role="col-header",t.colHeaderGroup=n;const r=DG(0,0);r.role="corner-header",t.cornerHeaderGroup=r;const o=DG(0,0);o.role="row-header",t.rowHeaderGroup=o;const s=DG(e,0);s.role="body",t.bodyGroup=s;const a=DG(0,0);a.role="right-frozen",t.rightFrozenGroup=a;const l=DG(0,0);l.role="bottom-frozen",t.bottomFrozenGroup=l;const h=DG(0,0);h.role="component",t.componentGroup=h;const c=DG(0,0);c.role="corner-right-top-header",t.rightTopCornerGroup=c;const u=DG(0,0);u.role="corner-right-bottom-header",t.rightBottomCornerGroup=u;const d=DG(0,0);d.role="corner-left-bottom-header",t.leftBottomCornerGroup=d,t.table.isPivotChart()&&(OG(c,t.table.theme.cornerRightTopCellStyle||t.table.theme.cornerHeaderStyle),OG(d,t.table.theme.cornerLeftBottomCellStyle||t.table.theme.cornerHeaderStyle),OG(u,t.table.theme.cornerRightBottomCellStyle||t.table.theme.cornerHeaderStyle)),t.tableGroup.addChild(s),t.tableGroup.addChild(a),t.tableGroup.addChild(l),t.tableGroup.addChild(o),t.tableGroup.addChild(n),t.tableGroup.addChild(u),t.tableGroup.addChild(c),t.tableGroup.addChild(d),t.tableGroup.addChild(r),t.tableGroup.addChild(h)}(this)}clearCells(){this.clear=!0,this.hasFrozen=!1,this.mergeMap.clear(),this.colHeaderGroup.clear(),this.rowHeaderGroup.clear(),this.cornerHeaderGroup.clear(),this.bodyGroup.clear(),this.bottomFrozenGroup.clear(),this.rightFrozenGroup.clear(),this.rightTopCornerGroup.clear(),this.rightBottomCornerGroup.clear(),this.leftBottomCornerGroup.clear(),this.colHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rowHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.cornerHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bodyGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bottomFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightTopCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.leftBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.rightBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.tableGroup.setAttributes({x:this.table.tableX,y:this.table.tableY,width:0,height:0}),this.tableGroup.border&&(this.tableGroup.parent.removeChild(this.tableGroup.border),delete this.tableGroup.border)}createComponent(){this.component=new Xj(this.table),this.component.addToGroup(this.componentGroup),this.selectedRangeComponents=new Map,this.selectingRangeComponents=new Map}createSceneGraph(){this.clear=!1,this.frozenColCount=this.table.rowHeaderLevelCount,this.frozenRowCount=this.table.columnHeaderLevelCount,this.proxy=new wG(this.table),Yj(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0,!0),this.proxy.createGroupForFirstScreen(this.cornerHeaderGroup,this.colHeaderGroup,this.rowHeaderGroup,this.rightFrozenGroup,this.bottomFrozenGroup,this.bodyGroup,0,0),this.afterScenegraphCreated()}renderSceneGraph(){this.stage.render()}getCellOld(t,e){let i;if(i=this.hasFrozen&&t<this.table.frozenColCount&&e<this.table.frozenRowCount?this.cornerHeaderGroup.getChildAt(t)?.getChildAt(e):e<this.table.frozenRowCount?this.colHeaderGroup.getChildAt(this.hasFrozen?t-this.table.frozenColCount:t)?.getChildAt(e):t<this.table.frozenColCount?this.rowHeaderGroup.getChildAt(t)?.getChildAt(e-this.table.frozenRowCount):this.bodyGroup.getChildAt(t-this.table.frozenColCount)?.getChildAt(e-this.table.frozenRowCount),i&&"shadow-cell"===i.role){const n=this.table.getCellRange(t,e);i=this.getCell(n.start.col,n.start.row)}return i||void 0}getColGroupOld(t,e=!1){let i;return i=t<this.frozenColCount&&e?this.cornerHeaderGroup.getChildAt(t):t<this.frozenColCount?this.rowHeaderGroup.getChildAt(t):e?this.rowHeaderGroup.getChildAt(t-this.frozenColCount):this.bodyGroup.getChildAt(t-this.frozenColCount),i||void 0}getCell(t,e,i){let n;if(n=this.table.rightFrozenColCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e<this.table.frozenRowCount?this.rightBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>=this.table.rowCount-this.table.bottomFrozenRowCount&&t<this.table.frozenColCount?this.leftBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e>=this.table.rowCount-this.table.bottomFrozenRowCount?this.rightBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>this.table.rowCount-1-this.table.bottomFrozenRowCount?this.bottomFrozenGroup.getColGroup(t)?.getRowGroup(e):this.getColGroup(t,e<this.frozenRowCount)?.getRowGroup(e),n&&"shadow-cell"===n.role&&!i){const i=this.table.getCellRange(t,e);i.start.col===t&&i.start.row===e||(n=this.getCell(i.start.col,i.start.row))}return n||KN}highPerformanceGetCell(t,e,i){return this.proxy.highPerformanceGetCell(t,e,i)}getColGroup(t,e=!1){let i;return i=t<this.frozenColCount&&e?this.cornerHeaderGroup.getColGroup(t):t<this.frozenColCount?this.rowHeaderGroup.getColGroup(t):e?this.colHeaderGroup.getColGroup(t):!e&&this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t):this.bodyGroup.getColGroup(t),i||void 0}getColGroupInBottom(t){if(this.table.bottomFrozenRowCount>0)return this.bottomFrozenGroup.getColGroup(t)}getColGroupInLeftBottomCorner(t){if(this.table.bottomFrozenRowCount>0)return this.leftBottomCornerGroup.getColGroup(t)}getColGroupInRightTopCorner(t){if(this.table.rightFrozenColCount>0)return this.rightTopCornerGroup.getColGroup(t)}getColGroupInRightBottomCorner(t){if(this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0)return this.rightBottomCornerGroup.getColGroup(t)}getCellSize(t,e){const i=this.getCell(t,e),n=Sk(this.table,t,e);let r=i.attribute.width,o=i.attribute.height;return n&&(r/=n.end.col-n.start.col+1,o/=n.end.row-n.start.row+1),{width:r,height:o}}updateNextFrame(){this.resetAllSelectComponent(),this.stage.renderNextFrame()}resetAllSelectComponent(){var t;(t=this).selectingRangeComponents.forEach(((e,i)=>{xG(e,i,t)})),t.selectedRangeComponents.forEach(((e,i)=>{xG(e,i,t)}))}hideHoverIcon(t,e){if(-1===t||-1===e)return;NG(this,this.getCell(t,e),"mouseenter_cell")}showHoverIcon(t,e){if(-1===t||-1===e)return;jG(this,this.getCell(t,e),"mouseenter_cell")}hideClickIcon(t,e){if(-1===t||-1===e)return;NG(this,this.getCell(t,e),"click_cell")}showClickIcon(t,e){if(-1===t||-1===e)return;jG(this,this.getCell(t,e),"click_cell")}deactivateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.deactivate?.()}activateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.activate?.(this.table)}removeInteractionBorder(t,e){const i=this.getCell(t,e);i.setAttribute("highlightStroke",void 0),i.setAttribute("highlightStrokeArrayWidth",void 0),i.setAttribute("highlightStrokeArrayColor",void 0)}createCellSelectBorder(t,e,i,n,r,o,s){!function(t,e,i,n,r,o,s,a){const l=Math.min(e,n),h=Math.min(i,r),c=Math.max(e,n),u=Math.max(i,r);let d;for(let e=l;e<=c;e++)for(let i=h;i<=u;i++){const n=t.highPerformanceGetCell(e,i);if("shadow-cell"===n.role)continue;n.AABBBounds.width();const r=n.globalAABBBounds;d?d.union(r):d=r}const p=t.table.theme,f=p.selectionStyle?.cellBorderColor,g=p.selectionStyle?.cellBorderLineWidth,m=eT({pickable:!1,fill:p.selectionStyle?.cellBgColor??"rgba(0, 0, 255,0.1)",lineWidth:g,stroke:a.map((t=>!!t&&f)),x:d.x1-t.tableGroup.attribute.x,y:d.y1-t.tableGroup.attribute.y,width:d.width(),height:d.height(),visible:!0});t.lastSelectId=s,t.selectingRangeComponents.set(`${l}-${h}-${c}-${u}-${s}`,{rect:m,role:o}),t.tableGroup.insertAfter(m,"body"===o?t.bodyGroup:"columnHeader"===o?t.colHeaderGroup:"rowHeader"===o?t.rowHeaderGroup:t.cornerHeaderGroup)}(this,t,e,i,n,r,o,s)}moveSelectingRangeComponentsToSelectedRangeComponents(){var t;(t=this).selectingRangeComponents.forEach(((e,i)=>{t.selectedRangeComponents.get(i)&&t.selectedRangeComponents.get(i).rect.delete(),t.selectedRangeComponents.set(i,e)})),t.selectingRangeComponents=new Map,t.updateNextFrame()}deleteLastSelectedRangeComponents(){var t;(t=this).selectedRangeComponents.forEach(((e,i)=>{i.split("-")[4]===t.lastSelectId&&(e.rect.delete(),t.selectedRangeComponents.delete(i))}))}deleteAllSelectBorder(){var t;(t=this).selectedRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectedRangeComponents=new Map}updateCellSelectBorder(t,e,i,n){!function(t,e,i,n,r){let o=Math.min(n,e),s=Math.min(r,i),a=Math.max(n,e),l=Math.max(r,i);const h=()=>{let e=!1;for(let i=o;i<=a;i++){if(i===o)for(let n=s;n<=l;n++){const r=Sk(t.table,i,n);if(r&&r.start.col<o){o=r.start.col,e=!0;break}}if(!e&&i===a)for(let n=s;n<=l;n++){const r=Sk(t.table,i,n);if(r&&r.end.col>a){a=r.end.col,e=!0;break}}if(e)break}if(!e)for(let i=s;i<=l;i++){if(i===s)for(let n=o;n<=a;n++){const r=Sk(t.table,n,i);if(r&&r.start.row<s){s=r.start.row,e=!0;break}}if(!e&&i===l)for(let n=o;n<=a;n++){const r=Sk(t.table,n,i);if(r&&r.end.row>l){l=r.end.row,e=!0;break}}if(e)break}e&&h()};h(),t.selectingRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectingRangeComponents=new Map;let c=!1,u=!1,d=!1,p=!1;if(o<=t.table.frozenColCount-1&&s<=t.table.frozenRowCount-1&&(p=!0),o<=t.table.frozenColCount-1&&l>=t.table.frozenRowCount&&(c=!0),s<=t.table.frozenRowCount-1&&a>=t.table.frozenColCount&&(u=!0),a>=t.table.frozenColCount&&l>=t.table.frozenRowCount&&(d=!0),p){const e=Math.min(a,t.table.frozenColCount-1),i=Math.min(l,t.table.frozenRowCount-1),n=[!0,!u,!c,!0];t.createCellSelectBorder(o,s,e,i,"cornerHeader",`${o}${s}${a}${l}`,n)}if(u){const e=Math.max(o,t.table.frozenColCount),i=Math.min(l,t.table.frozenRowCount-1),n=[!0,!0,!d,!p];t.createCellSelectBorder(e,s,a,i,"columnHeader",`${o}${s}${a}${l}`,n)}if(c){const e=Math.max(s,t.table.frozenRowCount),i=Math.min(a,t.table.frozenColCount-1),n=[!p,!d,!0,!0];t.createCellSelectBorder(o,e,i,l,"rowHeader",`${o}${s}${a}${l}`,n)}if(d){const e=Math.max(o,t.table.frozenColCount),i=Math.max(s,t.table.frozenRowCount),n=[!u,!0,!0,!c];t.createCellSelectBorder(e,i,a,l,"body",`${o}${s}${a}${l}`,n)}}(this,t,e,i,n)}getIcon(t,e,i,n){let r;return this.getCell(t,e).forEachChildren((t=>{"icon"===t.role&&t.containsPoint(i,n,xy.GLOBAL)&&(r=t)})),r}setIconHoverStyle(t,e,i,n){if(t.attribute.backgroundColor){let e=t.parent.getChildByName("icon-back");e?e.setAttributes({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,visible:!0}):(e=eT({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,pickable:!1,visible:!0}),e.name="icon-back"),t.parent.insertBefore(e,t)}if(t.attribute.hoverImage&&t.attribute.image!==t.attribute.hoverImage&&(t.image=t.attribute.hoverImage),t.tooltip){const{x1:n,x2:r,y1:o,y2:s}=t.globalAABBBounds,a={content:t.tooltip.title,referencePosition:{rect:{left:n-this.table.tableX,right:r-this.table.tableX,top:o-this.table.tableY,bottom:s-this.table.tableY,width:t.globalAABBBounds.width(),height:t.globalAABBBounds.height()},placement:t.tooltip.placement},style:Object.assign({},this.table.internalProps.theme?.tooltipStyle,t.tooltip?.style)};this.table.internalProps.tooltipHandler.isBinded(a)||this.table.showTooltip(e,i,a)}}setIconNormalStyle(t,e,i){const n=t.parent.getChildByName("icon-back");n&&n.setAttribute("visible",!1),t.attribute.hoverImage&&t.attribute.image!==t.attribute.originImage&&(t.image=t.attribute.originImage)}updateColWidth(t,e){!function(t,e,i){const n="autoHeight"===t.table.heightMode,r=t.getColGroup(e,!0);r&&zj(r,i,n,"col-corner",t);const o=t.getColGroup(e);o&&zj(o,i,n,"row-body",t);const s=t.getColGroupInLeftBottomCorner(e);s&&zj(s,i,n,"left-bottom",t);const a=t.getColGroupInBottom(e);a&&zj(a,i,n,"bottom",t);const l=t.getColGroupInRightBottomCorner(e);l&&zj(a,i,n,"right-bottom",t),e<t.frozenColCount?(t.cornerHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.rowHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))):(t.colHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.bodyGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))),s&&t.leftBottomCornerGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),a&&t.bottomFrozenGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),l&&t.rightBottomCornerGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.table.setColWidth(e,o.attribute.width,!0)}(this,t,e),this.updateContainer()}updateChartSize(t){!function(t,e){for(let i=e;i<=t.proxy.colEnd;i++)t.getColGroup(i).getChildren().forEach((e=>{const i=t.table.getColWidth(e.col),n=t.table.getRowHeight(e.row);e.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null,t.setAttribute("width",Math.ceil(i-t.attribute.cellPadding[3]-t.attribute.cellPadding[1])),t.setAttribute("height",Math.ceil(n-t.attribute.cellPadding[0]-t.attribute.cellPadding[2])))}))}))}(this,t)}updateChartState(t){this.table.isPivotChart()&&function(t,e){const i=t.table;if(i.isPivotChart()){const n=i._selectedDataItemsInChart.length;if((null===e||0===e?.length||0===Object.keys(e).length)&&0===n)return;const r=[];if(Array.isArray(e))e.forEach((t=>{if(t&&0!==t.key&&Object.keys(t).length>0){const e={};for(const i in t)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(e[i]=t[i]);r.push(e)}}));else if(e&&0!==e.key&&Object.keys(e).length>0){const t={};for(const i in e)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(t[i]=e[i]);r.push(t)}yd(i._selectedDataItemsInChart,r)||(i._selectedDataItemsInChart=r,i.internalProps.layoutMap.updateDataStateToChartInstance(),kG(t),i.scenegraph.updateNextFrame())}}(this,t)}updateAutoColWidth(t){this.table.internalProps._widthResizedColMap.delete(t);const e=this.table.getColWidth(t),i=IN(t,0,this.table.rowCount-1,this.table);i!==e&&this.updateColWidth(t,i-e)}recalculateColWidths(){kN(this.table,0,this.table.colCount-1,!0)}recalculateRowHeights(){jN(this.table,0,this.table.rowCount-1,!0,!0)}resize(){"adaptive"===this.table.widthMode&&this.recalculateColWidths(),"adaptive"===this.table.heightMode&&this.recalculateRowHeights(),this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.updateTableSize(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),"adaptive"!==this.table.widthMode&&"adaptive"!==this.table.heightMode||this.updateChartSize(this.table.rowHeaderLevelCount),this.updateNextFrame()}updateTableSize(){this.tableGroup.setAttributes({width:Math.min(this.table.tableNoFrameWidth,Math.max(this.colHeaderGroup.attribute.width,this.bodyGroup.attribute.width,0)+Math.max(this.cornerHeaderGroup.attribute.width,this.rowHeaderGroup.attribute.width,0)+this.rightBottomCornerGroup.attribute.width),height:Math.min(this.table.tableNoFrameHeight,(this.colHeaderGroup.attribute.height??0)+(this.bodyGroup.attribute.height??0)+this.bottomFrozenGroup.attribute.height)}),this.tableGroup.border&&this.tableGroup.border.setAttributes({width:this.tableGroup.attribute.width+this.tableGroup.border.attribute.lineWidth,height:this.tableGroup.attribute.height+this.tableGroup.border.attribute.lineWidth}),this.table.bottomFrozenRowCount>0&&(this.bottomFrozenGroup.setAttribute("y",this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height),this.leftBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height,width:this.table.getFrozenColsWidth()}),this.rightBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height})),this.table.rightFrozenColCount>0&&(this.rightFrozenGroup.setAttribute("x",this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width),this.rightTopCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width,height:this.table.getFrozenRowsHeight()}),this.rightBottomCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width}))}updateRowHeight(t,e){!function(t,e,i){for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=Sk(t.table,n,e);o&&o.start.col!==n||(Fj(t,r,n,e,r.attribute.height,i,t.table.isHeader(n,e)),t.updateCellContentWhileResize(n,e))}let n=0,r=0;e<t.table.columnHeaderLevelCount?(t.colHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height+i),t.rowHeaderGroup.setAttribute("y",t.colHeaderGroup.attribute.y+i),t.bodyGroup.setAttribute("y",t.bodyGroup.attribute.y+i),n=e+1,r=t.table.columnHeaderLevelCount-1):(n=e+1,r=t.bodyRowEnd-t.table.bottomFrozenRowCount);for(let e=n;e<=r;e++)for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=Sk(t.table,n,e);(!o||o.start.col===n&&o.start.row===e)&&r.setAttribute("y",r.attribute.y+i)}t.table.setRowHeight(e,t.table.getRowHeight(e)+i,!0)}(this,t,e),this.updateContainerHeight(t,e)}updateContainerWidth(t,e){t<this.frozenColCount?(this.rowHeaderGroup.setDeltaWidth(e),this.cornerHeaderGroup.setDeltaWidth(e),this.colHeaderGroup.setDeltaX(e),this.bodyGroup.setDeltaX(e)):(this.colHeaderGroup.setDeltaWidth(e),this.bodyGroup.setDeltaWidth(e)),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}updateContainerHeight(t,e){t<this.table.frozenRowCount?(this.colHeaderGroup.setDeltaHeight(e),this.cornerHeaderGroup.setDeltaHeight(e),this.rowHeaderGroup.setDeltaY(e),this.bodyGroup.setDeltaY(e)):t>=this.table.rowCount-this.table.bottomFrozenRowCount?(this.leftBottomCornerGroup.setDeltaHeight(e),this.bottomFrozenGroup.setDeltaHeight(e),this.rightBottomCornerGroup.setDeltaHeight(e)):(this.rowHeaderGroup.setDeltaHeight(e),this.bodyGroup.setDeltaHeight(e)),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}setColWidth(t,e){const i=this.table.getColWidth(t);i!==e&&(this.updateColWidth(t,e-i),this.table._clearColRangeWidthsMap(t))}setRowHeight(t,e){const i=this.table.getRowHeight(t);i!==e&&(this.updateRowHeight(t,e-i),this.table._clearRowRangeHeightsMap(t))}setX(t){this.table.scenegraph.proxy.setX(-t)}setY(t){this.table.scenegraph.proxy.setY(-t)}setBodyAndRowHeaderY(t){this.colHeaderGroup.attribute.height+t!==this.bodyGroup.attribute.y&&(this.bodyGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.table.rightFrozenColCount>0&&this.rightFrozenGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.updateNextFrame())}setBodyAndColHeaderX(t){this.rowHeaderGroup.attribute.width+t!==this.bodyGroup.attribute.x&&(this.bodyGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.colHeaderGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.table.bottomFrozenRowCount>0&&this.bottomFrozenGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.updateNextFrame())}afterScenegraphCreated(){this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.createFrameBorder(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),TG(this.table),this.updateNextFrame()}dealWidthMode(){const t=this.table;if("adaptive"===t.widthMode){const e=t.tableNoFrameWidth-t.getFrozenColsWidth()-t.getRightFrozenColsWidth();let i=0;for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)i+=t.getColWidth(e);const n=e/i;for(let i=t.frozenColCount;i<t.colCount-t.rightFrozenColCount;i++){let r;r=i===t.colCount-t.rightFrozenColCount-1?e-t.getColsWidth(t.frozenColCount,t.colCount-t.rightFrozenColCount-2):Math.round(t.getColWidth(i)*n),this.setColWidth(i,r)}}else if(t.autoFillWidth){const e=t.tableNoFrameWidth;let i=0,n=0;for(let e=0;e<t.colCount;e++){const r=t.getColWidth(e);(e<t.frozenColCount||e>=t.colCount-t.rightFrozenColCount)&&(n+=r),i+=r}if(i<e&&i-n>0){const r=(e-n)/(i-n);for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)this.setColWidth(e,t.getColWidth(e)*r)}}let e=0;this.bodyGroup.forEachChildrenSkipChild((t=>{e+=t.attribute.width})),this.bodyGroup.setAttribute("width",e);let i=0;this.colHeaderGroup.forEachChildrenSkipChild((t=>{i+=t.attribute.width})),this.colHeaderGroup.setAttribute("width",i);let n=0;this.rowHeaderGroup.forEachChildrenSkipChild((t=>{n+=t.attribute.width})),this.rowHeaderGroup.setAttribute("width",n);let r=0;this.cornerHeaderGroup.forEachChildrenSkipChild((t=>{r+=t.attribute.width})),this.cornerHeaderGroup.setAttribute("width",r),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height),this.bodyGroup.setAttributes({x:this.rowHeaderGroup.attribute.width,y:this.colHeaderGroup.attribute.height})}dealHeightMode(){const t=this.table;if("adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight-t.getFrozenRowsHeight()-t.getBottomFrozenRowsHeight();let i=0;for(let e=t.frozenRowCount;e<t.rowCount-t.bottomFrozenRowCount;e++)i+=t.getRowHeight(e);const n=e/i;for(let i=t.frozenRowCount;i<t.rowCount-t.bottomFrozenRowCount;i++){let r;r=i===t.rowCount-t.bottomFrozenRowCount-1?e-t.getRowsHeight(t.frozenRowCount,t.rowCount-t.bottomFrozenRowCount-2):Math.round(t.getRowHeight(i)*n),this.setRowHeight(i,r)}}}dealFrozen(){!function(t){if(t.table.frozenColCount>t.table.rowHeaderLevelCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.frozenColCount-t.table.rowHeaderLevelCount;e++)RG(t),PG(t)}else if(t.table.frozenColCount<t.table.rowHeaderLevelCount)for(let e=0;e<t.table.rowHeaderLevelCount-t.table.frozenColCount;e++)EG(t),HG(t);t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0,t.frozenColCount=t.table.frozenColCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0}(this)}resetFrozen(){!function(t){if(t.frozenColCount>t.table.rowHeaderLevelCount)for(let e=0;e<t.frozenColCount-t.table.rowHeaderLevelCount;e++)EG(t),HG(t);else if(t.frozenColCount<t.table.rowHeaderLevelCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.rowHeaderLevelCount-t.frozenColCount;e++)RG(t),PG(t)}t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0,t.frozenColCount=t.table.rowHeaderLevelCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0}(this)}updateCellLayoutWidthCertainWidth(t,e,i){const n=t.attribute.width;let r=!1;return t.forEachChildren(((t,o)=>{o+=e;const s=Sk(this.table,i,o);s?t=this.getCell(s.start.col,s.start.row):t.setAttribute("width",n);const a=RW(Cj("padding",this.table._getCellStyle(i,o),i,o,this.table)),l=t.getChildByName("text");let h=0,c=0;if(l)h=l.AABBBounds.height()+(a[0]+a[2]),l.setAttribute("maxLineWidth",n-(a[1]+a[3])),c=l.AABBBounds.height()+(a[0]+a[2]);else{const e=t.getChildAt(1);h=e.AABBBounds.height()+(a[0]+a[2]),e._cellWidth=n-(a[1]+a[3]),e.layout(),c=e.AABBBounds.height()+(a[0]+a[2])}const u=this.table.getRowHeight(o);t.attribute.height!==c&&(t.setAttribute("height",c),(u===h||c>u)&&(r=!0))})),r}updateHeaderPosition(t,e,i,n){!function(t,e,i,n,r){const o=r.scenegraph,s=r.getCellLocation(i,n),a="columnHeader"===s?"column":"rowHeader"===s?"row":void 0;let l=0,h=0,c=0,u=0,d=0,p=0,f=0,g=0;if("column"===a){const o=Sk(r,t,e),s=Sk(r,i,n);o&&s?(l=o.start.col,c=o.end.col,d=s.start.col,f=s.end.col):(l=t,c=t,d=i,f=i),h=e,u=r.rowCount-1,p=n,g=r.rowCount-1}else if("row"===a){const o=Sk(r,t,e),s=Sk(r,i,n);o&&s?(h=o.start.row,u=o.end.row,p=s.start.row,g=s.end.row):(h=e,u=e,p=n,g=n),l=t,c=r.colCount-1,d=i,f=r.colCount-1}const m=Math.min(l,d),y=Math.max(c,f),b=Math.min(h,p),v=Math.max(u,g);for(let t=m;t<=y;t++){const e=r.scenegraph.getColGroup(t,!0),i=r.scenegraph.getColGroup(t);e&&e.setAttribute("width",r.getColWidth(t)),i&&i.setAttribute("width",r.getColWidth(t))}o.updateContainer();for(let t=m;t<=y;t++){const e=r.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=b;e<=v;e++)o.updateCellContent(t,e)}}(t,e,i,n,this.table)}updateContainer(){const t=FG(this.cornerHeaderGroup),e=FG(this.rowHeaderGroup),i=FG(this.colHeaderGroup),n=FG(this.bodyGroup),r=FG(this.rightFrozenGroup);FG(this.bottomFrozenGroup),FG(this.leftBottomCornerGroup),FG(this.rightTopCornerGroup),FG(this.rightBottomCornerGroup),this.cornerHeaderGroup.setDeltaWidth(t-this.cornerHeaderGroup.attribute.width),this.leftBottomCornerGroup.setDeltaWidth(t-this.leftBottomCornerGroup.attribute.width),this.colHeaderGroup.setDeltaWidth(i-this.colHeaderGroup.attribute.width),this.rightFrozenGroup.setDeltaWidth(i-this.rightFrozenGroup.attribute.width),this.rowHeaderGroup.setDeltaWidth(e-this.rowHeaderGroup.attribute.width),this.bottomFrozenGroup.setDeltaWidth(e-this.bottomFrozenGroup.attribute.width),this.rightFrozenGroup.setDeltaWidth(r-this.rightFrozenGroup.attribute.width),this.rightTopCornerGroup.setDeltaWidth(r-this.rightTopCornerGroup.attribute.width),this.rightBottomCornerGroup.setDeltaWidth(r-this.rightBottomCornerGroup.attribute.width),this.bodyGroup.setDeltaWidth(n-this.bodyGroup.attribute.width),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.bottomFrozenGroup.setAttribute("x",this.rowHeaderGroup.attribute.width),this.bodyGroup.setAttribute("x",this.rowHeaderGroup.attribute.width),this.updateTableSize();const o=this.table.stateManeger.scroll.horizontalBarPos,s=this.table.stateManeger.scroll.verticalBarPos;this.component.updateScrollBar(),this.table.stateManeger.setScrollLeft(o),this.table.stateManeger.setScrollTop(s),this.updateNextFrame()}updateCellContentWhileResize(t,e){const i=this.table.getBodyColumnType(t,e),n=this.getCell(t,e);"image"!==i&&"video"!==i||Sj(n,t,e,this.table)}createFrameBorder(){this.updateTableSize();const t=!this.isPivot;Yj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,this.bodyGroup.role,t?[!0,!0,!0,!1]:void 0),Yj(this.rowHeaderGroup,this.isPivot?this.table.theme.rowHeaderStyle.frameStyle:this.table.theme.bodyStyle.frameStyle,this.rowHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),Yj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,this.colHeaderGroup.role,t?[!0,!0,!0,!1]:void 0),Yj(this.cornerHeaderGroup,this.isPivot?this.table.theme.cornerHeaderStyle.frameStyle:this.table.theme.headerStyle.frameStyle,this.cornerHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),Yj(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0)}getResizeColAt(t,e,i,n=8){if(i){let e;if(t<i.globalAABBBounds.x1+n?e={col:i.col-1,row:i.row,x:i.globalAABBBounds.x1}:i.globalAABBBounds.x2-n<t&&(e={col:i.col,row:i.row,x:i.globalAABBBounds.x2}),e&&this.table.rightFrozenColCount>0&&e.col===this.table.colCount-this.table.rightFrozenColCount-1&&this.table.tableNoFrameWidth-this.table.getFrozenColsWidth()-this.table.getRightFrozenColsWidth()+this.table.scrollLeft<this.bodyGroup.attribute.width&&(e.col=e.col+1,e.rightFrozen=!0),e)return e}else;return{col:-1,row:-1}}updateIcon(t,e){Lj(e,t),t.name=e.name,this.updateNextFrame()}updateFrozen(){this.clear||(this.resetFrozen(),this.dealFrozen(),this.component.updateScrollBar())}dealWidthRightFrozen(t){this.clear?this.table.internalProps.rightFrozenColCount=t:function(t,e){const{table:i,proxy:n,rightTopCornerGroup:r,rightFrozenGroup:o,rightBottomCornerGroup:s,bottomFrozenGroup:a,bodyGroup:l,colHeaderGroup:h}=e,c=e.table.rightFrozenColCount;if(t>c){for(let n=i.colCount-c-1;n>=i.colCount-t;n--)LG(o,e.getColGroup(n),o.firstChild),LG(r,e.getColGroup(n,!0),r.firstChild),LG(s,e.getColGroupInBottom(n),s.firstChild);let n=0;o.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,r.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,s.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width}))}else if(t<c){for(let n=i.colCount-c;n<i.colCount-t;n++){const t=e.getColGroup(n);t.setAttribute("x",l.lastChild.attribute.x+i.getColWidth(l.lastChild.col)),l.appendChild(t);const r=e.getColGroupInRightTopCorner(n);r.setAttribute("x",h.lastChild.attribute.x+i.getColWidth(h.lastChild.col)),h.appendChild(r);const o=e.getColGroupInRightBottomCorner(n);o.setAttribute("x",a.lastChild.attribute.x+i.getColWidth(a.lastChild.col)),a.appendChild(o)}let n=0;o.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,r.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,s.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width}))}o.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),r.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),s.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),i.internalProps.rightFrozenColCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}dealWidthBottomFrozen(t){this.clear?this.table.internalProps.bottomFrozenRowCount=t:function(t,e){const{table:i,proxy:n,bottomFrozenGroup:r,leftBottomCornerGroup:o,rightBottomCornerGroup:s}=e;r.childrenCount||(n.table.isPivotChart()||(nG(o,0,0,0,i.rowHeaderLevelCount-1,0,-1,"rowHeader",i),nG(s,0,0,i.colCount-i.rightFrozenColCount,i.colCount-1,0,-1,"body",i)),nG(r,0,0,n.colStart,n.colEnd,0,-1,"body",i));const a=e.table.bottomFrozenRowCount;if(t>a){for(let n=0;n<i.rowHeaderLevelCount;n++){const r=e.getColGroupInLeftBottomCorner(n);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)LG(r,e.getCell(n,o,!0),r.firstChild);let o=0;r.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}for(let r=n.colStart;r<=n.colEnd;r++){const n=e.getColGroupInBottom(r);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)LG(n,e.getCell(r,o,!0),n.firstChild);let o=0;n.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let n=i.colCount-i.rightFrozenColCount;n<i.colCount;n++){const r=e.getColGroupInRightBottomCorner(n);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)LG(r,e.getCell(n,o,!0),r.firstChild);let o=0;r.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}}else if(t<a){for(let n=0;n<i.rowHeaderLevelCount;n++){const r=e.getColGroup(n);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(n,o,!0);t.setAttribute("y",r.lastChild.attribute.y+i.getRowHeight(r.lastChild.row)),r.appendChild(t)}const o=e.getColGroupInLeftBottomCorner(n);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}for(let r=n.colStart;r<=n.colEnd;r++){const n=e.getColGroup(r);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(r,o,!0);t.setAttribute("y",n.lastChild.attribute.y+i.getRowHeight(n.lastChild.row)),n.appendChild(t)}const o=e.getColGroupInBottom(r);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let n=i.colCount-i.rightFrozenColCount;n<i.colCount;n++){const r=e.getColGroup(n);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(n,o,!0);t.setAttribute("y",r.lastChild.attribute.y+i.getRowHeight(r.lastChild.row)),r.appendChild(t)}const o=e.getColGroupInRightBottomCorner(n);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}}r.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),o.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),s.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),i.internalProps.bottomFrozenRowCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}updateBorderSizeAndPosition(){this.bodyGroup.border&&(this.bodyGroup.appendChild(this.bodyGroup.border),Jj(this.bodyGroup),0===this.rowHeaderGroup.attribute.width?qj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!0]):qj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!1])),this.colHeaderGroup.border&&(this.colHeaderGroup.appendChild(this.colHeaderGroup.border),Jj(this.colHeaderGroup),0===this.cornerHeaderGroup.attribute.width?qj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!0]):qj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!1])),this.rowHeaderGroup.border&&(this.rowHeaderGroup.appendChild(this.rowHeaderGroup.border),Jj(this.rowHeaderGroup)),this.cornerHeaderGroup.border&&(this.cornerHeaderGroup.appendChild(this.cornerHeaderGroup.border),Jj(this.cornerHeaderGroup))}updateSortIcon(t,e,i,n,r,o,s){const a=this.table.internalProps.headerHelper.getSortIcon(n,this.table,t,e);if(i&&this.updateIcon(i,a),s!==i){const t=this.table.internalProps.headerHelper.getSortIcon("normal",this.table,r,o);if(s)this.updateIcon(s,t);else{let e;this.getCell(r,o).forEachChildren((t=>"sort"===t.attribute.funcType&&(e=t,!0))),e&&this.updateIcon(e,t)}}}updateFrozenIcon(t,e){const i=Math.max(t,e);this.colHeaderGroup.forEachChildrenSkipChild((t=>!(t.col<=i)||(t.forEachChildren((t=>{t.forEachChildren((e=>{if("frozen"===e.attribute.funcType){const i=this.table.internalProps.headerHelper.getFrozenIcon(t.col,t.row);return this.updateIcon(e,i),!0}return!1}))})),!1))),this.cornerHeaderGroup.forEachChildrenSkipChild((t=>!(t.col<=i)||(t.forEachChildren((t=>{t.forEachChildren((e=>{if("frozen"===e.attribute.funcType){const i=this.table.internalProps.headerHelper.getFrozenIcon(t.col,t.row);return this.updateIcon(e,i),!0}return!1}))})),!1)))}sortCell(){this.isPivot||(this.transpose?this.proxy.sortCellHorizontal():this.proxy.sortCellVertical())}getCellOverflowText(t,e){const i=this.getCell(t,e).getChildByName("text",!0);if(i){const t=qu(i.attribute.text)?i.attribute.text.join(""):i.attribute.text;let e="";if(Yu(i.cache.clipedText)?e=i.cache.clipedText:i.cache.layoutData.lines.forEach((t=>{e+=t.str})),e!==t)return t}return null}updateDrill(t,e,i,n,r){this.component.drillIcon.update(t,e,i,n,r,this)}updateCellContent(t,e){if(!this.clear)return tG(t,e,this.table)}setPixelRatio(t){this.stage.disableDirtyBounds(),this.stage.window.setDpr(t),this.stage.render(),this.stage.enableDirtyBounds()}updateHierarchyIcon(t,e){const i=this.getCell(t,e);let n;n=this.table.isHeader(t,e)?this.table.internalProps.headerHelper.getHierarchyIcon(i.col,i.row):this.table.internalProps.bodyHelper.getHierarchyIcon(i.col,i.row),this.findAndUpdateIcon(i,[Jc.collapse,Jc.expand],n)}updateRow(t,e){_G(t,e,this.table),this.recalculateColWidths(),this.recalculateRowHeights(),this.table.stateManeger.checkFrozen(),this.updateNextFrame()}findAndUpdateIcon(t,e,i){t.forEachChildren((t=>{if("group"===t.type)this.findAndUpdateIcon(t,e,i);else if(-1!==e.indexOf(t.attribute.funcType))return this.updateIcon(t,i),!0;return!1}))}}function jG(t,e,i){e.forEachChildren((e=>{"group"===e.type?jG(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!0,t.updateNextFrame())}))}function NG(t,e,i){e.forEachChildren((e=>{"group"===e.type?NG(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!1,t.updateNextFrame())}))}function GG(t,e,i){const n=t.getCell(e,i);if("shadow-cell"===n.role){t.getCell(n.mergeCol,n.mergeRow).addUpdateBoundTag()}else n.addUpdateBoundTag()}function VG(t,e,i,n,r){const o=t.table;for(let i=0;i<o.columnHeaderLevelCount;i++)GG(t,e,i);const s=t.getColGroup(e);return s?.addUpdateBoundTag(),!0}function UG(t,e,i,n,r,o){const s=t.table;for(let i=0;i<s.columnHeaderLevelCount;i++)GG(t,e,i);const a=t.getColGroup(e);return a?.addUpdateBoundTag(),!0}function KG(t,e,i,n,r){const o=t.table;for(let e=0;e<o.colCount;e++)GG(t,e,i);return!0}function $G(t,e,i,n,r,o){const s=t.table;for(let e=0;e<s.colCount;e++)GG(t,e,i);return!0}function XG(t,e,i){const{table:n}=t,{scenegraph:r}=n,{highlightScope:o,singleStyle:s,disableHeader:a,cellPos:l,cellPosContainHeader:h}=t.hover,c=l.col,u=l.row;if(o===Kc.none||a&&(h.col!==e||h.row!==i)){const t=h.col,n=h.row;r.hideHoverIcon(t,n),r.showHoverIcon(e,i),h.col=e,h.row=i}if((a&&n.isHeader(e,i)||o===Kc.none)&&(e=-1,i=-1),c===e&&u===i)return;r.deactivateChart(c,u),r.activateChart(e,i);let d=!1;const{ranges:p,highlightScope:f}=t.select;if(-1!==c&&-1!==u&&(d=function(t,e,i,n,r,o,s){let a=!1;o===Kc.single?a=!!function(t,e,i,n,r){return GG(t,e,i),!0}(t,e,i)||a:o===Kc.row?a=!!KG(t,0,i)||a:o===Kc.column?a=!!VG(t,e)||a:o===Kc.cross&&(a=!!KG(t,0,i)||a,a=!!VG(t,e)||a);return a}(r,c,u,0,0,o),a||r.hideHoverIcon(c,u)),-1===e||-1===i)return l.col=-1,l.row=-1,void(!d||c===e&&u===i||t.table.scenegraph.updateNextFrame());o===Kc.single?d=!!function(t,e,i,n,r){return GG(t,e,i),!0}(r,e,i)||d:o===Kc.row?d=!!$G(r,0,i)||d:o===Kc.column?d=!!UG(r,e)||d:o===Kc.cross&&(d=!!$G(r,0,i)||d,d=!!UG(r,e)||d),o===Kc.none||a||r.showHoverIcon(e,i),l.col=e,l.row=i,d&&t.table.scenegraph.updateNextFrame()}function YG(t,e,i){let n,r=null,o=!1;if(Array.isArray(i.sortState))for(let s=0;s<i.sortState.length&&(n=i.sortState[s],n&&(r=i._getHeaderCellBySortState(n)),r&&(o=qG(t,e,r.col,r.row,i)),!o);s++);else n=i.sortState,n&&(r=i._getHeaderCellBySortState(n)),r&&(o=qG(t,e,r.col,r.row,i));const s=i.getHeaderDefine(t,e);n&&o&&s?.sort?n.order="asc"===n.order?"desc":"desc"===n.order?"normal":"asc":s?.sort?n={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"asc"}:o&&s?.showSort||(n={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"normal"});i.fireListeners(sf.SORT_CLICK,n).includes(!1)||(i.internalProps.sortState=n,i.stateManeger.setSortState(n),s?.sort&&function(t,e,i){let n;n=t.fieldKey?e.internalProps.layoutMap.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.internalProps.layoutMap.headerObjects.find((e=>e&&e.field===t.field));if(!n)return;const{field:r}=n;if(null===r)return;"function"==typeof i.sort?e.dataSource.sort(r,t.order||"asc",i.sort):e.dataSource.sort(r,t.order||"asc",Cu)}(n,i,s),i.scenegraph.sortCell(),i.stateManeger.updateSelectPos(-1,-1))}function qG(t,e,i,n,r){return r._getLayoutCellId(t,e)===r._getLayoutCellId(i,n)}const ZG=Up(sf,{PIVOT_SORT_CLICK:"pivot_sort_click",DRILLMENU_CLICK:"drillmenu_click"}),JG=Up(sf,{VCHART_EVENT_TYPE:"vchart_event_type"});function QG(t){if(!("canMoveHeaderPosition"in t.table.internalProps.layoutMap))return;setTimeout((()=>{t.columnMove.moving=!1}),0);t.table.moveHeaderPosition({col:t.columnMove.colSource,row:t.columnMove.rowSource},{col:t.columnMove.colTarget,row:t.columnMove.rowTarget})&&(!function(t,e,i,n,r){const o=Math.min(t,i),s=Math.max(t,i),a=Math.min(e,n),l=Math.max(e,n);for(let t=o;t<=s;t++)r._clearColRangeWidthsMap(t);for(let t=a;t<=l;t++)r._clearRowRangeHeightsMap(t)}(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget,t.table),t.table.clearCellStyleCache(),t.table.scenegraph.updateHeaderPosition(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget)),t.updateCursor(),t.table.scenegraph.component.hideMoveCol(),t.table.scenegraph.updateNextFrame()}function tV(t){if(!t)return;const e=t.role?.startsWith("icon")?t:"richtext"===t.type?t._currentHoverIcon:void 0;return e?"richtext"===t.type?{icon:e,position:{left:t.globalAABBBounds.x1+e.globalAABBBounds.x1,right:t.globalAABBBounds.x1+e.globalAABBBounds.x2,top:t.globalAABBBounds.y1+e.globalAABBBounds.y1,bottom:t.globalAABBBounds.y1+e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"richtext-icon"}:{icon:e,position:{left:e.globalAABBBounds.x1,right:e.globalAABBBounds.x2,top:e.globalAABBBounds.y1,bottom:e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"icon"}:void 0}function eV(t,e){if("adaptive"===e.table.widthMode&&e.columnResize.col<e.table.colCount-1){const i=e.table.getColWidth(e.columnResize.col+1);i-t<0&&(t=i),e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.scenegraph.updateColWidth(e.columnResize.col+1,-t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col),e.table.internalProps._widthResizedColMap.add(e.columnResize.col+1)}else e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col)}class iV{table;interactionState;select;hover;hoverIcon;residentHoverIcon;columnResize;columnMove;menu;sort;frozen;scroll;tablePosition;drill;sparkLine;_clearVerticalScrollBar;_clearHorizontalScrollBar;resetInteractionState=lf((()=>{this.updateInteractionState(Uc.default)}),100);constructor(t){this.table=t,this.initState(),this.updateVerticalScrollBar=this.updateVerticalScrollBar.bind(this),this.updateHorizontalScrollBar=this.updateHorizontalScrollBar.bind(this)}initState(){this._initState(),this.setHoverState(),this.setSelectState(),this.setFrozenState()}_initState(){this.interactionState=Uc.default,this.select={highlightScope:Kc.single,ranges:[],cellPos:{col:-1,row:-1},selecting:!1},this.hover={highlightScope:Kc.single,cellPos:{col:-1,row:-1}},this.hoverIcon={col:-1,row:-1,icon:null},this.columnResize={col:-1,x:0,resizing:!1},this.columnMove={colSource:-1,colTarget:-1,rowSource:-1,rowTarget:-1,x:0,y:0,moving:!1},this.menu={x:-1,y:-1,isShow:!1,itemList:[],bounds:new ep,highlightIndex:-1,dropDownMenuHighlight:[]},this.sort={col:-1,row:-1,order:"normal"},this.frozen={col:-1},this.scroll={horizontalBarPos:0,verticalBarPos:0},this.tablePosition={absoluteX:0,absoluteY:0},this.drill={col:-1,row:-1},this.sparkLine={col:-1,row:-1}}setHoverState(){const{highlightMode:t,disableHover:e,disableHeaderHover:i}=this.table.options.hover??{highlightMode:"cell"};e?this.hover.highlightScope=Kc.none:"cross"===t?this.hover.highlightScope=Kc.cross:"row"===t?this.hover.highlightScope=Kc.row:"column"===t?this.hover.highlightScope=Kc.column:"cell"===t&&(this.hover.highlightScope=Kc.single),this.hover.singleStyle=!e,this.hover.disableHeader=i,(this.hover.highlightScope===Kc.none||i)&&(this.hover.cellPosContainHeader={col:-1,row:-1})}setSelectState(){const{disableSelect:t,disableHeaderSelect:e}=this.table.options?.select??{disableSelect:!1,disableHeaderSelect:!1};this.select.highlightScope=t?Kc.none:Kc.single,this.select.singleStyle=!t,this.select.disableHeader=e}isSelected(t,e){let i=!1;return this.select.ranges.forEach((n=>{qp(n,t,e)&&(i=!0)})),i}setSortState(t){this.sort.field=t.field,this.sort.fieldKey=t.fieldKey,this.sort.order=t.order}setFrozenState(){this.frozen.col=this.table.frozenColCount-1}updateInteractionState(t){this.interactionState!==t&&(this.interactionState=t)}updateHoverhighlightScope(t){this.hover.highlightScope!==t&&(this.hover.highlightScope=t)}updateHoverPos(t,e){XG(this,t,e)}updateSelectPos(t,e,i=!1,n=!1,r=!1){-1!==e&&-1!==e&&(this.select.selecting=!0),function(t,e,i,n,r,o){const{table:s,interactionState:a}=t,{scenegraph:l}=s,{highlightScope:h,disableHeader:c,cellPos:u}=t.select;if((c&&s.isHeader(e,i)||"none"===h)&&(e=-1,i=-1),u.col!==e||u.row!==i){if(-1!==e&&-1!==i&&t.select.ranges.length>0)if(a===Uc.grabing){const n=t.select.ranges[t.select.ranges.length-1];e>n.start.col&&e>n.end.col&&s._makeVisibleCell(e+1,i),i>n.start.row&&i>n.end.row&&s._makeVisibleCell(e,i+1),e<n.start.col&&e<n.end.col&&s._makeVisibleCell(e-1,i),i<n.start.row&&i<n.end.row&&s._makeVisibleCell(e,i-1)}else s._makeVisibleCell(e,i);if(o){t.select.ranges=[],l.deleteAllSelectBorder(),t.select.ranges.push({start:{col:0,row:0},end:{col:s.colCount-1,row:s.rowCount-1}});const e=t.select.ranges[t.select.ranges.length-1];l.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else if(-1===u.col||-1===u.row||-1!==e&&-1!==i){if(a===Uc.default){const o=t.select.ranges[t.select.ranges.length-1];if(n&&o){if(s.isColumnHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),n=Math.max(o.start.col,o.end.col,e),r=Math.min(o.start.row,o.end.row,i),a=s.rowCount-1;o.start={col:t,row:r},o.end={col:n,row:a}}else if(s.isRowHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),n=s.colCount-1,r=Math.min(o.start.row,o.end.row,i),a=Math.max(o.start.row,o.end.row,i);o.start={col:t,row:r},o.end={col:n,row:a}}else o.end={col:e,row:i};l.deleteLastSelectedRangeComponents(),l.updateCellSelectBorder(o.start.col,o.start.row,o.end.col,o.end.row)}else{-1===u.col||-1===u.row||r||(t.select.ranges=[],l.deleteAllSelectBorder()),s.isColumnHeader(e,i)?t.select.ranges.push({start:{col:e,row:i},end:{col:e,row:s.rowCount-1}}):s.isRowHeader(e,i)?t.select.ranges.push({start:{col:e,row:i},end:{col:s.colCount-1,row:i}}):t.select.ranges.push({start:{col:e,row:i},end:{col:e,row:i}}),u.col=e,u.row=i;const n=t.select.ranges[t.select.ranges.length-1];l.updateCellSelectBorder(n.start.col,n.start.row,n.end.col,n.end.row)}}else if(a===Uc.grabing){-1===u.col&&(u.col=e),-1===u.row&&(u.row=i);const n=t.select.ranges[t.select.ranges.length-1];n.end={col:e,row:i},u.col=e,u.row=i,l.updateCellSelectBorder(n.start.col,n.start.row,e,i)}}else u.col=-1,u.row=-1,t.select.ranges=[],l.deleteAllSelectBorder();l.updateNextFrame()}}(this,t,e,i,n,r)}checkCellRangeInSelect(t,e){return function(t,e,i,n){for(let n=0;n<i.length;n++)if(Jp(i[n],{start:t,end:e}))return!0;return!1}(t,e,this.select.ranges,this.select.highlightScope)}updateHoverIcon(t,e,i,n,r){if(i===this.residentHoverIcon?.icon)return;const o=tV(i);if(o)if("richtext-icon"===o.type){const i=o.icon;if(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame()),i.attribute.tooltip){const n={content:i.attribute.tooltip.title,referencePosition:{rect:o.position,placement:i.attribute.tooltip.placement},style:Object.assign({},this.table.internalProps.theme?.tooltipStyle,i.tooltip?.style)};this.table.internalProps.tooltipHandler.isBinded(n)||this.table.showTooltip(t,e,n)}}else{const i=o.icon;i!==this.hoverIcon.icon&&(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=t,this.hoverIcon.col=e,this.hoverIcon.icon=i,this.table.scenegraph.setIconHoverStyle(i,t,e,n),this.table.scenegraph.updateNextFrame())}else this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame())}isResizeCol(){return this.columnResize.resizing}isSelecting(){return this.select.selecting}endSelectCells(){if(this.select.selecting=!1,0===this.select.ranges.length)return;this.table.scenegraph.moveSelectingRangeComponentsToSelectedRangeComponents();const t=this.select.ranges[this.select.ranges.length-1].end.col,e=this.select.ranges[this.select.ranges.length-1].end.row;this.table.fireListeners(sf.SELECTED_CELL,{ranges:this.select.ranges,col:t,row:e})}endResizeCol(){setTimeout((()=>{this.columnResize.resizing=!1}),0),this.table.scenegraph.updateChartSize(this.columnResize.col),this.checkFrozen(),this.table.scenegraph.component.hideResizeCol(),this.table.scenegraph.updateNextFrame()}startResizeCol(t,e,i,n){this.columnResize.resizing=!0,this.columnResize.col=t,this.columnResize.x=e,this.columnResize.isRightFrozen=n,this.table.scenegraph.component.showResizeCol(t,i,n),this.table.stateManeger.updateSelectPos(-1,-1),this.table.scenegraph.updateNextFrame()}updateResizeCol(t,e){!function(t,e,i){t=Math.ceil(t),e=Math.ceil(e);let n=i.columnResize.isRightFrozen?i.columnResize.x-t:t-i.columnResize.x;if(Math.abs(n)<1)return;const r=i.table.getColWidth(i.columnResize.col);let o=r;o+=n;const s=i.table.getMinColWidth(i.columnResize.col),a=i.table.getMaxColWidth(i.columnResize.col);if(o<s||o>a){if(r===s||r===a)return;n=r-s>a-r?a-r:s-r}n=Math.ceil(n),i.columnResize.col<i.table.rowHeaderLevelCount||i.columnResize.col>=i.table.colCount-i.table.rightFrozenColCount?eV(n,i):"indicator"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;let n,r,o;if(i.indicatorsAsCol)n=i.getIndicatorKey(e.columnResize.col,e.table.columnHeaderLevelCount);else{const t=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount-1),n=t.colHeaderPaths[t.colHeaderPaths.length-1];r=n.dimensionKey,o=n.value}for(let s=e.table.rowHeaderLevelCount;s<e.table.colCount-e.table.rightFrozenColCount;s++){const a=i.getIndicatorKey(s,e.table.columnHeaderLevelCount);if(i.indicatorsAsCol&&a===n)e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s);else if(!i.indicatorsAsCol){const n=i.getCellHeaderPaths(s,e.table.columnHeaderLevelCount-1),a=n?.colHeaderPaths[n.colHeaderPaths.length-1];a&&r===a.dimensionKey&&o===a.value&&(e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s))}}}(n,i):"indicatorGroup"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap,n=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount),r=i.getHeadNode(n.colHeaderPaths.slice(0,n.colHeaderPaths.length-1)),o=r.startInTotal+e.table.frozenColCount,s=r.startInTotal+e.table.frozenColCount+r.size-1,a=e.table.getColsWidth(o,s),l=t;for(let t=o;t<=s;t++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const n=i.getBody(t,e.table.columnHeaderLevelCount);if(n?.disableColumnResize)continue}const n=e.table.getColWidth(t);e.table.scenegraph.updateColWidth(t,n/a*l),e.table.internalProps._widthResizedColMap.add(t)}}(n,i):"all"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;for(let n=e.table.options.frozenColCount;n<e.table.colCount-e.table.rightFrozenColCount;n++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const t=i.getBody(n,e.table.columnHeaderLevelCount);if(t?.disableColumnResize)continue}e.table.scenegraph.updateColWidth(n,t),e.table.internalProps._widthResizedColMap.add(n)}}(n,i):eV(n,i),i.columnResize.x=t,i.table.scenegraph.component.updateResizeCol(i.columnResize.col,e,i.columnResize.isRightFrozen),i.columnResize.col<i.table.frozenColCount&&!i.table.isPivotTable()&&!i.table.transpose&&i.table.scenegraph.component.setFrozenColumnShadow(i.table.frozenColCount-1,i.columnResize.isRightFrozen),i.table.scenegraph.updateNextFrame()}(t,e,this)}startMoveCol(t,e,i,n){!function(t,e,i,n,r){if(!("canMoveHeaderPosition"in r.table.internalProps.layoutMap))return;r.columnMove.moving=!0,r.columnMove.colSource=t,r.columnMove.rowSource=e,r.columnMove.x=i-r.table.tableX,r.columnMove.y=n-r.table.tableY;const o=r.table.getCellLocation(t,e),s="columnHeader"===o?r.columnMove.x:"rowHeader"===o?r.columnMove.y:0;r.table.scenegraph.component.showMoveCol(t,e,s),r.table.stateManeger.updateSelectPos(-1,-1),r.table.scenegraph.updateNextFrame()}(t,e,i,n,this)}updateMoveCol(t,e,i,n){!function(t,e,i,n,r){if(!("canMoveHeaderPosition"in r.table.internalProps.layoutMap))return;const o=function(t,e,i){const n=i.getCellRange(t.col,t.row);if(i.isColumnHeader(t.col,t.row)){const r=i.getCellRange(e.col,n.start.row);e.row>=i.columnHeaderLevelCount&&(e.row=i.columnHeaderLevelCount-1),e.col>=t.col?e.col=r.end.col:e.col=r.start.col}else if(i.isRowHeader(t.col,t.row)){const r=i.getCellRange(n.start.col,e.row);e.col>=i.rowHeaderLevelCount&&(e.col=i.rowHeaderLevelCount-1);const o=i.internalProps.layoutMap;if("tree"===o.rowHierarchyType){const n=o.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,r=o.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths;if(n.length<=r.length){const o=r[n.length-1];o&&(e.row>=t.row?e.row=o.startInTotal+o.size-1+i.columnHeaderLevelCount:e.row=o.startInTotal+i.columnHeaderLevelCount)}}else e.row>=t.row?e.row=r.end.row:e.row=r.start.row}return e}({col:r.columnMove.colSource,row:r.columnMove.rowSource},{col:t,row:e},r.table);let s,a,l,h;r.columnMove.x=i-r.table.tableX,r.columnMove.y=n-r.table.tableY,r.columnMove.colTarget=o.col,r.columnMove.rowTarget=o.row,r.table.internalProps.layoutMap.canMoveHeaderPosition({col:r.columnMove.colSource,row:r.columnMove.rowSource},{col:r.columnMove.colTarget,row:r.columnMove.rowTarget})?r.updateCursor("grabbing"):r.updateCursor("not-allowed");const c=r.table.getCellLocation(t,e);"columnHeader"===c?(a=r.columnMove.x,s=r.columnMove.colTarget>=r.columnMove.colSource?r.table.getColsWidth(0,r.columnMove.colTarget):r.table.getColsWidth(0,r.columnMove.colTarget-1)):"rowHeader"===c&&(h=r.columnMove.y,l=r.columnMove.rowTarget>=r.columnMove.rowSource?r.table.getRowsHeight(0,r.columnMove.rowTarget):r.table.getRowsHeight(0,r.columnMove.rowTarget-1)),r.table.scenegraph.component.updateMoveCol(a,s,h,l),r.table.scenegraph.updateNextFrame()}(t,e,i,n,this)}isMoveCol(){return this.columnMove.moving}endMoveCol(){QG(this)}checkFrozen(){if(this.table.options.frozenColCount){if(this.table.tableNoFrameWidth-this.table.getColsWidth(0,this.table.options.frozenColCount-1)<=120)return this.table._setFrozenColCount(0),this.setFrozenCol(-1),!1;if(this.table.frozenColCount!==this.table.options.frozenColCount)return this.table._setFrozenColCount(this.table.options.frozenColCount),this.setFrozenCol(this.table.options.frozenColCount),!1}return!0}setFrozenCol(t){t!==this.frozen.col?(this.frozen.col=t,this.table.scenegraph.updateFrozen(),this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)):this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)}updateVerticalScrollBar(t){const e=this.table.getAllRowsHeight();this.scroll.verticalBarPos=Math.ceil(t*(e-this.table.scenegraph.height)),this.table.scenegraph.setY(-this.scroll.verticalBarPos),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}updateHorizontalScrollBar(t){const e=this.table.getAllColsWidth();this.scroll.horizontalBarPos=Math.ceil(t*(e-this.table.scenegraph.width)),this.table.scenegraph.setX(-this.scroll.horizontalBarPos),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}setScrollTop(t){const e=this.table.getAllRowsHeight();t=Math.max(0,Math.min(t,e-this.table.scenegraph.height)),t=Math.ceil(t),this.scroll.verticalBarPos=t,this.table.scenegraph.setY(-t),this.table.scenegraph.component.updateVerticalScrollBarPos(t/(e-this.table.scenegraph.height)),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}setScrollLeft(t){const e=this.table.getAllColsWidth(),i=this.table.getFrozenColsWidth();t=Math.max(0,Math.min(t,e-this.table.scenegraph.width)),t=Math.ceil(t),this.scroll.horizontalBarPos=t,this.table.scenegraph.setX(-t),this.table.scenegraph.component.updateHorizontalScrollBarPos(t/(e-i)),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}hideVerticalScrollBar(){this.table.scenegraph.component.hideVerticalScrollBar()}showVerticalScrollBar(t){this.table.scenegraph.component.showVerticalScrollBar(),t&&(clearTimeout(this._clearVerticalScrollBar),this._clearVerticalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideVerticalScrollBar()}),1e3))}hideHorizontalScrollBar(){this.table.scenegraph.component.hideHorizontalScrollBar()}showHorizontalScrollBar(t){this.table.scenegraph.component.showHorizontalScrollBar(),t&&(clearTimeout(this._clearHorizontalScrollBar),this._clearHorizontalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideHorizontalScrollBar()}),1e3))}triggerContextMenu(t,e,i,n){this.menu.isShow&&this.menu.x===i&&this.menu.y===n?this.hideMenu():this.showContextMenu(t,e,i,n)}showContextMenu(t,e,i,n){this.table.internalProps.menu?.contextMenuItems&&("html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.menu.x=i,this.menu.y=n,this.table.scenegraph.component.menu.attach(i,n,t,e,Nj.contextmenu)),this.table.fireListeners(sf.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"contextmenu"}))}triggerDropDownMenu(t,e,i,n){this.table.fireListeners(sf.DROPDOWN_ICON_CLICK,{col:t,row:e}),this.menu.isShow?this.hideMenu():this.showDropDownMenu(t,e,i,n)}showDropDownMenu(t,e,i,n){"html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.table.scenegraph.component.menu.attach(i,n,t,e,Nj.dropDown),this.menu.bounds=this.table.scenegraph.component.menu.bounds),this.table.fireListeners(sf.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"dropDown"}),this.residentHoverIcon&&this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row);const r=this.table.scenegraph.getCell(t,e);let o;r.forEachChildren((t=>t.attribute.funcType===Jc.dropDown&&(o=t,!0))),o&&(this.residentHoverIcon={col:t,row:e,icon:o},this.table.scenegraph.setIconHoverStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row,r),o.oldVisibleTime=o.attribute.visibleTime,o.setAttribute("visibleTime","always"),o.setAttribute("visible",!0))}hideMenu(){this.table.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),this.table.fireListeners(sf.HIDE_MENU,null),this.menu.isShow=!1,this.table.scenegraph.component.menu.detach(),this.residentHoverIcon&&(this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row),this.residentHoverIcon.icon.setAttribute("visibleTime",this.residentHoverIcon.icon.oldVisibleTime),this.residentHoverIcon.icon.setAttribute("visible","always"===this.residentHoverIcon.icon.attribute.visibleTime),this.residentHoverIcon=null)}setDropDownMenuHighlight(t){this.menu.dropDownMenuHighlight=t;for(let e=0;e<t.length;e++){const{col:i,row:n}=t[e];this.table.scenegraph.updateCellContent(i,n)}}dropDownMenuIsHighlight(t,e,i){const n=this.menu.dropDownMenuHighlight;if(Array.isArray(n))for(let r=0;r<n.length;r++){const o=n[r];let{col:s,row:a}=o;const{field:l,menuKey:h}=o;if("number"!=typeof s||"number"!=typeof a)if(this.table.isPivotTable()&&(Array.isArray(l),1)){const t=this.table.internalProps.layoutMap.getPivotCellAdress(l);if(!t)continue;s=t.col,a=t.row}else{const t=this.table.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!t)continue;s=t.col,a=t.row}if(bu(s)&&bu(a)&&this.table.isCellRangeEqual(t,e,s,a)){const n=this.table._getHeaderLayoutMap(s??t,a??e).dropDownMenu||this.table.globalDropDownMenu;if(n)for(let t=0;t<n.length;t++){const e=n[t];if(ou(e)&&(e.menuKey||e.text)===(h||"")&&t===i)return!0;if(au(e)&&e===h&&t===i)return!0}}}return!1}triggerSort(t,e,i){if(this.table.isPivotTable()){const i=this.table.getPivotSortState(t,e);return void this.table.fireListeners(ZG.PIVOT_SORT_CLICK,{col:t,row:e,order:i||"normal",dimensionInfo:this.table.internalProps.layoutMap.getPivotDimensionInfo(t,e),cellLocation:this.table.getCellLocation(t,e)})}const n=this.sort.col,r=this.sort.row;YG(t,e,this.table),this.sort.col=t,this.sort.row=e,this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,i,this.sort.order,n,r,this.sort.icon),this.sort.icon=i}updateSortState(t){if(t.field===this.sort.field&&t.order===this.sort.order)return;const e=this.sort.col,i=this.sort.row,n="asc"===this.sort.order?"sort_downward":"desc"===this.sort.order?"sort_upward":"sort_normal";this.setSortState(t);const r=this.table.internalProps.layoutMap.getHeaderCellAddressByField(t.field);this.sort.col=r.col,this.sort.row=r.row;const o=this.table.scenegraph.getCell(this.sort.col,this.sort.row).getChildByName(n,!0);this.table.scenegraph.sortCell(),this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,o,this.sort.order,e,i,this.sort.icon)}triggerFreeze(t,e,i){this.table.isPivotTable()||this.table.transpose||(!function(t,e,i){i.frozenColCount>0?t!==i.frozenColCount-1?i.setFrozenColCount(t+1):i.setFrozenColCount(0):i.setFrozenColCount(t+1)}(t,0,this.table),this.frozen.icon=i)}updateCursor(t="default"){this.table.getElement().style.cursor=t}updateDrillState(t,e,i,n,r,o){this.drill.dimensionKey=t,this.drill.title=e,this.drill.drillDown=i,this.drill.drillUp=n,this.drill.col=r,this.drill.row=o,function(t,e,i,n,r){const o=r.getCellLocation(t,e);let s=0,a=0,l=!1;"columnHeader"===o?(s=r.getColsWidth(0,r.rowHeaderLevelCount-1)-(0===r.frozenColCount?r.scrollLeft:0),a=r.getRowsHeight(0,e-1)+r.getRowHeight(e)/2,l=!0):"rowHeader"===o&&(a=r.getRowsHeight(0,r.columnHeaderLevelCount-1),s=r.getColsWidth(0,t-1)+r.getColWidth(t)/2,l=!0),r.scenegraph.updateDrill(l,s,a,i,n)}(r,o,i,n,this.table)}updateSparklineHoverPose(t,e,i,n){-1!==this.sparkLine.col&&-1!==this.sparkLine.row&&function(t,e,i){const n=i.scenegraph.getCell(t,e).getChildByName("sparkline"),r=n?.getChildByName("highlight-line"),o=n?.getChildByName("highlight-symbol");r&&r.setAttributes({visible:!1,pickable:!1}),o&&o.setAttributes({visible:!1,pickable:!1}),i.scenegraph.updateNextFrame()}(this.sparkLine.col,this.sparkLine.row,this.table),-1!==t&&-1!==e&&function(t,e,i,n,r){const o=r.scenegraph.getCell(t,e).getChildByName("sparkline"),s=o?.getChildByName("sparkline-line"),a=o?.getChildByName("sparkline-symbol-group");if(!s)return;const l=s.bandwidth,h=s.min,c=s.max,u=s.attribute.points;let d;i-=o.globalAABBBounds.x1,o.globalAABBBounds.y1;for(let t=0;t<u.length;t++){const{x:e,y:n,defined:r,rawData:p}=u[t];if(Math.abs(i-e)<l/2&&(d={point:u[t],points:u,pointsBandWidth:l,pointData:p},r)){const t=o.getChildByName("highlight-line");if(t)t.setAttributes({x:e,visible:!0,pickable:!0});else{const t=QA({x:e,y:0,points:[{x:0,y:c},{x:0,y:h}],lineWidth:s.hover.strokeWidth,stroke:s.hover.stroke});t.name="highlight-line",o.addChild(t)}const i=o.getChildByName("highlight-symbol");if(i)i.setAttributes({x:e,y:n,visible:!0,pickable:!0});else{const t=nT({x:e,y:n,stroke:a.hover.stroke,lineWidth:a.hover.strokeWidth,fill:a.hover.fill,size:2*a.hover.size,symbolType:"circle"});t.name="highlight-symbol",o.addChild(t)}break}}if(r.scenegraph.updateNextFrame(),d){const i={col:t,row:e,field:r.getHeaderField(t,e),value:r.getCellValue(t,e),dataValue:r.getCellOriginValue(t,e),cellHeaderPaths:r.internalProps.layoutMap.getCellHeaderPaths(t,e),title:r.getBodyColumnDefine(t,e).title,cellRange:r.getCellRelativeRect(t,e),sparkline:{pointData:d.pointData},scaleRatio:r.canvas.getBoundingClientRect().width/r.canvas.offsetWidth};r.fireListeners(sf.MOUSEOVER_CHART_SYMBOL,i)}}(t,e,i,0,this.table),this.sparkLine.col=t,this.sparkLine.row=e}}function nV(t){const e={abstractPos:{x:t.x,y:t.y}},i=function(t){for(;t&&t.parent;){if("cell"===t.role)return t;t=t.parent}return null}(t.target);return i&&(e.eventArgs={col:i.col,row:i.row,event:t,targetCell:i,target:t.target}),e}let rV,oV;function sV(t){if(t.stateManeger.endResizeCol(),t.hasListeners(sf.RESIZE_COLUMN_END)){const e=[];for(let i=0;i<t.colCount;i++)e.push(t.getColWidth(i));t.fireListeners(sf.RESIZE_COLUMN_END,{col:t.stateManeger.columnResize.col,columns:e})}}function aV(t,e){let{deltaX:i,deltaY:n}=t;t.shiftKey&&t.deltaY&&(i=n,n=0);const[r,o]=function(t,e,i){const n=2,r=Math.abs(t/e),o=r<=1/n?0:t,s=r>n?0:e;return[Math.ceil(o*(i.horizontal??0)),Math.ceil(s*(i.vertical??0))]}(i,n,{horizontal:1,vertical:1});(r||o)&&e.interactionState!==Uc.scrolling&&e.updateInteractionState(Uc.scrolling),r&&(e.setScrollLeft(e.scroll.horizontalBarPos+r),e.showHorizontalScrollBar(!0)),o&&(e.setScrollTop(e.scroll.verticalBarPos+o),e.showVerticalScrollBar(!0)),e.resetInteractionState(),t.cancelable&&(0!==n&&lV(n,e)||0!==i&&hV(i,e))&&t.preventDefault()}function lV(t,e){return 0!=e.table.getAllRowsHeight()-e.table.scenegraph.height&&(!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t<=0&&e.scroll.verticalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t>=0&&Math.abs(e.scroll.verticalBarPos-i)<1}(t,e))}function hV(t,e){return 0!=e.table.getAllColsWidth()-e.table.scenegraph.width&&(!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t<=0&&e.scroll.horizontalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t>=0&&Math.abs(e.scroll.horizontalBarPos-i)<1}(t,e))}function cV(t){const e=t.table,i=e.stateManeger,n=e.scenegraph;t.touchMovePoints=[],e.scenegraph.tableGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(n.component.vScrollBar)||e.target.isChildOf(n.component.vScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))})),window.addEventListener("touchmove",(e=>{if(t.touchMove&&e.preventDefault(),!t.isTouchdown||!uV(e))return;t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,timestamp:Date.now()});const n=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,r=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;aV({deltaX:n,deltaY:r},i),e.cancelable&&(0!==r&&lV(r,i)||0!==n&&hV(n,i))&&e.preventDefault()}),{passive:!1}),window.addEventListener("touchend",(e=>{if(t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&uV(e)){if(t.touchMovePoints?.length){t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,timestamp:Date.now()});const n=t.touchMovePoints[0],r=t.touchMovePoints[t.touchMovePoints?.length-1];!function(t,e,i){let n=Date.now();const r=.95,o=()=>{const s=Date.now(),a=s-n;let l=!0;const h=Math.pow(r,a/16),c=h*t,u=h*e;let d=0,p=0;Math.abs(c)>.05&&(l=!1,d=(t+c)/2*a),Math.abs(u)>.05&&(l=!1,p=(e+u)/2*a),aV({deltaX:-d,deltaY:-p},i),l||(n=s,t=c,e=u,requestAnimationFrame(o))};requestAnimationFrame(o)}((r.x-n.x)/(r.timestamp-n.timestamp),(r.y-n.y)/(r.timestamp-n.timestamp),i)}t.isTouchdown=!1,t.touchMovePoints=[]}})),window.addEventListener("touchcancel",(e=>{t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&(t.isTouchdown=!1,t.touchMovePoints=[])}))}function uV(t){return!!t.changedTouches}function dV(t,e,i){if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"top";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom";if(t===i.rowHeaderLevelCount-1&&e>=i.rowHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left"}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left";if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"right";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom"}return"bottom"}class pV{table;isTouchdown;touchMovePoints;touchSetTimeout;touchEnd;touchMove;constructor(t){this.table=t,this.bindOuterEvent(),setTimeout((()=>{this.bindSelfEvent()}),0)}bindOuterEvent(){!function(t){const e=t.table,i=e.stateManeger;document.body.addEventListener("pointermove",(n=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const{x:r,y:o}=e._getMouseAbstractPoint(n,!1);i.interactionState!==Uc.scrolling&&i.interactionState===Uc.grabing&&i.isResizeCol()&&(t.dealColumnResize(r,o),e.hasListeners(sf.RESIZE_COLUMN)&&e.fireListeners(sf.RESIZE_COLUMN,{col:e.stateManeger.columnResize.col,colWidth:e.getColWidth(e.stateManeger.columnResize.col)}))})),e.scenegraph.tableGroup.addEventListener("pointermove",(n=>{const r=rV?.x??n.x,o=rV?.y??n.y;rV={x:n.x,y:n.y},t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const s=nV(n);if(i.interactionState===Uc.scrolling)return;if(i.interactionState===Uc.grabing&&Math.abs(r-n.x)+Math.abs(o-n.y)>=1)return void(i.isResizeCol()||(i.isMoveCol()?t.dealColumnMover(s):t.dealTableSelect(s)));i.isResizeCol()||t.checkColumnResize(s)?i.updateCursor("col-resize"):i.updateCursor();const a=n.path.find((t=>"cell"===t.role));if(e.hasListeners(sf.MOUSELEAVE_CELL)&&("cell"!==a?.role||-1===e.stateManeger.hover.cellPos.col||-1===e.stateManeger.hover.cellPos.row||a.col===e.stateManeger.hover.cellPos.col&&a.row===e.stateManeger.hover.cellPos.row||e.fireListeners(sf.MOUSELEAVE_CELL,{col:e.stateManeger.hover.cellPos.col,row:e.stateManeger.hover.cellPos.row,cellRange:e.getCellRangeRelativeRect({col:e.stateManeger.hover.cellPos.col,row:e.stateManeger.hover.cellPos.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:n.nativeEvent})),e.hasListeners(sf.MOUSEENTER_CELL)&&"cell"===a?.role&&Uu(a.col)&&Uu(a.row)&&(a.col!==e.stateManeger.hover.cellPos.col||a.row!==e.stateManeger.hover.cellPos.row)&&e.fireListeners(sf.MOUSEENTER_CELL,{col:a.col,row:a.row,cellRange:e.getCellRangeRelativeRect({col:a.col,row:a.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:n.nativeEvent}),t.dealIconHover(s),t.dealTableHover(s),s.eventArgs&&e.hasListeners(sf.MOUSEMOVE_CELL)){let t,i;if(s.eventArgs?.target){const e=tV(s.eventArgs?.target);e&&(t=e.icon,i=e.position)}e.fireListeners(sf.MOUSEMOVE_CELL,{col:s.eventArgs.col,row:s.eventArgs.row,x:s.abstractPos.x,y:s.abstractPos.y,event:n.nativeEvent,targetIcon:t?{name:t.name,position:i,funcType:t.attribute.funcType}:void 0})}})),e.scenegraph.tableGroup.addEventListener("pointerout",(e=>{const i=nV(e),n=i?.eventArgs?.target;"table"===n?.role&&t.dealTableHover()})),e.scenegraph.tableGroup.addEventListener("pointerover",(t=>{const i=nV(t),n=i?.eventArgs?.target;if(e.hasListeners(sf.MOUSEOVER_CHART_SYMBOL)&&"symbol"===n.type){const i=t.composedPath().find((t=>"cell"===t.roll));if(i){const{col:n,row:r}=i,o={col:n,row:r,field:e.getHeaderField(n,r),value:e.getCellValue(n,r),dataValue:e.getCellOriginValue(n,r),cellHeaderPaths:e.internalProps.layoutMap.getCellHeaderPaths(n,r),title:e.getBodyColumnDefine(n,r).title,cellRange:e.getCellRelativeRect(n,r),event:t.nativeEvent,sparkline:{pointData:void 0},scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};e.fireListeners(sf.MOUSEOVER_CHART_SYMBOL,o)}}})),e.scenegraph.tableGroup.addEventListener("pointerleave",(n=>{i.isResizeCol()||(i.updateInteractionState(Uc.default),i.updateCursor()),t.dealTableHover();const r=n.target;r&&!r.isDescendantsOf(e.scenegraph.tableGroup)&&e.fireListeners(sf.MOUSELEAVE_TABLE,{col:-1,row:-1,event:n.nativeEvent})})),e.scenegraph.tableGroup.addEventListener("pointerupoutside",(n=>{console.log("pointerupoutside"),i.isResizeCol()&&sV(e),i.updateInteractionState(Uc.default),t.dealTableHover(),t.dealTableSelect()})),e.scenegraph.tableGroup.addEventListener("pointerdown",(n=>{if(rV={x:n.x,y:n.y},0!==n.button)return;const r=nV(n);if(i.interactionState!==Uc.default)return;e.isPivotChart()&&"chart"!==r?.eventArgs?.target.type&&e.scenegraph.updateChartState(null),i.menu.isShow&&r.eventArgs&&r.eventArgs.target!==i.residentHoverIcon?.icon&&i.hideMenu();const o=r?.eventArgs?.target?.role?.startsWith("icon")?r.eventArgs.target:void 0;if(!o||!1===o.attribute.interactive)if("touch"===n.pointerType)t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.touchMove=!0,(!t.touchEnd&&t.checkColumnResize(r,!0)||!t.touchEnd&&t.chechColumnMover(r)||t.dealTableSelect(r)&&!t.touchEnd)&&i.updateInteractionState(Uc.grabing)}),500);else{if(t.checkColumnResize(r,!0))return e.scenegraph.updateChartState(null),void i.updateInteractionState(Uc.grabing);if(t.chechColumnMover(r))return void i.updateInteractionState(Uc.grabing);t.dealTableSelect(r)&&i.updateInteractionState(Uc.grabing)}if(e.hasListeners(sf.MOUSEDOWN_CELL)){const t=nV(n);t.eventArgs&&e.fireListeners(sf.MOUSEDOWN_CELL,{col:t.eventArgs.col,row:t.eventArgs.row,event:n.nativeEvent})}})),e.scenegraph.tableGroup.addEventListener("pointerup",(t=>{if(0===t.button){if("grabing"===i.interactionState){if(i.updateInteractionState(Uc.default),i.isResizeCol())sV(e);else if(i.isMoveCol()){e.stateManeger.endMoveCol();const i=nV(t);i.eventArgs&&e.hasListeners(sf.CHANGE_HEADER_POSITION)&&e.fireListeners(sf.CHANGE_HEADER_POSITION,{target:{col:i.eventArgs.col,row:i.eventArgs.row},source:{col:e.stateManeger.columnMove.colSource,row:e.stateManeger.columnMove.colSource}})}else if(i.isSelecting()){e.stateManeger.endSelectCells();const i=nV(t);if(i.eventArgs&&e.hasListeners(sf.DRAG_SELECT_END)){const n={event:t.nativeEvent,cells:[],col:i.eventArgs.target.col,row:i.eventArgs.target.row,scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};n.cells=e.getSelectedCellInfos(),e.fireListeners(sf.DRAG_SELECT_END,n)}}}else i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default);if(e.hasListeners(sf.MOUSEUP_CELL)){const i=nV(t);i.eventArgs&&e.fireListeners(sf.MOUSEUP_CELL,{col:i.eventArgs.col,row:i.eventArgs.row,event:t.nativeEvent})}}})),e.scenegraph.tableGroup.addEventListener("rightdown",(t=>{const n=nV(t);if(n.eventArgs){i.triggerContextMenu(n.eventArgs.col,n.eventArgs.row,n.abstractPos.x,n.abstractPos.y);const{col:r,row:o}=n.eventArgs;if(e.hasListeners(sf.CONTEXTMENU_CELL)){const i=e.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=tV(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...i,event:t.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};!function(t,e,i){for(let n=0;n<t.length;n++){const r=t[n];if(r.start.col<=e&&e<=r.end.col&&r.start.row<=i&&i<=r.end.row||r.end.col<=e&&e<=r.start.col&&r.end.row<=i&&i<=r.start.row)return!0}return!1}(e.stateManeger.select.ranges,r,o)?l.cells=[[i]]:l.cells=e.getSelectedCellInfos(),e.fireListeners(sf.CONTEXTMENU_CELL,l)}}})),e.scenegraph.tableGroup.addEventListener("click",(i=>{if(console.log("click",i.clone()),e.stateManeger.columnResize.resizing||e.stateManeger.columnMove.moving)return;const n=nV(i);if(t.dealIconClick(i,n),!n?.eventArgs)return;const{col:r,row:o}=n.eventArgs;if(e.hasListeners(sf.CLICK_CELL)){const t=e.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=tV(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...t,event:i.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};e.fireListeners(sf.CLICK_CELL,l)}})),e.scenegraph.stage.addEventListener("click",(n=>{console.log("stage click");const r=n.target;r&&!r.isDescendantsOf(e.scenegraph.tableGroup)&&r!==e.scenegraph.tableGroup&&(console.log("pointerup outside table"),i.updateInteractionState(Uc.default),t.dealTableHover(),t.dealTableSelect(),i.updateCursor(),e.scenegraph.updateChartState(null))})),e.scenegraph.tableGroup.addEventListener("dblclick",(t=>{const i=nV(t),n=i.eventArgs.targetCell.globalAABBBounds,{col:r,row:o}=i.eventArgs,s=e.getCellValue(r,o);if(e.internalProps.focusControl.setFocusRect(new gf(n.x1+e.scrollLeft,n.y1+e.scrollTop,n.x2-n.x1,n.y2-n.y1),s),e.hasListeners(sf.DBLCLICK_CELL)){const n=e.getCellInfo(r,o);let s,a;if(i.eventArgs?.target){const t=tV(i.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,event:t.nativeEvent,federatedEvent:t,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};e.fireListeners(sf.DBLCLICK_CELL,l)}}))}(this),function(t){const e=t.table,i=e.stateManeger,n=e.internalProps.handler;n.on(e.getElement(),"blur",(e=>{console.log("blur"),t.dealTableHover()})),n.on(e.getElement(),"wheel",(t=>{aV(t,i)})),n.on(e.getElement(),"keydown",(i=>{if(e.keyboardOptions?.selectAllOnCtrlA&&"a"===i.key&&(i.ctrlKey||i.metaKey)&&(i.preventDefault(),t.deelTableSelectAll()),e.hasListeners(sf.KEYDOWN)){const t={keyCode:i.keyCode??i.which,code:i.code,event:i,cells:e.getSelectedCellInfos(),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};e.fireListeners(sf.KEYDOWN,t)}})),n.on(e.getElement(),"copy",(t=>{if(e.keyboardOptions?.copySelected){const i=e.getCopyValue();Uu(i)&&(t.preventDefault(),Qp?window.clipboardData.setData("Text",i):t.clipboardData.setData("text/plain",i))}})),n.on(e.getElement(),"contextmenu",(t=>{t.preventDefault()})),n.on(e.getContainer(),"resize",(()=>{e.resize()}))}(this),function(t){const e=t.table,i=e.stateManeger,n=e.scenegraph;n.component.vScrollBar.addEventListener("pointerover",(t=>{i.showVerticalScrollBar()})),n.component.hScrollBar.addEventListener("pointerover",(t=>{i.showHorizontalScrollBar()})),n.component.vScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==Uc.scrolling&&i.hideVerticalScrollBar()})),n.component.hScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==Uc.scrolling&&i.hideHorizontalScrollBar()})),n.component.vScrollBar._slider.addEventListener("pointerdown",(()=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling)})),n.component.vScrollBar.addEventListener("pointerup",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.vScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.hScrollBar._slider.addEventListener("pointerdown",(()=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling)})),n.component.hScrollBar.addEventListener("pointerup",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.hScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)}));const r=gu(i.updateVerticalScrollBar,20),o=gu(i.updateHorizontalScrollBar,20);n.component.vScrollBar.addEventListener("scroll",(t=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);r(e,t)})),n.component.hScrollBar.addEventListener("scroll",(t=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);o(e)}))}(this),cV(this)}bindSelfEvent(){const t=this.table.stateManeger;var e;this.table.on(sf.ICON_CLICK,(e=>{const{col:i,row:n,x:r,y:o,funcType:s,icon:a}=e;var l;s===Jc.dropDown?t.triggerDropDownMenu(i,n,r,o):s===Jc.sort?t.triggerSort(i,n,a):s===Jc.frozen?t.triggerFreeze(i,n,a):s===Jc.drillDown?(l=this.table).fireListeners(ZG.DRILLMENU_CLICK,l.stateManeger.drill):s!==Jc.collapse&&s!==Jc.expand||this.table.toggleHierarchyState(i,n)})),this.table.on(sf.DROPDOWNMENU_CLICK,(()=>{t.hideMenu()})),function(t){const e=t.internalProps.layoutMap.headerObjects,i=t.internalProps.layoutMap.columnObjects;for(let t=0;t<e.length;t++){const i=e[t];if(i&&i.style?.textStick)return console.log("checkHaveTextStick",!0),!0}for(let t=0;t<i.length;t++){const e=i[t];if(e&&e.style?.textStick)return console.log("checkHaveTextStick",!0),!0}return console.log("checkHaveTextStick",!1),!1}(this.table)&&this.table.on(sf.SCROLL,(t=>{TG(this.table)})),e=this.table,"browser"===hf.mode&&e.on(sf.CLICK_CELL,(t=>{const{col:i,row:n}=t;let r;r=e.internalProps.layoutMap.isHeader(i,n)?e.isPivotTable()?e._getHeaderLayoutMap(i,n).headerType:e.getHeaderDefine(i,n).headerType:e.getBodyColumnType(i,n);const o=e.isHeader(i,n)?e.getHeaderDefine(i,n):e.getBodyColumnDefine(i,n),s=e.getCellValue(i,n),a=e.getCellOriginValue(i,n);if("link"===o.cellType){if(!1===o.linkJump)return;const t=o.templateLink,r=!1!==o.linkDetect;let l;if(t){const r=e.getCellOriginRecord(i,n),o=Object.assign({__value:s,__dataValue:a},r),h=/\{\s*(\S+?)\s*\}/g;l=t.replace(h,((t,e)=>o[e]))}else if(r){if(!_f.test(s))return;l=s}else l=s;window.open(l)}else if("image"===r){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=new Image;e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",t.appendChild(e),document.body.appendChild(t)}else if("video"===r){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=document.createElement("video");e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",e.setAttribute("preload","auto"),e.setAttribute("controls","true"),t.appendChild(e),document.body.appendChild(t)}})),this.table.on(sf.DBLCLICK_CELL,(t=>{if(t.federatedEvent){const e=nV(t.federatedEvent),i=this.table.scenegraph.getResizeColAt(e.abstractPos.x,e.abstractPos.y,e.eventArgs?.targetCell);this.table._canResizeColumn(i.col,i.row)&&i.col>=0&&this.table.scenegraph.updateAutoColWidth(i.col)}})),this.table.isPivotTable()&&function(t){const e=t.internalProps.layoutMap.rowsDefine,i=t.internalProps.layoutMap.columnsDefine;for(let t=0;t<e.length;t++){const i=e[t];if("string"!=typeof i&&(i.drillDown||i.drillUp))return!0}for(let t=0;t<i.length;t++){const e=i[t];if("string"!=typeof e&&(e.drillDown||e.drillUp))return!0}return!1}(this.table)&&function(t){t.on(sf.MOUSEENTER_CELL,(e=>{const{col:i,row:n}=e;if(-1===i||-1===n)return;const r=t.internalProps.layoutMap.getHeaderDimension(i,n);r?.drillDown||r?.drillUp?t.stateManeger.updateDrillState(r.dimensionKey,r.title,r.drillDown,r.drillUp,i,n):t.stateManeger.updateDrillState(void 0,void 0,!1,!1,-1,-1)})),t.on(sf.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateDrillState(void 0,void 0,!1,!1,-1,-1)}))}(this.table),function(t){let e=!1;e=t.isPivotTable()?t.internalProps.layoutMap.indicatorsDefine.some((t=>"string"!=typeof t&&"sparkline"===t.cellType)):t.internalProps.layoutMap.columnObjects.some((t=>"sparkline"===t.cellType));e&&(t.on(sf.MOUSEMOVE_CELL,(e=>{const{col:i,row:n,x:r,y:o}=e;"sparkline"!==t.getBodyColumnType(i,n)&&t.stateManeger.updateSparklineHoverPose(-1,-1,0,0),t.stateManeger.updateSparklineHoverPose(i,n,r,o)})),t.on(sf.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateSparklineHoverPose(-1,-1,0,0)})))}(this.table),function(t){t.isPivotChart()&&t.scenegraph.tableGroup.addEventListener("click",(e=>{if(!t.stateManeger.columnMove.moving&&!t.stateManeger.columnResize.resizing)if("axis-label"===e.target.name){const i=nV(e),{col:n,row:r}=i.eventArgs,o=t.internalProps.layoutMap;let s,a;o.indicatorsAsCol?(s=o.getDimensionKeyInChartSpec(o.rowHeaderLevelCount,r)[0],a=o.getCellHeaderPaths(o.rowHeaderLevelCount-2,r).rowHeaderPaths):(s=o.getDimensionKeyInChartSpec(n,o.columnHeaderLevelCount)[0],a=o.getCellHeaderPaths(n,o.columnHeaderLevelCount-1).colHeaderPaths);const l=a.map((t=>({key:t.dimensionKey,value:t.value}))).filter((t=>t.key));if(l.push({key:s,value:e.target.attribute.text}),t._selectedDimensionInChart.length&&function(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i].key!==e[i].key||t[i].value!==e[i].value)return!1;return!0}(t._selectedDimensionInChart,l))return;t._selectedDimensionInChart=l,o.updateDataStateToChartInstance(),kG(t.scenegraph),t.scenegraph.updateNextFrame()}else t._selectedDimensionInChart?.length&&(t._selectedDimensionInChart.length=0,t.internalProps.layoutMap.updateDataStateToChartInstance(),kG(t.scenegraph),t.scenegraph.updateNextFrame())}))}(this.table),function(t){t.isPivotChart()&&(t.on(sf.MOUSEENTER_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=dV(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(sf.MOUSEENTER_AXIS,e)}}))})),t.on(sf.MOUSELEAVE_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=dV(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(sf.MOUSELEAVE_AXIS,e)}}))})))}(this.table)}dealTableHover(t){if(!t)return void this.table.stateManeger.updateHoverPos(-1,-1);const{eventArgs:e}=t;e?this.table.stateManeger.updateHoverPos(e.col,e.row):this.table.stateManeger.updateHoverPos(-1,-1)}dealIconHover(t){const{eventArgs:e}=t;e?this.table.stateManeger.updateHoverIcon(e.col,e.row,e.target,e.targetCell,e.event):this.table.stateManeger.updateHoverIcon(-1,-1,void 0,void 0)}dealMenuHover(t){}dealTableSelect(t){if(!t)return this.table.stateManeger.updateSelectPos(-1,-1),!1;const{eventArgs:e}=t;return!!e&&(this.table.isPivotChart()||"chart"===t?.eventArgs?.target.type||this.table.stateManeger.updateHoverPos(-1,-1),!this.table.isPivotChart()||"axis-label"!==t?.eventArgs?.target.name&&"chart"!==t?.eventArgs?.target.type?(this.table.stateManeger.updateSelectPos(e.col,e.row,e.event.shiftKey,e.event.ctrlKey||e.event.metaKey),!0):(this.table.stateManeger.updateSelectPos(-1,-1),!1))}deelTableSelectAll(){this.table.stateManeger.updateSelectPos(-1,-1,!1,!1,!0)}dealMenuSelect(t){}checkColumnResize(t,e){const{eventArgs:i}=t;if(i){const n=this.table.scenegraph.getResizeColAt(t.abstractPos.x,t.abstractPos.y,i.targetCell);if(this.table._canResizeColumn(n.col,n.row)&&n.col>=0)return e&&this.table.stateManeger.startResizeCol(n.col,t.abstractPos.x,t.abstractPos.y,n.rightFrozen),!0}return!1}dealColumnResize(t,e){this.table.stateManeger.updateResizeCol(t,e)}chechColumnMover(t){const{eventArgs:e}=t;return!!(e&&this.table.isHeader(e.col,e.row)&&function(t,e,i){for(let n=0;n<i.length;n++)if(qp(i[n],t,e))return!0;return!1}(e.col,e.row,this.table.stateManeger.select.ranges)&&this.table._canDragHeaderPosition(e.col,e.row))&&(this.table.stateManeger.startMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y),!0)}dealColumnMover(t){const{eventArgs:e}=t;this.table.stateManeger.updateMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y)}startColumnResize(t){}dealIconClick(t,e){const{eventArgs:i}=e,{target:n,event:r,col:o,row:s}=i||{target:t.target,event:t,col:-1,row:-1},a=n;if(a.role&&a.role.startsWith("icon-"))return this.table.fireListeners(sf.ICON_CLICK,{name:a.name,x:(a.globalAABBBounds.x1+a.globalAABBBounds.x2)/2,y:a.globalAABBBounds.y2,col:o,row:s,funcType:a.attribute.funcType,icon:a}),!0;if(n instanceof dA){const t=n.pickIcon(r.global);if(t)return this.table.fireListeners(sf.ICON_CLICK,{name:t.attribute.id,x:t.globalX+t.globalAABBBounds.width()/2,y:t.globalY+t.AABBBounds.height(),col:o,row:s,funcType:t.attribute.funcType,icon:t}),!0}return!1}}const fV=t=>{const e=t.value;return Number(e)>80?"#20a8d8":Number(e)>50?"#4dbd74":Number(e)>20?"#ffc107":"#f86c6b"};class gV extends Ru{_showBar;_barColor;_barBgColor;_barPositiveColor;_barNegativeColor;_barAxisColor;_barHeight;_barBottom;_barPadding;_showBarMark;_barMarkPositiveColor;_barMarkNegativeColor;_barMarkWidth;_barMarkPosition;_barRightToLeft;static get DEFAULT(){return oV||(oV=new gV)}constructor(t={},e={}){super(t,e),this._showBar=t.showBar??!0,this._barColor=t.barColor??fV,this._barPositiveColor=t.barPositiveColor??"#4dbd74",this._barNegativeColor=t.barNegativeColor??"#f86c6b",this._barAxisColor=t.barAxisColor??"black",this._barBgColor=t.barBgColor,this._barHeight=t.barHeight??3,this._barHeight=t.barHeight??3,this._barBottom=t.barBottom??0,this._barPadding=t.barPadding??[1,1,1,1],this._showBarMark=t.showBarMark??!1,this._barMarkPositiveColor=t.barMarkPositiveColor??"#4dbd74",this._barMarkNegativeColor=t.barMarkNegativeColor??"#f86c6b",this._barMarkWidth=t.barMarkWidth??2,this._barMarkPosition=t.barMarkPosition??"right",this._barRightToLeft=t.barRightToLeft??!1}get showBar(){return this._showBar}set showBar(t){this._showBar=t}get barColor(){return this._barColor}set barColor(t){this._barColor=t}get barBgColor(){return this._barBgColor}set barBgColor(t){this._barBgColor=t}get barHeight(){return this._barHeight}set barHeight(t){this._barHeight=t}get barBottom(){return this._barBottom}set barBottom(t){this._barBottom=t}get barPositiveColor(){return this._barPositiveColor}set barPositiveColor(t){this._barPositiveColor=t}get barNegativeColor(){return this._barNegativeColor}set barNegativeColor(t){this._barNegativeColor=t}get barAxisColor(){return this._barAxisColor}set barAxisColor(t){this._barAxisColor=t}get barPadding(){return this._barPadding}set barPadding(t){this._barPadding=t}get showBarMark(){return this._showBarMark}set showBarMark(t){this._showBarMark=t}get barMarkPositiveColor(){return this._barMarkPositiveColor}set barMarkPositiveColor(t){this._barMarkPositiveColor=t}get barMarkNegativeColor(){return this._barMarkNegativeColor}set barMarkNegativeColor(t){this._barMarkNegativeColor=t}get barMarkWidth(){return this._barMarkWidth}set barMarkWidth(t){this._barMarkWidth=t}get barMarkPosition(){return this._barMarkPosition}set barMarkPosition(t){this._barMarkPosition=t}get barRightToLeft(){return this._barRightToLeft}set barRightToLeft(t){this._barRightToLeft=t}clone(){return new gV(this,null)}}const mV=["type","content","font","color","width","height","marginRight","marginLeft","src","svg","name","path","positionType","tooltip","hover","cursor","shape","interactive"];class yV{expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=yj();this.expandIcon=e[Qc.expandIconName],this.collapseIcon=e[Qc.collapseIconName]}getIcons(t,e,i,n,r){const o=[],{icon:s}=this._table.getBodyColumnDefine(t,e);if(s){let r;if("function"==typeof s){r=s({col:t,row:e,value:i,dataValue:n,table:this._table})}else r=s;const a=yj(),l=t=>{let e;e="string"==typeof t?a[t]:t,e&&o.push(e)};Array.isArray(r)?r.forEach(((t,e)=>{l(t)})):l(r)}const a=this.getHierarchyIcon(t,e);return a&&o.push(a),r&&o.forEach(((i,n)=>{(i.content||i.src)&&(o[n]=this.getCellIconFromRecordValue(i,t,e))})),o}getStyleClass(t){switch(t){case"text":case"link":return Eu;case"image":case"video":return Pu;case"chart":case"sparkline":return Ru;case"progressbar":return gV}}getCellIconFromRecordValue(t,e,i){if(Array.isArray(t))return t.map((t=>this.getCellIconFromRecordValue(t,e,i)));if(!tf.isObject(t)||"function"==typeof t)return this._table.getFieldData(t,e,i);const n={},r=t;return mV.forEach((t=>{if(void 0!==r[t]){const o=this._table.getFieldData(r[t],e,i);null!=o?n[t]=o:this._table._hasField(r[t],e,i)||(n[t]=r[t])}})),n}getHierarchyIcon(t,e){const i=this._table.getHierarchyState(t,e);return i===Xc.expand?this.expandIcon:i===Xc.collapse?this.collapseIcon:void 0}}function bV(t,e){const i=document.createElement(t);return e&&i.classList.add(...e),i}!function(){const t=document.createElement("style");t.id="vtable-menu-styleSheet",t.textContent="\n@keyframes vtable__menu-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__menu-element {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\tbackground-color: #fff;\n\tpadding: 6px 0;\n\t/* pointer-events: none; */\n\tuser-select: none;\n\tcolor: #000;\n\tmax-width: 300px;\n\tz-index: 99999;\n\tborder: #CCC 0.5px solid;\n\tcursor: default;\n\twidth: max-content;\n\tbox-shadow: 0px 8px 16px rgba(27, 31, 35, 0.12);\n}\n.vtable__menu-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n\tz-index: -9999;\n}\n.vtable__menu-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__menu-element--shown-animation 150ms ease-out;\n}\n.vtable__menu-element__content {\n\tfont-family: Roboto;\n\tfont-size: 12px;\n\toverflow: hidden;\n\tdisplay: inline-block;\n\t/* height: 100%; */\n\tline-height: 30px;\n}\n.vtable__menu-element__item {\n\theight: 32px;\n\tpadding: 0px 12px;\n\tcursor: pointer;\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-start;\n}\n.vtable__menu-element__item:hover {\n\tbackground-color: rgba(27, 31, 35, 0.06);\n}\n.vtable__menu-element__icon{\n\t/* vertical-align: top; */\n\tdisplay: flex;\n\t/* line-height: 30px; */\n\tmargin-right: 6px;\n}\n.vtable__menu-element__no-event {\n\tpointer-events: none;\n}\n.vtable__menu-element--select {\n\tcolor: #2E68CF;\n}.vtable__menu-element--normal {\n\tcolor: rgba(20, 20, 20, 0.9);;\n}\n.vtable__menu-element__split {\n\theight: 0px;\n\tborder: 1px solid rgb(209, 213, 218);\n\tmargin: 5px 0;\n}\n.vtable__menu-element__title {\n\tcolor: rgb(149, 149, 149);\n}\n.vtable__menu-element__arrow {\n\tposition: absolute;\n\tright: 3px;\n\tfont-weight: bold;\n\tmargin-top: 1px;\n}\n.vtable__menu-element__item-text {\n\tmargin-right: 15px;\n}\n",document.body.appendChild(t)}();const vV="vtable__menu-element",wV=`${vV}__item`,CV=`${vV}__content`,xV=`${vV}--hidden`,_V=`${vV}--shown`,SV=`${vV}--normal`,AV=`${vV}--select`,TV=`${vV}__icon`,BV=`${vV}__split`,MV=`${vV}__title`,RV=`${vV}__arrow`,PV=`${vV}__no-event`,EV=`${vV}__item-text`;function HV(){return bV("div",[vV,xV])}function LV(t,e,i,n,r,o){const s=t.getCellRange(n,r);for(let n=0;n<e.length;n++){const r=e[n];let{col:o,row:a}=r;const{field:l,menuKey:h}=r;if("number"!=typeof o||"number"!=typeof a)if(t.isPivotTable()&&(Array.isArray(l),1)){const e=t.internalProps.layoutMap.getPivotCellAdress(l);if(!e)continue;o=e.col,a=e.row}else{const e=t.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!e)continue;o=e.col,a=e.row}if(bu(o)&&bu(a)&&qp(s,o,a)&&i===h)return!0}return!1}class kV{_handler;_rootElement;_secondElement;_menuInstanceInfo;_showChildrenIndex;_mouseEnterSecondElement;constructor(t){this._handler=new df,this._rootElement=HV(),this._secondElement=HV(),this._secondElement.sub=!0,this._showChildrenIndex=-1,this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("touchend",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(xV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(xV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(e=>{if(this._rootElement.classList.contains(xV))return;e.stopPropagation();const{hasChildren:i,dropDownIndex:n,col:r,row:o,sub:s}=e.target;if(i){this._showChildrenIndex=n;const i=this._secondElement;i?.classList.remove(xV),i?.classList.add(_V),i.innerHTML="";const s=this._menuInstanceInfo.content[n]?.children;for(let e=0;e<s.length;e++){const n=s[e],a=IV(n,!!t.stateManeger.menu.dropDownMenuHighlight&&LV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof n?n?.menuKey||n?.text:n,r,o));a.col=r,a.row=o,a.dropDownIndex=e,"string"==typeof n?(a.text=n,a.menuKey=n):"object"==typeof n&&(a.text=n.text,a.menuKey=n.menuKey||n.text),a.sub=!0,a.sub=!0,i.appendChild(a)}const a=e.target.getBoundingClientRect();this._bindSecondElement(t,r,o,a.right,a.top)}else if(i&&this._showChildrenIndex===n){const t=this._secondElement;t?.classList.remove(xV),t?.classList.add(_V)}else!s&&this._secondElement?.classList.contains(_V)&&setTimeout((()=>{if(!0!==this._mouseEnterSecondElement){this._showChildrenIndex=-1;const t=this._secondElement;t?.classList.remove(_V),t?.classList.add(xV)}}),300)})),this._secondElement?.addEventListener("wheel",(t=>{t.stopPropagation()})),this._secondElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(xV)||t.stopPropagation()})),this._secondElement?.addEventListener("mouseenter",(t=>{this._mouseEnterSecondElement=!0})),this._secondElement?.addEventListener("mouseleave",(t=>{this._mouseEnterSecondElement=!1})),this._secondElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._secondElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._secondElement.classList.contains(xV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n);let h=!1;this._menuInstanceInfo.content.forEach(((e,r)=>{if("object"==typeof e&&e.children&&e.children.length)for(let r=0;r<e.children.length;r++){const s=e.children[r];if(LV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey:s,i,n)&&o===("object"==typeof s?s?.menuKey:s))return void(h=!0)}})),t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,cellHeaderPaths:t.isPivotTable()?t.getCellHeaderPaths(i,n):void 0,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement,o=this._secondElement;if(this._menuInstanceInfo=n,r?.classList.remove(_V),r?.classList.add(xV),o?.classList.remove(_V),o?.classList.add(xV),this._canBindToCell(t,e,i)){if(r.innerHTML="",Array.isArray(n.content)){const o=n.content;for(let n=0;n<o?.length;n++){const s=o[n];let a=!!t.stateManeger.menu.dropDownMenuHighlight&&LV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey||s?.text:s,e,i);if(t.stateManeger.menu.dropDownMenuHighlight&&"object"==typeof s&&Array.isArray(s.children)&&s.children.length)for(let n=0;n<s.children.length;n++){const r=s.children[n];if(LV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof r?r?.menuKey||r?.text:r,e,i)){a=!0;break}}const l=IV(s,a);l.col=e,l.row=i,l.dropDownIndex=n,"string"==typeof s?(l.text=s,l.menuKey=s):"object"==typeof s&&(l.text=s.text,l.menuKey=s.menuKey||s.text,s.children?.length&&(l.hasChildren=!0)),r.appendChild(l)}}if(this._bindToCell(t,e,i,n.position,n.referencePosition))return r?.classList.add(_V),r?.classList.remove(xV),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement,e=this._secondElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(_V),t.classList.add(xV)),e?.parentElement&&(e.classList.remove(_V),e.classList.add(xV))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{top:o,bottom:s,left:a,right:l}=n,{frozenRowCount:h,frozenColCount:c}=t;if(i>=h&&h>0){if(s<t.getCellRangeRelativeRect({col:e,row:h-1}).bottom)return!1}else if(s<0)return!1;if(e>=c&&c>0){if(l<t.getCellRangeRelativeRect({col:c-1,row:i}).right)return!1}else if(l<0)return!1;const{offsetHeight:u,offsetWidth:d}=r;return!(u<o)&&!(d<a)}_bindToCell(t,e,i,n,r){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const e=.8*a;o.style.maxWidth=`${e}px`;const i=o.clientWidth,h=o.clientHeight;let c,u;return n?(c=n.x+t.tableX,u=n.y+t.tableY):r&&(c=r.rect.right-i+t.tableX,u=r.rect.bottom+t.tableY),u+h>l&&(u=l-h,c+=i-2),u<0&&(u/=2),o.style.top=`${u}px`,c<0?c=0:c+i>a&&(c=a-i),o.style.left=`${c}px`,!0}return!1}_bindSecondElement(t,e,i,n,r){const o=this._secondElement,s=this._rootElement,a=t.getElement(),{width:l,left:h,top:c}=t.internalProps.element.getBoundingClientRect(),{x:u,y:d,width:p}=s.getBoundingClientRect();if(o){o.parentElement!==a&&a.appendChild(o),o.style.left="0px";const t=.8*l;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=r-4-c,s=n-h;o.style.top=`${i}px`;let u=s;return u+e>l?u=u-e-p:u+=4,o.style.left=`${u}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();if(t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5)return!0;if(this._secondElement){const{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();if(t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5)return!0}return!1}}function IV(t,e){const i=bV("div",[wV,e?AV:SV]);if("string"==typeof t){const e=bV("span",[CV,PV,EV]);e.innerHTML=t,i.appendChild(e)}else if("object"==typeof t){const n=t.type??"item";if("split"===n)return i?.classList.add(BV),i;if(t?.icon?.svg)if(_f.test(t.icon.svg)){const e=new Image;t.icon.width?e.style.width=t.icon.width.toString()+"px":e.style.width="16px",t.icon.height?e.style.height=t.icon.height.toString()+"px":e.style.height="16px",e.src=t.icon.svg,i.appendChild(e)}else{const n=bV("span",[TV,PV]);n.innerHTML=e&&t.selectedIcon&&t.selectedIcon.svg?t.selectedIcon.svg:t.icon.svg,t.icon.width&&n.children[0].setAttribute("width",t.icon.width.toString()),t.icon.height&&n.children[0].setAttribute("height",t.icon.height.toString()),i.appendChild(n)}const r=bV("span",[CV,PV,EV]);if(r.innerHTML=t.text,i.appendChild(r),"title"===n)i?.classList.add(PV,MV);else if(t?.children?.length){const t=bV("span",[CV,PV,RV]);t.innerHTML=e?'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#2E68CF" fill-opacity="0.65"></path></svg>':'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#141414" fill-opacity="0.65"></path></svg>',i.appendChild(t)}}return i}let OV;class DV extends ku{static get DEFAULT(){return OV||(OV=new DV)}constructor(t={},e={}){super(t,e),this.textAlign=(t.textAlign??e?.textAlign)||"center"}clone(){return new DV(this)}}class FV{normalIcon;upIcon;downIcon;freezeIcon;frozenIcon;frozenCurrentIcon;dropDownAbsoluteIcon;expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=yj();this.freezeIcon=e[Qc.freezeIconName],this.frozenIcon=e[Qc.frozenIconName],this.frozenCurrentIcon=e[Qc.frozenCurrentIconName],this.normalIcon=e[Qc.normalIconName],this.upIcon=e[Qc.upwardIconName],this.downIcon=e[Qc.downwardIconName],this.dropDownAbsoluteIcon=e[Qc.dropdownIconName],this.expandIcon=e[Qc.expandIconName],this.collapseIcon=e[Qc.collapseIconName]}getIcons(t,e){const i=[];if(this._table.isPivotTable()){const{showSort:n}=this._table.internalProps.layoutMap.getHeader(t,e);if(n){const n=this._table.getPivotSortState(t,e),r="asc"===n?this.downIcon:"desc"===n?this.upIcon:this.normalIcon;r&&i.push(r)}}else{const n=this._table.sortState;let r;r=void 0;const o=this._table.getCellRange(t,e);if(n)if(Array.isArray(n))for(let t=0;t<n.length;t++){const e=n[t],i=this._table._getHeaderCellBySortState(e);if(i&&qp(o,i.col,i.row)){({order:r}=e);break}}else{const t=this._table._getHeaderCellBySortState(n);t&&qp(o,t.col,t.row)&&({order:r}=n)}const s=this.getSortIcon(r,this._table,t,e);s&&i.push(s)}if(this._table.showFrozenIcon&&t<this._table.allowFrozenColCount){const n=this.getFrozenIcon(t,e);n&&i.push(n)}if(this.checkDropDownIcon(this._table,t,e)){const t=this.dropDownAbsoluteIcon;i.push(t)}const n=this.getDropDownStateIcons(this._table,t,e);n.length&&i.push(...n);const{headerIcon:r}=this._table._getHeaderLayoutMap(t,e),o=this.getHierarchyIcon(t,e);if(o&&i.push(o),r){let n;if("function"==typeof r){n=r({col:t,row:e,value:this._table.getCellValue(t,e),dataValue:this._table.getCellOriginValue(t,e),table:this._table})}else n=r;const o=yj(),s=t=>{let e;e="string"==typeof t?o[t]:t,e&&i.push(e)};Array.isArray(n)?n.forEach(((t,e)=>{s(t)})):s(n)}return i}getFrozenIcon(t,e){if(this._table.isPivotTable()||this._table.transpose)return null;const i=this._table.getHeaderDefine(t,e);if(i.columns&&i.columns.length>0)return null;let n=this.freezeIcon;return this._table.options.frozenColCount-1>t?n=this.frozenIcon:this._table.options.frozenColCount-1===t&&(n=this.frozenCurrentIcon),n}getSortIcon(t,e,i,n){const r="asc"===t?this.downIcon:"desc"===t?this.upIcon:this.normalIcon,o=e.getHeaderDefine(i,n);return!o||!o.showSort&&!o.sort||o.columns&&o.columns.length>0?null:r}getDropDownStateIcons(t,e,i){const n=t.getHeaderDefine(e,i),r=t._getHeaderLayoutMap(e,i),{dropDownMenu:o}=r,s=[];if(Array.isArray(o)&&o.length||Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!n?.columns?.length){const n=o||t.globalDropDownMenu;let r=-1,a=-1;for(let o=0;o<n.length;o++){const s=n[o];if("object"==typeof s&&s.children&&s.children.length)for(let n=0;n<s.children.length;n++){const l=s.children[n];if(t.stateManeger.menu?.dropDownMenuHighlight&&LV(t,t.stateManeger.menu?.dropDownMenuHighlight,"object"==typeof l?l?.menuKey:l,e,i)){r=o,a=n;break}}if(t._dropDownMenuIsHighlight(e,i,o)){r=o;break}}if(-1!==r){let e;e=-1!==a?(o||t.globalDropDownMenu)[r].children[a]:(o||t.globalDropDownMenu)[r],e.stateIcon&&(e.stateIcon.svg?s.push({type:"svg",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,svg:e.stateIcon.svg,positionType:Zc.right,marginRight:0,funcType:Jc.dropDownState,interactive:!1}):e.stateIcon.src&&s.push({type:"image",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,src:e.stateIcon.src,positionType:Zc.right,marginRight:0,funcType:Jc.dropDownState,interactive:!1}))}}return s}getDropDownIconRect(t,e,i){const n=this.downIcon.hover?.width??this.downIcon?.width??0,r=this.downIcon.hover?.height??this.downIcon?.height??0,o=t.right-2-n,s=t.right-2;let a;a="middle"===i?t.top+t.height/2-n/2:"top"===i?t.top+e/2:"bottom"===i?t.bottom-2*e:t.top;return{left:o,right:s,top:a,bottom:r+a,width:n,height:r}}getHierarchyIcon(t,e){const{hierarchyState:i}=this._table._getHeaderLayoutMap(t,e);if(i){if(i===Xc.expand)return this.expandIcon;if(i===Xc.collapse)return this.collapseIcon}}checkDropDownIcon(t,e,i){if(t.isPivotTable()){const n=t._getHeaderLayoutMap(e,i);if(Array.isArray(n.dropDownMenu)&&n.dropDownMenu.length)return!0}else{const n=t.getHeaderDefine(e,i);if(Array.isArray(n.dropDownMenu)&&n.dropDownMenu.length||(!Array.isArray(n.dropDownMenu)||0!==n.dropDownMenu.length)&&Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!n?.columns?.length)return!0}return!1}getStyleClass(t){switch(t){case"text":case"link":return Ou;case"image":case"video":return DV}}}class zV{_table;_tooltipElement;constructor(t){this._table=t}release(){this.unbindTooltipElement(),this._tooltipElement&&this._tooltipElement.release?.(),this._tooltipElement=void 0}_getTooltipElement(){return this._tooltipElement||(this._tooltipElement=this.createTooltipElementInternal()),this._tooltipElement}bindTooltipElement(t,e,i,n){return this._getTooltipElement().bindToCell(this._table,t,e,i,n)}moveTooltipElement(t,e,i,n){this._getTooltipElement().move(this._table,t,e,i,n)}unbindTooltipElement(){this._getTooltipElement().unbindFromCell()}locateTooltipElement(t,e,i,n,r){this._getTooltipElement()._locate(this._table,t,e,i,n,r)}}!function(){const t=document.createElement("style");t.id="vtable-tooltip-styleSheet",t.textContent="\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\tpointer-events: none;\n\tuser-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n border: 1px solid #E6E8ED;\n box-sizing: border-box;\n border-radius: 4px;\n box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n color: #141414;\n font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow: hidden;\n\tword-wrap: break-word;\n\tposition: relative;\n\tbackground-color: #FFF;\n\tz-index: 2;\n\tborder-radius: 4px\n}\n.vtable__bubble-tooltip-element__triangle {\n\t/* font-size: .75rem; */\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tdisplay: block;\n\ttransform: rotate(45deg);\n transform-origin: 50% 50% 0;\n\tz-index: 1;\n\tbackground-color: #FFF;\n\tborder: 1px solid #E6E8ED;\n}\n",document.body.appendChild(t)}();const WV="vtable__bubble-tooltip-element",jV=`${WV}__content`,NV=`${WV}__triangle`,GV=`${WV}--hidden`,VV=`${WV}--shown`;class UV{_handler;_rootElement;_messageElement;_triangleElement;constructor(){this._handler=new df;const t=this._rootElement=bV("div",[WV,GV]),e=bV("span",[jV]),i=bV("span",[NV]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${jV}`)||void 0,this._triangleElement=t.querySelector(`.${NV}`)||void 0}bindToCell(t,e,i,n,r){const o=this._rootElement,s=this._messageElement,a=this._triangleElement;if(o?.classList.remove(VV),o?.classList.add(GV),this._canBindToCell(t,e,i)){s.setAttribute("style",""),a.setAttribute("style",""),n?.className&&o.classList.add(n.className),n?.style?.bgColor&&(s.style.backgroundColor=n?.style?.bgColor),n?.style?.bgColor&&(a.style.backgroundColor=n?.style?.bgColor),a.style.display=!0===n?.style?.arrowMark?"block":"none",n?.style?.font&&(s.style.font=n?.style?.font),n?.style?.color&&(s.style.color=n?.style?.color),n?.style?.padding&&(s.style.padding=`${n?.style?.padding.join("px ")}px`),s&&(s.textContent=n?.content);if(this._bindToCell(t,e,i,n?.position,n?.referencePosition,r,n?.style?.arrowMark))return o?.classList.add(VV),o?.classList.remove(GV),!0}else this.unbindFromCell();return!1}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler?.release?.(),delete this._rootElement,delete this._messageElement}move(t,e,i,n,r){const o=this._rootElement;this._canBindToCell(t,e,i)?(this._bindToCell(t,e,i,n?.position,n?.referencePosition,r),o?.classList.add(VV),o?.classList.remove(GV)):this.unbindFromCell()}unbindFromCell(){const t=this._rootElement;t?.parentElement&&(t.classList.remove(VV),t.classList.add(GV))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{bottom:o,left:s,right:a}=n,{frozenRowCount:l,frozenColCount:h}=t;if(i>=l&&l>0){if(o<t.getCellRangeRelativeRect({col:e,row:l-1}).bottom)return!1}else if(o<0)return!1;if(e>=h&&h>0){if(a<t.getCellRangeRelativeRect({col:h-1,row:i}).right)return!1}else if(s<0)return!1;const{offsetHeight:c,offsetWidth:u}=r;return!(c<o)&&!(u<s)}_bindToCell(t,e,i,n,r,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),h=t.getElement(),c=t.internalProps.element.offsetWidth,{width:u}=l;if(a){let l,d;a.parentElement!==h&&h.appendChild(a),a.style.left="0px";const p=Math.min(.8*c,4*u);a.style.maxWidth=`${p}px`;const f=a.clientWidth,g=a.clientHeight;if(!n&&!r)return!1;{const a=this.getComputedPosition(t,e,i,n,r,o,s);d=a.x,l=a.y}a.style.left=`${d}px`,a.style.top=`${l}px`,wu()&&(a.style.fontSize="11px");const{x1:m,x2:y,y1:b,y2:v}=t.stateManeger.menu.bounds,w=d,C=w+f,x=l,_=w+g;return!(t.stateManeger.menu.isShow&&m<C&&y>w&&v>x&&b<_)}return!1}getComputedPosition(t,e,i,n,r,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),{width:h,height:c}=t.internalProps.element.getBoundingClientRect(),{width:u}=l;let d,p;const f=Math.min(.8*h,4*u);a.style.maxWidth=`${f}px`;const g=a.clientWidth,m=a.clientHeight,y=s?6:0;if(n)p=n.x,d=n.y+y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(r){let e=r.placement??$c.bottom;const i=r.rect.left+r.rect.width/2+t.tableX,n=r.rect.top+r.rect.height/2+t.tableY,s=r.rect.top+t.tableY,a=r.rect.bottom+t.tableY,l=r.rect.left+t.tableX,u=r.rect.right+t.tableX;let f=0;const b=()=>{f++,f>=4||(this.removeStyleFromTriangle(),e===$c.top?(p=i-g/2,d=s-m-y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",o&&d<0&&(e=$c.right,b())):e===$c.bottom?(p=i-g/2,d=a+y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",o&&d+m>c&&(e=$c.left,b())):e===$c.left?(d=n-m/2,p=l-g-y,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",o&&p<0&&(e=$c.top,b())):e===$c.right&&(d=n-m/2,p=u+y,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",o&&p+g>h&&(e=$c.bottom,b())))};b()}return o&&(p<0?p=0:p+a.offsetWidth>h&&(p=h-a.offsetWidth)),{x:p,y:d}}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,n,r,o){const s=this.getComputedPosition(t,e,i,n,r,o),a=s.x,l=s.y;this._rootElement.style.left=`${a}px`,this._rootElement.style.top=`${l}px`}}class KV extends zV{createTooltipElementInternal(){return new UV}}const $V={"bubble-tooltip":function(t){return new KV(t)}};class XV{_table;_tooltipInstances;_attachInfo;confine;constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}release(){const t=this._tooltipInstances;for(const e in t)t[e]?.release?.();delete this._tooltipInstances,this._attachInfo=null}_bindToCell(t,e,i){const n=this._attachInfo,r=this._getTooltipInstanceInfo(t,e);if(!n||r&&n.instance===r||(n.instance?.unbindTooltipElement(),this._attachInfo=null),!r)return;if(r&&r.bindTooltipElement(t,e,i,this.confine)){const n=this._table.getCellRange(t,e);this._attachInfo={range:n,instance:r,tooltipOptions:i}}}_move(t,e,i){const n=this._attachInfo;if(!n||!qp(n.range,t,e))return;const{instance:r}=n;r?.moveTooltipElement(t,e,i,this.confine)}moveToPosition(t,e,i,n){const r=this._attachInfo;if(!r||!qp(r.range,t,e))return;const{instance:o}=r;this._attachInfo.tooltipOptions.position=i,this._attachInfo.tooltipOptions.referencePosition=n,o?.locateTooltipElement(t,e,i,n,this.confine)}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindTooltipElement(),this._attachInfo=null}_isBindCell(t,e){const i=this._attachInfo;return!!i&&qp(i.range,t,e)}_bindTableEvent(t){t.on(sf.MOUSEENTER_CELL,(e=>{if(wu())return;const{x1:i,x2:n,y1:r,y2:o}=t.stateManeger.menu.bounds;if(t.stateManeger.menu.isShow&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>i&&e.x<n&&e.y>r&&e.y<o)return;const{col:s,row:a}=e;if((!e.related||!this._isBindCell(s,a))&&t.internalProps.tooltip?.isShowOverflowTextTooltip){const i=t.getCellOverflowText(s,a),n=t.getHeaderDescription(s,a),r=t.getCellRangeRelativeRect({col:s,row:a});let o;i&&(o={content:n?`${n}\n ${i}`:i,referencePosition:{placement:$c.bottom,rect:r},style:{arrowMark:!1}}),n&&(o={content:n,referencePosition:{placement:$c.bottom,rect:r},style:{arrowMark:!1}}),o&&this._bindToCell(e.col,e.row,o)}})),t.on(sf.MOUSEMOVE_CELL,(e=>{if(!wu()){if(this._attachInfo?.tooltipOptions?.referencePosition){const i=this._attachInfo.tooltipOptions.referencePosition,{event:n}=e,{left:r,right:o,top:s,bottom:a}=i.rect,l=t._getMouseAbstractPoint(n,!1);l.inTable&&l.x>=r-5&&l.x<=o+5&&l.y>=s-5&&l.y<=a+5||this._unbindFromCell()}this._attachInfo&&t.stateManeger.menu.isShow&&this._bindToCell(e.col,e.row)}})),t.on(sf.MOUSELEAVE_CELL,(t=>{t.related&&this._isBindCell(t.related.col,t.related.row)||this._unbindFromCell()})),t.on(sf.SELECTED_CELL,(t=>{this._isBindCell(t.col,t.row)&&this._unbindFromCell()})),t.on(sf.MOUSELEAVE_TABLE,(t=>{this._unbindFromCell()})),t.on(sf.SCROLL,(e=>{const i=this._attachInfo;if(i?.tooltipOptions&&i?.range?.start){const{col:e,row:n}=i.range.start,r=t.getCellRangeRelativeRect({col:e,row:n});i.tooltipOptions.referencePosition.rect=r,this._move(i.range.start.col,i.range.start.row,i.tooltipOptions)}}))}_getTooltipInstanceInfo(t,e){const i=this._table,n=this._tooltipInstances,r="bubble-tooltip";return n&&n[r]||n&&(n[r]=$V[r](i))}isBinded(t){return JSON.stringify(t)===JSON.stringify(this._attachInfo?.tooltipOptions)}}const YV=new Map;function qV(t,e,i){const n=`${t}-${e}-${i}`,r=YV.get(n);if(r)return r;const o=(s={fontSize:t,fontFamily:i,fontWeight:e},new Lp({defaultFontParams:{fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:11},getTextBounds:l?void 0:lT,specialCharSet:`{}()//&-/: .,@%'"~${Lp.ALPHABET_CHAR_SET}${Lp.ALPHABET_CHAR_SET.toUpperCase()}`,...a??{}},s));var s,a,l;return YV.set(n,o),o}const ZV=new class{measureText(t,e){const{fontSize:i,fontFamily:n,fontWeight:r}=e;return qV(i,r,n).measure(t)}measureTextWidth(t,e){const{fontSize:i,fontFamily:n="sans-serif",fontWeight:r="normal"}=e;return qV(i,r,n).measure(t).width}clipText(t,e,i){if(0===t.length)return{str:"",width:0};let n=this.measureTextWidth(t,e);return n<=i?{str:t,width:n}:(n=this.measureTextWidth(t[0],e),n>i?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,r){const o=Math.floor((n+r)/2),s=t.substring(0,o+1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const r=t.substring(0,o);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipText(t,e,i,n,o)}if(a<i){if(o>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,o+2);return l=this.measureTextWidth(n,e),l>=i?{str:s,width:a}:this._clipText(t,e,i,o,r)}return{str:s,width:a}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const o=this.measureTextWidth(n,e);if(o>i)return{str:"",width:0};i-=o;const s=this._clipText(t,e,i,0,t.length-1);return s.str+=n,s.width+=o,s}};class JV{_table;_menuElement;constructor(t){this._table=t}release(){this.unbindMenuElement(),this._menuElement&&this._menuElement.release(),this._menuElement=void 0}_getMenuElement(){return this._menuElement||(this._menuElement=this.createMenuElementInternal()),this._menuElement}bindMenuElement(t,e,i){return this._getMenuElement().bindToCell(this._table,t,e,i)}unbindMenuElement(){this._getMenuElement().unbindFromCell()}pointInMenuElement(t,e){return this._getMenuElement().pointInMenuElement(t,e)}}const QV="vtable__menu-element",tU=`${QV}--hidden`,eU=`${QV}--shown`;class iU{_handler;_rootElement;_menuInstanceInfo;constructor(t){this._handler=new df,this._rootElement=bV("div",[QV,tU]),this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(tU))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(tU)||t.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement;if(this._menuInstanceInfo=n,r?.classList.remove(eU),r?.classList.add(tU),this._canBindToCell(t,e,i)){r.innerHTML="",r.appendChild(n.content);if(this._bindCell(t,e,i,n.position,n.referencePosition))return r?.classList.add(eU),r?.classList.remove(tU),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(eU),t.classList.add(tU))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{top:o,bottom:s,left:a,right:l}=n,{frozenRowCount:h,frozenColCount:c}=t;if(i>=h&&h>0){if(s<t.getCellRangeRelativeRect({col:e,row:h-1}).bottom)return!1}else if(s<0)return!1;if(e>=c&&c>0){if(l<t.getCellRangeRelativeRect({col:c-1,row:i}).right)return!1}else if(l<0)return!1;const{offsetHeight:u,offsetWidth:d}=r;return!(u<o)&&!(d<a)}_bindCell(t,e,i,n,r){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const t=.8*a;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=o.clientHeight;let h,c;return n&&(h=n.x,c=n.y),r&&(h=r.rect.right-e,c=r.rect.bottom),c+i>l&&(c=l-i,h+=e-2),c<0&&(c/=2),o.style.top=`${c}px`,h<0?h=0:h+e>a&&(h=a-e),o.style.left=`${h}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();return t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5}}class nU extends JV{createMenuElementInternal(){return new kV(this._table)}}let rU=class extends JV{createMenuElementInternal(){return new iU(this._table)}};const oU={"dropdown-menu":function(t){return new nU(t)},"context-menu":function(t){return new nU(t)},container:t=>new rU(t)};class sU{_table;_menuInstances;_attachInfo;constructor(t){this._table=t,this._menuInstances={},this._bindTableEvent(t)}release(){const t=this._menuInstances;for(const e in t)t[e].release();delete this._menuInstances,this._attachInfo=null}_bindToCell(t,e,i,n){const r=this._attachInfo,o=this._getMenuInstanceInfo(t,e,i,n);if(!r||o&&r.instance===o.instance||(r.instance?.unbindMenuElement(),this._attachInfo=null),!o)return;const{instance:s,info:a}=o;if(s&&s.bindMenuElement(t,e,a)){const i=this._table.getCellRange(t,e);this._attachInfo={range:i,instance:s}}}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindMenuElement(),this._attachInfo=null}_isBindToCell(t,e){const i=this._attachInfo;return!!i&&qp(i.range,t,e)}pointInMenuElement(t,e){if(!this._attachInfo)return!1;const i=this._attachInfo,{instance:n}=i;return n.pointInMenuElement(t,e)}_bindTableEvent(t){t.on(sf.DROPDOWN_ICON_CLICK,(t=>{this._attachInfo&&this._isBindToCell(t.col,t.row)?this._unbindFromCell():this._bindToCell(t.col,t.row,"dropdown-menu")})),t.on(sf.DROPDOWN_MENU_CLEAR,(t=>{this._unbindFromCell()})),t.on(sf.CONTEXTMENU_CELL,(e=>{if("html"===t.internalProps.menu?.renderMode){const i=t._getMouseAbstractPoint(e.event,!1);let n=null;i.inTable&&"function"==typeof t.internalProps.menu?.contextMenuItems?n=t.internalProps.menu.contextMenuItems(t.getHeaderField(e.col,e.row),e.row):i.inTable&&Array.isArray(t.internalProps.menu?.contextMenuItems)&&(n=t.internalProps.menu?.contextMenuItems),this._bindToCell(e.col,e.row,"context-menu",{content:n,position:{x:i.x,y:i.y}})}}))}_getMenuInstanceInfo(t,e,i,n){const r=this._table,o=this._menuInstances,s=function(t,e,i,n,r){const{lineHeight:o,textBaseline:s,textStick:a}=t._getCellStyle(e,i);let l=t.getCellRangeRelativeRect(t.getCellRange(e,i));a&&(l=t.getVisibleCellRangeRelativeRect({col:e,row:i}));let{left:h,right:c,bottom:u,top:d,width:p,height:f}=l;if(t.isHeader(e,i)&&({left:h,right:c,bottom:u,top:d,width:p,height:f}=t.internalProps.headerHelper.getDropDownIconRect(l,o,s||"middle")),r?.content)return{type:n,position:r.position,referencePosition:r.referencePosition??{rect:{left:h,right:c,top:d,bottom:u,width:p,height:f}},content:r.content};if("dropdown-menu"===n){const{dropDownMenu:r=t.globalDropDownMenu,pivotInfo:o}=t._getHeaderLayoutMap(e,i);return{type:n,referencePosition:{rect:{left:h,right:c,top:d,bottom:u,width:p,height:f}},content:r,pivotInfo:o}}return null}(r,t,e,i,n);if(!s)return null;return{instance:o&&o[i]||o&&(o[i]=oU[i](r)),type:i,info:s}}}class aU extends EventTarget{_table;_input;constructor(t,e){if(super(),this._table=t,"node"===hf.mode)return;const i=document.createElement("div");i.style.opacity="0",i.dataset.vtable="vtable",i.style.pointerEvents="none",i.classList.add("input-container");const n=this._input=document.createElement("input");i.appendChild(n),n.classList.add("table-focus-control"),n.dataset.vtable="vtable",n.readOnly=!0,e.appendChild(i)}focus(){this._input.focus({preventScroll:!0})}setFocusRect(t,e){const i=this._input;i.value=e,i.select();const n=t.top-this._table.scrollTop,r=t.left-this._table.scrollLeft;i.style.top=`${n.toFixed()}px`,i.style.left=`${r.toFixed()}px`,i.style.width=`${t.width.toFixed()}px`,i.style.height=`${t.height.toFixed()}px`}get input(){return this._input}release(){}}let lU=1;Op?lU=1:(lU=Math.ceil(window.devicePixelRatio||1),lU>1&&lU%2!=0&&(lU+=1));const hU={orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fill:"#000000",fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:"#89909D",fontSize:14},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!0,visible:!0};function cU(t,e){const{title:i={},item:n={},pager:r={},background:o={},type:s,id:a,visible:l,orient:h,position:c,data:u,filter:d,regionId:p,regionIndex:f,seriesIndex:g,seriesId:m,padding:y,...b}=fd({},hU,t),v=b;return i.visible&&(v.title=nO(i)),od(n.focusIconStyle)||rO(n.focusIconStyle),oO(n.shape),oO(n.label),oO(n.value),oO(n.background),lj(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),lj(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),lj(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,od(r.textStyle)||rO(r.textStyle),oO(r.handler),v.pager=r,o.visible&&!od(o.style)&&(fd(v,o.style),Uu(o.padding)&&(v.padding=o.padding)),v}class uU{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=cd(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),e=new CI(fd({},t,{defaultSelected:this.selectedData}));e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const n=this.table.tableNoFrameWidth,r=this.table.tableNoFrameHeight,o=RW(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=n-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=r-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,u=0;"horizontal"===l?c="middle"===h?(n-e)/2:"end"===h?n-e-o[1]:o[3]:u="middle"===h?(r-i)/2:"end"===h?r-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:u,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){return{layout:"bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",items:this.getLegendItems(),maxWidth:t.width,maxHeight:t.height,...cU(this.option,t)}}getLegendItems(){return this.option.data}initEvent(){this.legendComponent&&(this.legendComponent.addEventListener(mI.legendItemClick,(t=>{const e=sd(t,"detail.currentSelected");this.table.fireListeners(sf.LEGEND_ITEM_CLICK,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(mI.legendItemHover,(t=>{const e=sd(t,"detail");this.table.fireListeners(sf.LEGEND_ITEM_HOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(mI.legendItemUnHover,(t=>{const e=sd(t,"detail");this.table.fireListeners(sf.LEGEND_ITEM_UNHOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener("legendItemAttributeUpdate",(t=>{this.table.scenegraph.updateNextFrame()})))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}const dU={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},pU={horizontal:{...dU,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...dU,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},fU={horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...dU},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...dU}};function gU(t,e){const{title:i={},handler:n={},rail:r={},track:o={},startText:s,endText:a,handlerText:l,sizeBackground:h,background:c={},type:u,id:d,visible:p,orient:f,position:g,data:m,defaultSelected:y,field:b,filter:v,regionId:w,regionIndex:C,seriesIndex:x,seriesId:_,padding:S,...A}=fd({},("color"===t.type?pU:fU)["bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"],t),T=A;return i.visible&&(T.title=nO(i)),T.showHandler=!1!==n.visible,od(n.style)||(T.handlerStyle=rO(n.style)),Uu(r.width)&&(T.railWidth=r.width),Uu(r.height)&&(T.railHeight=r.height),od(r.style)||(T.railStyle=rO(r.style)),od(o.style)||(T.trackStyle=rO(o.style)),T.startText=oO(s),T.endText=oO(a),T.handlerText=oO(l),od(h)||(T.sizeBackground=rO(h)),c.visible&&!od(c.style)&&(fd(T,c.style),Uu(c.padding)&&(T.padding=c.padding)),T}class mU{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=cd(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight});let e;e="color"===this.option.type?new QI(fd({},t,{slidable:!0})):new eO(fd({},t,{slidable:!0})),e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const n=this.table.tableNoFrameWidth,r=this.table.tableNoFrameHeight,o=RW(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=n-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=r-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,u=0;"horizontal"===l?c="middle"===h?(n-e)/2:"end"===h?n-e-o[1]:o[3]:u="middle"===h?(r-i)/2:"end"===h?r-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:u,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){const e="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.orient;return{...gU(this.option),layout:e,align:i,min:this.option.min,max:this.option.max,value:this.option.value,["color"===this.option.type?"colors":"sizeRange"]:"color"===this.option.type?this.option.colors:this.option.sizeRange}}initEvent(){this.legendComponent&&this.legendComponent.addEventListener("change",(t=>{const e=sd(t,"detail.value");this.table.fireListeners(sf.LEGEND_CHANGE,{model:this,value:e,event:t}),this.table.scenegraph.updateNextFrame()}))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}function yU(t,e){return"color"===t.type||"size"===t.type?new mU(t,e):new uU(t,e)}class bU{table;_titleOption;_titleComponent;_cacheAttrs;constructor(t,e){this.table=e,this._titleOption=t,this._titleComponent=this._createOrUpdateTitleComponent(this._getTitleAttrs())}_createOrUpdateTitleComponent(t){if(this._titleComponent)yd(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=new iO(t);e.name="title",this.table.scenegraph.stage.defaultLayer.appendChild(e),this._titleComponent=e}return this._adjustTableSize(this._titleComponent.attribute),this._titleComponent}resize(){if(!this._titleComponent)return;const t=RW(this._titleOption.padding??10),e=this._titleOption.width??this.table.tableNoFrameWidth-t[1]-t[3];this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:e,textStyle:{width:e,...this._titleOption.textStyle},subtextStyle:{width:e,...this._titleOption.subtextStyle}}),this._adjustTableSize(this._titleComponent.attribute)}_adjustTableSize(t){let e=isFinite(this._titleComponent.AABBBounds.width())?this._titleComponent.AABBBounds.width():0;const i=isFinite(this._titleComponent.AABBBounds.height())?this._titleComponent.AABBBounds.height():0,n=(this.table.tableNoFrameWidth,this.table.tableNoFrameHeight,RW(t.padding??this._titleOption.padding??10));"left"===this._titleOption.orient?n[3]:"top"===this._titleOption.orient?n[0]:"right"===this._titleOption.orient?(n[1],e+=n[1]+n[3]):"bottom"===this._titleOption.orient&&n[2],"left"===this._titleOption.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this._titleOption.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this._titleOption.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this._titleOption.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i)),this._cacheAttrs=t,"right"!==this._titleOption.orient&&"bottom"!==this._titleOption.orient||this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY})}release(){this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent),this._titleComponent=null}_getTitleAttrs(){const t=RW(this._titleOption.padding??10),e=this._titleOption.width??this.table.tableNoFrameWidth-t[1]-t[3];return{text:this._titleOption.text??"",subtext:this._titleOption.subtext??"",x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:e,height:this._titleOption.height,minWidth:this._titleOption.minWidth,maxWidth:this._titleOption.maxWidth,minHeight:this._titleOption.minHeight,maxHeight:this._titleOption.maxHeight,padding:this._titleOption.padding,align:this._titleOption.align??"left",verticalAlign:this._titleOption.verticalAlign??"top",textStyle:{width:e,...this._titleOption.textStyle},subtextStyle:{width:e,...this._titleOption.subtextStyle}}}}const{toBoxArray:vU}=rf,{isTouchEvent:wU}=nf,CU=/^\$(\d+)\$(\d+)$/;!function(){const t=document.createElement("style");t.id="vtable-style-styleSheet",t.textContent="\n.vtable .input-container {\n\tposition: absolute;\n\ttop:0px;\n}\n.vtable .table-scrollable {\n\tposition: absolute;\n\toverflow: scroll;\n}\n.vtable .table-scrollable::-webkit-scrollbar-button{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-track-piece{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-corner {\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-thumb {\n\tborder-radius : 4px;\n\tbackground-color : rgba(100, 100, 100, .5);\n}\n\n.vtable .table-scroll-end-point {\n\topacity: 0;\n\tposition: relative;\n}\n.vtable {\n\t/* 设置overflow: auto 应该是为了滚动条的某个问题 但设置了auto之后 dom的下拉菜单只能显示在vtable节点中 超出会截断;现在去掉auto 暂时滚动条的问题没有发现 */\n\t/* overflow: auto; */\n\tposition: relative;\n\twidth: 100%;\n\theight: 100%;\n\ttext-align: left;\n -webkit-font-smoothing:auto;\n}\n.vtable > canvas {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n}\n.vtable .table-focus-control {\n\tposition: relative !important;\n\twidth: 1px;\n\theight: 1px;\n\topacity: 0;\n\tpadding: 0;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n\tmax-width: 500px;\n\tmax-height: 500px;\n\tfloat: none !important;\n}\n.vtable input.table-focus-control::-ms-clear {\n\tvisibility: hidden;\n}\n.vtable input.table-focus-control.composition {\n\topacity: 1;\n\tmax-width: none;\n\tmax-height: none;\n}\n",document.body.appendChild(t)}();const xU={};class _U extends Su{internalProps;showFrozenIcon=!0;showSort=!0;padding;globalDropDownMenu;tableNoFrameWidth;tableNoFrameHeight;tableX;tableY;_widthMode;_heightMode;_autoFillWidth;customRender;canvasWidth;canvasHeight;_vDataSet;scenegraph;stateManeger;eventManeger;_pixelRatio;static get EVENT_TYPE(){return sf}options;version="0.10.2";pagination;id=`VTable${Date.now()}`;headerStyleCache;bodyStyleCache;container;constructor(t,e={}){if(super(),!t)throw new Error("vtable's container is undefined");const{frozenColCount:i=0,defaultRowHeight:n=40,defaultHeaderRowHeight:r,defaultColWidth:o=80,defaultHeaderColWidth:s,widthMode:a="standard",heightMode:l="standard",autoFillWidth:h=!1,keyboardOptions:c,columnResizeMode:u,dragHeaderMode:d,showFrozenIcon:p,allowFrozenColCount:f,padding:g,hover:m,menu:y,select:b,customRender:v,pixelRatio:w=lU,renderChartAsync:C,renderChartAsyncBatchCount:x}=e;this.container=t,this.options=e,this.options.container=t,this._widthMode=a,this._heightMode=l,this._autoFillWidth=h,this.customRender=v,this.padding={top:0,right:0,left:0,bottom:0},g&&("number"==typeof g?(this.padding.top=g,this.padding.left=g,this.padding.bottom=g,this.padding.right=g):(g.top&&(this.padding.top=g.top),g.bottom&&(this.padding.bottom=g.bottom),g.left&&(this.padding.left=g.left),g.right&&(this.padding.right=g.right))),this.tableNoFrameWidth=0,this.tableNoFrameHeight=0;const _=this.internalProps={};void 0!==p&&(this.showFrozenIcon=p),"number"==typeof f&&f<=0&&(this.showFrozenIcon=!1),_.handler=new df,_.element=function(t){const e=document.createElement("div");e.setAttribute("tabindex","0"),e.classList.add("vtable"),e.style.outline="none",e.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const i=(e.offsetWidth||e.parentElement?.offsetWidth||1)-1,n=(e.offsetHeight||e.parentElement?.offsetHeight||1)-1;return e.style.width=i&&i-t.left-t.right+"px"||"0px",e.style.height=n&&n-t.top-t.bottom+"px"||"0px",e}(this.padding),_.focusControl=new aU(this,_.element),_.pixelRatio=w,_.canvas=document.createElement("canvas"),_.element.appendChild(_.canvas),_.context=_.canvas.getContext("2d"),_.frozenColCount=i,_.defaultRowHeight=n,_.defaultHeaderRowHeight=r??n,_.defaultColWidth=o,_.defaultHeaderColWidth=s??o,_.keyboardOptions=c,_.columnResizeMode=u,_.dragHeaderMode=d,_.renderChartAsync=C,sN(x),_._rowHeightsMap=new ff,_._rowRangeHeightsMap=new Map,_._colRangeWidthsMap=new Map,_._widthResizedColMap=new Set,this.colWidthsMap=new ff,this.colContentWidthsMap=new ff,this.colWidthsLimit={},_.calcWidthContext={_:_,get full(){return this._.canvas.width/(this._.context.pixelRatio??window.devicePixelRatio)}},_.cellTextOverflows={},_.focusedTable=!1,_.theme=Ff.of(e.theme??Ff.DEFAULT),t?(t.innerHTML="",t.appendChild(_.element),this._updateSize()):this._updateSize(),this.options=e,_.theme=Ff.of(e.theme??Ff.DEFAULT),_.bodyHelper=new yV(this),_.headerHelper=new FV(this),_.autoWrapText=e.autoWrapText,_.allowFrozenColCount=e.allowFrozenColCount??_.colCount,_.limitMaxAutoWidth=e.limitMaxAutoWidth??450,this._vDataSet=new jz,this.scenegraph=new WG(this),this.stateManeger=new iV(this),this.eventManeger=new pV(this),e.legends&&(_.legends=yU(e.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),e.title&&(_.title=new bU(e.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),_.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},e.tooltip),"html"===_.tooltip.renderMode&&(_.tooltipHandler=new XV(this,_.tooltip.confine)),_.menu=Object.assign({renderMode:"html"},e.menu),Array.isArray(e.menu?.dropDownMenuHighlight)&&this.setDropDownMenuHighlight(e.menu?.dropDownMenuHighlight),Array.isArray(e.menu?.defaultHeaderMenuItems)&&(this.globalDropDownMenu=e.menu.defaultHeaderMenuItems),"html"===_.menu.renderMode&&(_.menuHandler=new sU(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map}throttleInvalidate=function(t,e){let i=null;return function(...n){i||(i=setTimeout((()=>{t.apply(this,n),i=null}),e))}}(this.render.bind(this),200);getContainer(){return this.container}getElement(){return this.internalProps.element}get canvas(){return this.internalProps.canvas}resize(){this._updateSize(),this.internalProps.legends&&this.internalProps.legends.resize(),this.internalProps.title&&this.internalProps.title.resize(),this.scenegraph.resize()}get rowCount(){return this.internalProps.rowCount}set rowCount(t){this.internalProps.rowCount=t}get colCount(){return this.internalProps.colCount??0}set colCount(t){this.internalProps.colCount=t}get frozenColCount(){return this.internalProps.frozenColCount??0}set frozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManeger.setFrozenCol(this.internalProps.frozenColCount)}setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManeger.setFrozenCol(this.internalProps.frozenColCount)}_setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t}_resetFrozenColCount(){this.options.frozenColCount&&(this.tableNoFrameWidth-this.getColsWidth(0,this.options.frozenColCount-1)<=120?this._setFrozenColCount(0):this.frozenColCount!==this.options.frozenColCount&&this._setFrozenColCount(this.options.frozenColCount))}get frozenRowCount(){return this.internalProps.frozenRowCount??0}set frozenRowCount(t){this.internalProps.frozenRowCount=t}get rightFrozenColCount(){return this.internalProps.rightFrozenColCount??0}set rightFrozenColCount(t){this.scenegraph.dealWidthRightFrozen(t)}get bottomFrozenRowCount(){return this.internalProps.bottomFrozenRowCount??0}set bottomFrozenRowCount(t){this.scenegraph.dealWidthBottomFrozen(t)}get defaultRowHeight(){return this.internalProps.defaultRowHeight}set defaultRowHeight(t){this.internalProps.defaultRowHeight=t,this.options.defaultRowHeight=t}get defaultHeaderRowHeight(){return this.internalProps.defaultHeaderRowHeight}set defaultHeaderRowHeight(t){this.internalProps.defaultHeaderRowHeight=t,this.options.defaultHeaderRowHeight=t}get defaultColWidth(){return this.internalProps.defaultColWidth}set defaultColWidth(t){this.internalProps.defaultColWidth=t,this.options.defaultColWidth=t}get defaultHeaderColWidth(){return this.internalProps.defaultHeaderColWidth}set defaultHeaderColWidth(t){this.internalProps.defaultHeaderColWidth=t,this.options.defaultHeaderColWidth=t}get colWidthsMap(){return this.internalProps._colWidthsMap}set colWidthsMap(t){this.internalProps._colWidthsMap=t}get colContentWidthsMap(){return this.internalProps._colContentWidthsMap}set colContentWidthsMap(t){this.internalProps._colContentWidthsMap=t}get _colRangeWidthsMap(){return this.internalProps._colRangeWidthsMap}set _colRangeWidthsMap(t){this.internalProps._colRangeWidthsMap=t}get _rowRangeHeightsMap(){return this.internalProps._rowRangeHeightsMap}set _rowRangeHeightsMap(t){this.internalProps._rowRangeHeightsMap=t}get rowHeightsMap(){return this.internalProps._rowHeightsMap}set rowHeightsMap(t){this.internalProps._rowHeightsMap=t}get colWidthsLimit(){return this.internalProps._colWidthsLimit}set colWidthsLimit(t){this.internalProps._colWidthsLimit=t}get keyboardOptions(){return this.internalProps.keyboardOptions??null}set keyboardOptions(t){this.internalProps.keyboardOptions=t??void 0}get widthMode(){return this._widthMode}set widthMode(t){t!==this._widthMode&&(this._widthMode=t,this.options.widthMode=t)}get heightMode(){return this._heightMode}set heightMode(t){t!==this._heightMode&&(this._heightMode=t,this.options.heightMode=t)}get autoFillWidth(){return this._autoFillWidth}set autoFillWidth(t){t!==this._autoFillWidth&&(this._autoFillWidth=t)}_colWidthDefineToPxWidth(t){return"auto"===t?0:dj(this,t)}_getColWidthLimits(t){const e=this.colWidthsLimit[t];if(!e)return null;const i={};return e.min&&(i.min=dj(this,e.min),i.minDef=e.min),e.max&&(i.max=dj(this,e.max),i.maxDef=e.max),i}_adjustColWidth(t,e){const i=this._getColWidthLimits(t);return Math.max(function(t,e){return t?t.min&&t.min>e?t.min:t.max&&t.max<e?t.max:e:e}(i,e),0)}setPixelRatio(t){this.internalProps.pixelRatio=t,this.scenegraph.setPixelRatio(t)}_updateSize(){const{padding:t}=this;let e=0,i=0;if("browser"===hf.mode){const n=this.getElement(),r=n.parentElement?.offsetWidth??0,o=n.parentElement?.offsetHeight??0;n.style.width=r&&r-t.left-t.right+"px"||"0px",n.style.height=o&&o-t.top-t.bottom+"px"||"0px";const{canvas:s}=this.internalProps;e=s.parentElement?.offsetWidth??0,i=s.parentElement?.offsetHeight??0,this?.scenegraph?.stage?this.scenegraph.stage.resize(e,i):(s.style.width="",s.style.height="",s.width=e,s.height=i,s.style.width=`${e}px`,s.style.height=`${i}px`)}else"node"===hf.mode&&(e=this.canvasWidth-1,i=this.canvasHeight-1);const n=Math.floor(e-Fu(this.getTheme().scrollStyle)),r=Math.floor(i-Fu(this.getTheme().scrollStyle));if(this.internalProps.theme?.frameStyle){const t=vU(this.internalProps.theme.frameStyle?.borderLineWidth??[null]),e=vU(this.internalProps.theme.frameStyle?.shadowBlur??[0]);this.tableX=(t[3]??0)+(e[3]??0),this.tableY=(t[0]??0)+(e[0]??0),this.tableNoFrameWidth=n-((t[1]??0)+(e[1]??0))-((t[3]??0)+(e[3]??0)),this.tableNoFrameHeight=r-((t[0]??0)+(e[0]??0))-((t[2]??0)+(e[2]??0))}}get rowHierarchyType(){return"grid"}setColWidths(t){t.forEach(((t,e)=>this.setColWidth(e,t)))}getColsWidth(t,e){e=Math.min(e,this.colCount-1);const i=this._colRangeWidthsMap.get(`$${t}$${e}`);if(null!=i)return i;const n=this._colRangeWidthsMap.get(`$${t}$${e-1}`);if(null!=n){const i=n+this.getColWidth(e);return t>=0&&e>=0&&!Number.isNaN(i)&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(i)),Math.round(i)}let r=0;for(let i=t;i<=e;i++)r+=this.getColWidth(i);return t>=0&&e>=0&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(r)),Math.round(r)}getRowHeight(t){return this.rowHeightsMap.get(t)?this.rowHeightsMap.get(t):this.isColumnHeader(0,t)||this.isCornerHeader(0,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[t]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.isBottomFrozenRow(this.rowHeaderLevelCount,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[this.columnHeaderLevelCount-this.bottomFrozenRowCount]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight}setRowHeight(t,e,i){this.rowHeightsMap.put(t,Math.round(e)),i&&this._clearRowRangeHeightsMap(t)}getRowsHeight(t,e){const i=this._rowRangeHeightsMap.get(`$${t}$${e}`);if(null!=i)return i;const n=this._rowRangeHeightsMap.get(`$${t}$${e-1}`);if(null!=n){const i=Math.round(n+(this.rowHeightsMap.get(e)??(this.isColumnHeader(0,e)||this.isCornerHeader(0,e)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[e]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight)));return t>=0&&e>=0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(i)),i}let r=0;if("standard"===this.heightMode&&this.internalProps.layoutMap&&e>=this.columnHeaderLevelCount&&!this.bottomFrozenRowCount&&!this.hasAutoImageColumn()){for(let e=t;e<this.columnHeaderLevelCount;e++)r+=this.getRowHeight(e);r+=this.defaultRowHeight*(e-Math.max(this.columnHeaderLevelCount,t)+1)}else for(let i=t;i<=e;i++)r+=this.getRowHeight(i);return t>=0&&e>=0&&r>0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(r)),Math.round(r)}getColWidthDefined(t){const{layoutMap:e}=this.internalProps;if("autoWidth"===this.widthMode)return"auto";const{width:i}=e?.getColumnWidthDefined(t)??{};return"number"==typeof i&&i<=0?0:i||(this.isRowHeader(t,0)||this.isCornerHeader(t,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.isRightFrozenColumn(t,this.columnHeaderLevelCount)&&this.isPivotTable()?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[this.rowHeaderLevelCount-this.rightFrozenColCount]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth)}getColWidth(t){const e=this.colWidthsMap.get(t)??0;return"adaptive"===this.widthMode&&"number"==typeof e||this.transpose&&"number"==typeof e?this._colWidthDefineToPxWidth(e):this._adjustColWidth(t,this._colWidthDefineToPxWidth(e))}setColWidth(t,e,i,n){this.colWidthsMap.put(t,"number"==typeof e?Math.round(e):e),i&&this._clearColRangeWidthsMap(t),n||this.stateManeger.checkFrozen()}_clearColRangeWidthsMap(t){if("number"!=typeof t)this._colRangeWidthsMap.clear();else{const e=this._colRangeWidthsMap.keys();for(const i of e){const e=CU.exec(i);if(e){const n=Number(e[1]),r=Number(e[2]);t>=n&&t<=r&&this._colRangeWidthsMap.delete(i)}}}}_clearRowRangeHeightsMap(t){if("number"!=typeof t)this._rowRangeHeightsMap.clear();else{const e=this._rowRangeHeightsMap.keys();for(const i of e){const e=CU.exec(i);if(e){const n=Number(e[1]),r=Number(e[2]);t>=n&&t<=r&&this._rowRangeHeightsMap.delete(i)}}}}_getColContentWidth(t){return Number(this.colContentWidthsMap.get(t))}_setColContentWidth(t,e){this.colContentWidthsMap.put(t,e)}getAllRowsHeight(){if(this.internalProps.rowCount<=0)return 0;return this.getRowsHeight(0,this.internalProps.rowCount-1)}getAllColsWidth(){if(this.internalProps.colCount<=0)return 0;return this.getColsWidth(0,this.internalProps.colCount-1)}getMaxColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.max)??1/0;return"string"==typeof i&&(i=dj(this,i)),i}setMaxColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).max=e}getMinColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.min)??0;return"string"==typeof i&&(i=dj(this,i)),i}setMinColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).min=e}getCellRect(t,e){const i=this.isFrozenCell(t,e);let n=this.getColsWidth(0,t-1)||0;const r=this.getColWidth(t);i&&i.col&&(n+=this.scrollLeft);let o=this.getRowsHeight(0,e-1);const s=this.getRowHeight(e);return i&&i.row&&(o+=this.scrollTop),new gf(Math.round(n),Math.round(o),Math.round(r),Math.round(s))}getMergeCellRect(t,e){const i=this.getCellRange(t,e),n=this.getColsWidth(0,i.start.col-1)||0,r=this.getColsWidth(i.start.col,i.end.col),o=this.getRowsHeight(0,i.start.row-1)||0,s=this.getRowsHeight(i.start.row,i.end.row);return new gf(Math.round(n),Math.round(o),Math.round(r),Math.round(s))}getCellRelativeRect(t,e){return this._toRelativeRect(this.getCellRect(t,e))}getCellRangeRelativeRect(t){if(t.start)return this._toRelativeRect(this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row));const e=this.getCellRange(t.col,t.row);return this._toRelativeRect(this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row))}getVisibleCellRangeRelativeRect(t){let e;return e=t.start?t:this.getCellRange(t.col,t.row),this._getVisiableRect(this.getCellRangeRelativeRect(t),e)}_getVisiableRect(t,e){const i=e.start.col>=this.frozenColCount?Math.max(t.left,this.frozenColCount>=1?this.getColsWidth(0,this.frozenColCount-1):0):t.left,n=Math.min(t.right,this.tableNoFrameWidth),r=t.copy();r.left=i,r.right=n;const o=e.start.row>=this.frozenRowCount?Math.max(t.top,this.frozenRowCount>=1?this.getRowsHeight(0,this.frozenRowCount-1):0):t.top,s=Math.min(t.bottom,this.tableNoFrameHeight);return r.top=o,r.bottom=s,r}getCellsRect(t,e,i,n){const r=this.isFrozenCell(t,e),o=this.isFrozenCell(i,n);let s=this.getColsWidth(0,t-1)||0,a=this.getColsWidth(t,i);if(r&&r.col){const e=this.scrollLeft;s+=e,o&&o.col||(a-=e,a=Math.max(a,this.getColsWidth(t,this.frozenColCount-1)))}let l=this.getRowsHeight(0,e-1),h=this.getRowsHeight(e,n);if(r&&r.row){const t=this.scrollTop;l+=t,o&&o.row||(h-=t,h=Math.max(h,this.getRowsHeight(e,this.frozenRowCount-1)))}return new gf(Math.round(s),Math.round(l),Math.round(a),Math.round(h))}getCellsRectWidth(t,e,i,n){const r=this.isFrozenCell(t,e),o=this.isFrozenCell(i,n);let s=this.getColsWidth(t,i);if(r&&r.col){const e=this.scrollLeft;o&&o.col||(s-=e,s=Math.max(s,this.getColsWidth(t,this.frozenColCount-1)))}return s}getCellRangeRect(t){if(t.start)return this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row)}getCellRangeRectWidth(t){if(t.start)return this.getCellsRectWidth(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRectWidth(e.start.col,e.start.row,e.end.col,e.end.row)}isFrozenCell(t,e){const{frozenRowCount:i,frozenColCount:n}=this.internalProps,r=i>0&&e<i||this.isBottomFrozenRow(t,e),o=n>0&&t<n||this.isRightFrozenColumn(t,e);return r||o?{row:r,col:o}:null}getRowAt(t){const e=function(t,e){if(!t.internalProps.frozenRowCount)return null;let{scrollTop:i}=t;const n=t.internalProps.frozenRowCount;for(let r=0;r<n;r++){const n=t.getRowHeight(r),o=i+n;if(o>e)return{top:i,row:r,bottom:o,height:n};i=o}return null}(this,t);if(e)return e;let i=this.getTargetRowAt(t);return i||(i={top:-1,row:-1,bottom:-1,height:-1}),i}getColAt(t){const e=function(t,e){if(!t.internalProps.frozenColCount)return null;let{scrollLeft:i}=t;const n=t.internalProps.frozenColCount;for(let r=0;r<n;r++){const n=t.getColWidth(r),o=i+n;if(o>e)return{left:i,col:r,right:o,width:n};i=o}return null}(this,t);if(e)return e;let i=this.getTargetColAt(t);return i||(i={left:-1,col:-1,right:-1,width:1}),i}getCellAt(t,e){const i=this.getRowAt(e),{row:n,top:r,bottom:o,height:s}=i,a=this.getColAt(t),{col:l,left:h,right:c,width:u}=a;return{row:n,col:l,rect:{left:h,right:c,top:r,bottom:o,width:u,height:s}}}_checkRowCol(t,e){return t>=0&&t<this.colCount&&e>=0&&e<this.rowCount}_makeVisibleCell(t,e){if(this._checkRowCol(t,e)){const i=this.isFrozenCell(t,e);if(i&&i.col&&i.row)return;const n=this.getCellRect(t,e),r=function(t){let e=0;t.internalProps.frozenColCount>0&&(e=t.getFrozenColsWidth());let i=0;return t.internalProps.frozenRowCount>0&&(i=t.getFrozenRowsHeight()),new gf(t.scrollLeft+e,t.scrollTop+i,t.tableNoFrameWidth-e,t.tableNoFrameHeight-i)}(this);if(r.contains(n))return;i&&i.col||this.getColsWidth(0,this.frozenColCount-1)+n.width>this.canvas.width||(n.left<r.left?this.scrollLeft-=r.left-n.left:r.right<n.right&&(this.scrollLeft-=r.right-n.right)),i&&i.row||this.getRowsHeight(0,this.frozenRowCount-1)+n.height>this.canvas.height||(n.top<r.top?this.scrollTop-=r.top-n.top:r.bottom<n.bottom&&(this.scrollTop-=r.bottom-n.bottom))}}render(){this.scenegraph.renderSceneGraph()}_toRelativeRect(t){const e=t.copy(),i=this.getVisibleRect();return e.offsetLeft(-i.left),e.offsetTop(-i.top),e}getVisibleRect(){const{scrollTop:t,scrollLeft:e}=this,i=this.tableNoFrameWidth,n=this.tableNoFrameHeight;return new gf(e,t,i,n)}get visibleRowCount(){const{frozenRowCount:t}=this,e=this.getVisibleRect(),i=t>0?e.top+this.getRowsHeight(0,t-1):e.top,n=this.getTargetRowAt(i);if(!n)return 0;const r=Math.max(n.top>=i?n.row:n.row+1,t);let o=this.getRowsHeight(0,r-1),s=0;const{rowCount:a}=this;for(let t=r;t<a;t++){const i=o+this.getRowHeight(t);if(e.bottom<i)break;s++,o=i}return s}get visibleColCount(){const{frozenColCount:t}=this,e=this.getVisibleRect(),i=t>0?e.left+this.getColsWidth(0,t-1):e.left,n=this.getTargetColAt(i);if(!n)return 0;const r=Math.max(n.left>=i?n.col:n.col+1,t);let o=this.getColsWidth(0,r-1),s=0;const{colCount:a}=this;for(let t=r;t<a;t++){const i=o+this.getColWidth(t);if(e.right<i)break;s++,o=i}return s}get scrollTop(){return this.stateManeger.scroll.verticalBarPos}set scrollTop(t){this.stateManeger.setScrollTop(t)}get scrollLeft(){return this.stateManeger.scroll.horizontalBarPos}set scrollLeft(t){this.stateManeger.setScrollLeft(t)}getScrollLeft(){return this.scrollLeft}getScrollTop(){return this.scrollTop}setScrollLeft(t){this.scrollLeft=Math.ceil(t)}setScrollTop(t){this.scrollTop=Math.ceil(t)}getCellOverflowText(t,e){return this.scenegraph.getCellOverflowText(t,e)}addReleaseObj(t){if(!t||!t.release||"function"!=typeof t.release)throw new Error("not releaseObj!");(this.internalProps.releaseList=this.internalProps.releaseList||[]).push(t)}dispose(){this.release()}release(){const t=this.internalProps;t.tooltipHandler?.release?.(),t.menuHandler?.release?.(),gj.clearAll(),super.release?.(),t.handler?.release?.(),t.focusControl?.release?.(),t.releaseList&&(t.releaseList.forEach((t=>t?.release?.())),t.releaseList=null),this.scenegraph.stage.release();const{parentElement:e}=t.element;e&&e.removeChild(t.element)}fireListeners(t,e){return super.fireListeners(t,e)}updateOption(t){this.options=t;const{frozenColCount:e=0,defaultRowHeight:i=40,defaultHeaderRowHeight:n,defaultColWidth:r=80,defaultHeaderColWidth:o=80,keyboardOptions:s,columnResizeMode:a,dragHeaderMode:l,showFrozenIcon:h,allowFrozenColCount:c,padding:u,hover:d,menu:p,select:f,pixelRatio:g,widthMode:m,heightMode:y,autoFillWidth:b,customRender:v,renderChartAsync:w,renderChartAsyncBatchCount:C}=t;g&&g!==this.internalProps.pixelRatio&&(this.internalProps.pixelRatio=g),u&&("number"==typeof u?(this.padding.top=u,this.padding.left=u,this.padding.bottom=u,this.padding.right=u):(u.top&&(this.padding.top=u.top),u.bottom&&(this.padding.bottom=u.bottom),u.left&&(this.padding.left=u.left),u.right&&(this.padding.right=u.right))),this.showFrozenIcon="boolean"!=typeof h||h,"number"==typeof c&&c<=0&&(this.showFrozenIcon=!1),this.widthMode=m??"standard",this.heightMode=y??"standard",this.autoFillWidth=b??!1,this.customRender=v;const x=this.internalProps;"node"!==hf.mode&&function(t,e){t.style.margin=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`;const i=(t.offsetWidth||t.parentElement?.offsetWidth||1)-1,n=(t.offsetHeight||t.parentElement?.offsetHeight||1)-1;t.style.width=i&&i-e.left-e.right+"px"||"0px",t.style.height=n&&n-e.top-e.bottom+"px"||"0px"}(x.element,this.padding),x.frozenColCount=e,x.defaultRowHeight=i,x.defaultHeaderRowHeight=n??i,x.defaultColWidth=r,x.defaultHeaderColWidth=o??r,x.keyboardOptions=s,x.columnResizeMode=a,x.dragHeaderMode=l,x.renderChartAsync=w,sN(C),x.cellTextOverflows={},x._rowHeightsMap=new ff,x._rowRangeHeightsMap=new Map,x._colRangeWidthsMap=new Map,x._widthResizedColMap=new Set,this.colWidthsMap=new ff,this.colContentWidthsMap=new ff,this.colWidthsLimit={},x.theme=Ff.of(t.theme??Ff.DEFAULT),x.autoWrapText=t.autoWrapText,x.allowFrozenColCount=t.allowFrozenColCount??x.colCount,x.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this._vDataSet=new jz,x.legends?.release(),x.title?.release(),x.layoutMap.release(),this.scenegraph.clearCells(),this.stateManeger.initState(),this._updateSize(),t.legends&&(x.legends=yU(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(x.title=new bU(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),x.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"!==x.tooltip.renderMode||x.tooltipHandler||(x.tooltipHandler=new XV(this,x.tooltip.confine)),x.menu=Object.assign({renderMode:"html"},t.menu),"html"!==x.menu.renderMode||x.menuHandler||(x.menuHandler=new sU(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.clearColWidthCache(),this.clearRowHeightCache()}renderWithRecreateCells(){this.refreshHeader(),this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}getFrozenRowsHeight(){return this.getRowsHeight(0,this.frozenRowCount-1)}getFrozenColsWidth(){return this.getColsWidth(0,this.frozenColCount-1)}getBottomFrozenRowsHeight(){if(this.bottomFrozenRowCount>0){return this.getRowsHeight(this.rowCount-this.bottomFrozenRowCount,this.rowCount-1)}return 0}getRightFrozenColsWidth(){if(this.rightFrozenColCount>0){return this.getColsWidth(this.colCount-this.rightFrozenColCount,this.colCount-1)}return 0}getDrawRange(){const t=Math.min(this.tableNoFrameWidth,this.getAllColsWidth()),e=Math.min(this.tableNoFrameHeight,this.getAllRowsHeight());return new gf(this.tableX,this.tableY,t,e)}_getMouseAbstractPoint(t,e=!0){const i=this;let n;if(!t)return{inTable:!1,x:void 0,y:void 0};n=wU(t)?t.changedTouches[0]:t;const r=n.clientX||n.pageX+window.scrollX,o=n.clientY||n.pageY+window.scrollY,s=i.internalProps.canvas.getBoundingClientRect();let a=!0;s.right<=r&&(a=!1),s.bottom<=o&&(a=!1);const l=s.width,h=l/(this.canvas.offsetWidth||l),c=s.height,u=c/(this.canvas.offsetHeight||c);return{x:(r-s.left)/h+(e?i.scrollLeft:0)-i.tableX,y:(o-s.top)/u+(e?i.scrollTop:0)-i.tableY,inTable:a}}getTheme(){return this.internalProps.theme}getTargetColAt(t){if(0===t)return{left:0,col:0,right:0,width:0};const e=(e,i)=>{let n=i-this.getColWidth(e);const{colCount:r}=this.internalProps;for(let i=e;i<r;i++){const e=this.getColWidth(i),r=n+e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{left:n,col:i,right:r,width:e};n=r}return null},i=this.computeTargetColByX(t),n=this.getColsWidth(0,i);return t>=n?e(i,n):((e,i)=>{let n=i;for(let i=e;i>=0;i--){const e=this.getColWidth(i),r=n-e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{left:r,col:i,right:n,width:e};n=r}return null})(i,n)}getTargetRowAt(t){if(0===t)return{top:0,row:0,bottom:0,height:0};const e=(e,i)=>{let n=i-this.getRowHeight(e);const{rowCount:r}=this.internalProps;for(let i=e;i<r;i++){const e=this.getRowHeight(i),r=n+e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{top:n,row:i,bottom:r,height:e};n=r}return null},i=this.computeTargetRowByY(t),n=this.getRowsHeight(0,i);return t>=n?e(i,n):((e,i)=>{let n=i;for(let i=e;i>=0;i--){const e=this.getRowHeight(i),r=n-e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{top:r,row:i,bottom:n,height:e};n=r}return null})(i,n)}computeTargetRowByY(t){if(this._rowRangeHeightsMap.get("$0$"+(this.rowCount-1))){let e=0,i=this.rowCount-1;for(;i-e>1;){const n=Math.floor((e+i)/2);if(t<this._rowRangeHeightsMap.get(`$0$${n}`))i=n;else{if(!(t>this._rowRangeHeightsMap.get(`$0$${n}`)))return n;e=n}}return i}return Math.min(Math.ceil(t/this.internalProps.defaultRowHeight),this.rowCount-1)}computeTargetColByX(t){if(this._colRangeWidthsMap.get("$0$"+(this.colCount-1))){let e=0,i=this.colCount-1;for(;i-e>1;){const n=Math.floor((e+i)/2);if(t<this._colRangeWidthsMap.get(`$0$${n}`))i=n;else{if(!(t>this._colRangeWidthsMap.get(`$0$${n}`)))return n;e=n}}return i}return Math.min(Math.ceil(t/this.internalProps.defaultColWidth),this.colCount-1)}clearSelected(){this.stateManeger.updateSelectPos(-1,-1)}selectCell(t,e){this.stateManeger.updateSelectPos(t,e),this.stateManeger.endSelectCells()}get allowFrozenColCount(){return this.internalProps.allowFrozenColCount}get rowHeaderLevelCount(){return this.internalProps.layoutMap.rowHeaderLevelCount}get columnHeaderLevelCount(){return this.internalProps.layoutMap.columnHeaderLevelCount}get records(){return this.internalProps.records}get dataSource(){return this.internalProps.dataSource}set dataSource(t){this.scenegraph.clearCells(),uj(this,t),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()}get autoWrapText(){return this.internalProps.autoWrapText}set autoWrapText(t){this.internalProps.autoWrapText=t,this.options.autoWrapText=t}updateAutoWrapText(t){this.internalProps.autoWrapText!==t&&(this.internalProps.autoWrapText=t,this.options.autoWrapText=t,this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render())}get theme(){return this.internalProps.theme}set theme(t){this.internalProps.theme=Ff.of(t??Ff.DEFAULT),this.options.theme=t}updateTheme(t){this.internalProps.theme=Ff.of(t??Ff.DEFAULT),this.options.theme=t,this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}getBodyField(t,e){return this.internalProps.layoutMap.getBody(t,e).field}getBodyColumnDefine(t,e){const i=this.internalProps.layoutMap.getBody(t,e);return i?.define}getBodyColumnType(t,e){return this.internalProps.layoutMap.getBody(t,e).cellType}getHeaderField(t,e){return this.internalProps.layoutMap.getHeaderField(t,e)}getHeaderFieldKey(t,e){return this.internalProps.layoutMap.getHeaderFieldKey(t,e)}getHeaderDefine(t,e){const i=this.internalProps.layoutMap.getHeader(t,e);return i?.define}getCellLocation(t,e){return this.internalProps.layoutMap.getCellLocation(t,e)}getCellHeaderPaths(t,e){return this.internalProps.layoutMap.getCellHeaderPaths(t,e)}getHeadersDefine(t,e){const i=[];for(;;){const n=this.getHeaderDefine(t,e);if(!n||!n.field&&!n.columns)break;i.push(n),e++}return i}_getHeaderLayoutMap(t,e){return this.internalProps.layoutMap.getHeader(t,e)}_getBodyLayoutMap(t,e){return this.internalProps.layoutMap.getBody(t,e)}getContext(){return this.internalProps.context}getRecordByRowCol(t,e){if(!this.internalProps.layoutMap.isHeader(t,e))return this.internalProps.dataSource?.get(this.getRecordIndexByRow(t,e))}getRecordStartRowByRecordIndex(t){return this.internalProps.layoutMap.getRecordStartRowByRecordIndex(t)}_getHeaderCellBySortState(t){const{layoutMap:e}=this.internalProps;let i;if(i=t.fieldKey?e.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.headerObjects.find((e=>e&&e.field===t.field)),i){return e.getHeaderCellAdress(i.id)}}getCellRange(t,e){return this.internalProps.layoutMap.getCellRange(t,e)}isCellRangeEqual(t,e,i,n){return this.internalProps.layoutMap.isCellRangeEqual(t,e,i,n)}_getLayoutCellId(t,e){return this.internalProps.layoutMap.getCellId(t,e)}getHeaderDescription(t,e){const i=this._getHeaderLayoutMap(t,e),n=i?.define,r=n?.description??i?.description;if("function"==typeof r){return r({col:t,row:e,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e)})}return r}setRecords(t,e){const i="undefined"!=typeof window?window.performance.now():0;if(this.scenegraph.clearCells(),void 0!==e&&(this.internalProps.sortState=e,this.stateManeger.setSortState(this.sortState)),t){if(cj(this,t),this.sortState){let t,e,i;if(Array.isArray(this.sortState)?0!==this.sortState.length&&({order:t,field:e,fieldKey:i}=this.sortState?.[0]):({order:t,field:e,fieldKey:i}=this.sortState),t&&e&&"normal"!==t){const n=this._getSortFuncFromHeaderOption(void 0,e,i);let r;r=i?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===i)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===e)),r?.define?.sort&&this.dataSource.sort(r.field,t,n??Cu)}}this.refreshRowColCount()}else cj(this,t);this.scenegraph.createSceneGraph(),this.render(),console.log("setRecords cost time:",("undefined"!=typeof window?window.performance.now():0)-i)}setRecord(t,e,i){const n=this.getRecordIndexByRow(e,i);this.dataSource.setRecord(t,n)}setDropDownMenuHighlight(t){this.stateManeger.setDropDownMenuHighlight(t)}_dropDownMenuIsHighlight(t,e,i){return this.stateManeger.dropDownMenuIsHighlight(t,e,i)}isHeader(t,e){return this.internalProps.layoutMap&&this.internalProps.layoutMap.isHeader(t,e)}isColumnHeader(t,e){return this.internalProps.layoutMap?.isColumnHeader(t,e)}isRowHeader(t,e){return this.internalProps.layoutMap?.isRowHeader(t,e)}isCornerHeader(t,e){return this.internalProps.layoutMap?.isCornerHeader(t,e)}isRightFrozenColumn(t,e){return this.internalProps.layoutMap?.isRightFrozenColumn(t,e)}isBottomFrozenRow(t,e){return this.internalProps.layoutMap?.isBottomFrozenRow(t,e)}getCellInfo(t,e){const i=this.isHeader(t,e)?this.getHeaderDefine(t,e):this.getBodyColumnDefine(t,e);return{col:t,row:e,field:this.getHeaderField(t,e),cellHeaderPaths:this.internalProps.layoutMap.getCellHeaderPaths(t,e),title:i.title,cellType:i.cellType?"string"==typeof i.cellType?i.cellType:"progressbar":"text",originData:this.getCellOriginRecord(t,e),cellRange:this.getCellRangeRelativeRect({col:t,row:e}),value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellLocation:this.getCellLocation(t,e),scaleRatio:this.canvas.getBoundingClientRect().width/this.canvas.offsetWidth}}_hasField(t,e,i){if(null==t)return!1;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return!1;const r=n.getRecordIndexByRow(e,i);return n.internalProps.dataSource.hasField(r,t)}_getCellStyle(t,e){const{layoutMap:i}=this.internalProps;if(i.isHeader(t,e)){let n=this.headerStyleCache.get(`${t}-${e}`);if(n)return n;const r=i.getHeader(t,e);if(!r||r.isEmpty)return xU;const o=this.internalProps.headerHelper.getStyleClass(r.headerType);if(i.isBottomFrozenRow(t,e)&&this.theme.bottomFrozenStyle)n=Du({},this.theme.bottomFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText);else if(i.isRightFrozenColumn(t,e)&&this.theme.rightFrozenStyle)n=Du({},this.theme.rightFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText);else{const{style:s}=r;n=Du(s,i.isColumnHeader(t,e)||i.isBottomFrozenRow(t,e)?this.theme.headerStyle:i.isRowHeader(t,e)||i.isRightFrozenColumn(t,e)?this.theme.rowHeaderStyle:this.theme.cornerHeaderStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText)}return this.headerStyleCache.set(`${t}-${e}`,n),n}let n;n=this.isListTable()&&!this.transpose||this.isPivotTable()&&this.internalProps.layoutMap.indicatorsAsCol?t:e;let r=this.bodyStyleCache.get(n);if(r)return r;const o=i.getBody(t,e),s=this.internalProps.bodyHelper.getStyleClass(o.cellType),a=o?.style;return r=Hu(a,this.theme.bodyStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},s,this.options.autoWrapText),Gu(a)||this.bodyStyleCache.set(n,r),r}clearCellStyleCache(){this.headerStyleCache.clear()}clearRowHeightCache(){this.internalProps._rowHeightsMap.clear(),this._clearRowRangeHeightsMap()}clearColWidthCache(){this.internalProps._colWidthsMap.clear(),this._clearColRangeWidthsMap()}_canResizeColumn(t,e){if(!(t>=0&&e>=0))return!1;if(this.isCellRangeEqual(t,e,t+1,e))return!1;if("none"===this.internalProps.columnResizeMode)return!1;if("header"===this.internalProps.columnResizeMode){if(!this.isHeader(t,e))return!1}else if("body"===this.internalProps.columnResizeMode&&this.isHeader(t,e))return!1;const i=this.colWidthsLimit[t];return!(i&&i.min&&i.max)||i.max!==i.min}_canDragHeaderPosition(t,e){if(this.isHeader(t,e)&&this.stateManeger.isSelected(t,e)){const i=this.stateManeger.select.ranges[0];if(this.isColumnHeader(t,e)){if(i.end.row!==this.rowCount-1)return!1}else{if(!this.isRowHeader(t,e))return!1;if(i.end.col!==this.colCount-1)return!1}const n=this.getHeaderDefine(t,e);if(void 0===n.dragHeader){if("all"===this.internalProps.dragHeaderMode)return!0;if("column"===this.internalProps.dragHeaderMode){if(this.isColumnHeader(t,e))return!0}else if("row"===this.internalProps.dragHeaderMode&&this.isRowHeader(t,e))return!0;return!1}return n.dragHeader}return!1}getCellIcons(t,e){let i;if(this.isHeader(t,e))i=this.internalProps.headerHelper.getIcons(t,e);else{const n=this.getCellValue(t,e),r=this.getCellOriginValue(t,e),o=this.internalProps.context;i=this.internalProps.bodyHelper.getIcons(t,e,n,r,o)}return i}showDropDownMenu(t,e,i){let n="dropdown-menu";i&&(n=Array.isArray(i.content)?"dropdown-menu":"container"),"html"===this.internalProps.menu.renderMode&&(this.stateManeger.menu.isShow=!0,this.internalProps.menuHandler._bindToCell(t,e,n,i))}showTooltip(t,e,i){"html"===this.internalProps.tooltip.renderMode&&this.internalProps.tooltipHandler._bindToCell(t,e,i)}getCellStyle(t,e){const i=this._getCellStyle(t,e),n=pj(i,this,t,e,Cj).theme,{autoWrapText:r,lineClamp:o,textOverflow:s}=i;return{textAlign:n.text.textAlign,textBaseline:n.text.textBaseline,bgColor:Nu(n.group.fill)?Cj("bgColor",i,t,e,this):n.group.fill,color:Nu(n.text.fill)?Cj("color",i,t,e,this):n.text.fill,fontFamily:n.text.fontFamily,fontSize:n.text.fontSize,fontWeight:n.text.fontWeight,fontVariant:n.text.fontVariant,fontStyle:n.text.fontStyle,lineHeight:n.text.lineHeight,autoWrapText:r??!1,lineClamp:o??"auto",textOverflow:s,borderColor:Nu(n.group.stroke)?Cj("borderColor",i,t,e,this):n.group.stroke,borderLineWidth:n.group.lineWidth,borderLineDash:n.group.lineDash,underline:!!n.text.underline,lineThrough:!!n.text.lineThrough,padding:n._vtable.padding,underlineWidth:n.text.underline,lineThroughLineWidth:n.text.lineThrough}}getAllBodyCells(t,e){const i=this.rowHeaderLevelCount,n=this.columnHeaderLevelCount,r=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-n+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,r-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+n)))))}getAllCells(t,e){const i=0,n=0,r=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-n+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,r-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+n)))))}getAllColumnHeaderCells(){const t=this.rowHeaderLevelCount,e=0,i=this.colCount-1,n=this.columnHeaderLevelCount-1;return Array(n-e+1).fill(0).map(((n,r)=>Array(i-t+1).fill(0).map(((i,n)=>this.getCellInfo(n+t,r+e)))))}getAllRowHeaderCells(){const t=0,e=this.columnHeaderLevelCount,i=this.rowHeaderLevelCount-1,n=this.rowCount-1;return Array(n-e+1).fill(0).map(((n,r)=>Array(i-t+1).fill(0).map(((i,n)=>this.getCellInfo(n+t,r+e)))))}scrollToCell(t){const e=this.getDrawRange();if(bu(t.col)&&t.col>=this.frozenColCount){const i=this.getFrozenColsWidth(),n=this.getColsWidth(0,t.col-1);this.scrollLeft=Math.min(n-i,this.getAllColsWidth()-e.width)}if(bu(t.row)&&t.row>=this.frozenRowCount){const i=this.getFrozenRowsHeight(),n=this.getRowsHeight(0,t.row-1);this.scrollTop=Math.min(n-i,this.getAllRowsHeight()-e.height)}this.render()}getCopyValue(){const t=this.stateManeger.select.ranges;let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),n=Math.min(t[0].start.row,t[0].end.row),r=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),n=Math.min(n,t.start.row,t.end.row),r=Math.max(r,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),r=Math.max(t.start.row,t.end.row);n<=e&&r>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.col,t.end.col),r=Math.max(t.start.col,t.end.col);n<=e&&r>=e&&(i=!0)})),i},a=(e,i)=>{let n;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&r<=i&&o>=i&&(n=t)})),n},l=(t,e,i)=>{const n=this.getCellRange(t,e);let r=n.start.col,o=n.start.row;if(i){const t=Math.min(i.start.col,i.end.col),e=Math.min(i.start.row,i.end.row);r=Math.max(t,n.start.col),o=Math.max(e,n.start.row)}if(r!==t||o!==e)return"";return this.getCellValue(t,e)};let h="";for(let t=n;t<=r;t++){if(o(t)){for(let n=e;n<=i;n++){if(s(n)){const e=a(n,t);if(e){const r=l(n,t,e);if("undefined"!=typeof Promise&&r instanceof Promise);else{const t=`${r}`;/^\[object .*\]$/.exec(t)||(h+=t)}(n<e.end.col||n<i)&&(h+="\t")}else h+="\t"}}h+="\n"}}return h}getSelectedCellInfos(){const t=this.stateManeger.select.ranges;let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),n=Math.min(t[0].start.row,t[0].end.row),r=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),n=Math.min(n,t.start.row,t.end.row),r=Math.max(r,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),r=Math.max(t.start.row,t.end.row);n<=e&&r>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.col,t.end.col),r=Math.max(t.start.col,t.end.col);n<=e&&r>=e&&(i=!0)})),i},a=(e,i)=>{let n;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&r<=i&&o>=i&&(n=t)})),n},l=[];for(let t=n;t<=r;t++){if(o(t)){const n=[];for(let r=e;r<=i;r++){if(s(r)){if(a(r,t)){const e=this.getCellInfo(r,t);n.push(e)}}}l.push(n)}}return l}measureText(t,e){return ZV.measureText(t,e)}getCustomRender(t,e){let i;if("body"!==this.getCellLocation(t,e)){const n=this.getHeaderDefine(t,e);i=n?.headerCustomRender}else{const n=this.getBodyColumnDefine(t,e);i=n?.customRender||this.customRender}return i}getCustomLayout(t,e){let i;if("body"!==this.getCellLocation(t,e)){const n=this.getHeaderDefine(t,e);i=n?.headerCustomLayout}else{const n=this.getBodyColumnDefine(t,e);i=n?.customLayout}return i}hasAutoImageColumn(){return this.internalProps.layoutMap.columnObjects.find((t=>!("image"!==t.cellType||!t.define.imageAutoSizing)))}_getActiveChartInstance(){const t=this.scenegraph.getCell(this.stateManeger.hover?.cellPos?.col,this.stateManeger.hover?.cellPos?.row);return"chart"===t?.getChildren()?.[0]?.type?t.getChildren()[0].activeChartInstance:null}cellIsInVisualView(t,e){const i=this.getDrawRange(),n=this.getCellRelativeRect(t,e);return t<this.frozenColCount&&e<this.frozenRowCount||n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}exportImg(){return this.scenegraph.stage.toCanvas().toDataURL()}exportCellImg(t,e){this.cellIsInVisualView(t,e)||this.scrollToCell({col:t,row:e});const i=this.getCellRelativeRect(t,e);return this.scenegraph.stage.toCanvas(!1,(new ip).set(i.left+this.tableX+1,i.top+this.tableY+1,i.right+this.tableX,i.bottom+this.tableY)).toDataURL()}}var SU=Object.freeze({__proto__:null,BaseTable:_U});function AU(t,e,i){const n=t[e];return t[e]=i,n}function TU(t){for(const e in t)delete t[e]}function BU(){TU(Cf),TU(fj),TU($N)}var MU=Object.freeze({__proto__:null,chartModule:function(t,e){return null!=e?AU($N,t,e):$N[t]},clearAll:BU,icon:function(t,e){return null!=e?AU(fj,t,e):fj[t]},theme:function(t,e){return null!=e?AU(Cf,t,e):Cf[t]}});var RU=Object.freeze({__proto__:null,dateFormat:function(t,e,i,n,r){null==i&&(i=!1),null==n&&(n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==r&&(r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);const o=i?"UTC":"",s=function(t){return`0${t}`.substring(0,2)};return function(i){const a=new Date(Date.parse(i[t]));return e.replace(/%(.)/g,(function(t,e){switch(e){case"y":return a[`get${o}FullYear`]();case"m":return s(a[`get${o}Month`]()+1);case"n":return n[a[`get${o}Month`]()];case"d":return s(a[`get${o}Date`]());case"w":return r[a[`get${o}Day`]()];case"x":return a[`get${o}Day`]();case"H":return s(a[`get${o}Hours`]());case"M":return s(a[`get${o}Minutes`]());case"S":return s(a[`get${o}Seconds`]());default:return`%${e}`}}))}},numberFormat:function(t){return t=Object.assign({},{digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},t),function(e){if(isNaN(e)||!isFinite(e))return"";const i=function(t,e,i){const n=(t+="").split(".");let r=n[0];const o=n.length>1?i+n[1]:"";return r=function(t,e){return t.replace(/\d+/,(function(t){return t.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return`${t}${e}`}))}))}(r,e),r+o}((t.scaler*e).toFixed(t.digitsAfterDecimal),t.thousandsSep,t.decimalSep);return`${t.prefix}${i}${t.suffix}`}}});const PU="NO_AXISID_FRO_VTABLE";function EU(t,e,i){const n=i.getCellHeaderPaths(t,e);let r;if(i.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=i.columnObjects.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=i.columnObjects.find((e=>e.indicatorKey===t))}const o=r?.chartSpec;return o}function HU(t,e,i){const n=i.getRawChartSpec(t,e);if(n?.series){const t={};return n.data?.id&&(t[n.data.id]=void 0),n?.series.forEach((e=>{if(!e.data?.fromDataId)if(e.data?.transforms)t[e.data?.id??n.data?.id??"data"]=void 0;else{const i="horizontal"===e.direction?e.xField:e.yField;t[e.data?.id??n.data?.id??"data"]=e.data?.id?i:void 0}})),t}return n.data.id}let LU=0;class kU{_headerObjects;_headerObjectMap;_headerCellIds;_columns;bodyRowCount=1;hierarchyIndent;_transpose=!1;_showHeader=!0;_recordsCount=0;_table;_cellRangeMap;constructor(t,e,i,n){this._cellRangeMap=new Map,this._showHeader=i,this._table=t,this._columns=[],this._headerCellIds=[],this.hierarchyIndent=n??20,this._headerObjects=this._addHeaders(0,e,[]),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{})}get transpose(){return this._transpose}set transpose(t){this._transpose=t}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}isHeader(t,e){return!!(this.transpose&&t<this.headerLevelCount)||!this.transpose&&e<this.headerLevelCount}getCellLocation(t,e){return this.isHeader(t,e)?this.transpose?"rowHeader":"columnHeader":"body"}isColumnHeader(t,e){return!this.transpose&&e<this.headerLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isCornerHeader(t,e){return!1}isRowHeader(t,e){return!!(this.transpose&&t<this.headerLevelCount)}getColumnHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getRowHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getCornerHeaderRange(){}getBodyRange(){return this.transpose?{start:{col:this.headerLevelCount,row:0},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:this.headerLevelCount},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}}get headerLevelCount(){return this.showHeader?this._headerCellIds.length:0}get columnHeaderLevelCount(){return this.transpose?0:this.headerLevelCount}get rowHeaderLevelCount(){return this.transpose?this.headerLevelCount:0}get bottomFrozenRowCount(){return 0}get rightFrozenColCount(){return 0}get colCount(){return this.transpose?this.headerLevelCount+this.recordsCount:this._columns.length}get rowCount(){return this.transpose?this._columns.length:this.headerLevelCount+this.recordsCount}get recordsCount(){return this._recordsCount}set recordsCount(t){this._recordsCount=t}get headerObjects(){return this._headerObjects}get columnObjects(){return this._columns}get columnWidths(){return this._columns}getColumnWidthDefined(t){if(this.transpose){let e,i,n=0;if(t>=this.rowHeaderLevelCount){let t;return this.columnObjects.forEach(((r,o)=>{"number"==typeof r.width?n=Math.max(r.width,n):"auto"===r.width&&(t=!0),"number"==typeof r.minWidth&&(i=Math.max(r.minWidth,i)),"number"==typeof r.maxWidth&&(e=Math.max(r.maxWidth,e))})),n=n>0?n:t?"auto":void 0,{width:n,minWidth:i,maxWidth:e}}if(this.isRowHeader(t,0)){const e=Array.isArray(this._table.defaultHeaderColWidth)?this._table.defaultHeaderColWidth[t]??this._table.defaultColWidth:this._table.defaultHeaderColWidth;return"auto"===e?{width:"auto"}:{width:e}}}return this._columns[t]}getCellId(t,e){return this.transpose?this.headerLevelCount<=t?this._columns[e]?.id:this._headerCellIds[t]?.[e]:this.headerLevelCount<=e?this._columns[t]?.id:this._headerCellIds[e]?.[t]}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]}getHeaderFieldKey(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.fieldKey||(this.transpose?this._columns[e]?.fieldKey:this._columns[t]?.fieldKey)}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||(this.transpose?this._columns[e]&&this._columns[e].field:this._columns[t]&&this._columns[t].field)}getHeaderCellAdress(t){for(let e=0;e<this._headerCellIds.length;e++){const i=this._headerCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return this.transpose?{col:e,row:n}:{col:n,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdress(e.id)}getBody(t,e){return this.transpose?this._columns[e]:this._columns[t]}getBodyLayoutRangeById(t){if(this.transpose){for(let e=0;e<(this.rowCount??0);e++)if(t===this._columns[e].id)return{start:{col:0,row:e},end:{col:0,row:e}}}else for(let e=0;e<(this.colCount??0);e++)if(t===this._columns[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getBodyCellValue(t,e){if(this.isHeader(t,e))return null;const{field:i,fieldFormat:n}=this.getBody(t,e);return this._table.getFieldData(n||i,t,e)}getCellRange(t,e){if(-1===t||-1===e)return{start:{col:t,row:e},end:{col:t,row:e}};if(this._cellRangeMap.has(`$${t}$${e}`))return this._cellRangeMap.get(`$${t}$${e}`);let i={start:{col:t,row:e},end:{col:t,row:e}};if(this.transpose)i=this.getCellRangeTranspose(t,e);else if(this.headerLevelCount<=e){if(this.headerLevelCount<=e&&this.columnObjects[t]?.define?.mergeCell){const n=this.getBodyCellValue(t,e);for(let r=e-1;r>=this.headerLevelCount&&n===this.getBodyCellValue(t,r);r--)i.start.row=r;for(let r=e+1;r<this.rowCount&&n===this.getBodyCellValue(t,r);r++)i.end.row=r}}else{const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<this.headerLevelCount&&n===this.getCellId(t,r);r++)i.end.row=r}return this._cellRangeMap.set(`$${t}$${e}`,i),i}getCellRangeTranspose(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(this.headerLevelCount<=t||-1===t&&-1===e){if(this.headerLevelCount<=t&&this.columnObjects[e]?.define?.mergeCell){const n=this.getBodyCellValue(t,e);for(let r=t-1;r>=this.headerLevelCount&&n===this.getBodyCellValue(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getBodyCellValue(r,e);r++)i.end.col=r}return i}const n=this.getCellId(t,e);for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r;for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<this.headerLevelCount&&n===this.getCellId(r,e);r++)i.end.col=r;return i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t,e){return this.transpose?t<this.headerLevelCount?-1:t-this.headerLevelCount:e<this.headerLevelCount?-1:e-this.headerLevelCount}getRecordStartRowByRecordIndex(t){return this.headerLevelCount+t}_addHeaders(t,e,i,n){const r=[],o=this._newRow(t,n);return e.forEach((e=>{const s=this._columns.length,a=LU++,l={id:a,title:e.title??e.caption,headerIcon:e.headerIcon,field:e.field,fieldKey:e?.fieldKey,fieldFormat:e.fieldFormat,style:e.headerStyle,headerType:e.headerType??"text",dropDownMenu:e.dropDownMenu,define:e,columnWidthComputeMode:e.columnWidthComputeMode};r[a]=l;for(let e=t-1;e>=0;e--)this._headerCellIds[e][s]=i[e];if(o[s]=n?this._headerCellIds[t-1][s]:a,e.columns)this._addHeaders(t+1,e.columns,[...i,a],e.hideColumnsSubHeader).forEach((t=>r.push(t)));else{const i=e;this._columns.push({id:LU++,field:i.field,fieldKey:i.fieldKey,fieldFormat:i.fieldFormat,width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth,icon:i.icon,cellType:i.cellType??i.columnType??"text",chartModule:"chartModule"in i?i.chartModule:null,chartSpec:"chartSpec"in i?i.chartSpec:null,sparklineSpec:"sparklineSpec"in i?i.sparklineSpec:Af,style:i.style,define:i,columnWidthComputeMode:i.columnWidthComputeMode,disableColumnResize:i?.disableColumnResize});for(let e=t+1;e<this._headerCellIds.length;e++)this._headerCellIds[e][s]=a}})),r}_newRow(t,e=!1){if(this._headerCellIds[t]){const e=this._headerCellIds[t-1];if(e.length>this._headerCellIds[t].length)for(let i=this._headerCellIds[t].length;i<e.length;i++)this._headerCellIds[t][i]=e[i];return this._headerCellIds[t]}if(e)return[];const i=this._headerCellIds[t]=[];if(!this._columns.length)return i;const n=this._headerCellIds[t-1];for(let t=0;t<n.length;t++)i[t]=n[t];return i}getCellHeaderPaths(t,e){let i=[],n=[];return this.transpose?n=[{field:this._columns[e].field}]:i=[{field:this._columns[t].field}],{colHeaderPaths:i,rowHeaderPaths:n}}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}canMoveHeaderPosition(t,e){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)){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const n=i.end.col-i.start.col+1;let r;const o=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?o.end.col-n+1:o.start.col,r===i.start.col)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.col,n);e.unshift(r,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.col,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.col,targetIndex:r,moveSize:n,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){const n=i.end.row-i.start.row+1;let r;const o=this.getCellRange(i.start.col,e.row);if(r=e.row>=t.row?o.end.row-n+1:o.start.row,r===i.start.row)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.row,n);e.unshift(r,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.row,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.row,targetIndex:r,moveSize:n,moveType:"row"}}}return null}toggleHierarchyState(t){const e=t.add.map((t=>({col:0,row:this._table.frozenRowCount+t}))),i=t.remove.map((t=>({col:0,row:this._table.frozenRowCount+t})));return{addCellPositions:e,removeCellPositions:i}}setChartInstance(t,e,i){(this.transpose?this._columns[e]:this._columns[t]).chartInstance=i}getChartInstance(t,e){return(this.transpose?this._columns[e]:this._columns[t]).chartInstance}getAxisConfigInPivotChart(t,e){}isEmpty(t,e){return!1}getChartAxes(t,e){return[]}getRawChartSpec(t,e){const i=this.getBody(t,e);return i?.chartSpec}getChartDataId(t,e){return HU(t,e,this)}release(){const t=this._table._getActiveChartInstance();t?.release(),this.columnObjects.forEach((t=>{t.chartInstance?.release()}))}}class IU{sizeIncludeParent=!1;rowExpandLevel;hierarchyType;tree={id:0,dimensionKey:"",value:"",children:[],level:-1,startIndex:0,size:0,startInTotal:0,hierarchyState:void 0};totalLevel=0;dimensionKeys=new ff;constructor(t,e="grid",i=void 0){this.sizeIncludeParent=null!=i,this.rowExpandLevel=i,this.hierarchyType=e,this.reset(t)}reset(t,e=!1){this.dimensionKeys=new ff,this.tree.children=t,this.setTreeNode(this.tree,0,this.tree),this.totalLevel=this.dimensionKeys.count()}setTreeNode(t,e,i){t.startIndex=e,t.startInTotal=(i.startInTotal??0)+t.startIndex,(t.dimensionKey??t.indicatorKey)&&(!this.dimensionKeys.contain(t.indicatorKey?Sf:t.dimensionKey)&&this.dimensionKeys.put(t.level,t.indicatorKey?Sf:t.dimensionKey),t.id||(t.id=++OU));let n=t.dimensionKey&&this.sizeIncludeParent?1:0;return"grid"===this.hierarchyType?t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):n=1:t.hierarchyState===Xc.expand&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):t.hierarchyState===Xc.collapse&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)})):!t.hierarchyState&&t.level+1<this.rowExpandLevel&&t.children?(t.hierarchyState=Xc.expand,t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)}))):t.children?(t.hierarchyState=Xc.collapse,t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)}))):(t.hierarchyState=Xc.none,n=1),t.size=n,n}getTreePath(t,e=30){const i=[];return this.searchPath(t,this.tree,i,e),i.shift(),i}searchPath(t,e,i,n){if(!e)return!1;if(t<e.startIndex||t>=e.startIndex+e.size)return!1;if(i.push(e),!e.children||0===e.children.length)return!0;if(e.level>=n)return!0;const r=t-e.startIndex;return e.children.some((t=>this.searchPath(r,t,i,n))),!0}movePosition(t,e,i){let n,r,o;const s=(a,l)=>{if((void 0===r||void 0===o)&&(a.level===t&&(a.startInTotal===e&&(r=l),a.startInTotal<=i&&i<=a.startInTotal+a.size-1&&(o=l)),a.children&&a.level<t)){n=a;for(let t=0;t<a.children.length;t++)(e>=a.children[t].startInTotal&&e<=a.children[t].startInTotal+a.children[t].size||i>=a.children[t].startInTotal&&i<=a.children[t].startInTotal+a.children[t].size)&&s(a.children[t],t)}};s(this.tree,0);const a=n.children.splice(r,1);a.unshift(o,0),Array.prototype.splice.apply(n.children,a)}}let OU=0,DU=0;class FU{_showHeader=!0;rowDimensionTree;columnDimensionTree;rowTree;columnTree;cornerHeaderObjs;columnHeaderObjs=[];rowHeaderObjs=[];_cornerHeaderCellIds=[];_columnHeaderCellIds=[];_rowHeaderCellIds=[];_columnWidths=[];rowsDefine;columnsDefine;indicatorsDefine;columnPaths=[];_headerObjects=[];_headerObjectMap={};_indicators=[];indicatorTitle;indicatorsAsCol=!0;hideIndicatorName=!1;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;cornerSetting;_indicatorShowType="column";rowHierarchyType;rowExpandLevel;rowHierarchyIndent;rowDimensionKeys=[];colDimensionKeys=[];indicatorKeys=[];indicatorDimensionKey=Sf;_cellRangeMap;_CellHeaderPathMap;_table;constructor(t){if(this._table=t,this._cellRangeMap=new Map,this._CellHeaderPathMap=new Map,this.rowTree=t.options.rowTree,this.columnTree=t.options.columnTree,this.rowsDefine=t.options.rows??[],this.columnsDefine=t.options.columns??[],this.indicatorsDefine=t.options.indicators??[],this.indicatorTitle=t.options.indicatorTitle,this.hideIndicatorName=t.options.hideIndicatorName??!1,this.showRowHeader=t.options.showRowHeader??!0,this.showColumnHeader=t.options.showColumnHeader??!0,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.rowHierarchyType=t.options.rowHierarchyType??"grid",this.rowExpandLevel=t.options.rowExpandLevel??1,this.rowHierarchyIndent=t.options.rowHierarchyIndent??20,this.cornerSetting=t.options.corner??{titleOnDimension:"column"},this.indicatorsDefine?.forEach((t=>{"string"==typeof t?this.indicatorKeys.push(t):this.indicatorKeys.push(t.indicatorKey)})),this.columnDimensionTree=new IU(this.columnTree??[]),this.rowDimensionTree=new IU(this.rowTree??[],this.rowHierarchyType,"tree"===this.rowHierarchyType?this.rowExpandLevel:void 0),this.colDimensionKeys=this.columnDimensionTree.dimensionKeys.valueArr(),this.rowDimensionKeys=this.rowDimensionTree.dimensionKeys.valueArr(),this.cornerHeaderObjs="column"===this.cornerSetting.titleOnDimension?this._addCornerHeaders(this.columnHeaderTitle?[""].concat(this.colDimensionKeys):this.colDimensionKeys):"row"===this.cornerSetting.titleOnDimension?this._addCornerHeaders(this.rowHeaderTitle?[""].concat(this.rowDimensionKeys):this.rowDimensionKeys):this._addCornerHeaders(null),this.columnDimensionTree.tree.children&&(this.columnHeaderObjs=this._addHeaders(this._columnHeaderCellIds,0,this.columnDimensionTree.tree.children,[]),this.columnHeaderTitle)){const t=++OU,e=Array(this.colCount-this.rowHeaderLevelCount).fill(t);this._columnHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{id:t}};this.columnHeaderObjs.push(i),this._headerObjects[t]=i}if(DU=0,this.rowDimensionTree.tree.children&&(this.rowHeaderObjs="tree"===this.rowHierarchyType?this._addHeadersForTreeMode(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0):this._addHeaders(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[])),this.rowHeaderTitle){const t=++OU,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{id:t}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}DU=0,this.indicatorsAsCol=!bu(this.rowDimensionKeys.find((t=>t===this.indicatorDimensionKey))),this._rowHeaderCellIds=fu(this._rowHeaderCellIds),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.setColumnWidths()}_addHeaders(t,e,i,n){const r=[];return t[e]||function(e){const i=t[e]=[];if(0===DU)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const o=i.id,s=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),a=this.indicatorsDefine?.find((t=>"string"!=typeof t&&(i.indicatorKey?t.indicatorKey===i.indicatorKey:t.title===i.value))),l={id:o,title:i.value??a.title,field:i.dimensionKey,style:"function"==typeof(a??s)?.headerStyle?(a??s)?.headerStyle:Object.assign({},(a??s)?.headerStyle),headerType:a?.headerType??s?.headerType??"text",headerIcon:a?.headerIcon??s?.headerIcon,define:Object.assign({},i,a??s),fieldFormat:a?.headerFormat??s?.headerFormat,dropDownMenu:a?.dropDownMenu??s?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},width:s?.width,minWidth:s?.minWidth,maxWidth:s?.maxWidth,showSort:a?.showSort??s?.showSort,description:s?.description};a?(a.customRender&&(i.customRender=a.customRender),bu(this._indicators.find((t=>t.indicatorKey===a.indicatorKey)))||this._indicators.push({id:++OU,indicatorKey:a.indicatorKey,field:a.indicatorKey,fieldFormat:a?.format,cellType:a?.cellType??a?.columnType??"text",chartModule:"chartModule"in a?a.chartModule:null,chartSpec:"chartSpec"in a?a.chartSpec:null,sparklineSpec:"sparklineSpec"in a?a.sparklineSpec:null,style:a?.style,icon:a?.icon,define:Object.assign({},i,a,{dragHeader:s?.dragHeader}),width:a?.width,minWidth:a?.minWidth,maxWidth:a?.maxWidth,disableColumnResize:a?.disableColumnResize})):i.indicatorKey&&(bu(this._indicators.find((t=>t.indicatorKey===i.indicatorKey)))||this._indicators.push({id:++OU,indicatorKey:i.indicatorKey,field:i.indicatorKey,cellType:"text",define:Object.assign({},i)})),r[o]=l,this._headerObjects[o]=l,t[e][DU]=o;for(let i=e-1;i>=0;i--)t[i][DU]=n[i];if(i.children)this._addHeaders(t,e+1,i.children??[],[...n,o]).forEach((t=>r.push(t)));else{for(let i=e+1;i<t.length;i++)t[i][DU]=o;DU++}})),r}_addHeadersForTreeMode(t,e,i,n,r,o){const s=[];return t[e]||function(e){const i=t[e]=[];if(0===DU)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const a=i.id,l=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),h={id:a,title:i.value,field:i.dimensionKey,style:i.level+1===r||"function"==typeof l?.headerStyle?l?.headerStyle:Object.assign({},l?.headerStyle,{textAlign:"left"}),headerType:l?.headerType??"text",headerIcon:l?.headerIcon,define:Object.assign(i,{linkJump:l?.linkJump,linkDetect:l?.linkDetect,templateLink:l?.templateLink,keepAspectRatio:l?.keepAspectRatio??!1,imageAutoSizing:l?.imageAutoSizing,headerCustomRender:l?.headerCustomRender,headerCustomLayout:l?.headerCustomLayout,dragHeader:l?.dragHeader}),fieldFormat:l?.headerFormat,dropDownMenu:l?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},hierarchyLevel:i.level,dimensionTotalLevel:r,hierarchyState:i.level+1===r?void 0:i.hierarchyState,width:l?.width,minWidth:l?.minWidth,maxWidth:l?.maxWidth};s[a]=h,this._headerObjects[a]=h,t[e][DU]=a;for(let i=e-1;i>=0;i--)t[i][DU]=n[i];if(i.hierarchyState===Xc.expand&&i.children)o&&DU++,this._addHeadersForTreeMode(t,e,i.children??[],[...n,a],r,o&&i.hierarchyState===Xc.expand).forEach((t=>s.push(t)));else{o&&DU++;for(let i=e+1;i<t.length;i++)t[i][DU]=a}})),s}_addCornerHeaders(t){const e=[];if(t)t.forEach(((t,i)=>{const n=++OU,r=this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)),o={id:n,title:t===this.indicatorDimensionKey?this.indicatorTitle:r?.title??"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:n,value:t},dropDownMenu:r?.cornerDropDownMenu,pivotInfo:{value:r?.title??"",dimensionKey:t,isPivotCorner:!0},description:r?.cornerDescription};if(e[n]=o,this._headerObjects[n]=o,"column"===this.cornerSetting.titleOnDimension){this._cornerHeaderCellIds[i]||(this._cornerHeaderCellIds[i]=[]);for(let t=0;t<this.rowHeaderLevelCount;t++)this._cornerHeaderCellIds[i][t]=n}else if("row"===this.cornerSetting.titleOnDimension)for(let t=0;t<this.columnHeaderLevelCount;t++)this._cornerHeaderCellIds[t]||(this._cornerHeaderCellIds[t]=[]),this._cornerHeaderCellIds[t][i]=n}));else{const t=++OU,i={id:t,title:"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:t,value:""}};e[t]=i,this._headerObjects[t]=i;for(let e=0;e<this.columnHeaderLevelCount;e++)for(let i=0;i<this.rowHeaderLevelCount;i++)this._cornerHeaderCellIds[e]||(this._cornerHeaderCellIds[e]=[]),this._cornerHeaderCellIds[e][i]=t}return e}setColumnWidths(){const t=new Array(this.colCount).fill(void 0);if(this.showHeader&&this.showRowHeader&&(this.rowHeaderTitle&&(t[0]={}),this.rowDimensionKeys.forEach(((e,i)=>{const n=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));n&&(t[i+(this.rowHeaderTitle?1:0)]={width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth})}))),this.indicatorsAsCol)for(let e=this.rowHeaderLevelCount;e<this.colCount;e++){const i=this.getBody(e,this.columnHeaderLevelCount);t[e]={width:i?.width,minWidth:i?.minWidth,maxWidth:i?.maxWidth}}else{let e,i,n,r=0;this._indicators.forEach(((t,o)=>{"number"==typeof t.width?r=Math.max(t.width,r):"auto"===t.width&&(n=!0),"number"==typeof t.minWidth&&(i=Math.max(t.minWidth,i)),"number"==typeof t.maxWidth&&(e=Math.max(t.maxWidth,e))})),r=r>0?r:n?"auto":void 0,t.fill({width:r,minWidth:i,maxWidth:e},this.rowHeaderLevelCount,this.colCount)}this._columnWidths=t}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.rowHeaderLevelCount||(e<this.columnHeaderLevelCount||(t>=this.colCount-this.rightFrozenColCount||e>=this.rowCount-this.bottomFrozenRowCount))}isCornerHeader(t,e){return t<this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isRowHeader(t,e){return t<this.rowHeaderLevelCount&&e>=this.columnHeaderLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}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 headerLevelCount(){return this.columnHeaderLevelCount}get columnHeaderLevelCount(){if(this.showHeader&&this.showColumnHeader){let t=this.indicatorsAsCol&&this.hideIndicatorName&&this.colDimensionKeys[this.colDimensionKeys.length-1]===this.indicatorDimensionKey?this.columnDimensionTree.totalLevel-1:this.columnDimensionTree.totalLevel;return this.columnHeaderTitle&&(t+=1),t}return 0}get rowHeaderLevelCount(){if(this.showHeader&&this.showRowHeader){if("tree"===this.rowHierarchyType)return this.rowHeaderTitle?2:1;let t=this.indicatorsAsCol?this.rowDimensionTree.totalLevel:this.hideIndicatorName&&this.rowDimensionKeys[this.rowDimensionKeys.length-1]===this.indicatorDimensionKey?this.rowDimensionTree.totalLevel-1:this.rowDimensionTree.totalLevel;return this.rowHeaderTitle&&(t+=1),t}return 0}get colCount(){return this.columnDimensionTree.tree.size+this.rowHeaderLevelCount+this.rightFrozenColCount}get rowCount(){return this.rowDimensionTree.tree.size+this.columnHeaderLevelCount+this.bottomFrozenRowCount}get bodyRowCount(){return this.rowDimensionTree.tree.size}get bottomFrozenRowCount(){return this.showHeader&&this.showColumnHeader&&this.indicatorsAsCol&&!this.hideIndicatorName&&this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0}get rightFrozenColCount(){return this.showHeader&&this.showColumnHeader&&!this.indicatorsAsCol&&!this.hideIndicatorName&&this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicators}getCellId(t,e){if(e>=0&&t>=0){if(this.isCornerHeader(t,e))return this._cornerHeaderCellIds[e][t];if(this.isColumnHeader(t,e))return this._columnHeaderCellIds[e][t-this.rowHeaderLevelCount];if(this.isRowHeader(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount]?.[t];if(this.isRightFrozenColumn(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount][this.rowHeaderLevelCount-1];if(this.isBottomFrozenRow(t,e))return this._columnHeaderCellIds[this.columnHeaderLevelCount-1]?.[t-this.rowHeaderLevelCount]}}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||this.getBody(t,e)?.field}getHeaderCellAdress(t){for(let e=0;e<this._columnHeaderCellIds.length;e++){const i=this._columnHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n+this._table.frozenColCount,row:e}}for(let e=0;e<this._rowHeaderCellIds.length;e++){const i=this._rowHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n,row:e+this._table.frozenRowCount}}for(let e=0;e<this._cornerHeaderCellIds.length;e++){const i=this._cornerHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdress(e.id)}getBody(t,e){const i=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators.find((e=>e.indicatorKey===t))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}const n=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators.find((t=>t.indicatorKey===n))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}getBodyLayoutRangeById(t){for(let e=0;e<(this.colCount??0);e++)if(t===this.columnObjects[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getCellRange(t,e){if(-1===t||-1===e)return{start:{col:t,row:e},end:{col:t,row:e}};if(this._cellRangeMap.has(`${t}-${e}`))return this._cellRangeMap.get(`${t}-${e}`);const i={start:{col:t,row:e},end:{col:t,row:e}};if(this.isHeader(t,e)&&-1!==t&&-1!==e){const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r}return this._cellRangeMap.set(`${t}-${e}`,i),i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t){return t<this.columnHeaderLevelCount||t>=this.rowCount-this.bottomFrozenRowCount?-1:t-this.columnHeaderLevelCount}getRecordIndexByCol(t){return t<this.rowHeaderLevelCount||t>=this.colCount-this.rightFrozenColCount?-1:t-this.rowHeaderLevelCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getCellHeaderPathsWidthTreeNode(t,e){if(this._CellHeaderPathMap.has(`${t}-${e}`))return this._CellHeaderPathMap.get(`${t}-${e}`);const i=this.getRecordIndexByCol(t),n=this.getRecordIndexByRow(e);let r,o;if(t>=0&&(r=this.columnDimensionTree.getTreePath(i,this.showHeader&&this.showColumnHeader?e-(this.columnHeaderTitle?1:0):this.columnDimensionTree.totalLevel)),e>=0)if("tree"===this.rowHierarchyType)if(t>=this.rowHeaderLevelCount)o=this.rowDimensionTree.getTreePath(n,t+this.rowDimensionTree.totalLevel);else{const i=this.getHeader(t,e);o=this.rowDimensionTree.getTreePath(n,t+i.hierarchyLevel)}else o=this.rowDimensionTree.getTreePath(n,this.showHeader&&this.showRowHeader?t-(this.rowHeaderTitle?1:0):this.rowDimensionTree.totalLevel);const s={colHeaderPaths:r,rowHeaderPaths:o};return this._CellHeaderPathMap.set(`${t}-${e}`,s),s}getCellHeaderPaths(t,e){const i=this.getCellHeaderPathsWidthTreeNode(t,e),n={colHeaderPaths:[],rowHeaderPaths:[]};return i.colHeaderPaths.forEach((t=>{const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",n.colHeaderPaths.push(e)})),i.rowHeaderPaths.forEach((t=>{const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",n.rowHeaderPaths.push(e)})),n}getIndicatorInfoByIndicatorKey(t){const e=this.indicatorsDefine?.find((e=>"string"!=typeof e&&(!!t&&e.indicatorKey===t)));return e}getHeaderDimension(t,e){if(this.isHeader(t,e)){const i=this.getHeader(t,e);return this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))}}isColumnIndicatorHeader(t,e){return"column"===this._indicatorShowType&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return"row"===this._indicatorShowType&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}toggleHierarchyState(t,e){const i=this._rowHeaderCellIds.slice(0),n=i.map((t=>this.getHeaderCellAdress(t[0]))),r=this.getHeader(t,e);if(r.define.hierarchyState=r.define.hierarchyState===Xc.collapse?Xc.expand:Xc.collapse,this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._rowHeaderCellIds=[],this.rowHeaderObjs=this._addHeadersForTreeMode(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0),this.rowHeaderTitle){const t=++OU,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{field:"",headerType:"text",cellType:"text"}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}return DU=0,this._rowHeaderCellIds=fu(this._rowHeaderCellIds),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this._CellHeaderPathMap=new Map,function(t,e,i,n){const r=t.map((t=>t[0])),o=e.map((t=>t[0])),s=[],a=[];for(let t=0;t<r.length;t++)o.includes(r[t])||a.push(i[t]);for(let t=0;t<o.length;t++)r.includes(o[t])||s.push(n.getHeaderCellAdress(o[t]));return{addCellPositions:s,removeCellPositions:a}}(i,this._rowHeaderCellIds,n,this)}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}getPivotCellAdress(t){if(!Array.isArray(t))return;let e,i,n=this.rowTree,r=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1){if("row"===this?.cornerSetting?.titleOnDimension){let t=0;return"grid"===this.rowHierarchyType&&(t=this.rowDimensionKeys.indexOf(s.dimensionKey)),-1===t?void 0:{col:this.rowHeaderTitle?t+1:t,row:0}}const t=this.colDimensionKeys.indexOf(s.dimensionKey);return-1===t?void 0:{col:0,row:this.columnHeaderTitle?t+1:t}}let a=!1;for(let t=0;t<r.length;t++){const e=r[t];if((bu(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){r=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<n.length;t++){const i=n[t];if((bu(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){n=i.children,e=i;break}}}let o=0,s=0;if(e){s=this.columnHeaderLevelCount;const{startInTotal:t,level:i}=e;return s+=t,o="grid"===this.rowHierarchyType?this.rowHeaderTitle?i+1:i:0,{col:o,row:s}}if(i){o=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=i;return o+=t,s=this.columnHeaderTitle?e+1:e,{col:o,row:s}}}getPivotDimensionInfo(t,e){const{colHeaderPaths:i,rowHeaderPaths:n}=this.getCellHeaderPaths(t,e),r=[];return i.length?i.forEach(((t,e)=>{r.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):n.length?n.forEach(((t,e)=>{r.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):this.isCornerHeader(t,e)&&("row"===this?.cornerSetting?.titleOnDimension?r.push({dimensionKey:this.rowDimensionKeys[this.rowHeaderTitle?t-1:t],isPivotCorner:!0}):r.push({dimensionKey:this.colDimensionKeys[this.columnHeaderTitle?e-1:e],isPivotCorner:!0})),r}getIndicatorKey(t,e){return this.getBody(t,e)?.indicatorKey}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}canMoveHeaderPosition(t,e){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("tree"!==this.rowHierarchyType){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}{const i=du(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths),n=du(this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths);if(i.pop(),n.pop(),i.length<=n.length)return i.length!==n.length||!i.find(((t,e)=>t.dimensionKey!==n[e].dimensionKey||t.value!==n[e].value))}}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 n=i.end.col-i.start.col+1;let r;const o=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?o.end.col-n+1:o.start.col,r===i.end.col)return null;for(let t=0;t<this._columnHeaderCellIds.length;t++){const e=this._columnHeaderCellIds[t].splice(i.start.col-this.rowHeaderLevelCount,n);e.unshift(r-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this._columnHeaderCellIds[t],e)}const s=this._columnWidths.splice(i.start.col,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columnWidths,s),this.columnDimensionTree.movePosition(t.row,i.start.col-this.rowHeaderLevelCount,r-this.rowHeaderLevelCount),this.columnDimensionTree.reset(this.columnDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._cellRangeMap=new Map,{sourceIndex:i.start.col,targetIndex:r,moveSize:n,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){let n;const r=this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,o=this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths,s=r[r.length-1],a=o[r.length-1],l=s.size;if(n=e.row>=t.row?a.startInTotal+a.size-l:a.startInTotal,n===t.row||n===i.end.row)return null;const h=this._rowHeaderCellIds.splice(i.start.row-this.columnHeaderLevelCount,l);return h.unshift(n,0),Array.prototype.splice.apply(this._rowHeaderCellIds,h),this.rowDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths.length-1,i.start.row-this.columnHeaderLevelCount,n+(e.row>t.row?s.size-1:0)),this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._cellRangeMap=new Map,{sourceIndex:i.start.row,targetIndex:n+this.columnHeaderLevelCount,moveSize:l,moveType:"row"}}}return null}getCellAdressByHeaderPath(t){let e,i;if(Array.isArray(t)){if(t.length>this.rowDimensionKeys.length+this.colDimensionKeys.length)return;e=t.filter((t=>this.colDimensionKeys.indexOf(t.dimensionKey)>=0)),i=t.filter((t=>this.rowDimensionKeys.indexOf(t.dimensionKey)>=0))}else e=t.colHeaderPaths,i=t.rowHeaderPaths;if(!Array.isArray(e)&&!Array.isArray(i))return;e?.sort(((t,e)=>this.colDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.colDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey))),i?.sort(((t,e)=>this.rowDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.rowDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey)));let n,r,o,s,a=!1;e?.length>=1&&i?.length>=1&&(a=!0);let l,h,c=this.rowTree,u=this.columnTree;if(e)for(let t=0;t<e.length;t++){const i=e[t];for(let t=0;t<u.length;t++){const e=u[t];if(!bu(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value||bu(i.indicatorKey)&&e.indicatorKey===i.indicatorKey){u=e.children,a&&!u?h=e:a||(h=e);break}}}if(i)for(let t=0;t<i.length;t++){const e=i[t];for(let t=0;t<c.length;t++){const i=c[t];if((!bu(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value||bu(e.indicatorKey)&&i.indicatorKey===e.indicatorKey)&&i.value===e.value){c=i.children,a&&!c?l=i:a||(l=i);break}}}if(!a||l&&h){if(l){r=this.columnHeaderLevelCount;const{startInTotal:t,level:e}=l;r+=t,o="grid"===this.rowHierarchyType?this.rowHeaderTitle?e+1:e:0}if(h){n=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=h;n+=t,s=this.columnHeaderTitle?e+1:e}return bu(n)||bu(r)?{col:n??o,row:r??s}:void 0}}setChartInstance(t,e,i){const n=this.getCellHeaderPaths(t,e);let r;if(this.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators.find((e=>e.indicatorKey===t))}r&&(r.chartInstance=i)}getChartInstance(t,e){const i=this.getCellHeaderPaths(t,e);let n;if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators.find((e=>e.indicatorKey===t))}else{const t=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators.find((e=>e.indicatorKey===t))}return n?.chartInstance}getDimension(t,e){return"column"===e?this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):"row"===e?this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):void 0}getAxisConfigInPivotChart(t,e){}isEmpty(t,e){return!1}getChartAxes(t,e){return[]}getRawChartSpec(t,e){return EU(t,e,this)}getChartDataId(t,e){return HU(t,e,this)}release(){const t=this._table._getActiveChartInstance();t?.release(),this._indicators.forEach((t=>{t.chartInstance?.release()}))}getHeadNode(t){if(!Array.isArray(t))return;let e,i,n=this.rowTree,r=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1)return;let a=!1;for(let t=0;t<r.length;t++){const e=r[t];if((bu(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){r=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<n.length;t++){const i=n[t];if((bu(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){n=i.children,e=i;break}}}return e||(i||void 0)}}const zU={isEmpty:!0,id:void 0,field:void 0,headerType:void 0,define:void 0};class WU{_headerObjects=[];_headerObjectMap={};_indicatorObjects=[];_columnWidths=[];rowTree;columnTree;rowsDefine;columnsDefine;indicatorsDefine;indicatorKeys;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;_indicatorShowType="column";indicatorsAsCol=!0;hideIndicatorName=!1;indicatorDimensionKey=Sf;indicatorTitle;rowKeysPath;colKeysPath;convertColKeys;rows;columns;rowShowAttrs;colShowAttrs;tree;dataset;dataConfig;_rowCount;_colCount;_bodyRowCount;cornerSetting;_table;hasTwoIndicatorAxes;_chartItemSpanSize;constructor(t,e){this._table=t,this._chartItemSpanSize=0,this.rowTree=t.options.rowTree,this.columnTree=t.options.columnTree,this.rowsDefine=t.options.rows??[],this.columnsDefine=t.options.columns??[],this.indicatorsDefine=t.options.indicators??[],this.indicatorTitle=t.options.indicatorTitle,this.dataset=e,this.dataConfig=e.dataConfig,this.indicatorKeys=e.indicatorKeys,this.indicatorsAsCol=t.options.indicatorsAsCol??!0,this.hideIndicatorName=t.options.hideIndicatorName??!1,this.showRowHeader=t.options.showRowHeader??!0,this.showColumnHeader=t.options.showColumnHeader??!0,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.cornerSetting=t.options.corner??{titleOnDimension:"column"},this.columns=e.columns,this.rows=e.rows,this.rowKeysPath=e.rowKeysPath,this.colKeysPath=e.colKeysPath,this.tree=e.tree,this.initState(),this.convertColKeys=fu(this.colKeysPath)}initState(){if(this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.colShowAttrs="column"===this._indicatorShowType?this.columns.concat(this.indicatorDimensionKey):Array.from(this.columns),this.rowShowAttrs="row"===this._indicatorShowType?this.rows.concat(this.indicatorDimensionKey):Array.from(this.rows),this._bodyRowCount=this.rowKeysPath.length*(this.indicatorsAsCol?1:this.indicatorKeys.length),this.initHeaderObjects(),this.initIndicatorObjects(),this.rowHeaderTitle){const t="rowHeaderTitle",e="string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),"");this._headerObjectMap[e]={id:e,title:e,field:t,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[e]),this._headerObjects.push(this._headerObjectMap[t]),this.rowShowAttrs.unshift(t),this.rowKeysPath.forEach(((t,i)=>{t.unshift(e)}))}if(this.columnHeaderTitle){const t="columnHeaderTitleCell",e="string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),"");this._headerObjectMap[e]={id:e,title:e,field:t,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[e]),this._headerObjects.push(this._headerObjectMap[t]),this.colShowAttrs.unshift(t),this.colKeysPath.forEach(((t,i)=>{t.unshift(e)}))}if(this._table.isPivotChart())if(this.hasTwoIndicatorAxes=this._indicatorObjects.some((t=>!!(t.chartSpec&&t.chartSpec.series&&t.chartSpec.series.length>1))),this._chartItemSpanSize=0,this._indicatorObjects.find((t=>(t.chartSpec?.barWidth&&(this._chartItemSpanSize=t.chartSpec?.barWidth),this._chartItemSpanSize>0||(t.chartSpec.series?.find((t=>(t.barWidth&&(this._chartItemSpanSize=t.barWidth),this._chartItemSpanSize>0))),this._chartItemSpanSize>0)))),this.indicatorsAsCol){const t="rowHeaderEmpty";this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[t]),this.rowShowAttrs.push(t),this.hasTwoIndicatorAxes||this.colShowAttrs.pop()}else{const t=this._table.pivotChartAxes.find((t=>"left"===t.orient));!1===t?.visible&&this.rowShowAttrs.pop()}this._colCount=(0===this.colKeysPath.length?1:this.colKeysPath.length)*(this.indicatorsAsCol?this.indicatorKeys.length:1)+this.rowHeaderLevelCount+this.rightFrozenColCount,this._rowCount=(0===this.rowKeysPath.length?1:this.rowKeysPath.length)*(this.indicatorsAsCol?1:this.indicatorKeys.length)+this.columnHeaderLevelCount+this.bottomFrozenRowCount,this.setColumnWidths()}setColumnWidths(){const t=new Array(this.colCount).fill(void 0);if(this.showRowHeader&&(this.rowHeaderTitle&&(t[0]={}),this.rowShowAttrs.forEach(((e,i)=>{const n=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));n&&(t[i+(this.rowHeaderTitle?1:0)]={width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth})}))),this.indicatorsAsCol)for(let e=this.rowHeaderLevelCount;e<this.colCount;e++){const i=this.getBody(e,this.columnHeaderLevelCount);t[e]={width:i?.width,minWidth:i?.minWidth,maxWidth:i?.maxWidth}}else{let e,i,n,r=0;this._indicatorObjects.forEach(((t,o)=>{"number"==typeof t.width?r=Math.max(t.width,r):"auto"===t.width&&(n=!0),"number"==typeof t.minWidth&&(i=Math.max(t.minWidth,i)),"number"==typeof t.maxWidth&&(e=Math.max(t.maxWidth,e))})),r=r>0?r:n?"auto":void 0,t.fill({width:r,minWidth:i,maxWidth:e},this.rowHeaderLevelCount,this.colCount-this.rightFrozenColCount)}this._columnWidths=t}get columnWidths(){return this._columnWidths}getColumnWidthDefined(t){return this._columnWidths[t]}getDimensionInfo(t){return this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))}getIndicatorInfo(t,e=""){const i=this.indicatorsDefine?.find((i=>"string"!=typeof i&&(t?i.indicatorKey===t:!!e&&i.title===e)));return i}getColKeysPath(){return this.colKeysPath}getRowKeysPath(){return this.rowKeysPath}initHeaderObjects(){for(let t=0,e=this.rowKeysPath.length;t<=e-1;t++){const e=this.rowKeysPath[t];for(let t=0,i=e.length;t<=i-1;t++)if(!this._headerObjectMap[e[t]]){const i=e[t].split(this.dataset.stringJoinChar),n=this.getDimensionInfo(this.rows[i.length-1]);this._headerObjectMap[e[t]]={id:e[t],field:n?.dimensionKey??this.rows[i.length-1],title:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.rows[i.length-1],headerType:n?.headerType??"text",cellType:"text"},fieldFormat:n?.headerFormat,dropDownMenu:n?.dropDownMenu,headerType:n?.headerType??"text",width:n?.width},this._headerObjects.push(this._headerObjectMap[e[t]])}}for(let t=0,e=this.colKeysPath.length;t<=e-1;t++){const e=this.colKeysPath[t];for(let t=0,i=e.length;t<=i-1;t++)if(!this._headerObjectMap[e[t]]){const i=e[t].split(this.dataset.stringJoinChar),n=this.getDimensionInfo(this.columns[i.length-1]);this._headerObjectMap[e[t]]={id:e[t],field:n?.dimensionKey??this.columns[i.length-1],title:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.columns[i.length-1],headerType:n?.headerType??"text",cellType:"text"},fieldFormat:n?.headerFormat,dropDownMenu:n?.dropDownMenu,headerType:n?.headerType??"text",width:n?.width},this._headerObjects.push(this._headerObjectMap[e[t]])}}let t;this.indicatorsDefine.forEach((t=>{const e="string"==typeof t?t:t.indicatorKey,i="string"==typeof t?void 0:t;this._headerObjectMap[e]||(this._headerObjectMap[e]={id:e,field:this.indicatorDimensionKey,title:i?.title??e,style:i?.headerStyle,define:{field:this.indicatorDimensionKey,headerType:i?.headerType??"text",cellType:"text"},dropDownMenu:i?.dropDownMenu,headerType:i?.headerType??"text",width:i?.width},this._headerObjects.push(this._headerObjectMap[e]))})),"column"===this.cornerSetting.titleOnDimension?t=this.colShowAttrs:"row"===this.cornerSetting.titleOnDimension&&(t=this.rowShowAttrs),t?.forEach((t=>{if(!this._headerObjectMap[t]){const e=this.getDimensionInfo(t);this._headerObjectMap[t]={id:t,field:t,title:t===this.indicatorDimensionKey?this.indicatorTitle:e?.title??t,style:this.cornerSetting?.headerStyle,define:{field:t,headerType:this.cornerSetting?.headerType??"text",cellType:"text"},dropDownMenu:e?.dropDownMenu,headerType:this.cornerSetting?.headerType??"text",width:e?.width},this._headerObjects.push(this._headerObjectMap[t])}}))}initIndicatorObjects(){this.indicatorKeys.forEach((t=>{const e=this.indicatorsDefine?.find((e=>"string"!=typeof e&&e.indicatorKey===t));this._indicatorObjects.push({id:t,indicatorKey:t,field:t,define:Object.assign({field:t,headerType:"text",cellType:e?.cellType??e?.columnType??"text"},e),fieldFormat:e?.format,cellType:e?.cellType??e?.columnType??"text",chartModule:e&&("chartModule"in e?e?.chartModule:null),chartSpec:e&&("chartSpec"in e?e?.chartSpec:null),sparklineSpec:e&&("sparklineSpec"in e?e?.sparklineSpec:null),style:e?.style,icon:e?.icon,width:e?.width,minWidth:e?.minWidth,maxWidth:e?.maxWidth,disableColumnResize:e?.disableColumnResize})}))}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}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.rowHeaderLevelCount||(e<this.columnHeaderLevelCount||(t>=this.colCount-this.rightFrozenColCount||e>=this.rowCount-this.bottomFrozenRowCount))}isCornerHeader(t,e){return t<this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRowHeader(t,e){return t<this.rowHeaderLevelCount&&e>=this.columnHeaderLevelCount}isColumnIndicatorHeader(t,e){return"column"===this._indicatorShowType&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return"row"===this._indicatorShowType&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}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 headerLevelCount(){return this.columnHeaderLevelCount}get columnHeaderLevelCount(){const t=this.colShowAttrs.length;if(this.showColumnHeader){return this.indicatorsAsCol&&this.hideIndicatorName&&this.colShowAttrs[this.colShowAttrs.length-1]===this.indicatorDimensionKey?t-1:t}return this.indicatorsAsCol?this.hideIndicatorName?0:1:0}get rowHeaderLevelCount(){const t=this.rowShowAttrs.length;if(this.showRowHeader){return this.indicatorsAsCol?t:this.hideIndicatorName&&this.rowShowAttrs[this.rowShowAttrs.length-1]===this.indicatorDimensionKey?t-1:t}return this.indicatorsAsCol||this.hideIndicatorName?0:1}get colCount(){return this._colCount}get rowCount(){return this._rowCount}get bodyRowCount(){return this._bodyRowCount}get bottomFrozenRowCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"bottom"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}get rightFrozenColCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"right"===t.orient));return!1===t?.visible||this.indicatorsAsCol?0:this.hasTwoIndicatorAxes?1:0}get leftAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"left"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}get topAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"top"===t.orient));return!1===t?.visible?0:this.indicatorsAsCol&&this.hasTwoIndicatorAxes?1:0}get rightAxesCount(){return this.rightFrozenColCount}get bottomAxesCount(){return this.bottomFrozenRowCount}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicatorObjects}getCellId(t,e){if(t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount||e<this.columnHeaderLevelCount&&t>=this.colCount-this.rightFrozenColCount)return 0;if(e>=0&&t>=0)if(this.isCornerHeader(t,e)){if("column"===this.cornerSetting.titleOnDimension)return this.colShowAttrs[e];if("row"===this.cornerSetting.titleOnDimension)return this.rowShowAttrs[t]}else{if(this.isColumnHeader(t,e))return e<this.columns.length+(this.columnHeaderTitle?1:0)?this.convertColKeys[e][this.indicatorsAsCol?Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length):t-this.rowHeaderLevelCount]:this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length];if(this.isRowHeader(t,e))return t<this.rows.length+(this.rowHeaderTitle?1:0)?this.rowKeysPath[this.indicatorsAsCol?e-this.columnHeaderLevelCount:Math.floor((e-this.columnHeaderLevelCount)/this.indicatorKeys.length)][t]:this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length];if(this.isRightFrozenColumn(t,e))return this.indicatorsAsCol?this.rowKeysPath[e-this.columnHeaderLevelCount][this.rowHeaderLevelCount-1]:this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length];if(this.isBottomFrozenRow(t,e))return this.indicatorsAsCol?this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length]:this.convertColKeys[this.convertColKeys.length-1][Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length)]}return 0}getIndicatorKey(t,e){if(this.isHeader(t,e))return"";if(this.indicatorsAsCol){const e=t-this.rowHeaderLevelCount;return this.indicatorKeys[e%this.indicatorKeys.length]}const i=e-this.columnHeaderLevelCount;return this.indicatorKeys[i%this.indicatorKeys.length]}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]??zU}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||this.getBody(t,e)?.field}getHeaderFieldKey(t,e){}getHeaderCellAdress(t){}getHeaderCellAddressByField(t){throw new Error(`Method not implemented.${t}`)}getBody(t,e){const i=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicatorObjects.find((e=>e.indicatorKey===t))??this._indicatorObjects[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}const n=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicatorObjects.find((t=>t.indicatorKey===n))??this._indicatorObjects[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}getBodyLayoutRangeById(t){for(let e=0;e<(this.colCount??0);e++)if(t===this.columnObjects[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getCellRange(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(!this.isHeader(t,e)||-1===t||-1===e||this.isIndicatorHeader(t,e))return i;if(this.isRightFrozenColumn(t,e)||this.isBottomFrozenRow(t,e))return i;const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r;return i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t){return t<this.columnHeaderLevelCount?-1:this.indicatorsAsCol?t-this.columnHeaderLevelCount:Math.floor((t-this.columnHeaderLevelCount)/this.indicatorKeys.length)}getRecordIndexByCol(t){return t<this.rowHeaderLevelCount?-1:this.indicatorsAsCol?Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length):t-this.rowHeaderLevelCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getCellHeaderPaths(t,e){const i=this.getRecordIndexByCol(t),n=this.getRecordIndexByRow(e);let r,o,s,a;return i>=0&&(r=this.colKeysPath[i],s=r?.[r.length-1]?.split(this.dataset.stringJoinChar),s&&this.showColumnHeader&&e<this.columns.length-1&&(s=s.slice(0,e+1))),n>=0&&(o=this.rowKeysPath[n],a=o?.[o.length-1]?.split(this.dataset.stringJoinChar),a&&this.showRowHeader&&t<this.rows.length-1&&(a=a.slice(0,t+1))),s&&this.indicatorsAsCol&&t>=this.rowHeaderLevelCount?s.push(this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length]):a&&e>=this.columnHeaderLevelCount&&a.push(this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length]),{colHeaderPaths:s?.map(((t,e)=>{const i=this._indicatorObjects.find((e=>e.indicatorKey===t));return{dimensionKey:i?void 0:this.colShowAttrs[e],indicatorKey:i?t:void 0,value:i?i.define.title:t}}))??[],rowHeaderPaths:a?.map(((t,e)=>{const i=this._indicatorObjects.find((e=>e.indicatorKey===t));return{dimensionKey:i?void 0:this.rowShowAttrs[e],indicatorKey:i?t:void 0,value:i?i.define.title:t}}))??[]}}getCellAdressByHeaderPath(t){let e,i;if(Array.isArray(t)){if(t.length>this.rowShowAttrs.length+this.colShowAttrs.length)return;e=t.filter((t=>this.colShowAttrs.indexOf(t.dimensionKey)>=0)),i=t.filter((t=>this.rowShowAttrs.indexOf(t.dimensionKey)>=0))}else e=t.colHeaderPaths,i=t.rowHeaderPaths;if(!Array.isArray(e)&&!Array.isArray(i))return;e?.sort(((t,e)=>this.colShowAttrs.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.colShowAttrs.indexOf(e.dimensionKey??this.indicatorDimensionKey))),i?.sort(((t,e)=>this.rowShowAttrs.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.rowShowAttrs.indexOf(e.dimensionKey??this.indicatorDimensionKey))),e?.length>=1&&i?.length;let n,r=0,o=0,s=this.rowTree,a=this.columnTree;if(e)for(let t=0;t<e.length;t++){const i=e[t];if(i.indicatorKey){n=i.indicatorKey;break}for(let t=0;t<a.length;t++){const e=a[t];if(!bu(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value){a=e.children,a&&0!==a.length&&!a?.[0]?.indicatorKey||(r+=t);break}r+=e.children?.[0]?.indicatorKey?0:e.children?.length??0}}if(i)for(let t=0;t<i.length;t++){const e=i[t];if(e.indicatorKey){n=e.indicatorKey;break}for(let t=0;t<s.length;t++){const i=s[t];if(!bu(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value){s=i.children,s&&0!==s.length&&!s?.[0]?.indicatorKey||(o+=t);break}o+=i.children?.[0]?.indicatorKey?0:i.children?.length??0}}return r=(this.indicatorsAsCol?r*this.indicatorKeys.length+this.indicatorKeys.indexOf(n):r)+this.rowHeaderLevelCount,o=(this.indicatorsAsCol?o:o*this.indicatorKeys.length+this.indicatorKeys.indexOf(n))+this.columnHeaderLevelCount,bu(r)||bu(o)?{col:r??undefined,row:o??undefined}:void 0}getHeaderDimension(t,e){if(this.isHeader(t,e)){const i=this.getHeader(t,e);return this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))}}updateDataset(t){this.dataset=t,this.dataConfig=t.dataConfig,this.rowKeysPath=t.rowKeysPath,this.colKeysPath=t.colKeysPath,this.tree=t.tree,this._indicatorObjects=[],this._headerObjects=[],this._headerObjectMap={},this.initState(),this.convertColKeys=fu(this.colKeysPath)}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}setChartInstance(t,e,i){const n=this.getCellHeaderPaths(t,e);let r;if(this.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicatorObjects.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicatorObjects.find((e=>e.indicatorKey===t))}r&&(r.chartInstance=i)}getChartInstance(t,e){const i=this.getCellHeaderPaths(t,e);let n;if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicatorObjects.find((e=>e.indicatorKey===t))}else{const t=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicatorObjects.find((e=>e.indicatorKey===t))}return n?.chartInstance}_generateChartState(){return{vtable_selected:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}},vtable_selected_reverse:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}}}}updateDataStateToChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();this._indicatorObjects.forEach((t=>{t.chartInstance.updateState(e)})),t?.updateState(e)}updateDataStateToActiveChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();t?.updateState(e)}getOptimunWidthForChart(t){const e=this.getCellHeaderPaths(t,this.columnHeaderLevelCount).colHeaderPaths;let i;for(const t in this.dataset.collectValuesBy)if("xField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t][e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}const n=this._chartItemSpanSize||25;return(i?.length??0)*(n+n/3)}getOptimunHeightForChart(t){const e=this.getCellHeaderPaths(this.rowHeaderLevelCount,t).rowHeaderPaths;let i;for(const t in this.dataset.collectValuesBy)if("yField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t][e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}const n=this._chartItemSpanSize||25;return(i?.length??0)*(n+n/3)}getIndicatorKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),n=[];return i?(!1===this.indicatorsAsCol?i.series?i.series.forEach((t=>{const e=t.yField;n.push(e)})):n.push(i.yField):i.series?i.series.forEach((t=>{const e=t.xField;n.push(e)})):n.push(i.xField),n):null}getDimensionKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),n=[];return i?(!1===this.indicatorsAsCol?n.push(i.xField??i?.series[0]?.xField):n.push(i.yField??i?.series[0]?.yField),n):null}getAxisConfigInPivotChart(t,e){return BN(t,e,this)}getRawChartSpec(t,e){return EU(t,e,this)}getChartSpec(t,e){return function(t,e,i){let n=i.getRawChartSpec(t,e);return n?(n=cd(n),n.axes=i.getChartAxes(t,e),n.padding=0,n.dataZoom=[],n):null}(t,e,this)}getChartAxes(t,e){return function(t,e,i){const n=[];if(i.indicatorsAsCol){const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByCol(t);r.forEach(((r,s)=>{qu(r)&&(r=r[0]);const a=RN(t,e,0===s?"bottom":"top",i),l=i.dataset.collectedValues[r+(a?"_align":"")]?i.dataset.collectedValues[r+(a?"_align":"")]:i.dataset.collectedValues[r],h=l?.[i.getColKeysPath()[o][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]??{min:0,max:1},c=MN(t,e,0===s?"bottom":"top",i);c?.zero&&(h.min=Math.min(h.min,0),h.max=Math.max(h.max,0)),n.push(fd({range:h},c,{type:"linear",orient:0===s?"bottom":"top",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:s,height:-1,sync:{axisId:PU}}))}));let s=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,t)[0];qu(s)&&(s=s[0]);const a=i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[],l=i.getRecordIndexByRow(e),h=i.getRowKeysPath()[l],c=a[h[h.length-1]],u=MN(t,e,"left",i);n.push(fd({domain:Array.from(c)},u,{type:"band",orient:"left",label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},width:-1}))}else{const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByRow(e);r.forEach(((r,s)=>{qu(r)&&(r=r[0]);const a=RN(t,e,0===s?"left":"right",i),l=i.dataset.collectedValues[r+(a?"_align":"")]?i.dataset.collectedValues[r+(a?"_align":"")]:i.dataset.collectedValues[r],h=l?.[i.getRowKeysPath()[o][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]]??{min:0,max:1},c=MN(t,e,0===s?"left":"right",i);c?.zero&&(h.min=Math.min(h.min,0),h.max=Math.max(h.max,0)),n.push(fd({range:h},c,{type:"linear",orient:0===s?"left":"right",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:s,width:-1,sync:{axisId:PU}}))}));let s=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];qu(s)&&(s=s[0]);const a=i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[],l=i.getRecordIndexByCol(t),h=i.getColKeysPath()[l],c=a?.[h[h.length-1]]??[],u=MN(t,e,"bottom",i);n.push(fd({domain:Array.from(c)},u,{type:"band",orient:"bottom",visible:!0,label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},height:-1}))}return n}(t,e,this)}getChartDataId(t,e){return HU(t,e,this)}isEmpty(t,e){return!!this._table.isPivotChart()&&(t>this.colCount-this.rightFrozenColCount-1||e>this.rowCount-this.bottomFrozenRowCount-1||!(!this.hasTwoIndicatorAxes||!this.indicatorsAsCol||e!==this.columnHeaderLevelCount-1))}release(){const t=this._table._getActiveChartInstance();t?.release(),this._indicatorObjects.forEach((t=>{t.chartInstance?.release()}))}}class jU{dataConfig;records;tree={};colFlatKeys={};rowFlatKeys={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;constructor(t,e){if(this.dataConfig=t,e){this.records=e;const t="undefined"!=typeof window?window.performance.now():0;this.setRecords(e);const i="undefined"!=typeof window?window.performance.now():0;console.log("processRecords:",i-t)}delete this.rowFlatKeys,delete this.colFlatKeys}setRecords(t){this.processRecords()}processRecords(){for(let t=0,e=this.records.length;t<e;t++){const e=this.records[t];this.processRecord(e)}}processRecord(t){const e=[],i=[];for(let e=0,n=this.dataConfig.rows.length;e<n;e++){const n=this.dataConfig.rows[e];void 0!==t[n]&&n!==this.dataConfig.indicatorDimensionKey&&i.push(t[n])}for(let i=0,n=this.dataConfig.columns.length;i<n;i++){const n=this.dataConfig.columns[i];void 0!==t[n]&&n!==this.dataConfig.indicatorDimensionKey&&e.push(t[n])}this.dataConfig.indicators.forEach((n=>{const r=t[n];void 0!==r&&(this.dataConfig.indicatorsAsCol?e.push(n):i.push(n));const o=i.join(this.stringJoinChar),s=e.join(this.stringJoinChar);0!==i.length&&(this.rowFlatKeys[o]||(this.rowFlatKeys[o]=1)),0!==e.length&&(this.colFlatKeys[s]||(this.colFlatKeys[s]=1)),0===e.length&&0===i.length||(this.tree[o]||(this.tree[o]={}),void 0!==r&&(this.tree[o][s]={value:r,record:t},this.dataConfig.indicatorsAsCol?e.pop():i.pop()))}))}getTreeNode(t=[],e=[],i){let n,r;if("string"==typeof t)n=t;else{let e=!1;t.map(((n,r)=>{n===i&&(t.splice(r,1),e=!0)})),e&&t.push(i),n=t.join(this.stringJoinChar)}if("string"==typeof e)r=e;else{let t=!1;e.map(((n,r)=>{n===i&&(e.splice(r,1),t=!0)})),t&&e.push(i),r=e.join(this.stringJoinChar)}return this.tree?.[n]?.[r]??void 0}}class NU{className="Aggregator";isRecord=!0;records=[];type;field;formatFun;_formatedValue;constructor(t,e,i){this.field=t,this.formatFun=e,this.isRecord=i??this.isRecord}formatValue(){return this._formatedValue||(this.formatFun?this._formatedValue=this.formatFun(this.value()):this._formatedValue=this.value()),this._formatedValue}reset(){this.records=[]}}class GU extends NU{type=Yc.RECORD;isRecord=!0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t))}value(){return this.records}reset(){this.records=[]}}class VU extends NU{type=Yc.SUM;sum=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.sum+=t.value():isNaN(parseFloat(t[this.field]))||(this.sum+=parseFloat(t[this.field]))}value(){return this.sum}reset(){this.records=[],this.sum=0}}class UU extends NU{type=Yc.COUNT;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.count+=t.value():this.count++}value(){return this.count}reset(){this.records=[],this.count=0}}class KU extends NU{type=Yc.AVG;sum=0;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className&&t.type===Yc.AVG?(this.sum+=t.sum,this.count+=t.count):isNaN(parseFloat(t[this.field]))||(this.sum+=parseFloat(t[this.field]),this.count++)}value(){return this.sum/this.count}reset(){this.records=[],this.sum=0,this.count=0}}class $U extends NU{type=Yc.MAX;max=Number.MIN_SAFE_INTEGER;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.max=t.max>this.max?t.max:this.max:"number"==typeof t?this.max=t>this.max?t:this.max:"number"==typeof t[this.field]?this.max=t[this.field]>this.max?t[this.field]:this.max:isNaN(t[this.field])||(this.max=parseFloat(t[this.field])>this.max?parseFloat(t[this.field]):this.max)}value(){return this.max}reset(){this.records=[],this.max=Number.MIN_SAFE_INTEGER}}class XU extends NU{type=Yc.MIN;min=Number.MAX_SAFE_INTEGER;isRecord=!1;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.min=t.min<this.min?t.min:this.min:"number"==typeof t?this.min=t<this.min?t:this.min:"number"==typeof t[this.field]&&(this.min=t[this.field]<this.min?t[this.field]:this.min)}value(){return this.min}reset(){this.records=[],this.min=Number.MAX_SAFE_INTEGER}}function YU(t,e){return t&&e?t.toString().localeCompare(e.toString(),"zh"):t?1:-1}function qU(t,e){const i=/(\d+)|(\D+)/g,n=/\d/,r=/^0/;let o,s,a,l,h=0,c=0;if(null!==e&&null===t)return-1;if(null!==t&&null===e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(h=+t,c=+e,h<c)return-1;if(h>c)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(c)&&!isNaN(h))return-1;if(isNaN(h)&&!isNaN(c))return 1;if(o=String(t),a=String(e),o===a)return 0;if(!n.test(o)||!n.test(a))return o>a?1:-1;for(o=o.match(i),a=a.match(i);o.length&&a.length;)if(s=o.shift(),l=a.shift(),s!==l)return n.test(s)&&n.test(l)?s.replace(r,".0")-l.replace(r,".0"):s>l?1:-1;return o.length-a.length}function ZU(t){return 2===t.length&&td(t[0])&&td(t[1])&&t[1]>=t[0]}function JU(t){const e=t[1]-t[0],i=t[1]*t[0]<0;let n=t[0]<=0?0-t[0]:0,r=t[1]>0?t[1]-0:0;return 0===e?t[0]<0?(n=1,r=0):t[0]>0&&(n=0,r=1):(n/=e,r/=e),{total:e,negative:n,positive:r,includeZero:i,domain:t,extendable_min:!0,extendable_max:!0}}function QU(t,e){const{positive:i,negative:n,extendable_min:r,extendable_max:o,domain:s}=t,{positive:a,negative:l,extendable_min:h,extendable_max:c,domain:u}=e;if(a>0){if(!h)return!1;let t=n/i;o&&(t=n/Math.max(i,a),s[1]=-s[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;r&&(t=i/Math.max(n,n),s[0]=-s[1]/t),u[1]=-u[0]*t}return!0}function tK(t,e){const{extendable_min:i,extendable_max:n,domain:r}=t,{positive:o,negative:s,domain:a}=e;return(0!==o||0!==s)&&(!(o>0&&!n)&&(!(s>0&&!i)&&(r[0]=a[0],r[1]=a[1],!0)))}function eK(t,e){const{positive:i,negative:n,extendable_max:r,domain:o}=t,{positive:s,negative:a,extendable_min:l,domain:h}=e;if(r&&l){const t=Math.max(n,a)/Math.max(i,s);o[1]=-o[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!r)return!1;{const t=a/s;o[1]=-o[0]/t}}return!0}function iK(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:r,domain:o}=e;return!(!i||!r)&&(n[0]=-n[1],o[1]=-o[0],!0)}function nK(t,e){const i=[t.min,t.max],n=[e.min,e.max];if(!ZU(i)||!ZU(n))return;const r=JU(i),o=JU(n),{positive:s,negative:a,extendable_min:l,extendable_max:h,includeZero:c}=r,{positive:u,negative:d,extendable_min:p,extendable_max:f,includeZero:g}=o;if(0===s&&0===a){if(!tK(r,o))return}else if(0===u&&0===d){if(!tK(o,r))return}else if(c||g)if(c&&!g){if(!QU(r,o))return}else if(g&&!c){if(!QU(o,r))return}else{if(a===d)return;if(a>d){if(!eK(r,o))return}else if(!eK(o,r))return}else{if(0===a&&0===u){if(!iK(r,o))return}else if(0===d&&0===s&&!iK(o,r))return;if(0===a&&0===d)if(0===i[0]&&n[0]>0){if(!p)return;n[0]=0}else{if(!(0===n[0]&&i[0]>0))return;if(!l)return;i[0]=0}if(0===s&&0===u)if(0===i[1]&&n[1]>0){if(!f)return;n[1]=0}else{if(!(0===n[1]&&i[1]>0))return;if(!h)return;i[1]=0}}return{range1:i,range2:n}}class rK{dataConfig;pagination;records;tree={};colFlatKeys={};rowFlatKeys={};colKeys=[];rowKeys=[];rowKeysPath;colKeysPath;rowOrder="key_a_to_z";colOrder="key_a_to_z";sorted=!1;sortRules;filterRules;aggregationRules;derivedFieldRules;mappingRules;totals;indicatorStatistics=[];aggregators={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;collectValuesBy;collectedValues={};cacheCollectedValues={};rows;columns;indicatorKeys;rowKeysPath_FULL;constructor(t,e,i,n,r,o,s,a){this.registerAggregators(),this.dataConfig=t,this.sortRules=this.dataConfig?.sortRules,this.aggregationRules=this.dataConfig?.aggregationRules,this.derivedFieldRules=this.dataConfig?.derivedFieldRules,this.mappingRules=this.dataConfig?.mappingRules,this.totals=this.dataConfig?.totals,this.rows=i,this.columns=n,this.indicatorKeys=r,this.colGrandTotalLabel=this.totals?.column?.grandTotalLabel??"总计",this.colSubTotalLabel=this.totals?.column?.subTotalLabel??"小计",this.rowGrandTotalLabel=this.totals?.row?.grandTotalLabel??"总计",this.rowSubTotalLabel=this.totals?.row?.subTotalLabel??"小计",this.collectValuesBy=this.dataConfig?.collectValuesBy,this.rowsIsTotal=new Array(this.rows.length).fill(!1),this.colsIsTotal=new Array(this.columns.length).fill(!1);for(let t=0,e=this.totals?.row?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.row.subTotalsDimensions[t],i=this.rows.indexOf(e);this.rowsIsTotal[i]=!0}for(let t=0,e=this.totals?.column?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.column.subTotalsDimensions[t],i=this.columns.indexOf(e);this.colsIsTotal[i]=!0}if(o){this.records=o;const t="undefined"!=typeof window?window.performance.now():0;this.setRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy();const e="undefined"!=typeof window?window.performance.now():0;console.log("processRecords:",e-t);const i="undefined"!=typeof window?window.performance.now():0;this.totalStatistics();const n="undefined"!=typeof window?window.performance.now():0;console.log("totalStatistics:",n-i);const r="undefined"!=typeof window?window.performance.now():0;this.sortKeys();const l="undefined"!=typeof window?window.performance.now():0;console.log("sortKeys:",l-r);const h="undefined"!=typeof window?window.performance.now():0;this.rowKeysPath_FULL=a?this.TreeToArr2(a):this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=s?this.TreeToArr2(s):this.TreeToArr(this.ArrToTree(this.colKeys,this.colsIsTotal,this.totals?.column?.showGrandTotals,this.colGrandTotalLabel,this.colSubTotalLabel));const c="undefined"!=typeof window?window.performance.now():0;console.log("TreeToArr:",c-h),this.dataConfig?.isPivotChart&&(this.dealWithZeroAlign(),this.cacheDeminsionCollectedValues())}this.updatePagination(e)}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(Yc.RECORD,GU),this.registerAggregator(Yc.SUM,VU),this.registerAggregator(Yc.COUNT,UU),this.registerAggregator(Yc.MAX,$U),this.registerAggregator(Yc.MIN,XU),this.registerAggregator(Yc.AVG,KU)}setRecords(){this.processRecords()}processCollectedValuesWithSumBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sumBy)for(const e in this.collectedValues[t]){const i=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()>t?e.value():t),Number.MIN_SAFE_INTEGER),n=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()<t?e.value():t),Number.MAX_SAFE_INTEGER);this.collectedValues[t][e]={},this.collectedValues[t][e].max=i,this.collectedValues[t][e].min=n}}processCollectedValuesWithSortBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sortBy)for(const e in this.collectedValues[t])this.collectedValues[t][e]=this.collectedValues[t][e].sort(((e,i)=>this.collectValuesBy[t]?.sortBy.indexOf(e)-this.collectValuesBy[t]?.sortBy.indexOf(i)))}processRecords(){let t=!1;if(this.dataConfig?.filterRules?.length>=1&&(t=!0),Array.isArray(this.records))for(let e=0,i=this.records.length;e<i;e++){const i=this.records[e];t&&!this.filterRecord(i)||this.processRecord(i)}else for(const e in this.records)for(let i=0,n=this.records[e].length;i<n;i++){const n=this.records[e][i];t&&!this.filterRecord(n)||this.processRecord(n,e)}this.rowFlatKeys={},this.colFlatKeys={}}filterRecord(t){let e=!0;for(let i=0;i<this.dataConfig.filterRules.length;i++){const n=this.dataConfig?.filterRules[i];if(n.filterKey){const i=t[n.filterKey];if(-1===n.filteredValues.indexOf(i)){e=!1;break}}else if(!n.filterFunc?.(t)){e=!1;break}}return e}processRecord(t,e){this.derivedFieldRules?.forEach(((e,i)=>{t[e.fieldName]=e.derivedFunc(t)}));const i=[],n=[];for(let e=0,i=this.rows.length;e<i;e++){const i=this.rows[e];n.push(t[i])}for(let e=0,n=this.columns.length;e<n;e++){const n=this.columns[e];i.push(t[n])}for(const e in this.collectValuesBy)if(t[e]){this.collectedValues[e]||(this.collectedValues[e]={});const i=this.collectValuesBy[e].by.map((e=>t[e])).join(this.stringJoinChar);if(this.collectedValues[e][i]||(this.collectValuesBy[e].sumBy?this.collectedValues[e][i]={}:this.collectValuesBy[e].range?this.collectedValues[e][i]={min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}:this.collectedValues[e][i]=[]),this.collectValuesBy[e].sumBy){const n=this.collectValuesBy[e].sumBy.map((e=>t[e])).join(this.stringJoinChar);this.collectedValues[e][i][n]||(this.collectedValues[e][i][n]=new this.aggregators[Yc.SUM](e)),this.collectedValues[e][i][n].push(t)}else if(this.collectValuesBy[e].range){const n=this.collectedValues[e][i];n.max=Math.max(t[e],n.max),n.min=Math.min(t[e],n.min)}else{const n=this.collectedValues[e][i];-1===n.indexOf(t[e])&&n.push(t[e])}}const r=n.join(this.stringJoinChar),o=i.join(this.stringJoinChar);0!==n.length&&(this.rowFlatKeys[r]||(this.rowKeys.push(n),this.rowFlatKeys[r]=1)),0!==i.length&&(this.colFlatKeys[o]||(this.colKeys.push(i),this.colFlatKeys[o]=1)),this.tree[r]||(this.tree[r]={}),this.tree[r]?.[o]||(this.tree[r][o]=[]);for(let i=0;i<this.indicatorKeys.length;i++){const n=this.getAggregatorRule(this.indicatorKeys[i]);if(this.tree[r]?.[o]?.[i]||(this.tree[r][o][i]=new this.aggregators[n?.aggregationType??Yc.SUM](n?.field??this.indicatorKeys[i],n?.formatFun)),e)this.indicatorKeys[i]===e&&this.tree[r]?.[o]?.[i].push(t);else if(n?.field)if("string"==typeof n?.field)bu(t[n?.field])&&this.tree[r]?.[o]?.[i].push(t);else{const e=n?.field.find((e=>t[e]));e&&this.tree[r]?.[o]?.[i].push(t)}else bu(t[this.indicatorKeys[i]])&&this.tree[r]?.[o]?.[i].push(t)}if(this.mappingRules)for(let e=0;e<this.indicatorKeys.length;e++){if(!this.indicatorStatistics[e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.indicatorStatistics[e]={max:new this.aggregators[Yc.MAX](this.indicatorKeys[e]),min:new this.aggregators[Yc.MIN](this.indicatorKeys[e]),total:new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}}this.indicatorStatistics[e].max.push(this.tree[r]?.[o]?.[e].value()),this.indicatorStatistics[e].min.push(this.tree[r]?.[o]?.[e].value()),this.indicatorStatistics[e].total.push(t)}}updateSortRules(t){this.sorted=!1,this.sortRules=t,this.sortKeys(),this.rowKeysPath_FULL=this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals||0===this.columns.length,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=this.TreeToArr(this.ArrToTree(this.colKeys,this.colsIsTotal,this.totals?.column?.showGrandTotals||0===this.rows.length,this.colGrandTotalLabel,this.colSubTotalLabel))}updateFilterRules(t,e=!1){if(this.filterRules=t,e)this.tree={};else for(const t in this.tree)for(const e in this.tree[t])for(let i=0;i<this.tree[t][e].length;i++)this.tree[t][e][i].reset();this.collectedValues={},this.processRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy(),this.dataConfig?.isPivotChart&&this.dealWithZeroAlign()}updatePagination(t){if(this.pagination=t,bu(this.pagination?.perPageCount)&&bu(this.pagination?.currentPage)){this.pagination.perPageCount=Math.ceil(this.pagination.perPageCount/this.indicatorKeys.length)*this.indicatorKeys.length;const{perPageCount:t,currentPage:e}=this.pagination,i=Math.ceil(t*(e||0)/this.indicatorKeys.length),n=i+Math.ceil(t/this.indicatorKeys.length);this.rowKeysPath=this.rowKeysPath_FULL?.slice(i,n)}else this.rowKeysPath=this.rowKeysPath_FULL;this.pagination&&(this.pagination.totalCount=this.rowKeysPath_FULL?.length)}getAggregatorRule(t){return this.aggregationRules?.find(((e,i)=>t===e.indicatorKey))}getAggregator(t=[],e=[],i){const n=this.indicatorKeys.indexOf(i);let r,o,s;return o="string"==typeof t?t:t.join(this.stringJoinChar),s="string"==typeof e?e:e.join(this.stringJoinChar),r=this.tree[o]?.[s]?.[n],r||{className:"",push(){},value:()=>null,formatValue:()=>"",reset(){}}}sortKeys(){const t=this;if(!this.sorted){this.sorted=!0;const e=function(e,i){return t.getAggregator(e,i,"").value()};switch(this.rowOrder){case"value_a_to_z":this.rowKeys.sort((function(t,i){return qU(e(t,[]),e(i,[]))}));break;case"value_z_to_a":this.rowKeys.sort((function(t,i){return-qU(e(t,[]),e(i,[]))}));break;default:this.rowKeys.sort(this.arrSort(this.rows,!0))}switch(this.colOrder){case"value_a_to_z":this.colKeys.sort((function(t,i){return qU(e([],t),e([],i))}));break;case"value_z_to_a":this.colKeys.sort((function(t,i){return-qU(e([],t),e([],i))}));break;default:const t=this.arrSort(this.columns,!1);this.colKeys.sort(t)}}}arrSort(t,e){let i;const n=this,r=function(r){const o=[];for(let r=0,s=t.length;r<s;r++){i=t[r];let s=!1;if(n.sortRules)for(let t=0,a=n.sortRules.length;t<a;t++)n.sortRules[t].sortField===i&&(s=!0,o.push({field:i,fieldIndex:r,sortRule:n.sortRules[t],func:n.getSort(n.sortRules[t],e)}));s||o.push({field:i,fieldIndex:r,func:qU})}return o}.call(this);return function(i,o){let s,a;for(let l=0;l<r.length;l++){if(a=r[l],a.sortRule?.sortByIndicator){let r=i,l=o;a.fieldIndex<t.length-1&&(r=i.slice(0,a.fieldIndex+1),r.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel),l=o.slice(0,a.fieldIndex+1),l.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel)),s=a.func(r,l)}else s=a.func(i[a.fieldIndex],o[a.fieldIndex]);if(0!==s)return s*(a.sortRule?.sortType===qc.DESC?-1:1)}return 0}}getSort(t,e){const i=this;return t.sortByIndicator?(n,r)=>{const o=function(e,n){return e.length<i.rows.length&&e[e.length-1]!==i.rowSubTotalLabel&&e[e.length-1]!==i.rowGrandTotalLabel&&e.push(i.rowSubTotalLabel),n.length<i.columns.length&&n[n.length-1]!==i.colSubTotalLabel&&n[n.length-1]!==i.colGrandTotalLabel&&n.push(i.colSubTotalLabel),i.getAggregator(e,n,t.sortByIndicator).value()};return e?qU(o(n,t.query),o(r,t.query)):qU(o(t.query,n),o(t.query,r))}:t.sortBy?function(t){let e;const i={},n={};for(let r=0;r<t.length;r++)e=t[r],i[e]=r,"string"==typeof e&&(n[e.toLowerCase()]=r);return function(t,e){return null!==i[t]&&void 0!==i[t]&&null!==i[e]&&void 0!==i[e]?i[t]-i[e]:null!==i[t]&&void 0!==i[t]?-1:null!==i[e]&&void 0!==i[e]?1:null!==n[t]&&void 0!==i[t]&&null!==n[e]&&void 0!==i[e]?n[t]-n[e]:null===n[t]||void 0===i[t]||null===n[e]||void 0===i[e]?0:null!==n[t]&&void 0!==i[t]?-1:null!==n[e]&&void 0!==i[e]?1:qU(t,e)}}(t.sortBy):t.sortType?YU:t.sortFunc?t.sortFunc:qU}totalStatistics(){const t=this;if(t?.totals?.column?.showSubTotals&&t?.totals?.column?.subTotalsDimensions?.length>=1||t?.totals?.row?.showSubTotals&&t?.totals?.row?.subTotalsDimensions?.length>=1||t?.totals?.column?.showGrandTotals||t?.totals?.row?.showGrandTotals){const e=[],i=(e,i)=>{const n=i.split(this.stringJoinChar);for(let r=0,o=t.totals?.column?.subTotalsDimensions?.length;r<o;r++){const o=t.totals.column.subTotalsDimensions[r],s=t.columns.indexOf(o);if(s>=0){const r=n.slice(0,s+1);r.push(t.totals?.column?.subTotalLabel??"小计");const o=r.join(this.stringJoinChar);this.tree[e][o]||(this.tree[e][o]=[]);for(let n=0;n<this.indicatorKeys.length;n++){if(!this.tree[e][o][n]){const t=this.getAggregatorRule(this.indicatorKeys[n]);this.tree[e][o][n]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[n],t?.formatFun)}this.tree[e][o][n].push(t.tree[e]?.[i]?.[n])}}}if(t.totals?.column?.showGrandTotals||0===this.rows.length){const n=t.colGrandTotalLabel;this.tree[e][n]||(this.tree[e][n]=[]);for(let r=0;r<this.indicatorKeys.length;r++){if(!this.tree[e][n][r]){const t=this.getAggregatorRule(this.indicatorKeys[r]);this.tree[e][n][r]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[r],t?.formatFun)}this.tree[e][n][r].push(t.tree[e]?.[i]?.[r])}}};Object.keys(t.tree).forEach((n=>{const r=n.split(this.stringJoinChar);Object.keys(t.tree[n]).forEach((o=>{for(let i=0,s=t.totals?.row?.subTotalsDimensions?.length;i<s;i++){const s=t.totals.row.subTotalsDimensions[i],a=t.rows.indexOf(s);if(a>=0){const i=r.slice(0,a+1);i.push(t.totals?.row?.subTotalLabel??"小计");const s=i.join(this.stringJoinChar);if(this.tree[s]||(this.tree[s]={},e.push(s)),!this.tree[s][o]){this.tree[s][o]=[];for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[s][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[s][o][e]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[s][o][e].push(t.tree[n]?.[o]?.[e])}}}}if(t.totals?.row?.showGrandTotals||0===this.columns.length){const i=t.rowGrandTotalLabel;this.tree[i]||(this.tree[i]={},e.push(i)),this.tree[i][o]||(this.tree[i][o]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[i][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[i][o][e]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[i][o][e].push(t.tree[n]?.[o]?.[e])}}i(n,o)}))})),e.forEach((e=>{Object.keys(t.tree[e]).forEach((t=>{i(e,t)}))}))}}ArrToTree(t,e,i,n,r){const o=[],s=this.stringJoinChar,a=new Map;if(t.forEach((t=>function(t){const i=[];let n;t.forEach(((l,h)=>{i.push(l);const c=i.join(s);let u=a.get(c);if(!u){if(u={id:c,children:[]},e[h]){let e=u.children;for(let i=h;i<t.length-1;i++){const t={id:`${c}${s}${r}`,children:[]};e.push(t),e=t.children}}a.set(c,u),n?e[h-1]?n.children.splice(n.children.length-1,0,u):n.children.push(u):o.push(u)}n=u}))}(t))),i){const t={id:n,children:[]};let i=t.children;for(let t=1;t<e.length;t++){const t={id:n,children:[]};i.push(t),i=t.children}o.push(t)}return o}TreeToArr(t){const e=[];function i(t,n){n.push(t.id),t.children.length>0?t.children?.forEach((t=>i(t,[...n]))):e.push(n)}return t.forEach((t=>i(t,[]))),e}TreeToArr2(t){const e=[];function i(t,n){n.push(n.length>0?[n[n.length-1],t.value].join(String.fromCharCode(0)):t.value),t.children?.length>0&&!t.children[0].indicatorKey?t.children?.forEach((t=>i(t,[...n]))):e.push(n)}return t.forEach((t=>i(t,[]))),e}dealWithZeroAlign(){const t=[];for(let e=0;e<this.aggregationRules.length;e++){const i=this.aggregationRules[e];qu(i.field)&&2===i.field.length&&t.push(i.field)}t.forEach((t=>{const e=t[0],i=t[1],n=this.collectedValues[e],r=this.collectedValues[i];this.collectedValues[e+"_align"]={},this.collectedValues[i+"_align"]={};const o=n||r;for(const t in o){const o=n?.[t]??{min:0,max:1},s=r?.[t]??{min:0,max:1},a=nK(o,s);if(a){const{range1:n,range2:r}=a;this.collectedValues[e+"_align"][t]={min:n[0],max:n[1]},this.collectedValues[i+"_align"][t]={min:r[0],max:r[1]}}else this.collectedValues[e+"_align"][t]={min:o.min,max:o.max},this.collectedValues[i+"_align"][t]={min:s.min,max:s.max}}}))}cacheDeminsionCollectedValues(){for(const t in this.collectValuesBy)"xField"!==this.collectValuesBy[t].type&&"yField"!==this.collectValuesBy[t].type||(this.dataConfig.dimensionSortArray?this.cacheCollectedValues[t]=oK(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}}function oK(t,e){return t.sort(((t,i)=>{const n=e.indexOf(t),r=e.indexOf(i);return n<r?-1:n>r?1:0}))}class sK{type;id;x=0;y=0;width=0;height=0;marginLeft;marginRight;marginTop;marginBottom;layoutWidth;layoutHeight;dx=0;dy=0;background;constructor(t){this.id=t.id,this.marginLeft=t.marginLeft??0,this.marginRight=t.marginRight??0,this.marginTop=t.marginTop??0,this.marginBottom=t.marginBottom??0,this.background=t.background||void 0}getSize(t){this.initLayoutSize()}initLayoutSize(){this.layoutWidth=this.width+this.marginLeft+this.marginRight,this.layoutHeight=this.height+this.marginTop+this.marginBottom,this.background&&(this.layoutWidth+=2*(this.background.expandX||0),this.layoutHeight+=2*(this.background.expandY||0)),this.dx=this.marginLeft,this.dy=this.marginTop}}const aK={row:{x:"x",y:"y",width:"width",height:"height",layoutWidth:"layoutWidth",layoutHeight:"layoutHeight",widthLimit:"widthLimit",heightLimit:"heightLimit",parentX:"parentX",parentY:"parentY",dx:"dx",dy:"dy"},column:{x:"y",y:"x",width:"height",height:"width",layoutWidth:"layoutHeight",layoutHeight:"layoutWidth",widthLimit:"heightLimit",heightLimit:"widthLimit",parentX:"parentY",parentY:"parentX",dx:"dy",dy:"dx"}};class lK{width=0;height=0;y=0;x=0;children=[];addAble=!0;widthLimit=0;heightLimit=0;direction;directionKey;offsetX=0;justifyContent;alignItems;constructor(t,e,i,n){this.direction=e,this.directionKey=aK[this.direction],this.justifyContent=i,this.alignItems=n,this[this.directionKey.widthLimit]=t}add(t){t[this.directionKey.x]=this[this.directionKey.width],this[this.directionKey.width]+=t[this.directionKey.layoutWidth],this.children.push(t),this.updateHeight(t)}canAdd(t){return!(this[this.directionKey.width]+t[this.directionKey.layoutWidth]>this[this.directionKey.widthLimit])}updateHeight(t){t[this.directionKey.layoutHeight]>this[this.directionKey.height]&&(this[this.directionKey.height]=t[this.directionKey.layoutHeight])}lineFinish(){this.updateXAlign()}updateXAlign(){const t=this[this.directionKey.widthLimit]-this[this.directionKey.width];"center"===this.justifyContent?this.offsetX=t/2:"start"===this.justifyContent?this.offsetX=0:this.offsetX=t}getOffsetY(t){switch(this.alignItems){case"start":default:return 0;case"center":return(this[this.directionKey.height]-t[this.directionKey.layoutHeight])/2;case"end":return this[this.directionKey.height]-t[this.directionKey.layoutHeight]}}getContentSize(){const t={width:0,height:0};for(let e=0;e<this.children.length;e++){const i=this.children[e];let n;n="container"===i.type?i.getContentSize():{width:i.layoutWidth,height:i.layoutHeight},t[this.directionKey.height]<n[this.directionKey.height]&&(t[this.directionKey.height]=n[this.directionKey.height]),t[this.directionKey.width]+=n[this.directionKey.width]}return t}getElements(t={parentX:0,parentY:0},e=!1,i=!1){const n=[];for(let r=0;r<this.children.length;r++){const o=this.children[r];if("container"===o.type||"group-element"===o.type){const r=o.getElements({[this.directionKey.parentX]:this.offsetX+this[this.directionKey.x]+t.parentX,[this.directionKey.parentY]:this.getOffsetY(o)+this[this.directionKey.y]+t.parentY},e,i);n.push(...r)}else{if("icon"===o.type&&("mouseenter_cell"===o.cache?.visibleTime&&!e||"click_cell"===o.cache?.visibleTime&&!i))continue;o[this.directionKey.x]+=this.offsetX+this[this.directionKey.x]+t.parentX,o[this.directionKey.y]+=this.getOffsetY(o)+this[this.directionKey.y]+t.parentY,n.push(o)}}return n}}class hK extends sK{type="rect";lineWidth;cornerRadius;radius;fill;stroke;constructor(t){super(t),this.width=t.width,this.height=t.height,this.lineWidth=t.lineWidth||0,this.cornerRadius=t.cornerRadius||0,this.radius=this.cornerRadius,this.fill=t.fill||"#777",this.stroke=t.stroke||void 0,this.initLayoutSize()}}var cK=Object.freeze({__proto__:null,Circle:class extends sK{type="circle";radius;radian;lineWidth;fill;stroke;constructor(t){super(t),this.radius=t.radius,this.radian=t.radian,this.lineWidth=t.lineWidth,this.fill=t.fill,this.stroke=t.stroke,this.width=2*this.radius,this.height=2*this.radius,this.initLayoutSize(),this.dx+=this.radius,this.dy+=this.radius}},Container:class extends sK{type="container";_widthObj;_heightObj;needCalcSize=!1;direction;justifyContent;alignItems;alignContent;lines=[];currentLine;currentLineY=0;table;directionKey;showBounds;offsetY=0;isRoot;constructor(t){super(t),this.direction=t.direction||"row",this.justifyContent=t.justifyContent||"start",this.alignItems=t.alignItems||"start",this.alignContent=t.alignContent||"start",lu(t.width)?this.width=t.width:(this._widthObj=t.width,this.needCalcSize=!0),lu(t.height)?this.height=t.height:(this._heightObj=t.height,this.needCalcSize=!0),this.directionKey=aK[this.direction],this.showBounds=t.showBounds||!1,this.initLayoutSize()}add(t){if(this.needCalcSize)throw new Error("Need to specify a parent element before adding a child element when use percent size!");"container"===t.type&&t.calcSize(this.width,this.height),this.currentLine&&this.currentLine.canAdd(t)?this.currentLine.add(t):(this.currentLine&&(this.currentLine.addAble=!1,this.currentLineY+=this.currentLine[this.directionKey.height],this.currentLine.lineFinish()),this.currentLine=new lK(this[this.directionKey.width],this.direction,this.justifyContent,this.alignItems),this.currentLine[this.directionKey.y]=this.currentLineY,this.currentLine.add(t),this.lines.push(this.currentLine))}updateYAlign(){const t=this[this.directionKey.height]-this.currentLineY;"center"===this.alignContent?this.offsetY=t/2:"start"===this.alignContent?this.offsetY=0:this.offsetY=t}getSize(){const t={width:0,height:0};this.currentLine&&this.currentLine.addAble?t[this.directionKey.height]=this.currentLineY+this.currentLine[this.directionKey.height]:t[this.directionKey.height]=this.currentLineY;for(let e=0;e<this.lines.length;e++){const i=this.lines[e];t[this.directionKey.width]<i[this.directionKey.width]&&(t[this.directionKey.width]=i[this.directionKey.width])}return t}getContentSize(){const t={width:0,height:0},e={width:!0,height:!0};this.isRoot||this._heightObj||(e.height=!1,t.height=this.height),this.isRoot||this._widthObj||(e.width=!1,t.width=this.width);for(let i=0;i<this.lines.length;i++){const n=this.lines[i].getContentSize();e[this.directionKey.width]&&t[this.directionKey.width]<n[this.directionKey.width]&&(t[this.directionKey.width]=n[this.directionKey.width]),e[this.directionKey.height]&&(t[this.directionKey.height]+=n[this.directionKey.height])}return t}calcSize(t,e){this._heightObj&&(this.height=e*this._heightObj.percent/100+this._heightObj.delta,this.needCalcSize=!1,this.initLayoutSize()),this._widthObj&&(this.width=t*this._widthObj.percent/100+this._widthObj.delta,this.needCalcSize=!1,this.initLayoutSize())}getElements(t={parentX:0,parentY:0},e=!1,i=!1){this.currentLine&&this.currentLine.addAble&&(this.currentLine.addAble=!1,this.currentLineY+=this.currentLine[this.directionKey.height],this.currentLine.lineFinish()),this.updateYAlign();const n=[];if(this.background&&this.background.fill){const e=new hK({width:this.width,height:this.height,stroke:this.background.stroke??!1,fill:this.background.fill,cornerRadius:this.background.cornerRadius??0,lineWidth:this.background.lineWidth??1});e.x+=this.x+t.parentX,e.y+=this.y+t.parentY,n.push(e)}if(this.showBounds){const e=new hK({width:this.width,height:this.height,cornerRadius:0,stroke:"red",fill:"rgba(255, 0, 0, 0.2)",lineWidth:4});e.x+=this.x+t.parentX,e.y+=this.y+t.parentY,n.push(e)}for(let r=0;r<this.lines.length;r++){const o=this.lines[r];o[this.directionKey.y]+=this.offsetY;const s=o.getElements({[this.directionKey.parentX]:this.x+t.parentX,[this.directionKey.parentY]:this.y+t.parentY},e,i);n.push(...s)}return n}},GroupElement:class extends sK{type="group-element";direction;alignItems;width=0;height=0;children=[];directionKey;constructor(t){super(t),this.direction=t.direction||"row",this.alignItems=t.alignItems||"start",this.directionKey=aK[this.direction]}add(t){t.x=this.width,this.width+=t.layoutWidth,this.children.push(t),this.updateHeight(t),this.initLayoutSize()}updateHeight(t){t.layoutHeight>this.height&&(this.height=t.layoutHeight)}getOffsetY(t){switch(this.alignItems){case"start":default:return 0;case"center":return(this[this.directionKey.height]-t[this.directionKey.layoutHeight])/2;case"end":return this[this.directionKey.height]-t[this.directionKey.layoutHeight]}}getElements(t={parentX:0,parentY:0},e=!1,i=!1){const n=[];for(let r=0;r<this.children.length;r++){const o=this.children[r];"icon"===o.type&&("mouseenter_cell"===o.cache?.visibleTime&&!e||"click_cell"===o.cache?.visibleTime&&!i)||(o[this.directionKey.x]+=this[this.directionKey.dx]+this[this.directionKey.x]+t.parentX,o[this.directionKey.y]+=this.getOffsetY(o)+this[this.directionKey.dy]+this[this.directionKey.y]+t.parentY,n.push(o))}return n}},Icon:class extends sK{type="icon";svg;iconName;cursor;cache;constructor(t){if(super(t),this.iconName=t.iconName,au(this.iconName)){const t=yj()[this.iconName];t&&(this.cache=t,this.width=t.width,this.height=t.height,this.svg=t.svg,this.cursor=t.cursor)}this.width=t.width??this.width,this.height=t.height??this.height,this.svg=t.svg??this.svg,this.initLayoutSize()}},Image:class extends sK{type="image";src;cursor;cache;shape;constructor(t){super(t),this.width=t.width??this.width,this.height=t.height??this.height,this.src=t.src??this.src,this.shape=t.shape??this.shape,this.initLayoutSize()}},Rect:hK,Sector:class extends sK{type="arc";radius;startDegree=0;endDegree=360;clockWise=!0;lineWidth;fill;stroke;constructor(t){super(t),this.radius=t.radius,this.startDegree=t.startDegree,this.endDegree=t.endDegree,this.clockWise=t.clockWise,this.lineWidth=t.lineWidth,this.fill=t.fill,this.stroke=t.stroke,this.width=2*this.radius,this.height=2*this.radius,this.initLayoutSize(),this.dx+=this.radius,this.dy+=this.radius}},Text:class extends sK{type="text";text;fill;color;stroke;lineWidth;fontSize;fontFamily;fontWeight;fontVariant;fontStyle;ellipsis;maxLineWidth;textAlign;textBaseline;lineHeight;underline;lineThrough;heightLimit;lineClamp;constructor(t){super(t),this.text=t.text,this.fontSize=t.fontSize||12,this.fontFamily=t.fontFamily||"sans-serif",this.fill=t.color||t.fill||"black",this.textBaseline=t.textBaseline||"top",this.textAlign=t.textAlign||"left",t.stroke&&(this.stroke=t.stroke),t.lineWidth&&(this.lineWidth=t.lineWidth),t.fontWeight&&(this.fontWeight=t.fontWeight),t.fontVariant&&(this.fontVariant=t.fontVariant),t.fontStyle&&(this.fontStyle=t.fontStyle),t.ellipsis&&(this.ellipsis=t.ellipsis),t.maxLineWidth&&(this.maxLineWidth=t.maxLineWidth),t.lineHeight&&(this.lineHeight=t.lineHeight),t.underline&&(this.underline=t.underline),t.lineThrough&&(this.lineThrough=t.lineThrough),t.heightLimit&&(this.heightLimit=t.heightLimit),t.lineClamp&&(this.lineClamp=t.lineClamp)}getSize(t){const{width:e,height:i}=t.measureText(this.text,{fontSize:this.fontSize,fontWeight:this.fontWeight,fontFamily:this.fontFamily});this.width=e,this.height=i,this.initLayoutSize(),this.background&&(this.dx+=this.background.expandX||0,this.dy+=this.background.expandY||0)}},percentCalc:function(t,e=0){return{percent:t,delta:e}}});t.CustomLayout=cK,t.DataStatistics=RU,t.ListTable=class extends _U{showHeader=!0;constructor(t,e){t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e);const i=this.internalProps;this.pagination=e.pagination,i.sortState=e.sortState,i.columns=e.columns?du(e.columns):e.header?du(e.header):[],this.showHeader=e.showHeader??!0,this.transpose=e.transpose??!1,this.refreshHeader(),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,i.sortState):this.setRecords([])}isListTable(){return!0}isPivotTable(){return!1}isPivotChart(){return!1}get sortState(){return this.internalProps.sortState}get columns(){return this.internalProps.columns}set columns(t){this.internalProps.columns=t,this.options.columns=t}updateColumns(t){this.internalProps.columns=t,this.options.columns=t,this.refreshHeader(),this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}get header(){return this.internalProps.columns}set header(t){this.internalProps.columns=t,this.options.header=t,this.refreshHeader(),setTimeout((()=>{this.render()}),0)}get transpose(){return this.internalProps.transpose??!1}set transpose(t){this.internalProps.transpose!==t&&(this.internalProps.transpose=t,this.options.transpose=t,this.internalProps.layoutMap&&(this.internalProps.layoutMap.transpose=t,this.refreshRowColCount(),this._resetFrozenColCount(),this.render()))}getCellValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}const{field:n,fieldFormat:r}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(r||n,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getRecordIndexByRow(t,e){const{layoutMap:i}=this.internalProps;return i.getRecordIndexByRow(t,e)}getCellOriginRecord(t,e){const i=this,n=i.getRecordIndexByRow(t,e);if(n>-1)return i.dataSource.get(n)}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.transpose){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;return super.updateOption(t),this.pagination=t.pagination,this.showHeader=t.showHeader??!0,i.columns=t.columns?du(t.columns):t.header?du(t.header):[],this.transpose=t.transpose??!1,this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,t.sortState):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){this.pagination&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.dataSource.updatePagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){const t=this,e=t.internalProps,i=t.transpose,n=t.showHeader;e.headerEvents&&e.headerEvents.forEach((e=>t.off(e)));const r=e.layoutMap=new kU(this,e.columns??[],n,t.options.hierarchyIndent);if(r.transpose=i,!i)for(let e=0;e<r.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:o}=r.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&t.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&t.setMinColWidth(e,n),o&&("number"==typeof o&&o>0||"string"==typeof o)&&t.setMaxColWidth(e,o)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(e.recordsCount=t.internalProps.dataSource?.length??0,t.transpose?(t.rowCount=e.rowCount??0,t.colCount=(t.internalProps.dataSource?.length??0)*e.bodyRowCount+e.headerLevelCount,t.frozenRowCount=0,t.frozenColCount=e.headerLevelCount,t.rightFrozenColCount=this.options.rightFrozenColCount??0):(t.colCount=e.colCount??0,t.rowCount=(t.internalProps.dataSource?.length??0)*e.bodyRowCount+e.headerLevelCount,t.frozenColCount=t.options.frozenColCount??0,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0,t.rightFrozenColCount=this.options.rightFrozenColCount??0))}getFieldData(t,e,i){if(null===t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=n.getRecordIndexByRow(e,i);return n.internalProps.dataSource.getField(r,t)}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize),!this.transpose){this.colWidthsLimit={};for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearColRangeWidthsMap(i)}else{const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearRowRangeHeightsMap(i)}return!0}return!1}getCellAddress(t,e){let i;for(let e=0;e<this.internalProps.records.length;e++){const n=this.internalProps.records[e];if("function"==typeof t)t(n)&&(i=e);else{let r=!0;for(const e in t)if(n[e]!==t[e]){r=!1;break}r&&(i=e)}if(bu(i))break}const n=this.getCellRangeByField(e,i);if(n)return{row:n.start.row,col:n.start.col}}getCellRangeByField(t,e){const{layoutMap:i}=this.internalProps,n=i.columnObjects.find((e=>e.field===t));if(n){const t=i.getBodyLayoutRangeById(n.id);let r;return bu(e)&&(r=i.getRecordStartRowByRecordIndex(e)),this.transpose?{start:{row:t.start.row,col:bu(r)?r+t.start.col:void 0},end:{row:t.end.row,col:bu(r)?r+t.end.col:void 0}}:{start:{col:t.start.col,row:bu(r)?r+t.start.row:void 0},end:{col:t.end.col,row:bu(r)?r+t.end.row:void 0}}}return null}getHierarchyState(t,e){if(!this.getBodyColumnDefine(t,e).tree)return Xc.none;const i=this.getRecordIndexByRow(t,e);return this.dataSource.getHierarchyState(i)}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(sf.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(sf.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.getRecordIndexByRow(t,e),r=this.dataSource.toggleHierarchyState(n),o=this.internalProps.layoutMap.toggleHierarchyState(r);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(o.removeCellPositions,o.addCellPositions)}hasHierarchyTreeHeader(){return(this.options.columns??this.options.header)?.some(((t,e)=>t.tree))}getMenuInfo(t,e,i){return{field:this.getHeaderField(t,e),value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e)}}_getSortFuncFromHeaderOption(t,e,i){if(t||(t=this.internalProps.columns),e&&t&&t.length>0)for(let n=0;n<t.length;n++){const r=t[n];if((i&&i===r.fieldKey||!i&&r.field===e)&&r.sort&&"function"==typeof r.sort)return r.sort;if(r.columns){const t=this._getSortFuncFromHeaderOption(r.columns,e,i);if(t)return t}}}updateSortState(t,e=!0){if(t)this.internalProps.sortState=t;else if(this.internalProps.sortState)if(Array.isArray(this.internalProps.sortState))for(let t=0;t<this.internalProps.sortState.length;t++){this.internalProps.sortState[t].order="normal"}else this.internalProps.sortState.order="normal";let i,n,r;if(Array.isArray(this.internalProps.sortState)?({order:i,field:n,fieldKey:r}=this.internalProps.sortState?.[0]):({order:i,field:n,fieldKey:r}=this.internalProps.sortState),n&&e){const t=this._getSortFuncFromHeaderOption(this.internalProps.columns,n,r);let e;e=r?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===r)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===n)),e?.define?.sort&&(this.dataSource.sort(e.field,i,t),this.scenegraph.sortCell())}this.stateManeger.updateSortState(t)}},t.PivotChart=class extends _U{pivotSortState;dataset;_selectedDataItemsInChart=[];_selectedDimensionInChart=[];_chartEventMap={};_axes;constructor(t,e){if(t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.setCustomStateNameToSpec(),this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig={isPivotChart:!0},this._axes=qu(e.axes)?e.axes:[],e.rows||e.columns){const t=e.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),i=e.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(i,t),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new rK(this.internalProps.dataConfig,null,t,i,n,e.records,e.columnTree,e.rowTree)}this.refreshHeader(),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return JG}get pivotChartAxes(){return this._axes}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!0}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;if(super.updateOption(t),this.setCustomStateNameToSpec(),i.columnResizeType=t.columnResizeType??"column",i.dataConfig={},this._axes=qu(t.axes)?t.axes:[],t.rows||t.columns){const e=t.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),i=t.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=t.indicators.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[]);this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(i,e),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.dataset=new rK(this.internalProps.dataConfig,null,e,i,n,t.records??this.internalProps.records,t.columnTree,t.rowTree)}return this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(){}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.off(t))),t.layoutMap=new WU(this,this.dataset);for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:r}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMinColWidth(e,n),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMaxColWidth(e,r)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.frozenColCount=e.rowHeaderLevelCount,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=e?.bottomFrozenRowCount??0,t.rightFrozenColCount=e?.rightFrozenColCount??0)}_getSortFuncFromHeaderOption(t,e,i){}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{t?.children?.[i]&&e&&this.syncHierarchyState(t.children[i],e)})))}getRecordIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByRow(t)}getRecordIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByCol(t)}getFieldData(t,e,i){if(null==t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=this.getRecordIndexByRow(i),o=this.getRecordIndexByCol(e),s=n.dataSource?.getField(r,o);if("string"!=typeof t){return fW({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,of)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:n}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n(i):i}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}const{field:i,fieldFormat:n}=this.internalProps.layoutMap.getBody(t,e);return this.getFieldData(n||i,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getCellOriginRecord(t,e){if(!this.internalProps.layoutMap.isHeader(t,e)&&this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[];return this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e)).records}}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.internalProps.layoutMap.updateDataset(this.dataset),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:n}=t[e],r=this.internalProps.layoutMap.getPivotCellAdress(i);r&&this.pivotSortState.push({col:r.col,row:r.row,order:n})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:n,order:r}=this.pivotSortState[t];if(qp(i,e,n))return r}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(JG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(JG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(n.removeCellPositions,n.addCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;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);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const n=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:n[n.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}_generateCollectValuesConfig(t,e){const i=this.options,n={};for(let r=0,o=i.indicators.length;r<o;r++)if("string"!=typeof i.indicators[r]&&i.indicators[r].chartSpec)if(!1===i.indicatorsAsCol){const o=i.indicators[r];if(n[o.indicatorKey]={by:e,range:!0,sumBy:!1!==o.chartSpec?.stack&&t.concat(o.chartSpec?.xField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const r="string"==typeof i.xField?i.xField:i.xField[0];n[r]={by:t,type:"horizontal"!==i.direction?"xField":void 0,range:"horizontal"===i.direction,sortBy:"horizontal"!==i.direction?i?.data?.fields?.[r]?.domain??o.chartSpec?.data?.fields?.[r]?.domain:void 0};const s=i.yField;n[s]={by:e,range:"horizontal"!==i.direction,sumBy:!1!==i.stack&&t.concat(r),sortBy:"horizontal"===i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.xField?o.chartSpec.xField:o.chartSpec.xField[0];n[s]={by:t,type:"horizontal"!==o.chartSpec.direction?"xField":void 0,range:"horizontal"===o.chartSpec.direction,sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.yField;n[a]={by:e,range:"horizontal"!==i.indicators[r].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&t.concat(s),sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}else{const o=i.indicators[r];if(n[o.indicatorKey]={by:t,range:!0,sumBy:!1!==o.chartSpec?.stack&&e.concat(o.chartSpec?.yField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const r="string"==typeof i.yField?i.yField:i.yField[0];n[r]={by:e,type:"horizontal"===i.direction?"yField":void 0,range:"horizontal"!==i.direction,sortBy:"horizontal"===i.direction?i?.data?.fields?.[r]?.domain??o.chartSpec?.data?.fields?.[r]?.domain:void 0};const s=i.xField;n[s]={by:t,range:"horizontal"===i.direction,sumBy:!1!==i.stack&&e.concat(r),sortBy:"horizontal"!==i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.yField?o.chartSpec.yField:o.chartSpec.yField[0];n[s]={by:e,type:"horizontal"===o.chartSpec.direction?"yField":void 0,range:"horizontal"!==o.chartSpec.direction,sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.xField;n[a]={by:t,range:"horizontal"===i.indicators[r].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&e.concat(s),sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}return n}_generateAggregationRules(){const t=[];return this.options.indicators.forEach((e=>{if("string"==typeof e)t.push({indicatorKey:e,field:e,aggregationType:Yc.RECORD});else if(e.chartSpec?.series){const i=[];e.chartSpec?.series.forEach((t=>{const e=!1===this.options.indicatorsAsCol?t.yField:t.xField;-1===i.indexOf(e)&&i.push(e)})),t.push({indicatorKey:e.indicatorKey,field:i,aggregationType:Yc.RECORD})}else{const i=!1===this.options.indicatorsAsCol?e.chartSpec.yField:e.chartSpec.xField;t.push({indicatorKey:e.indicatorKey,field:i??e.indicatorKey,aggregationType:Yc.RECORD})}})),t}setCustomStateNameToSpec(){const t=t=>{t.bar?.state?.selected&&(t.bar.state.vtable_selected=t.bar.state.selected,t.bar.state.vtable_selected_reverse=t.bar.state.selected_reverse,delete t.bar.state.selected,delete t.bar.state.selected_reverse),t.point?.state?.selected&&(t.point.state.vtable_selected=t.point.state.selected,t.point.state.vtable_selected_reverse=t.point.state.selected_reverse,delete t.point.state.selected,delete t.point.state.selected_reverse),t.line?.state?.selected&&(t.line.state.vtable_selected=t.line.state.selected,t.line.state.vtable_selected_reverse=t.line.state.selected_reverse,delete t.line.state.selected,delete t.line.state.selected_reverse),t.area?.state?.selected&&(t.area.state.vtable_selected=t.area.state.selected,t.area.state.vtable_selected_reverse=t.area.state.selected_reverse,delete t.area.state.selected,delete t.area.state.selected_reverse)};this.options.indicators.forEach((e=>{if(e.chartSpec){const i=e.chartSpec;i.series?i.series.forEach((e=>{t(e)})):t(i)}}))}onVChartEvent(t,e,i){this._chartEventMap[t]="function"==typeof e?{callback:e}:{callback:i,query:e}}offVChartEvent(t){delete this._chartEventMap[t]}_bindChartEvent(t){if(t)for(const e in this._chartEventMap)this._chartEventMap[e].query?t.on(e,this._chartEventMap[e].query,this._chartEventMap[e].callback):t.on(e,this._chartEventMap[e].callback)}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),kG(this.scenegraph),function(t){const e=t.table;for(let i=t.proxy.colStart;i<=t.proxy.colEnd;i++)t.getColGroup(i).getChildren().forEach((t=>{const i=t.col,n=t.row;t.children.forEach((t=>{if("chart"===t.type){t.updateData(e.getCellValue(i,n));const r=e.internalProps.layoutMap.getChartAxes(i,n);t.setAttribute("axes",r);const o=t.attribute.spec;o.axes=r,t.setAttribute("spec",o)}}))}));IG(t.rowHeaderGroup,t.table),IG(t.colHeaderGroup,t.table),IG(t.rightFrozenGroup,t.table),IG(t.bottomFrozenGroup,t.table)}(this.scenegraph),this.render()}setLegendSelected(t){this.internalProps.legends.legendComponent.setSelected(t)}getChartDatumPosition(t,e){const i=this.getCellAddressByHeaderPaths(e),n=this.getCellRelativeRect(i.col,i.row);console.log(n);const r=this.scenegraph.getCell(i.col,i.row);let o;const s=r?.getChildren()?.[0];if(s.attribute.chartInstance){const e=s.attribute.chartInstance,{dataId:i,data:n,axes:r}=s.attribute,a=s.getViewBox();r.forEach(((t,i)=>{if("linear"===t.type){e._chart._components[i]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const n=e._chart._components[i];n._spec.domain=t.domain.slice(0),n.updateScaleDomain()}})),e.updateViewBox({x1:a.x1-s.getRootNode().table.scrollLeft,x2:a.x2-s.getRootNode().table.scrollLeft,y1:a.y1-s.getRootNode().table.scrollTop,y2:a.y2-s.getRootNode().table.scrollTop},!1),e.updateDataSync(i,n),o=e.convertDatumToPosition(t),this.render()}return o?{x:Math.round(o.x+n.bounds.x1),y:Math.round(o.y+n.bounds.y1)}:null}_getDimensionSortArray(){if(this.options?.axes?.length){const t=this.options.indicatorsAsCol?"left":"bottom",e=this.options.axes.find((e=>e.orient===t));if(e&&qu(e.domain))return e.domain}}},t.PivotTable=class extends _U{pivotSortState;dataset;flatDataToObjects;constructor(t,e){if(t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.pagination=e.pagination,this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig=e.dataConfig,this.internalProps.enableDataAnalysis=e.enableDataAnalysis,this.internalProps.enableDataAnalysis&&(e.rows||e.columns)){const t=e.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),i=e.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.dataset=new rK(this.internalProps.dataConfig,this.pagination,t,i,n,e.records)}this.refreshHeader(),this.pivotSortState=[],e.pivotSortState&&this.updatePivotSortState(e.pivotSortState),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return ZG}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!1}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;if(super.updateOption(t),this.pagination=t.pagination,i.columnResizeType=t.columnResizeType??"column",i.dataConfig=t.dataConfig,i.enableDataAnalysis=t.enableDataAnalysis,"tree"===t?.rowHierarchyType&&"tree"===this.internalProps.layoutMap.rowHierarchyType&&this.internalProps.layoutMap.rowExpandLevel===t?.rowExpandLevel){const t=this.internalProps.layoutMap.rowDimensionTree.tree.children;this.internalProps.layoutMap.rowTree.forEach(((e,i)=>{this.syncHierarchyState(t[i],e)}))}if(this.internalProps.enableDataAnalysis&&(t.rows||t.columns)){const e=t.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=t.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),r=t.indicators.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[]);this.dataset=new rK(i.dataConfig,this.pagination,e,n,r,t.records)}return this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){this.pagination&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.dataset.updatePagination(this.pagination),this.refreshHeader(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.off(t)));const e=this.options.records??this.internalProps.records;this.options.enableDataAnalysis?t.layoutMap=new WU(this,this.dataset):(Array.isArray(this.options.columnTree)||Array.isArray(this.options.rowTree))&&(t.layoutMap=new FU(this),e?.[0]?.constructor!==Array&&(this.flatDataToObjects=new jU({rows:t.layoutMap.rowDimensionKeys,columns:t.layoutMap.colDimensionKeys,indicators:t.layoutMap.indicatorKeys,indicatorsAsCol:t.layoutMap.indicatorsAsCol,indicatorDimensionKey:t.layoutMap.indicatorDimensionKey},e)));for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:r}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMinColWidth(e,n),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMaxColWidth(e,r)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.frozenColCount=e.rowHeaderLevelCount,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0,t.rightFrozenColCount=this.options.rightFrozenColCount??0)}_getSortFuncFromHeaderOption(t,e,i){}get rowHierarchyType(){return this.internalProps.layoutMap.rowHierarchyType}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{t?.children?.[i]&&e&&this.syncHierarchyState(t.children[i],e)})))}getRecordIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByRow(t)}getRecordIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByCol(t)}getFieldData(t,e,i){if(null==t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=this.getRecordIndexByRow(i),o=this.getRecordIndexByCol(e),s=n.dataSource?.getField(r,o);if("string"!=typeof t){return fW({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,of)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:n}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n(i):i}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.formatValue?r.formatValue():""}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey),{fieldFormat:s}=this.internalProps.layoutMap.getBody(t,e);return"function"==typeof s?s(o?.record):o?.value??""}const{field:i,fieldFormat:n}=this.internalProps.layoutMap.getBody(t,e);return this.getFieldData(n||i,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return o?.value}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getCellOriginRecord(t,e){if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[];return this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e)).records}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return o?.record}}}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.internalProps.layoutMap.updateDataset(this.dataset),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:n}=t[e],r=this.internalProps.layoutMap.getPivotCellAdress(i);r&&this.pivotSortState.push({col:r.col,row:r.row,order:n})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:n,order:r}=this.pivotSortState[t];if(qp(i,e,n))return r}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(ZG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(ZG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(n.removeCellPositions,n.addCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;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);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const n=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:n[n.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}},t.TYPES=nu,t.clearGlobal=function(){BU()},t.core=SU,t.data=bW,t.getIcons=function(){return yj()},t.register=MU,t.themes=zf,t.version="0.10.2"}));
17
+ ***************************************************************************** */function Qj(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}const tN=Cx();class eN extends Xx{type="chart";chartInstance;activeChartInstance;active;cacheCanvas;constructor(t){super(t),this.numberType=tN,t.chartInstance?this.chartInstance=t.chartInstance:(t.chartInstance=this.chartInstance=new t.ClassType(t.spec,{renderCanvas:t.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:{x1:0,x2:0,y1:0,y2:0},interactive:!1,animation:!1,autoFit:!1}),this.chartInstance.renderSync())}activate(t){this.active=!0;const{x1:e,y1:i,x2:n,y2:r}=this.getViewBox(),o=t.scenegraph.tableGroup.globalAABBBounds,s=new ep;s.x1=o.x1+t.getFrozenColsWidth(),s.x2=o.x2-t.getRightFrozenColsWidth(),s.y1=o.y1+t.getFrozenRowsHeight(),s.y2=o.y2-t.getBottomFrozenRowsHeight();const a=s.intersect({x1:e-t.scrollLeft,x2:n-t.scrollLeft,y1:i-t.scrollTop,y2:r-t.scrollTop});this.activeChartInstance=new this.attribute.ClassType(this.attribute.spec,{renderCanvas:this.attribute.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:{x1:e-t.scrollLeft,x2:n-t.scrollLeft,y1:i-t.scrollTop,y2:r-t.scrollTop},animation:!1,interactive:!0,autoFit:!1,beforeRender:t=>{const e=t.window.getContext();e.inuse=!0,e.clearMatrix(),e.setTransformForCurrent(!0),e.beginPath(),e.rect(a.x1,a.y1,a.x2-a.x1,a.y2-a.y1),e.clip()},afterRender(t){t.window.getContext().inuse=!1}}),this.activeChartInstance.renderSync(),t.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance),this.activeChartInstance.on("click",(e=>{console.log("click captured",e),eN.temp&&t.scenegraph.updateChartState(e?.datum)})),this.activeChartInstance.on("brushEnd",(e=>{console.log("brushEnd captured",e),t.scenegraph.updateChartState(e?.value?.inBrushData),eN.temp=0,setTimeout((()=>{eN.temp=1}),0)})),t._bindChartEvent?.(this.activeChartInstance),console.log("active")}static temp=1;deactivate(){this.active=!1,this.activeChartInstance.release(),this.activeChartInstance=null,console.log("deactivate")}updateData(t){this.attribute.data=t}getViewBox(){const t=this.parent,e=this.attribute.cellPadding,i=this.stage.table;return{x1:Math.ceil(t.globalAABBBounds.x1+e[3]+i.scrollLeft),x2:Math.ceil(t.globalAABBBounds.x1+t.attribute.width-e[1]+i.scrollLeft),y1:Math.ceil(t.globalAABBBounds.y1+e[0]+i.scrollTop),y2:Math.ceil(t.globalAABBBounds.y1+t.attribute.height-e[2]+i.scrollTop)}}}const iN=[],nN=[];let rN=5,oN=!1;function sN(t){bu(t)&&(rN=t)}function aN(t){const{axes:e,dataId:i,data:n,spec:r}=t.attribute,{chartInstance:o}=t,s=t.getViewBox();if(e.forEach(((t,e)=>{if("linear"===t.type){o._chart._components[e]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const i=o._chart._components[e];i._spec.domain=t.domain.slice(0),i.updateScaleDomain()}})),o.updateViewBox({x1:s.x1-t.getRootNode().table.scrollLeft,x2:s.x2-t.getRootNode().table.scrollLeft,y1:s.y1-t.getRootNode().table.scrollTop,y2:s.y2-t.getRootNode().table.scrollTop},!1,!1),"string"==typeof i)o.updateDataSync(i,n??[]);else{const t=[];for(const e in i){const s=i[e],a=r.series.find((t=>t?.data?.id===e));t.push({id:e,values:s?n?.filter((t=>t.hasOwnProperty(s)))??[]:n??[],fields:a?.data?.fields}),o.updateFullDataSync||o.updateDataSync(e,s?n?.filter((t=>t.hasOwnProperty(s)))??[]:n??[])}o.updateFullDataSync?.(t)}const a=o.getStage();t.cacheCanvas=a.toCanvas()}function lN(t){oN=!0,nN.length>0?requestAnimationFrame((()=>{const e=nN.splice(0,rN);iN.splice(0,rN),e.forEach((t=>{aN(t),t.addUpdateBoundTag()})),t.render(),lN(t)})):oN=!1}const hN=Symbol.for("ChartRender");let cN=class{type;numberType=tN;drawShape(t,e,i,n,r,o,s,a){const l=Gv(t,o?.theme).group,{dataId:h,data:c,spec:u}=t.attribute;t.getViewBox();const{width:d=l.width,height:p=l.height}=t.attribute,{chartInstance:f,active:g,cacheCanvas:m,activeChartInstance:y}=t;if(!g&&m)e.drawImage(m,i,n,d,p);else if(y)if("string"==typeof h)y.updateDataSync(h,c??[]);else{const t=[];for(const e in h){const i=h[e],n=u.series.find((t=>t?.data?.id===e));t.push({id:e,values:i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[],fields:n?.data?.fields}),f.updateFullDataSync||y.updateDataSync(e,i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[])}y.updateFullDataSync?.(t)}else t.getRootNode().table.internalProps.renderChartAsync?(-1===iN.indexOf(`${t.parent.col}+${t.parent.row}`)&&(iN.push(`${t.parent.col}+${t.parent.row}`),nN.push(t)),oN||lN(t.getRootNode().table)):aN(t)}draw(t,e,i,n){const{context:r}=i;if(!r)return;const{clip:o}=t.attribute;o?r.save():r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),r.beginPath(),n.skipDraw?this.drawShape(t,r,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,r,0,0,i),o?r.restore():r.highPerformanceRestore()}};cN=Qj([Vm()],cN);let uN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{shape:p}=t.attribute;if("circle"===p){const{width:r=l.width,height:o=l.height}=t.attribute;e.beginPath(),e.arc(i+r/2,n+o/2,Math.min(r,o)/2,0,2*Math.PI),e.closePath(),e.save(),e.clip()}}};uN=Qj([Vm()],uN);let dN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{shape:p}=t.attribute;"circle"===p&&e.restore()}};function pN(t,e,i){const{highlightScope:n,disableHeader:r,cellPos:o}=t.hover;if(!t.table.isHeader(e,i)||!r){if(n===Kc.single&&o.col===e&&o.row===i)return"cellBgColor";if(n===Kc.column&&o.col===e)return"inlineColumnBgColor";if(n===Kc.row&&o.row===i)return"inlineRowBgColor";if(n===Kc.cross){if(o.col===e&&o.row===i)return"cellBgColor";if(o.col===e)return"inlineColumnBgColor";if(o.row===i)return"inlineRowBgColor"}}}dN=Qj([Vm()],dN);let fN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{stroke:p=l.stroke,strokeArrayWidth:f=l.strokeArrayWidth,strokeArrayColor:g=l.strokeArrayColor}=t.attribute;p&&(Array.isArray(f)||Array.isArray(g))&&(d.doStroke=!1)}};fN=Qj([Vm()],fN);let gN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{width:d=l.width,height:p=l.height,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:y=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;if(!f||!Array.isArray(m)&&0===y)return;let v,w;if(Array.isArray(g)||Array.isArray(m)){if("number"==typeof y&&1&y||Array.isArray(m)&&m.some((t=>1&t))){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=_N(t,Math.ceil(d),Math.ceil(p));v=e,w=r}else v=Math.ceil(d),w=Math.ceil(p);mN(t,e,i,n,l,f,m||y,g||b,v,w)}}};function mN(t,e,i,n,r,o,s,a,l,h,c,u){const d=function(t){if(!Array.isArray(t))return{isSplitDraw:!1,width:t};let e;for(let i=0;i<t.length;i++){const n=t[i];if(n)if(e){if(n!==e)return{isSplitDraw:!0}}else e=n}return{isSplitDraw:!1,width:e}}(s),p=!Array.isArray(s),f=!Array.isArray(o),g=Array.isArray(u),m=Array.isArray(a)||d.isSplitDraw;e.setStrokeStyle(t,t.attribute,i,n,r);let y=!1;e.getLineDash().length&&(y=!0),e.beginPath(),e.moveTo(i,n),(f||o[0])&&(p||s[0])?(g&&Array.isArray(u[0])?(e.moveTo(i+l*u[0][0],n),e.lineTo(i+l*(u[0][1]-u[0][0]),n),e.moveTo(i+l,n)):(e.moveTo(i,n),e.lineTo(i+l,n)),!m&&!y||a&&!a[0]||(a&&(e.strokeStyle=a[0]),p||(e.lineWidth=s[0]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+l,n))):e.moveTo(i+l,n),(f||o[1])&&(p||s[1])?(g&&Array.isArray(u[1])?(e.moveTo(i+l,n+h*u[1][0]),e.lineTo(i+l,n+h*(u[1][1]-u[1][0])),e.moveTo(i+l,n+h)):(e.moveTo(i+l,n),e.lineTo(i+l,n+h)),!m&&!y||a&&!a[1]||(a&&(e.strokeStyle=a[1]),p||(e.lineWidth=s[1]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i+l,n+h))):e.moveTo(i+l,n+h),(f||o[2])&&(p||s[2])?(g&&Array.isArray(u[2])?(e.moveTo(i+l*u[2][0],n+h),e.lineTo(i+l*(u[2][1]-u[2][0]),n+h),e.moveTo(i,n+h)):(e.moveTo(i,n+h),e.lineTo(i+l,n+h)),!m&&!y||a&&!a[2]||(a&&(e.strokeStyle=a[2]),p||(e.lineWidth=s[2]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,n+h))):e.moveTo(i,n+h),(f||o[3])&&(p||s[3])?(g&&Array.isArray(u[3])?(e.moveTo(i,n+h*u[3][0]),e.lineTo(i,n+h*(u[3][1]-u[3][0])),e.moveTo(i,n)):(e.moveTo(i,n),e.lineTo(i,n+h)),!m&&!y||a&&!a[3]||(a&&(e.strokeStyle=a[3]),p||(e.lineWidth=s[3]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n))):e.moveTo(i,n),m||y||(!p&&d.width&&(e.lineWidth=d.width),e.stroke())}gN=Qj([Vm()],gN);let yN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{lineDash:p=l.lineDash,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth}=t.attribute;f&&Array.isArray(p)&&p.length&&!Array.isArray(g)&&!Array.isArray(m)&&(d.doStroke=!1)}};yN=Qj([Vm()],yN);let bN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{lineDash:d=l.lineDash,stroke:p=l.stroke,strokeArrayColor:f=l.strokeArrayColor,strokeArrayWidth:g=l.strokeArrayWidth,lineWidth:m=l.lineWidth}=t.attribute;if(!p||!Array.isArray(d)||!d.length||Array.isArray(f)||Array.isArray(g))return;let y,b,{width:v=l.width,height:w=l.height}=t.attribute;if(v=Math.ceil(v),w=Math.ceil(w),1&m){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=_N(t,Math.ceil(v),Math.ceil(w));y=e,b=r}else y=Math.ceil(v),b=Math.ceil(w);e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),e.lineTo(i+y,n),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+y,n),e.lineTo(i+y,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n+b),e.lineTo(i+y,n+b),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,n),e.lineTo(i,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke()}};bN=Qj([Vm()],bN);let vN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{lineWidth:p=l.lineWidth,stroke:f=l.stroke,lineDash:g=l.lineDash,strokeArrayWidth:m=l.strokeArrayWidth,strokeArrayColor:y=l.strokeArrayColor}=t.attribute;f&&Array.isArray(g)&&!g.length&&!Array.isArray(y)&&!Array.isArray(m)&&1&p&&(d.doStroke=!1)}};vN=Qj([Vm()],vN);let wN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{lineWidth:d=l.lineWidth,stroke:p=l.stroke,lineDash:f=l.lineDash,strokeArrayWidth:g=l.strokeArrayWidth,strokeArrayColor:m=l.strokeArrayColor}=t.attribute,{width:y=l.width,height:b=l.height}=t.attribute;if(p&&Array.isArray(f)&&!f.length&&!Array.isArray(m)&&!Array.isArray(g)&&1&d){const{width:r,height:o}=_N(t,Math.ceil(y),Math.ceil(b));e.beginPath(),i=Math.floor(i)+.5,n=Math.floor(n)+.5,e.rect(i,n,r,o),e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()}}};wN=Qj([Vm()],wN);let CN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){if("cell"===t.role){const e=t.stage.table;if(e.stateManeger.interactionState!==Uc.scrolling){const i=function(t,e){let i,n;if("cell"===t.role&&"number"==typeof t.mergeCol&&"number"==typeof t.mergeRow)for(let n=t.col;n<=t.mergeCol;n++)for(let r=t.row;r<=t.mergeRow;r++){const t=pN(e.stateManeger,n,r);!t||i&&"cellBgColor"!==t||(i=t)}else"cell"===t.role&&(i=pN(e.stateManeger,t.col,t.row));if(!i)return;const r=e.internalProps.layoutMap;return r.isCornerHeader(t.col,t.row)?n=e.theme.cornerHeaderStyle?.hover:r.isColumnHeader(t.col,t.row)?n=e.theme.headerStyle?.hover:r.isRowHeader(t.col,t.row)?n=e.theme.rowHeaderStyle?.hover:r.isBottomFrozenRow(t.col,t.row)?n=e.theme.bottomFrozenStyle?.hover||e.theme.headerStyle?.hover:r.isRightFrozenColumn(t.col,t.row)?n=e.theme.rightFrozenStyle?.hover||e.theme.rowHeaderStyle?.hover:e.isHeader(t.col,t.row)||(n=e.theme.bodyStyle?.hover),Cj(i,n,t.col,t.row,e)}(t,e);i&&(t.oldColor=t.attribute.fill,t.attribute.fill=i)}}}};CN=Qj([Vm()],CN);let xN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){"oldColor"in t&&(t.attribute.fill=t.oldColor,delete t.oldColor)}};function _N(t,e,i){const n=t.stage.table;if("cell"===t.role){let r=t.col,o=t.row;const s=Sk(n,r,o);s&&(r=s.end.col,o=s.end.row),(n&&r===n.colCount-1||n&&r===n.frozenColCount-1&&n.scrollLeft)&&(e-=1),(n&&o===n.rowCount-1||n&&o===n.frozenRowCount-1&&n.scrollTop)&&(i-=1)}else"corner-frozen"===t.role&&(n.scrollLeft&&(e-=1),n.scrollTop&&(i-=1));return{width:e,height:i}}xN=Qj([Vm()],xN);let SN=class{time=Ry.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){const{stroke:p=l.stroke,strokeArrayWidth:f=l.strokeArrayWidth,strokeArrayColor:g=l.strokeArrayColor}=t.attribute;p&&(Array.isArray(p)||Array.isArray(f)||Array.isArray(g))&&(d.doStroke=!1)}};SN=Qj([Vm()],SN);let AN=class{time=Ry.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{width:d=l.width,height:p=l.height,stroke:f=l.stroke,strokeArrayColor:g=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:y=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;f&&(Array.isArray(m)||0!==y)&&(Array.isArray(f)||Array.isArray(g)||Array.isArray(m))&&(("number"==typeof y&&1&y||Array.isArray(m)&&m.some((t=>1&t)))&&(i=Math.floor(i)+.5,n=Math.floor(n)+.5),mN(t,e,i,n,l,f,m||y,g||b,Math.ceil(d),Math.ceil(p)))}};AN=Qj([Vm()],AN);var TN=new zm(((t,e,i,n)=>{i(KB)?n(KB).to(SN).inSingletonScope():(t(SN).toSelf().inSingletonScope(),t(E_).toService(SN)),i($B)?n($B).to(AN).inSingletonScope():(t(AN).toSelf().inSingletonScope(),t(E_).toService(AN)),t(gN).toSelf().inSingletonScope(),t(B_).toService(gN),t(fN).toSelf().inSingletonScope(),t(B_).toService(fN),t(cN).toSelf().inSingletonScope(),t(hN).to(cN),t(sB).to(cN),t(uN).toSelf().inSingletonScope(),t(M_).toService(uN),t(dN).toSelf().inSingletonScope(),t(M_).toService(dN),t(yN).toSelf().inSingletonScope(),t(B_).toService(yN),t(bN).toSelf().inSingletonScope(),t(B_).toService(bN),t(vN).toSelf().inSingletonScope(),t(B_).toService(vN),t(wN).toSelf().inSingletonScope(),t(B_).toService(wN),t(CN).toSelf().inSingletonScope(),t(B_).toService(CN),t(xN).toSelf().inSingletonScope(),t(B_).toService(xN)}));function BN(t,e,i){if(i._table.isPivotChart())if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let n=i.getIndicatorKeyInChartSpec(t,i.columnHeaderLevelCount-1)[1];if(qu(n)&&(n=n[0]),!n)return;const r=RN(t,e,"top",i),o=i.dataset.collectedValues[n+(r?"_align":"")]?i.dataset.collectedValues[n+(r?"_align":"")]:i.dataset.collectedValues[n],s=i.getRecordIndexByCol(t),a=o?o[i.getColKeysPath()[s][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]:{max:1,min:0},{axisOption:l,isPercent:h}=MN(t,e+1,"top",i);if(a.min===a.max&&(a.min>0?a.min=0:a.max=0),!1===l?.visible)return;return h&&(a.min=0,a.max=1),Qu(l?.min)&&(a.min=l.min),Qu(l?.max)&&(a.max=l.max),fd({range:a},l,{orient:"top",type:"linear",label:{flush:!0}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];qu(r)&&(r=r[0]);const o=RN(t,e,"bottom",i),s=i.dataset.collectedValues[r+(o?"_align":"")]?i.dataset.collectedValues[r+(o?"_align":"")]:i.dataset.collectedValues[r],a=i.getRecordIndexByCol(t),l=s?.[i.getColKeysPath()?.[a]?.[Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]??{min:0,max:1};l.min===l.max&&(l.min>0?l.min=0:l.max=0);let h=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(h=e)}));const{axisOption:c,isPercent:u}=MN(t,e-1,"bottom",i);if(!1===c?.visible)return;return u&&(l.min=0,l.max=1),Qu(c?.min)&&(l.min=c.min),Qu(c?.max)&&(l.max=c.max),fd({title:{visible:!0,text:h?.title},range:l},c,{orient:"bottom",type:"linear",label:{flush:!0}})}if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let n=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)?.[0];qu(n)&&(n=n[0]);const r=i.dataset.collectedValues[n]??[],o=i.getRecordIndexByRow(e),s=i.getRowKeysPath()[o],a=r[s[s.length-1]]??[],{axisOption:l,isPercent:h}=MN(t+1,e,"left",i);if(!1===l?.visible)return;return fd({domain:Array.from(a).reverse(),title:{autoRotate:!0}},l,{orient:"left",type:"band"})}}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];qu(r)&&(r=r[0]);const o=RN(t,e,"left",i),s=i.dataset.collectedValues[r+(o?"_align":"")]?i.dataset.collectedValues[r+(o?"_align":"")]:i.dataset.collectedValues[r],a=i.getRecordIndexByRow(e),l=s?.[i.getRowKeysPath()[a]?.[Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]??""]??{min:0,max:1};l.min===l.max&&(l.min>0?l.min=0:l.max=0);let h=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(h=e)}));const{axisOption:c,isPercent:u}=MN(t+1,e,"left",i);if(!1===c?.visible)return;return u&&(l.min=0,l.max=1),Qu(c?.min)&&(l.min=c.min),Qu(c?.max)&&(l.max=c.max),fd({title:{visible:!0,text:h?.title,autoRotate:!0},range:l},c,{orient:"left",type:"linear",label:{flush:!0}})}if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let n=i.getIndicatorKeyInChartSpec(i.rowHeaderLevelCount-1,e)[1];if(qu(n)&&(n=n[0]),!n)return;const r=RN(t,e,"right",i),o=i.dataset.collectedValues[n+(r?"_align":"")]?i.dataset.collectedValues[n+(r?"_align":"")]:i.dataset.collectedValues[n],s=i.getRecordIndexByRow(e),a=o?.[i.getRowKeysPath()[s]?.[Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]??""]??{min:0,max:1},{axisOption:l,isPercent:h}=MN(t-1,e,"right",i);if(a.min===a.max&&(a.min>0?a.min=0:a.max=0),!1===l?.visible)return;return h&&(a.min=0,a.max=1),Qu(l?.min)&&(a.min=l.min),Qu(l?.max)&&(a.max=l.max),fd({range:a,title:{autoRotate:!0}},l,{orient:"right",type:"linear",label:{flush:!0}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let n=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)?.[0];qu(n)&&(n=n[0]);const r=i.dataset.collectedValues[n]??[],o=i.getRecordIndexByCol(t),s=i.getColKeysPath()[o],a=r?.[s?.[s?.length-1]??""]??[],{axisOption:l,isPercent:h}=MN(t,e-1,"bottom",i);if(!1===l?.visible)return;return fd({domain:Array.from(a)},l,{orient:"bottom",type:"band"})}}}function MN(t,e,i,n){const r=n.getRawChartSpec(t,e);if(r&&qu(r.axes)){const t=r.axes.find((t=>t.orient===i));if(t)return{axisOption:t,isPercent:r.percent}}return{axisOption:n._table.pivotChartAxes.find((t=>t.orient===i)),isPercent:!1}}function RN(t,e,i,n){const r=[];"left"===i||"right"===i?r.push("left","right"):"top"!==i&&"bottom"!==i||r.push("top","bottom");const o=n.getRawChartSpec(t,e);let s;if(s=o&&qu(o.axes)?o.axes:n._table.pivotChartAxes,qu(s)){const t=[];s.forEach((e=>{r.includes(e.orient)&&t.push(e)}));for(let e=0;e<t.length;e++){const i=t[e];if(i.sync&&i.sync.zeroAlign&&i.sync.axisId&&t.find((t=>t.id===i.sync.axisId)))return!0}}return!1}function PN(t,e){const i=fd({},cO,t);let n=0;!1!==i.tick.visible&&(n=i.tick.width??4);let r=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).width)}))}else{const t=i.range,n=Math.abs(t.min)>1?Math.round(t.min):t.min,o=Math.abs(t.max)>1?Math.round(t.max):t.max;[HN(n),HN(o)].forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).width)}))}r+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:n,height:r}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize,fontWeight:i.title?.style?.fontWeight,fontFamily:i.title?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0,a=LN(Math.min(n,s),r,i.title?.style?.angle);o="left"!==t.orient&&"right"!==t.orient||!i.title.autoRotate?a.width:a.height,o+=i.title.space??4}return n+r+o+2}function EN(t,e){const i=fd({},cO,t);let n=0;!1!==i.tick.visible&&(n=i.tick.width??4);let r=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).height)}))}else{const t=i.range,n=Math.abs(t.min)>1?Math.round(t.min):t.min,o=Math.abs(t.max)>1?Math.round(t.max):t.max;[HN(n),HN(o)].forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:n,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize,fontWeight:i.label?.style?.fontWeight,fontFamily:i.label?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0;r=Math.max(r,LN(Math.min(n,s),o,i.label?.style?.angle).height)}))}r+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:n,height:r}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize,fontWeight:i.title?.style?.fontWeight,fontFamily:i.title?.style?.fontFamily}),s=i.label?.style?.maxLineWidth||1/0,a=LN(Math.min(n,s),r,i.title?.style?.angle);o="bottom"!==t.orient&&"top"!==t.orient||!i.title.autoRotate?a.height:a.width,o+=i.title.space??4}return n+r+o+2}function HN(t){return"number"!=typeof t&&(t=Number(t)),Number(t.toPrecision(1)).toString()}function LN(t,e,i=0){const n=i*Math.PI/180,r=-t/2,o=-e/2,s=t/2,a=-e/2,l=t/2,h=e/2,c=-t/2,u=e/2,d={x:r*Math.cos(n)-o*Math.sin(n),y:r*Math.sin(n)+o*Math.cos(n)},p={x:s*Math.cos(n)-a*Math.sin(n),y:s*Math.sin(n)+a*Math.cos(n)},f={x:l*Math.cos(n)-h*Math.sin(n),y:l*Math.sin(n)+h*Math.cos(n)},g={x:c*Math.cos(n)-u*Math.sin(n),y:c*Math.sin(n)+u*Math.cos(n)},m=Math.min(d.x,p.x,f.x,g.x),y=Math.max(d.x,p.x,f.x,g.x),b=Math.min(d.y,p.y,f.y,g.y);return{width:y-m,height:Math.max(d.y,p.y,f.y,g.y)-b}}function kN(t,e,i,n){"undefined"!=typeof window&&window.performance.now(),e=e??0,i=i??t.colCount-1,0===e&&i===t.colCount-1&&t._clearColRangeWidthsMap();const r=[];if(n)for(let e=0;e<t.colCount;e++)r.push(t.getColWidth(e));for(let n=e;n<=i;n++){let e;if(!t.internalProps.transpose&&"only-header"===t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode&&"showHeader"in t.internalProps.layoutMap){const i=t.internalProps.layoutMap.showHeader;t.internalProps.layoutMap.showHeader=!0,e=IN(n,0,t.internalProps.layoutMap.headerLevelCount,t,!1),t.internalProps.layoutMap.showHeader=i}else e=t.internalProps.transpose||"only-body"!==t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode?IN(n,0,t.rowCount-1,t,!1):IN(n,t.internalProps.layoutMap.getBodyRange().start.row,t.internalProps.layoutMap.getBodyRange().end.row,t,!1);t._setColContentWidth(n,e);t.getColWidth(n)!==e&&t._clearColRangeWidthsMap(n),t.setColWidth(n,e,!1,!0)}if("adaptive"===t.widthMode){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth-t.getFrozenColsWidth()-t.getRightFrozenColsWidth();let i=0;for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)i+=t.getColWidth(e);const n=e/i;for(let i=t.frozenColCount;i<t.colCount-t.rightFrozenColCount;i++){let r;r=i===t.colCount-t.rightFrozenColCount-1?e-t.getColsWidth(t.frozenColCount,t.colCount-t.rightFrozenColCount-2):Math.round(t.getColWidth(i)*n),t.setColWidth(i,r,!1,!0)}}else if(t.autoFillWidth){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0,n=0;for(let e=0;e<t.colCount;e++){const r=t.getColWidth(e);(e<t.frozenColCount||e>=t.colCount-t.rightFrozenColCount)&&(n+=r),i+=r}if(i<e&&i-n>0){const r=(e-n)/(i-n);for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)t.setColWidth(e,t.getColWidth(e)*r,!1,!0)}}if(n)for(let e=0;e<t.colCount;e++){const i=t.getColWidth(e);i!==r[e]&&t.scenegraph.updateColWidth(e,i-r[e])}}function IN(t,e,i,n,r){const o=function(t,e){const i=e.getColWidthDefined(t);if(e.internalProps._widthResizedColMap.has(t))return e.getColWidth(t);return i}(t,n);return"number"==typeof o?o:"auto"!==o&&"string"==typeof o?aj(o,n.internalProps.calcWidthContext):function(t,e,i,n,r,o){let s=0,a=1;n-i>5e3&&(a=Math.ceil((n-i)/5e3));if(o.isPivotChart()&&e>=o.rowHeaderLevelCount){if(o.internalProps.layoutMap.indicatorsAsCol)return o.defaultColWidth;{const t=o.internalProps.layoutMap.getOptimunWidthForChart(e);if(t>0)return t}}for(let r=i;r<=n;r+=a){if(o.isPivotChart()){const t=o.internalProps.layoutMap,i=BN(e,r,t);if(i){const t=PN(i,o);if("number"==typeof t){s=Math.max(t,s);continue}}else if(t.isLeftBottomCorner(e,r)||t.isRightTopCorner(e,r)||t.isRightBottomCorner(e,r))continue}const i=ON(e,r,o);if("number"==typeof i){s=Math.max(i,s);continue}const n=t;if("number"==typeof n&&"standard"===o.widthMode){s=Math.max(n,s);continue}const a=o.isHeader(e,r)?o._getHeaderLayoutMap(e,r)?.headerType:o.getBodyColumnType(e,r);if("text"!==a&&"link"!==a&&"progressbar"!==a){s=Math.max(s,o.getColWidth(e)||0);continue}let l=0;const h=o.internalProps.layoutMap;if(h.isHeader(e,r)){const t=h.getHeader(e,r);if("only-body"===t?.define?.columnWidthComputeMode)continue;t?.hierarchyLevel&&(l=(t.hierarchyLevel??0)*(h.rowHierarchyIndent??0))}else{const t=o.getBodyColumnDefine(e,r);if(t?.tree){const t=o.dataSource.getIndexKey(o.getRecordIndexByRow(e,r));l=Array.isArray(t)&&o.getHierarchyState(e,r)!==Xc.none?(t.length-1)*(h.hierarchyIndent??0):0}}const c=DN(e,r,o);s=Math.max(c+l,s)}const l=o.getMinColWidth(e),h=o.getMaxColWidth(e);if(s<l)return l;if(s>h)return h;return s}(o,t,e,i,0,n)}function ON(t,e,i){const n=i.getCustomRender(t,e),r=i.getCustomLayout(t,e);if(n||r){let o=1,s=0;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);o=n.end.col-n.start.col+1}const a={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:FN(t,e,i),table:i};if(r){const t=r(a);t.rootContainer.isRoot=!0;s=t.rootContainer.getContentSize().width??0}else if("function"==typeof n){const t=n(a);s=t?.expectedWidth??0}else s=n?.expectedWidth??0;return s/o}}function DN(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0;const a=i.getBodyColumnDefine(t,e);if("body"!==i.getCellLocation(t,e)||(!!a?.icon||!!a?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==Zc.absoluteRight&&(s+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0))}))}let l=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);l=n.end.col-n.start.col+1}const h=RW(Cj("padding",o,t,e,i)),c=h[1]+h[3],u=Cj("fontSize",o,t,e,i),d=Cj("fontFamily",o,t,e,i),p=Cj("fontWeight",o,t,e,i),f=vu(r).split("\n")||[];return f.length>=1?f.forEach((t=>{const e=i.measureText(t.slice(0,i.options.maxCharactersNumber||200),{fontSize:u,fontFamily:d,fontWeight:p}).width;n=Math.max((e+c+4+s)/l,n)})):n=Math.max((c+4+s)/l,n),!1!==i.internalProps.limitMaxAutoWidth&&(n=Math.min("number"==typeof i.internalProps.limitMaxAutoWidth?i.internalProps.limitMaxAutoWidth:450,n)),n}function FN(t,e,i){return{left:0,top:0,right:i.getColWidth(t),bottom:i.getRowHeight(e),width:i.getColWidth(t),height:i.getRowHeight(e)}}const zN=new J_({ignoreBuf:!0}),WN=new dA({width:0,height:0,textConfig:[]});function jN(t,e,i,n=!0,r){"undefined"!=typeof window&&window.performance.now();const o=[];if(r)for(let e=0;e<t.rowCount;e++)o.push(t.getRowHeight(e));if("autoHeight"===t.heightMode||"adaptive"===t.heightMode){e=e??0,i=i??t.rowCount-1,(0===e&&i===t.rowCount-1||n)&&t._clearRowRangeHeightsMap();for(let i=e;i<t.columnHeaderLevelCount;i++){const e=NN(i,0,t.colCount-1,t);t.setRowHeight(i,e)}if(i<t.columnHeaderLevelCount)return;if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol||!function(t){const{layoutMap:e}=t.internalProps,i=t.columnHeaderLevelCount;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;for(let n=0;n<t.colCount;n++){const r=e.getBody(n,i);if("function"==typeof r.style||"function"==typeof r.icon||r.define?.customRender||"function"==typeof r.define?.icon)return!1;const o=t._getCellStyle(n,i);if("function"==typeof o.padding||"function"==typeof o.fontSize||"function"==typeof o.lineHeight||!0===o.autoWrapText)return!1}return!0}(t))if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol)for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){let e;e=GN(t,n)?NN(n,0,t.rowHeaderLevelCount,t):NN(n,0,t.colCount-1,t),t.setRowHeight(n,e)}else for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){const e=NN(n,0,t.colCount-1,t);t.setRowHeight(n,e)}else{!function(t,e,i,n){for(let r=e;r<=i;r++)n.setRowHeight(r,t)}(NN(t.columnHeaderLevelCount,0,t.colCount-1,t),t.columnHeaderLevelCount,t.rowCount-1-t.bottomFrozenRowCount,t);for(let e=t.rowCount-t.bottomFrozenRowCount;e<=i;e++){const i=NN(e,0,t.colCount-1,t);t.setRowHeight(e,i)}}}if("adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight-t.getFrozenRowsHeight()-t.getBottomFrozenRowsHeight();let i=0;for(let e=t.frozenRowCount;e<t.rowCount-t.bottomFrozenRowCount;e++)i+=t.getRowHeight(e);const n=e/i;for(let i=t.frozenRowCount;i<t.rowCount-t.bottomFrozenRowCount;i++){let r;r=i===t.rowCount-t.bottomFrozenRowCount-1?e-t.getRowsHeight(t.frozenRowCount,t.rowCount-t.bottomFrozenRowCount-2):Math.round(t.getRowHeight(i)*n),t.setRowHeight(i,r,!1)}}if(r)for(let e=0;e<t.rowCount;e++){const i=t.getRowHeight(e);i!==o[e]&&t.scenegraph.updateRowHeight(e,i-o[e])}}function NN(t,e,i,n){let r=0;if(n.isPivotChart()&&t>=n.columnHeaderLevelCount&&t<n.rowCount-n.bottomFrozenRowCount){if(!n.internalProps.layoutMap.indicatorsAsCol)return n.getRowHeight(t);{const e=n.internalProps.layoutMap.getOptimunHeightForChart(t);if(e>0)return e}}for(let o=e;o<=i;o++){const e=VN(o,t,n);if("number"==typeof e){r=Math.max(e,r);continue}if(n.isPivotChart()){const e=BN(o,t,n.internalProps.layoutMap);if(e){const t=EN(e,n);if("number"==typeof t){r=Math.max(t,r);continue}}}const i=UN(o,t,n);r=Math.max(i,r)}return r}function GN(t,e){const{layoutMap:i}=t.internalProps;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;const n=i.getBody(t.rowHeaderLevelCount,e);if("function"==typeof n.style||"function"==typeof n.icon||n.define?.customRender||"function"==typeof n.define?.icon)return!1;const r=t._getCellStyle(t.rowHeaderLevelCount,e);return"function"!=typeof r.padding&&"function"!=typeof r.fontSize&&"function"!=typeof r.lineHeight&&!0!==r.autoWrapText}function VN(t,e,i){const n=i.getCustomRender(t,e),r=i.getCustomLayout(t,e);if(n||r){let o=1,s=0;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);o=n.end.col-n.start.col+1}const a={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:FN(t,e,i),table:i};if(r){const t=r(a);t.rootContainer.isRoot=!0;s=t.rootContainer.getContentSize().height??0}else if("function"==typeof n){const t=n(a);s=t?.expectedHeight??0}else s=n?.expectedHeight??0;return s/o}}function UN(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0,a=0;const l=[];let h=0;const c=[];let u=0;const d=i.getBodyColumnDefine(t,e);if("body"!==i.getCellLocation(t,e)||(!!d?.icon||!!d?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==Zc.absoluteRight&&t.positionType!==Zc.inlineFront&&t.positionType!==Zc.inlineEnd?(a+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0),s=Math.max(s,t.height??0)):t.positionType===Zc.inlineFront?(l.push(t),h=Math.max(h,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0))):t.positionType===Zc.inlineEnd&&(c.push(t),u=Math.max(u,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0)))}))}let p=1,f=t;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);p=n.end.row-n.start.row+1,t=n.start.col,f=n.end.col}const g=RW(Cj("padding",o,t,e,i)),m=Cj("fontSize",o,t,e,i),y=Cj("fontStyle",o,t,e,i),b=Cj("fontWeight",o,t,e,i),v=Cj("lineHeight",o,t,e,i)??m,w=Cj("fontFamily",o,t,e,i),C=Cj("autoWrapText",o,t,e,i),x=vu(r).split("\n")||[],_=i.getColsWidth(t,f);if(l.length||c.length){const t=Object.assign({text:r?.toString(),fontFamily:w,fontSize:m,fontStyle:y,fontWeight:b,lineHeight:v});t.textBaseline="middle";const e=[...l.map((t=>kj(t))),t,...c.map((t=>kj(t)))];WN.setAttributes({width:_-(g[1]+g[3])-a,height:0,textConfig:e}),n=WN.AABBBounds.height()}else if(C){const t=_-(g[1]+g[3])-a;zN.setAttributes({maxLineWidth:t,text:x,fontSize:m,fontStyle:y,fontWeight:b,fontFamily:w,lineHeight:v}),n=zN.AABBBounds.height()}else n=x.length*v;return(Math.max(n,s)+g[0]+g[2])/p}const KN=new bj({});KN.role="empty";const $N={},XN={};function YN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const m=Up(XN,$N)[c],y=xj("padding",f._getCellStyle(r,o),r,o,f);bu(y)&&(l=y),t||((t=new bj({x:i,y:n,width:s,height:a,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0})).role="cell",t.col=r,t.row=o,e?.addChild(t)),t.AABBBounds.width();const b=new eN({stroke:!1,x:l[3],y:l[0],canvas:f.canvas,spec:u,ClassType:m,width:s-l[3]-l[1],height:a-l[2]-l[0],chartInstance:d,dataId:p,data:f.getCellValue(r,o),cellPadding:l,axes:f.internalProps.layoutMap.getChartAxes(r,o)});return t.appendChild(b),f.internalProps.layoutMap.setChartInstance(r,o,b.chartInstance),t}function qN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const m=t._getCellStyle(r,o),y=xj("padding",m,r,o,t);bu(y)&&(h=y),g?.text?.textAlign&&(c=g?.text?.textAlign),g?.text?.textBaseline&&(u=g?.text?.textBaseline);const b="autoHeight"===t.heightMode,v="auto"===s,w=m.autoWrapText??t.internalProps.autoWrapText,C=m.lineClamp,x=new bj({x:i,y:n,width:a,height:l,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0});if(x.role="cell",x.col=r,x.row=o,e?.addChild(x),p&&x.appendChild(p),f){const e=t.getCellValue(r,o);let i;if(d&&(i=t.getCellIcons(r,o)),function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=[],g=[],m=[],y=[],b=[],v=[],w=[],C=[];let x,_=0,S=0,A=0,T=0,B=0,M=0;if(Array.isArray(e)&&0!==e.length){let R;if(e.forEach((t=>{switch(t.positionType){case Zc.left:f.push(t);break;case Zc.right:g.push(t);break;case Zc.contentLeft:m.push(t);break;case Zc.contentRight:y.push(t);break;case Zc.absoluteRight:C.push(t);break;case Zc.inlineFront:b.push(t);break;case Zc.inlineEnd:v.push(t)}})),f.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-left",i.name=e.name,i.setAttribute("x",_+(i.attribute.marginLeft??0)),_+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),S=Math.max(S,i.AABBBounds.height()),t.appendChild(i)})),g.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-right",i.name=e.name,i.setAttribute("x",A+(i.attribute.marginLeft??0)),A+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),T=Math.max(T,i.AABBBounds.height()),t.appendChild(i)})),w.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-absolute-left",i.name=e.name,i.setAttribute("x",B+(i.attribute.marginLeft??0)),B+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),C.forEach((e=>{const i=Lj(e,void 0,t.col,t.row,d);i.role="icon-absolute-right",i.name=e.name,i.setAttribute("x",M+(i.attribute.marginLeft??0)),M+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),0===b.length&&0===v.length){const t=pu(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),e={text:1!==t.length||s?t:t[0],maxLineWidth:r?1/0:l-(n[1]+n[3])-_-A,textBaseline:"top",heightLimit:o?-1:h-(n[0]+n[2]),pickable:!1,autoWrapText:s,lineClamp:a,wordBreak:"break-word"},c=new J_(p.text?Object.assign({},p.text,e):e);c.name="text",R=c}else{const e=Object.assign({text:i?.toString()},t.parent?.theme?.userTheme?.text||{});p.text&&Object.assign(e,p.text),e.textBaseline="middle";const s=[...b.map((t=>kj(t))),e,...v.map((t=>kj(t)))];s[0].textAlign=c;const a=new dA({width:r?0:l-(n[1]+n[3])-_-A,height:o?0:h-(n[0]+n[2]),textConfig:s,verticalDirection:o?"top":u});a.name="text",R=a,a.bindIconEvent()}if(0!==m.length||0!==y.length){const e=new Ej({x:0,y:0,fill:!1,stroke:!1});e.name="content",e.setCellContentOption({autoWidth:r,autoHeight:o,cellWidth:l-(n[1]+n[3])-_-A,cellHeight:h-(n[0]+n[2]),align:c,baseline:u}),m.forEach((i=>{const n=Lj(i,void 0,t.col,t.row,d);n.role="icon-content-left",n.name=i.name,e.addLeftOccupyingIcon(n)})),y.forEach((i=>{const n=Lj(i,void 0,t.col,t.row,d);n.role="icon-content-right",n.name=i.name,e.addRightOccupyingIcon(n)})),e.addContent(R),t.appendChild(e),e.layout(),x=e.AABBBounds.width(),e.AABBBounds.height()}else t.firstChild?t.insertBefore(R,t.firstChild):t.appendChild(R),x=R.AABBBounds.width(),R.AABBBounds.height()}else if(i){const e=pu(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),c=Hj(t.col,t.row,d),u={text:1!==e.length||s?e:e[0],maxLineWidth:r?1/0:l-(n[1]+n[3]+c),textBaseline:"top",autoWrapText:s,lineClamp:a,wordBreak:"break-word",heightLimit:o?-1:h-(n[0]+n[2]),pickable:!1,dx:c},f=new J_(p.text?Object.assign({},p.text,u):u);f.name="text",t.appendChild(f),x=f.AABBBounds.width(),f.AABBBounds.height()}const R=r?_+x+A:l-(n[1]+n[3]),P=h-(n[0]+n[2]);t.forEachChildren((t=>{"icon-left"===t.role?t.setAttribute("x",t.attribute.x+n[3]):"icon-right"===t.role?t.setAttribute("x",t.attribute.x+R-A+n[3]):"icon-absolute-right"===t.role?t.setAttribute("x",t.attribute.x+R-M+n[3]+n[1]):"content"!==t.name&&"text"!==t.name||("center"===c&&"richtext"!==t.type?t.setAttribute("x",n[3]+_+(R-_-A)/2):"right"===c&&"richtext"!==t.type?t.setAttribute("x",n[3]+R-A):t.setAttribute("x",n[3]+_))})),t.forEachChildren((t=>{"middle"===u?t.setAttribute("y",n[0]+(P-t.AABBBounds.height())/2):"bottom"===u?t.setAttribute("y",n[0]+P-t.AABBBounds.height()):t.setAttribute("y",n[0])})),t.setAttributes({width:R+n[1]+n[3],height:P+n[0]+n[2]})}(x,i,e,h,v,b,w,"number"==typeof C?C:void 0,a,l,c,u,t,g),g?._vtable?.marked){const t=qA({x:x.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});t.name="mark",x.appendChild(t)}}return p&&x.setAttributes({width:Math.max(x.attribute.width,p.attribute.width),height:Math.max(x.attribute.height,p.attribute.height)}),x}const ZN=yj();function JN(t,e,i){t.then((()=>{i(),e.scenegraph.updateNextFrame()})).catch((t=>{console.error(t)}))}function QN(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m){let y,b;if(i.internalProps?.dataConfig?.mappingRules&&!i.isHeader(n,r)&&i.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&i.internalProps.layoutMap.getIndicatorKey(n,r)===t.bgColor.indicatorKey&&(y=t.bgColor.mapping)})),"text"===t||"link"===t){if("link"===t){const o=i.getCellValue(n,r),s=i._getCellStyle(n,r);"link"===t&&("templateLink"in e&&e.templateLink||!("linkDetect"in e)||!e.linkDetect||_f.test(o))&&(m?(m.text.fill=Cj("linkColor",s,n,r,i),m.group.cursor="pointer"):m={text:{fill:Cj("linkColor",s,n,r,i)},group:{cursor:"pointer"}})}if(y){const t=i.getCellOriginValue(n,r),e=y(i,t);e&&(m?m.group.fill=e:m={group:{fill:e}})}let v,w,C,x=!0;if("body"!==i.getCellLocation(n,r)?(w=e?.headerCustomRender,C=e?.headerCustomLayout):(w=e?.customRender||i.customRender,C=e?.customLayout),C||w){const t=Oj(C,w,n,r,i.getColWidth(n),i.getRowHeight(r),!1,"autoHeight"===i.heightMode,i);v=t.elementsGroup,x=t.renderDefault}b=qN(i,l,0,h,n,r,o,s,a,c,u,d,p,v,x,m),f&&(b.mergeCol=g.end.col,b.mergeRow=g.end.row);const _=i.internalProps.layoutMap.getAxisConfigInPivotChart(n,r);if(_){const t=new hW(_,b.attribute.width,b.attribute.height,i);b.clear(),b.appendChild(t.component),t.overlap()}else i.internalProps.layoutMap.isEmpty(n,r)&&b.clear()}else if("image"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=xj("padding",d._getCellStyle(n,r),n,r,d);bu(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new bj({x:e,y:i,width:o,height:s,lineWidth:p?.group?.lineWidth??void 0,fill:p?.group?.fill??void 0,stroke:p?.group?.stroke??void 0,strokeArrayWidth:p?.group?.strokeArrayWidth??void 0,strokeArrayColor:p?.group?.strokeArrayColor??void 0,cursor:p?.group?.cursor??void 0,lineCap:"square",clip:!0});g.role="cell",g.col=n,g.row=r,t?.addChild(g);const m=d.getCellValue(n,r),y=rT({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[0]-h[2],image:m,cursor:"pointer"});return y.name="image",y.keepAspectRatio=a,y.successCallback=a||l?()=>{const t=y.resources.get(y.attribute.image).data;if(l&&_j(n,r,t.width,t.height,d.scenegraph,h),a){const{width:e,height:i}=vj(t.width,t.height,g.attribute.width-h[1]-h[3],g.attribute.height-h[0]-h[2]),n=wj(0,0,g.attribute.width,g.attribute.height,e,i,c,u,h);y.setAttributes({x:n.x,y:n.y,width:e,height:i})}d.scenegraph.updateNextFrame()}:()=>{Sj(g,n,r,d)},y.failCallback=()=>{const t=yj();y.image=t.damage_pic.svg},g.appendChild(y),g}(l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,c,u,d,i,m);else if("video"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=xj("padding",d._getCellStyle(n,r),n,r,d);bu(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new bj({x:e,y:i,width:o,height:s,lineWidth:p?.group?.lineWidth??void 0,fill:p?.group?.fill??void 0,stroke:p?.group?.stroke??void 0,strokeArrayWidth:p?.group?.strokeArrayWidth??void 0,strokeArrayColor:p?.group?.strokeArrayColor??void 0,cursor:p?.group?.cursor??void 0,lineCap:"square",clip:!0});g.role="cell",g.col=n,g.row=r,t?.addChild(g);const m=d.getCellValue(n,r),y=document.createElement("video");y.addEventListener("loadeddata",(()=>{l&&_j(n,r,y.videoWidth,y.videoHeight,d.scenegraph,h);const t=g.attribute.width,e=g.attribute.height;if(a){const{width:i,height:n}=vj(y.videoWidth,y.videoHeight,t-h[1]-h[3],e-h[0]-h[2]),r=wj(0,0,t,e,i,n,c,u,h);b.setAttributes({width:i,height:n,x:r.x,y:r.y})}else b.setAttributes({x:h[3],y:h[0],width:t-h[1]-h[3],height:e-h[2]-h[0]});const i=Math.floor(Math.min(t-h[1]-h[3],e-h[2]-h[0])/2),o=0+(t>b.attribute.width?b.attribute.x-0+b.attribute.width/2:t/2),s=0+(e>b.attribute.height?b.attribute.y-0+b.attribute.height/2:e/2),p=new Pj({x:o-i/2,y:s-i/2,width:i,height:i,image:ZN.play.svg,cursor:ZN.play.cursor});p.name="play-icon",g.appendChild(p),d.scenegraph.updateNextFrame()})),y.onerror=()=>{b.image=ZN.damage_pic.svg},y.src=m,y.setAttribute("preload","auto");const b=rT({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[2]-h[0],image:y,cursor:"pointer"});return b.name="image",g.appendChild(b),g}(l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,c,u,d,i,m);else if("chart"===t){const t=i.internalProps.layoutMap.getChartInstance(n,r);b=YN(null,l,0,h,n,r,i.getColWidth(n),i.getRowHeight(r),c,i.getCellValue(n,r),e.chartModule,i.isPivotChart()?i.internalProps.layoutMap.getChartSpec(n,r):e.chartSpec,t,i.internalProps.layoutMap?.getChartDataId(n,r)??"data",i,m)}else if("progressbar"===t){const t=i._getCellStyle(n,r),p=i.getCellValue(n,r),f=i.getCellOriginValue(n,r);b=qN(i,l,0,h,n,r,o,s,a,c,u,d,!1,null,!0,m);const g=Aj(e,t,o,p,f,n,r,0,i);b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g)}else"sparkline"===t&&(b=Mj(null,l,0,h,n,r,s,a,c,i,m));return b}function tG(t,e,i,n){const r=i.scenegraph.highPerformanceGetCell(t,e,!0);if(!n&&"empty"===r.role)return;const o=i.isHeader(t,e)?i._getHeaderLayoutMap(t,e).headerType:i.getBodyColumnType(t,e),s=i.getCellLocation(t,e),a="body"!==s?i.getHeaderDefine(t,e):i.getBodyColumnDefine(t,e);let l,h,c;if(("body"!==s||a?.mergeCell)&&(h=i.getCellRange(t,e),l=h.start.col!==h.end.col||h.start.row!==h.end.row),!l||t===h.start.col&&e===h.start.row){const u="body"!==s||(!!a?.icon||!!a?.tree),d=pj(i._getCellStyle(t,e),i,t,e,Cj).theme,p=d._vtable.padding,f=d._vtable.textAlign,g=d._vtable.textBaseline;let m,y,b;i.internalProps?.dataConfig?.mappingRules&&!i.isHeader(t,e)&&i.internalProps?.dataConfig?.mappingRules?.forEach(((n,r)=>{n.bgColor&&i.internalProps.layoutMap.getIndicatorKey(t,e)===n.bgColor.indicatorKey&&(m=n.bgColor.mapping)})),"body"!==s?(a?.headerCustomRender,a?.headerCustomLayout):(a?.customRender||i.customRender,a?.customLayout),h?(y=i.getColsWidth(h.start.col,h.end.col),b=i.getRowsHeight(h.start.row,h.end.row)):(y=i.getColWidth(t),b=i.getRowHeight(e));const v=i.getCellValue(t,e);Yp(v)?(r.removeAllChild(),JN(v,i,eG.bind(null,o,a,i,t,e,m,y,b,r,p,f,g,u,l,h,n,d))):c=eG(o,a,i,t,e,m,y,b,r,p,f,g,u,l,h,n,d)}else c=new bj({x:0,y:n?0:r.attribute.y,width:0,height:0,visible:!1,pickable:!1}),c.role="shadow-cell",c.col=t,c.row=e,c.mergeCol=h.start.col,c.mergeRow=h.start.row,n||(r.parent.insertAfter(c,r),r.parent.removeChild(r),tG(h.start.col,h.start.row,i,!1));return c}function eG(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,m){const y=QN(t,e,i,n,r,i.getColWidth(n),s,a,g?i.scenegraph.getColGroup(n):l.parent,g?0:l.attribute.y,h,c,u,d,p,f,m);return g||(l.parent.insertAfter(y,l),l.parent.removeChild(l),i.scenegraph?.proxy.cellCache.get(n)&&i.scenegraph?.proxy.cellCache.set(n,y)),y}function iG(t,e,i,n,r,o,s,a,l,h){let c,u,d,p=0,f=0;t.colHeight&&(f=t.colHeight);for(let g=n;g<=r;g++){const n=g,r="body"!==l?a.getHeaderDefine(e,n):a.getBodyColumnDefine(e,n),m="body"!==l||(!!r?.icon||!!r?.tree),y=pj(a._getCellStyle(e,n),a,e,n,Cj).theme;y.group.width=i,y.group.height=Array.isArray(s)?s[n]:s,y._vtable.padding&&(c=y._vtable.padding),y.text.textAlign&&(u=y.text.textAlign),y.text.textBaseline&&(d=y.text.textBaseline),"body"===l||y.group.fill||(y.group.fill="#fff");let b=i,v=a.getRowHeight(n);const w=(a.isHeader(e,n)?a._getHeaderLayoutMap(e,n).headerType:a.getBodyColumnType(e,n))||"text";let C,x,_;if(("body"!==l||r?.mergeCell)&&(x=a.getCellRange(e,n),_=x.start.col!==x.end.col||x.start.row!==x.end.row,_&&(b=0,v=0,C=o.get(`${x.start.col},${x.start.row};${x.end.col},${x.end.row}`),!C))){for(let t=x.start.col;t<=x.end.col;t++)b+=a.getColWidth(t);for(let t=x.start.row;t<=x.end.row;t++)v+=a.getRowHeight(t);o.set(`${x.start.col},${x.start.row};${x.end.col},${x.end.row}`,{x:0,y:f,cellWidth:b,cellHeight:v})}if(C){const i=C.cellHeight/(x.end.row-x.start.row+1),r=new bj({x:0,y:f,width:0,height:i,visible:!1,pickable:!1});r.role="shadow-cell",r.col=e,r.row=n,r.mergeCol=x.start.col,r.mergeRow=x.start.row,t?.addChild(r),t.updateColumnRowNumber(n),t.updateColumnHeight(i),x=a.getCellRange(e,n),f+=i,p=Math.max(p,C.cellWidth)}else{const o=a.getCellValue(e,n);if(Yp(o)){JN(o,a,QN.bind(null,w,r,a,e,n,i,b,v,t,f,c,u,d,m,_,x,y)),t.updateColumnRowNumber(n);const s=_?a.getRowHeight(n)/(x.end.row-x.start.row+1):a.getRowHeight(n);t.updateColumnHeight(s),f+=s}else{const o=QN(w,r,a,e,n,i,b,v,t,f,c,u,d,m,_,x,y);t.updateColumnRowNumber(n);const s=_?o.attribute.height/(x.end.row-x.start.row+1):o.attribute.height;t.updateColumnHeight(s),f+=s}}if(h&&n>h)break}return t.setAttribute("width",i),{width:i,height:f}}function nG(t,e,i,n,r,o,s,a,l,h){if(n>r||o>s)return;const{layoutMap:c,defaultRowHeight:u,defaultHeaderRowHeight:d,defaultColWidth:p}=l.internalProps;let f=0,g=0;for(let c=n;c<=r;c++){const n=c,r=l.getColWidth(n),p=new bj({x:e+f,y:i,width:r,height:0,clip:!1,pickable:!1});p.role="column",p.col=c,t.addChild(p);const{width:m,height:y}=iG(p,n,r,o,s,l.scenegraph.mergeMap,"columnHeader"===a?d??u:u,l,a,h);f+=m,g=Math.max(g,y)}t.setAttribute("width",f),t.setAttribute("height",g)}function rG(t,e){for(let i=0;i<e.table.colCount;i++){if(i>=e.table.rowHeaderLevelCount&&i<e.colStart||i>e.colEnd&&i<e.table.colCount-e.table.rightFrozenColCount)continue;const n=Sk(e.table,i,t);if(n&&n.start.row!==t){const r=e.highPerformanceGetCell(i,t,!0),o=tG(n.start.col,n.start.row,e.table,!0);o.col=i,o.row=t,o.setAttribute("y",e.table.getRowsHeight(e.table.columnHeaderLevelCount,n.start.row-1)),r.parent.insertAfter(o,r),r.parent.removeChild(r),r.needUpdate=!1,o.needUpdate=!1,e.cellCache.get(i)&&e.cellCache.set(i,o)}}}function oG(t,e,i){for(let n=0;n<i.table.rowCount;n++){if(n>=i.table.columnHeaderLevelCount&&n<i.rowStart||n>i.rowEnd&&n<i.table.rowCount-i.table.bottomFrozenRowCount)continue;const r=Sk(i.table,t,n);if(r&&r.start.col!==t){if(e&&sG(r.start.col,r.end.col,n,i))continue;const o=i.highPerformanceGetCell(t,n,!0),s=tG(r.start.col,r.start.row,i.table,!0);s.col=t,s.row=n,s.setAttribute("x",i.table.getColsWidth(i.table.rowHeaderLevelCount,r.start.col-1)-o.parent.attribute.x),o.parent.insertAfter(s,o),o.parent.removeChild(o),o.needUpdate=!1,s.needUpdate=!1,i.cellCache.get(t)&&i.cellCache.set(t,s)}}}function sG(t,e,i,n){for(let r=t;r<=e;r++)if("shadow-cell"!==n.highPerformanceGetCell(r,i,!0).role&&"empty"!==n.highPerformanceGetCell(r,i,!0).role)return!0;return!1}function aG(t){let e=t.firstChild;for(;"group"!==e.type;)e=e._next;return e}function lG(t){let e=t.lastChild;for(;"group"!==e.type;)e=e._prev;return e}function hG(t,e,i,n="left"){for(let r=t;r<=e;r++){const t=i.scenegraph.getColGroup(r);t&&cG(t,i,n);const e=i.scenegraph.getColGroup(r,!0);e&&cG(e,i,n);const o=i.scenegraph.getColGroupInBottom(r);o&&cG(o,i,n)}const r=Math.min(i.scenegraph.proxy.colLimit,i.scenegraph.proxy.bodyRightCol-i.scenegraph.proxy.bodyLeftCol+1),o=i.getColsWidth(i.rowHeaderLevelCount,i.rowHeaderLevelCount+r),s=i.getColsWidth(i.rowHeaderLevelCount,i.colCount-1);i.scenegraph.proxy.xLimitLeft=o/2,i.scenegraph.proxy.xLimitRight=s-o/2}function cG(t,e,i="left"){if("left"===i){let i;const n=function(t){let e=t._prev;for(;e&&"group"!==e.type;)e=e._prev;return e}(t);i=n?n.attribute.x+e.getColWidth(t._prev.col):e.getColsWidth(e.rowHeaderLevelCount,t.col-1),t.setAttribute("x",i)}else{let i;const n=function(t){let e=t._next;for(;e&&"group"!==e.type;)e=e._next;return e}(t);i=n?n.attribute.x-e.getColWidth(t.col):e.getColsWidth(e.rowHeaderLevelCount,t.col-1),t.setAttribute("x",i)}}async function uG(t,e,i,n,r){if("left"===e&&r.colEnd+t>r.bodyRightCol?t=r.bodyRightCol-r.colEnd:"right"===e&&r.colStart-t<r.bodyLeftCol&&(t=r.colStart-r.bodyLeftCol),!(t<=0))if(t<r.colEnd-r.colStart){const o="left"===e?r.colStart:r.colEnd-t+1,s="left"===e?r.colStart+t-1:r.colEnd,a="left"===e?r.colEnd+1:r.colStart-t,l="left"===e?r.colEnd+t:r.colStart-1;kN(r.table,a,l),function(t,e,i,n){for(let r=t;r<=e;r++)n.table.scenegraph.bodyGroup.childrenCount>0&&fG(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.colHeaderGroup.childrenCount>0&&fG(n.table.scenegraph.colHeaderGroup,i,n),n.table.scenegraph.bottomFrozenGroup.childrenCount>0&&fG(n.table.scenegraph.bottomFrozenGroup,i,n)}(o,s,e,r);const h=a,c=l;r.colStart="left"===e?r.colStart+t:r.colStart-t,r.colEnd="left"===e?r.colEnd+t:r.colEnd-t,oG(a,!0,r),gG(h,c,r),hG(h,c,r.table,e);const u=n-(r.table.scenegraph.getColGroup(i).attribute.x+r.table.getFrozenColsWidth()+r.table.scenegraph.proxy.deltaX);r.table.scenegraph.proxy.deltaX+=u,r.currentCol="left"===e?r.currentCol+t:r.currentCol-t,r.totalCol="left"===e?r.totalCol+t:r.totalCol-t,r.referenceCol=r.colStart+Math.floor((r.colEnd-r.colStart)/2),r.colUpdatePos=a,r.colUpdateDirection=e,r.table.scenegraph.updateNextFrame(),await r.progress()}else{const i="left"===e?r.colStart+t:r.colStart-t,n="left"===e?r.colEnd+t:r.colEnd-t;kN(r.table,i,n);!function(t,e,i,n){n.table.scenegraph.colHeaderGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))})),n.table.scenegraph.bottomFrozenGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))})),n.table.scenegraph.bodyGroup.forEachChildren(((r,o)=>{"group"===r.type&&dG(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))}))}(r.table.getColsWidth(r.bodyLeftCol,i-1),t,e,r);const o=i,s=n;r.colStart=i,r.colEnd=n,oG(i,!1,r),gG(o,s,r),hG(o,s,r.table,n>r.bodyRightCol-(r.colEnd-r.colStart+1)?"right":"left"),r.table.scenegraph.proxy.deltaX=0,r.currentCol="left"===e?r.currentCol+t:r.currentCol-t,r.totalCol="left"===e?r.totalCol+t:r.totalCol-t,r.referenceCol=r.colStart+Math.floor((r.colEnd-r.colStart)/2),r.colUpdatePos=r.colStart,r.colUpdateDirection=n>r.bodyRightCol-(r.colEnd-r.colStart+1)?"right":"left",r.table.scenegraph.updateNextFrame(),await r.progress()}}function dG(t,e,i){t.col=e,t.forEachChildren((t=>{t.col=e,t.needUpdate=!0})),t.setAttribute("x",i),t.needUpdate=!0}function pG(t,e){if(!t)return;let i=t.firstChild;for(;i;){i=e.updateCellGroupContent(i)._next}t.needUpdate=!1,t.setAttribute("width",e.table.getColWidth(t.col))}function fG(t,e,i){if("left"===e){const e=aG(t),n=lG(t);dG(e,n.col+1,n.attribute.x+i.table.getColWidth(n.col)),t.appendChild(e),t.border&&t.appendChild(t.border)}else{const e=lG(t),n=aG(t);dG(e,n.col-1,n.attribute.x-i.table.getColWidth(n.col-1)),t.insertBefore(e,t.firstChild)}}function gG(t,e,i){for(let n=t;n<=e;n++){const t=i.table.scenegraph.getColGroup(n);t&&pG(t,i);const e=i.table.scenegraph.getColGroup(n,!0);e&&pG(e,i);const r=i.table.scenegraph.getColGroupInBottom(n);r&&pG(r,i)}}function mG(t,e,i,n,r,o="up"){if("up"===o)for(let o=t;o<=e;o++)for(let t=i;t<=n;t++){const e=r.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._prev?e._prev?.attribute.y+r.getRowHeight(e._prev.row):r.getRowsHeight(r.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}else for(let o=t;o<=e;o++)for(let t=n;t>=i;t--){const e=r.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._next?e._next?.attribute.y-r.getRowHeight(e.row):r.getRowsHeight(r.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}const s=Math.min(r.scenegraph.proxy.rowLimit,r.scenegraph.proxy.bodyBottomRow-r.scenegraph.proxy.bodyTopRow+1),a=r.getRowsHeight(r.columnHeaderLevelCount,r.columnHeaderLevelCount+s),l=r.getRowsHeight(r.columnHeaderLevelCount,r.rowCount-1);r.scenegraph.proxy.yLimitTop=a/2,r.scenegraph.proxy.yLimitBottom=l-a/2}async function yG(t,e,i,n,r){if("up"===e&&r.rowEnd+t>r.bodyBottomRow?t=r.bodyBottomRow-r.rowEnd:"down"===e&&r.rowStart-t<r.bodyTopRow&&(t=r.rowStart-r.bodyTopRow),t<r.rowEnd-r.rowStart){!function(t,e,i,n){for(let r=0;r<n.table.rowHeaderLevelCount;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}for(let r=n.table.colCount-n.table.rightFrozenColCount;r<n.table.colCount;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}for(let r=n.bodyLeftCol;r<=n.bodyRightCol;r++){const o=n.table.scenegraph.getColGroup(r);for(let r=t;r<=e;r++)bG(o,i,n)}}("up"===e?r.rowStart:r.rowEnd-t+1,"up"===e?r.rowStart+t-1:r.rowEnd,e,r);const o="up"===e?r.rowEnd+1:r.rowStart-t,s="up"===e?r.rowEnd+t:r.rowStart-1;let a,l;if("autoHeight"===r.table.heightMode)a=o,l=s;else{const t=Math.max(r.bodyTopRow,i-1*r.screenRowCount),e=Math.min(r.bodyBottomRow,i+2*r.screenRowCount);a=Math.max(o,t),l=Math.min(s,e)}if(jN(r.table,a,l),r.rowStart="up"===e?r.rowStart+t:r.rowStart-t,r.rowEnd="up"===e?r.rowEnd+t:r.rowEnd-t,rG(a,r),vG(a,l,r),"autoHeight"===r.table.heightMode){mG(r.bodyLeftCol,r.bodyRightCol,a,l,r.table,e);const t=n-(r.table.scenegraph.highPerformanceGetCell(r.bodyLeftCol,i,!0).attribute.y+r.table.getFrozenRowsHeight()+r.table.scenegraph.proxy.deltaY);r.table.scenegraph.proxy.deltaY+=t}r.currentRow="up"===e?r.currentRow+t:r.currentRow-t,r.totalRow="up"===e?r.totalRow+t:r.totalRow-t,r.referenceRow=r.rowStart+Math.floor((r.rowEnd-r.rowStart)/2),r.rowUpdatePos=o,r.rowUpdateDirection=e,r.table.scenegraph.updateNextFrame(),"autoHeight"!==r.table.heightMode&&await r.progress()}else{const n="up"===e?r.rowStart+t:r.rowStart-t,o="up"===e?r.rowEnd+t:r.rowEnd-t;let s,a;!function(t,e,i,n){for(let r=0;r<n.table.rowHeaderLevelCount;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}for(let r=n.table.colCount-n.table.rightFrozenColCount;r<n.table.colCount;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}for(let r=n.bodyLeftCol;r<=n.bodyRightCol;r++){const o=n.table.scenegraph.getColGroup(r);o?.forEachChildren(((r,o)=>{n.updateCellGroupPosition(r,"up"===i?r.row+e:r.row-e,0===o?t:r._prev.attribute.y+n.table.getRowHeight(r._prev.row))}))}}(r.table.getRowsHeight(r.bodyTopRow,n-1),t,e,r),"autoHeight"===r.table.heightMode?(s=n,a=o):(s=Math.max(r.bodyTopRow,i-1*r.screenRowCount),a=Math.min(r.bodyBottomRow,i+2*r.screenRowCount)),jN(r.table,s,a),r.rowStart=n,r.rowEnd=o,rG(s,r),vG(s,a,r),"autoHeight"===r.table.heightMode&&mG(r.bodyLeftCol,r.bodyRightCol,s,a,r.table,o>r.bodyBottomRow-(r.rowEnd-r.rowStart+1)?"down":"up"),r.table.scenegraph.proxy.deltaY=0,r.currentRow="up"===e?r.currentRow+t:r.currentRow-t,r.totalRow="up"===e?r.totalRow+t:r.totalRow-t,r.referenceRow=r.rowStart+Math.floor((r.rowEnd-r.rowStart)/2),r.rowUpdatePos=r.rowStart,r.rowUpdateDirection=o>r.bodyBottomRow-(r.rowEnd-r.rowStart+1)?"down":"up",r.table.scenegraph.updateNextFrame(),"autoHeight"!==r.table.heightMode&&await r.progress()}}function bG(t,e,i){if("up"===e){const e=t.firstChild;i.updateCellGroupPosition(e,t.lastChild.row+1,t.lastChild.attribute.y+i.table.getRowHeight(t.lastChild.row)),t.appendChild(e)}else{const e=t.lastChild;i.updateCellGroupPosition(e,t.firstChild.row-1,t.firstChild.attribute.y-i.table.getRowHeight(e.row)),t.insertBefore(e,t.firstChild)}}function vG(t,e,i){for(let n=0;n<i.table.rowHeaderLevelCount;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r,!0);i.updateCellGroupContent(t)}for(let n=i.table.colCount-i.table.rightFrozenColCount;n<i.table.colCount;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r);i.updateCellGroupContent(t)}for(let n=i.bodyLeftCol;n<=i.bodyRightCol;n++)for(let r=t;r<=e;r++){const t=i.highPerformanceGetCell(n,r);i.updateCellGroupContent(t)}}class wG{table;mode="column";rowLimit=1e3;currentRow=0;totalRow;yLimitTop;yLimitBottom;rowStart=0;rowEnd=0;referenceRow=0;bodyTopRow;bodyBottomRow;screenRowCount;firstScreenRowLimit;taskRowCount;rowUpdatePos;rowUpdateDirection;screenTopRow=0;deltaY=0;colLimit=100;bodyLeftCol;bodyRightCol;totalCol;colStart;colEnd;taskColCount;xLimitLeft;xLimitRight;screenColCount;firstScreenColLimit;colUpdatePos;currentCol;referenceCol;screenLeftCol=0;colUpdateDirection;deltaX=0;cellCache=new Map;constructor(t){this.table=t,this.table.isPivotChart()?(this.rowLimit=100,this.colLimit=100):"autoHeight"===this.table.heightMode?this.rowLimit=100:"autoWidth"===this.table.widthMode&&(this.colLimit=100),this.table.internalProps.transpose?this.mode="row":this.table.isPivotTable()&&(this.mode="pivot"),this.table.options.maintainedDataCount&&(this.rowLimit=this.table.options.maintainedDataCount)}setParamsForColumn(){this.bodyLeftCol=this.table.rowHeaderLevelCount,this.bodyRightCol=this.table.colCount-1-this.table.rightFrozenColCount;const t=Math.min(this.colLimit,this.bodyRightCol-this.bodyLeftCol+1);this.totalCol=this.bodyLeftCol+t-1,this.colStart=this.bodyLeftCol;const e=this.table.defaultColWidth;this.taskColCount=1*Math.ceil(this.table.tableNoFrameWidth/e);const i=e*t,n=e*(this.bodyRightCol-this.bodyLeftCol+1);this.xLimitLeft=i/2,this.xLimitRight=n-i/2;const r=5*this.table.tableNoFrameWidth;this.screenColCount=Math.ceil(this.table.tableNoFrameWidth/e),this.firstScreenColLimit=this.bodyLeftCol+Math.ceil(r/e),this.colUpdatePos=this.bodyRightCol}setParamsForRow(){this.bodyTopRow=this.table.columnHeaderLevelCount,this.bodyBottomRow=this.table.rowCount-1-this.table.bottomFrozenRowCount;const t=Math.min(this.rowLimit,this.bodyBottomRow-this.bodyTopRow+1);this.totalRow=this.bodyTopRow+t-1,this.rowStart=this.bodyTopRow;const e=this.table.defaultRowHeight;this.taskRowCount=1*Math.ceil(this.table.tableNoFrameHeight/e);const i=e*t,n=e*(this.bodyBottomRow-this.bodyTopRow+1);this.yLimitTop=i/2,this.yLimitBottom=n-i/2;const r=5*this.table.tableNoFrameHeight;this.screenRowCount=Math.ceil(this.table.tableNoFrameHeight/e),this.firstScreenRowLimit=this.bodyTopRow+Math.ceil(r/e),this.rowUpdatePos=this.bodyBottomRow}async createGroupForFirstScreen(t,e,i,n,r,o,s,a){await async function(t,e,i,n,r,o,s,a,l){const{leftBottomCornerGroup:h,rightTopCornerGroup:c,rightBottomCornerGroup:u}=l.table.scenegraph;l.setParamsForRow(),l.setParamsForColumn(),kN(l.table,0,Math.min(l.firstScreenColLimit,l.table.colCount-1)),jN(l.table,0,Math.min(l.firstScreenRowLimit,l.table.rowCount-1)),l.table.rightFrozenColCount>0&&l.table.colCount-1>l.firstScreenColLimit&&kN(l.table,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1),l.table.bottomFrozenRowCount>0&&l.table.rowCount-1>l.firstScreenRowLimit&&kN(l.table,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1),l.table.scenegraph.colHeaderGroup.setAttribute("x",l.table.getFrozenColsWidth()),l.table.scenegraph.rowHeaderGroup.setAttribute("y",l.table.getFrozenRowsHeight()),l.table.scenegraph.bottomFrozenGroup.setAttribute("x",l.table.getFrozenColsWidth()),l.table.scenegraph.rightFrozenGroup.setAttribute("y",l.table.getFrozenRowsHeight()),l.table.scenegraph.bodyGroup.setAttributes({x:l.table.getFrozenColsWidth(),y:l.table.getFrozenRowsHeight()}),nG(t,s,a,0,l.table.rowHeaderLevelCount-1,0,l.table.columnHeaderLevelCount-1,"cornerHeader",l.table),nG(e,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),0,l.table.columnHeaderLevelCount-1,"columnHeader",l.table),nG(i,s,a,0,l.table.rowHeaderLevelCount-1,l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"rowHeader",l.table),l.table.bottomFrozenRowCount>0&&(l.table.isPivotChart()||nG(h,s,a,0,l.table.rowHeaderLevelCount-1,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"rowHeader",l.table),nG(r,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"body",l.table)),l.table.rightFrozenColCount>0&&(l.table.isPivotChart()||nG(c,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,0,l.table.columnHeaderLevelCount-1,"columnHeader",l.table),nG(n,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"body",l.table)),l.table.bottomFrozenRowCount>0&&l.table.rightFrozenColCount>0&&!l.table.isPivotChart()&&nG(u,s,a,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1,l.table.rowCount-1-l.table.bottomFrozenRowCount+1,l.table.rowCount-1,"body",l.table),nG(o,s,a,l.table.rowHeaderLevelCount,Math.min(l.firstScreenColLimit,l.table.colCount-1-l.table.rightFrozenColCount),l.table.columnHeaderLevelCount,Math.min(l.firstScreenRowLimit,l.table.rowCount-1-l.table.bottomFrozenRowCount),"body",l.table),o.firstChild?(l.currentRow=o.firstChild?.rowNumber??l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=o.lastChild?.col??l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2),await l.progress()):(l.currentRow=l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2))}(t,e,i,n,r,o,s,a,this)}async progress(){return new Promise(((t,e)=>{setTimeout((async()=>{this.colUpdatePos<this.colEnd?(await this.updateColCellGroupsAsync(),await this.progress()):this.rowUpdatePos<this.rowEnd?(await this.updateRowCellGroupsAsync(),await this.progress()):this.currentCol<this.totalCol?(await this.createCol(),await this.progress()):this.currentRow<this.totalRow&&(await this.createRow(),await this.progress()),t()}),0)}))}async createRow(){this.taskRowCount&&(console.log("createRow",this.currentRow,this.currentRow+this.taskRowCount),this.createRowCellGroup(this.taskRowCount))}async createCol(){this.taskColCount&&(console.log("createCol",this.currentCol,this.currentCol+this.taskColCount),this.createColGroup(this.taskRowCount))}createRowCellGroup(t){const e=Math.min(this.totalRow,this.currentRow+t);if(jN(this.table,this.currentRow+1,e,!1),this.table.rowHeaderLevelCount){let t=0;for(let i=0;i<this.table.rowHeaderLevelCount;i++){const n=this.table.scenegraph.getColGroup(i),r="rowHeader",{height:o}=iG(n,i,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);t=Math.max(t,o),this.table.scenegraph.rowHeaderGroup.setAttribute("height",t)}}if(this.table.rightFrozenColCount){let t=0;for(let i=this.table.colCount-this.table.rightFrozenColCount;i<this.table.colCount;i++){const n=this.table.scenegraph.getColGroup(i),r="rowHeader",{height:o}=iG(n,i,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);t=Math.max(t,o),this.table.scenegraph.rightFrozenGroup.setAttribute("height",t)}}let i=0;for(let t=this.bodyLeftCol;t<=this.bodyRightCol;t++){const n=this.table.scenegraph.getColGroup(t),r="body",{height:o}=iG(n,t,n.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,r);i=Math.max(i,o)}this.table.scenegraph.bodyGroup.setAttribute("height",i),this.currentRow=e,this.rowEnd=e,this.rowUpdatePos=this.rowEnd,this.referenceRow=this.rowStart+Math.floor((e-this.rowStart)/2),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}createColGroup(t){const e=Math.min(this.totalCol,this.currentCol+t);kN(this.table,this.currentCol+1,e);for(let t=0;t<this.table.rowCount;t++){const e=this.highPerformanceGetCell(this.currentCol,t);Qu(e.mergeCol)&&e.mergeCol>this.currentCol&&this.table.scenegraph.updateCellContent(e.col,e.row)}if(this.table.columnHeaderLevelCount){const t=this.table.scenegraph.colHeaderGroup.lastChild instanceof bj?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;nG(this.table.scenegraph.colHeaderGroup,i,n,this.currentCol+1,e,0,this.table.columnHeaderLevelCount-1,"columnHeader",this.table)}if(this.table.bottomFrozenRowCount){const t=this.table.scenegraph.bottomFrozenGroup.lastChild instanceof bj?this.table.scenegraph.bottomFrozenGroup.lastChild:this.table.scenegraph.bottomFrozenGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;nG(this.table.scenegraph.bottomFrozenGroup,i,n,this.currentCol+1,e,this.table.rowCount-this.table.bottomFrozenRowCount,this.table.rowCount-1,"columnHeader",this.table)}const i=this.table.scenegraph.bodyGroup.lastChild instanceof bj?this.table.scenegraph.bodyGroup.lastChild:this.table.scenegraph.bodyGroup.lastChild._prev,n=i.attribute.x+i.attribute.width,r=i.attribute.y;nG(this.table.scenegraph.bodyGroup,n,r,this.currentCol+1,e,this.rowStart,this.rowEnd,"body",this.table),this.currentCol=e,this.colEnd=e,this.colUpdatePos=this.colEnd,this.referenceCol=this.colStart+Math.floor((e-this.colStart)/2),console.log("async",this.referenceCol,this.colStart,this.colEnd),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}async setY(t){t<this.yLimitTop&&this.rowStart===this.bodyTopRow||t>this.yLimitBottom&&this.rowEnd===this.bodyBottomRow?this.table.scenegraph.setBodyAndRowHeaderY(-t):this.dynamicSetY(t)}async setX(t){t<this.xLimitLeft&&this.colStart===this.bodyLeftCol||t>this.xLimitRight&&this.colEnd===this.bodyRightCol?this.table.scenegraph.setBodyAndColHeaderX(-t):this.dynamicSetX(t)}async dynamicSetY(t){!async function(t,e){const i=e.table.getTargetRowAt(t+e.table.scenegraph.colHeaderGroup.attribute.height);if(!i)return;const n=i.row,r=i.top;e.screenTopRow=n;const o=n-e.referenceRow;o>0?(yG(o,"up",n,r,e),e.updateBody(t-e.deltaY)):o<0?(yG(-o,"down",n,r,e),e.updateBody(t-e.deltaY)):e.updateBody(t-e.deltaY),e.table.scenegraph.updateNextFrame()}(t,this)}async dynamicSetX(t){!async function(t,e){const i=e.table.getTargetColAt(t+e.table.scenegraph.rowHeaderGroup.attribute.width);if(!i)return;const n=i.col,r=i.left;e.screenLeftCol=n;const o=e.screenLeftCol-e.referenceCol;o>0?(uG(o,"left",e.screenLeftCol,r,e),e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX)):o<0?(uG(-o,"right",e.screenLeftCol,r,e),e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX)):e.table.scenegraph.setBodyAndColHeaderX(-t+e.deltaX),e.table.scenegraph.updateNextFrame()}(t,this)}updateBody(t){this.table.scenegraph.setBodyAndRowHeaderY(-t)}async updateRowCellGroupsAsync(){this.updateCellGroups(this.taskRowCount)}updateCellGroups(t){const e=Math.min(this.bodyBottomRow,this.rowUpdatePos+t);"autoHeight"===this.table.heightMode&&jN(this.table,this.rowUpdatePos,e,!1),vG(this.rowUpdatePos,e,this),"autoHeight"===this.table.heightMode&&mG(this.bodyLeftCol,this.bodyRightCol,this.rowUpdatePos,e,this.table,this.rowUpdateDirection),this.rowUpdatePos=e+1}async updateColCellGroupsAsync(){this.updateColGroups(this.taskRowCount)}updateColGroups(t){const e=Math.min(this.bodyRightCol,this.colUpdatePos+t);kN(this.table,this.colUpdatePos,e),gG(this.colUpdatePos,e,this),this.colUpdatePos=e+1}updateCellGroupPosition(t,e,i){t.row=e,t.setAttribute("y",i),t.needUpdate=!0,t.needUpdateForAutoRowHeight=!0}updateCellGroupContent(t){if(!t.needUpdate)return t;const e=this.table.scenegraph.updateCellContent(t.col,t.row);return t.needUpdate=!1,e||t}async sortCellVertical(){await async function(t){for(let e=t.bodyLeftCol;e<=t.bodyRightCol;e++)for(let i=t.rowStart;i<=t.rowEnd;i++)t.highPerformanceGetCell(e,i).needUpdate=!0;let e,i;"autoHeight"===t.table.heightMode?(e=t.rowStart,i=t.rowEnd):(e=Math.max(t.bodyTopRow,t.screenTopRow-1*t.screenRowCount),i=Math.min(t.bodyBottomRow,t.screenTopRow+2*t.screenRowCount)),jN(t.table,e,i),vG(e,i,t),"autoHeight"===t.table.heightMode&&mG(t.bodyLeftCol,t.bodyRightCol,e,i,t.table,t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up"),t.rowUpdatePos=t.rowStart,t.rowUpdateDirection=t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up",t.table.scenegraph.updateNextFrame(),"autoHeight"!==t.table.heightMode&&await t.progress()}(this)}async sortCellHorizontal(){await async function(t){for(let e=t.colStart;e<=t.colEnd;e++){const i=t.table.scenegraph.getColGroup(e);i.needUpdate=!0,i?.forEachChildren((t=>{t.needUpdate=!0}))}const e=Math.max(t.bodyLeftCol,t.screenLeftCol-1*t.screenColCount),i=Math.min(t.bodyRightCol,t.screenLeftCol+2*t.screenColCount);kN(t.table,e,i),gG(e,i,t),t.colUpdatePos=t.colStart,t.colUpdateDirection=t.colEnd>t.bodyRightCol-(t.colEnd-t.colStart+1)?"right":"left",t.table.scenegraph.updateNextFrame(),await t.progress()}(this)}highPerformanceGetCell(t,e,i){if(e>=this.table.columnHeaderLevelCount&&e<this.table.rowCount-this.table.bottomFrozenRowCount&&(e<this.rowStart||e>this.rowEnd))return KN;if(t>=this.table.rowHeaderLevelCount&&t<this.table.colCount-this.table.rightFrozenColCount&&(t<this.colStart||t>this.colEnd))return KN;if(this.cellCache.get(t)){const n=this.cellCache.get(t);if((n._next||n._prev)&&Math.abs(n.row-e)<e){let r=CG(n,e);return r&&(i||"shadow-cell"!==r.role)||(r=this.table.scenegraph.getCell(t,e,i)),r.row&&this.cellCache.set(t,r),r}const r=this.table.scenegraph.getCell(t,e,i);return r.col===t&&r.row&&this.cellCache.set(t,r),r}const n=this.table.scenegraph.getCell(t,e,i);return n.col===t&&n.row&&this.cellCache.set(t,n),n}}function CG(t,e){return t?t.row===e?t:t.row>e?CG(t._prev,e):CG(t._next,e):null}function xG(t,e,i){const[n,r,o,s]=e.split("-"),a=parseInt(n,10),l=parseInt(r,10),h=parseInt(o,10),c=parseInt(s,10);let u;for(let t=a;t<=h;t++)for(let e=l;e<=c;e++){const n=i.highPerformanceGetCell(t,e);if("cell"!==n.role)continue;n.AABBBounds.width();const r=n.globalAABBBounds;u?u.union(r):u=r}u?t.rect.setAttributes({x:u.x1-i.tableGroup.attribute.x,y:u.y1-i.tableGroup.attribute.y,width:u.width(),height:u.height(),visible:!0}):t.rect.setAttributes({visible:!1});const d=a===i.table.frozenColCount,p=l===i.table.frozenRowCount;d&&t.rect.attribute.stroke[3]||p&&t.rect.attribute.stroke[0]?(d&&i.tableGroup.insertAfter(t.rect,"columnHeader"===t.role?i.cornerHeaderGroup:i.rowHeaderGroup),p&&i.tableGroup.insertAfter(t.rect,"rowHeader"===t.role?i.cornerHeaderGroup:i.colHeaderGroup),t.rect.attribute.x<i.rowHeaderGroup.attribute.width&&i.table.scrollLeft>0&&("body"===t.role||"columnHeader"===t.role)&&t.rect.setAttributes({x:t.rect.attribute.x+(i.rowHeaderGroup.attribute.width-t.rect.attribute.x),width:t.rect.attribute.width-(i.rowHeaderGroup.attribute.width-t.rect.attribute.x)}),t.rect.attribute.y<i.colHeaderGroup.attribute.height&&i.table.scrollTop>0&&("body"===t.role||"rowHeader"===t.role)&&t.rect.setAttributes({y:t.rect.attribute.y+(i.colHeaderGroup.attribute.height-t.rect.attribute.y),height:t.rect.attribute.height-(i.colHeaderGroup.attribute.height-t.rect.attribute.y)})):i.tableGroup.insertAfter(t.rect,"body"===t.role?i.bodyGroup:"columnHeader"===t.role?i.colHeaderGroup:"rowHeader"===t.role?i.rowHeaderGroup:i.cornerHeaderGroup)}function _G(t,e,i){const n=i.scenegraph,r=SG(t.map((t=>t.row))).sort(((t,e)=>t-e)),o=SG(e.map((t=>t.row))).sort(((t,e)=>t-e));r.forEach((t=>{!function(t,e){for(let i=0;i<e.table.colCount;i++){const n=e.getColGroup(i,!1);let r;n.forEachChildren((e=>e.row===t&&(r=e,!0))),r&&n.removeChild(r)}}(t,n)})),r.length&&function(t){for(let e=0;e<t.table.colCount;e++){const i=t.getColGroup(e,!0),n=t.getColGroup(e,!1);let r=i.firstChild?.row;i.forEachChildren((t=>{t.row=r,r++})),r=n.firstChild?.row,n.forEachChildren((t=>{t.row=r,r++}))}}(n),o.forEach((t=>{!function(t,e){for(let i=0;i<e.table.colCount;i++){const n=tG(i,t,e.table,!0);if(!n)continue;const r=e.getColGroup(i);if(r.firstChild&&t<r.firstChild.row)r.insertBefore(n,r.firstChild);else if(r.lastChild&&t>r.lastChild.row)r.appendChild(n);else{let e;r.forEachChildren((i=>i.row===t&&(e=i,!0))),e!==n&&r.insertBefore(n,e)}let o=r.firstChild?.row;r.forEachChildren((t=>{t.row=o,o++}))}}(t,n)})),function(t){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!0),r=t.getColGroup(i,!1);let o=n.firstChild?.row,s=0;o=r.firstChild?.row,s=0,r.forEachChildren((t=>{t.row=o,o++,"cell"===t.role&&(t.setAttribute("y",s),s+=t.attribute.height)})),e=s}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}(n)}function SG(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}new Xx({});const AG=[];function TG(t){AG.forEach((e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((t=>{t.setAttributes({dy:0,dx:0})}))})),AG.length=0;const{scrollTop:e,scrollLeft:i,frozenRowCount:n,frozenColCount:r}=t,o=t.getFrozenRowsHeight(),s=t.getFrozenColsWidth(),{row:a}=t.getRowAt(e+o+1),{col:l}=t.getColAt(i+s+1),h=t.getAllRowsHeight()>t.tableNoFrameHeight?t.getRowAt(e+t.tableNoFrameHeight-1).row:t.rowCount-1,c=t.getAllColsWidth()>t.tableNoFrameWidth?t.getColAt(i+t.tableNoFrameWidth-1).col:t.colCount-1;for(let e=0;e<n;e++)for(let i=l;i<=c;i++)if(t._getCellStyle(i,e)?.textStick){MG(t.scenegraph.getCell(i,e),s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),AG.push({col:i,row:e})}if(-1!==a){for(let e=a;e<=h;e++)for(let i=0;i<r;i++)if(t._getCellStyle(i,e)?.textStick&&"tree"!==t.internalProps.layoutMap.rowHierarchyType){BG(t.scenegraph.getCell(i,e),o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),AG.push({col:i,row:e})}for(let e=a;e<=h;e++)for(let i=l;i<=c;i++)if(t._getCellStyle(i,e)?.textStick){const n=t.scenegraph.getCell(i,e);BG(n,o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),MG(n,s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),AG.push({col:i,row:e})}}}function BG(t,e,i){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const r=n.globalAABBBounds.y1,o=n.globalAABBBounds.y2;if(r<e){const i=r-e;t.forEachChildren((t=>{t.setAttribute("dy",2-i)}))}else if(o>i){const e=o-i;t.forEachChildren((t=>{t.setAttribute("dy",-e)}))}}function MG(t,e,i){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const r=n.globalAABBBounds.x1,o=n.globalAABBBounds.x2;if(r<e){const i=r-e;t.forEachChildren((t=>{t.setAttribute("dx",2-i)}))}else if(o>i){const e=o-i;t.forEachChildren((t=>{t.setAttribute("dx",-e)}))}}function RG(t){const e=t.bodyGroup.firstChild instanceof bj?t.bodyGroup.firstChild:null;e&&(t.rowHeaderGroup.appendChild(e),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width+e.attribute.width),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width-e.attribute.width))}function PG(t){const e=t.colHeaderGroup.firstChild instanceof bj?t.colHeaderGroup.firstChild:null;e&&(t.cornerHeaderGroup.appendChild(e),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width+e.attribute.width),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width-e.attribute.width))}function EG(t){const e=t.rowHeaderGroup.lastChild instanceof bj?t.rowHeaderGroup.lastChild:t.rowHeaderGroup.lastChild?._prev;e&&(IG(t.bodyGroup,e,t.bodyGroup.firstChild),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width+e.attribute.width),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width-e.attribute.width))}function HG(t){const e=t.cornerHeaderGroup.lastChild instanceof bj?t.cornerHeaderGroup.lastChild:t.cornerHeaderGroup.lastChild?._prev;e&&(IG(t.colHeaderGroup,e,t.colHeaderGroup.firstChild),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width+e.attribute.width),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width-e.attribute.width))}function LG(t){const e=t.bottomFrozenGroup.firstChild instanceof bj?t.bottomFrozenGroup.firstChild:null;e&&(t.leftBottomCornerGroup.appendChild(e),t.leftBottomCornerGroup.setAttribute("width",t.leftBottomCornerGroup.attribute.width+e.attribute.width),t.bottomFrozenGroup.setAttribute("width",t.bottomFrozenGroup.attribute.width-e.attribute.width))}function kG(t){const e=t.leftBottomCornerGroup.lastChild instanceof bj?t.leftBottomCornerGroup.lastChild:t.leftBottomCornerGroup.lastChild?._prev;e&&(IG(t.bottomFrozenGroup,e,t.bottomFrozenGroup.firstChild),t.bottomFrozenGroup.setAttribute("width",t.bottomFrozenGroup.attribute.width+e.attribute.width),t.leftBottomCornerGroup.setAttribute("width",t.leftBottomCornerGroup.attribute.width-e.attribute.width))}function IG(t,e,i){e&&t&&(i?t.insertBefore(e,i):t.appendChild(e))}function OG(t){for(let e=t.proxy.colStart;e<=t.proxy.colEnd;e++){t.getColGroup(e).getChildren().forEach((t=>{t.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null)}))}))}}function DG(t,e){t.forEachChildren((t=>{"column"===t.role&&t.forEachChildren((t=>{if("cell"===t.role){let i=!1;if(t.forEachChildren((t=>"axis"===t.name&&(i=!0,!0))),i){const i=e.internalProps.layoutMap.getAxisConfigInPivotChart(t.col,t.row),n=new hW(i,t.attribute.width,t.attribute.height,e);t.clear(),t.appendChild(n.component),n.overlap()}}}))}))}function FG(t,e){const{bgColor:i,borderColor:n,borderLineWidth:r,borderLineDash:o}=e,s={x:0,y:0,width:0,height:0,visible:!1,pickable:!0,fill:i};return s.stroke=Zj(n,void 0),s.lineWidth=r,o&&(s.lineDash=o),s.lineCap="square",Array.isArray(n)&&(s.strokeArrayColor=RW(n)),Array.isArray(r)&&(s.strokeArrayWidth=RW(r),s.lineWidth=1),t.setAttributes(s),t.role="corner-frozen",t}function zG(t,e){return new bj({x:0,y:0,width:t,height:e,clip:!1,pickable:!1})}function WG(t){let e=0;return t.forEachChildrenSkipChild(((t,i)=>{t.setAttribute("x",e),e+=t.attribute.width})),e}qb.load(Uk),qb.load(TN);const jG={visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}};class NG{proxy;tableGroup;colHeaderGroup;cornerHeaderGroup;rowHeaderGroup;bodyGroup;rightFrozenGroup;bottomFrozenGroup;rightTopCornerGroup;leftBottomCornerGroup;rightBottomCornerGroup;componentGroup;selectedRangeComponents;selectingRangeComponents;lastSelectId;component;stage;table;isPivot;transpose;hasFrozen;frozenColCount;frozenRowCount;clear;mergeMap;constructor(t){var e;this.table=t,this.hasFrozen=!1,this.clear=!0,this.mergeMap=new Map,e=jG,fd(zk.poptip,Fk,e),this.stage=function(t){return new xk(t)}({canvas:t.canvas,width:t.canvas.width,height:t.canvas.height,disableDirtyBounds:!1,background:t.theme.underlayBackgroundColor,dpr:t.internalProps.pixelRatio,pluginList:t.isPivotChart()?["poptipForText"]:void 0}),this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"},text:{ignoreBuf:!0}}),this.initSceneGraph(),this.stage.defaultLayer.add(this.tableGroup),this.stage.table=this.table,this.createComponent()}get width(){return this.tableGroup.attribute?.width??0}get height(){return this.tableGroup.attribute?.height??0}get x(){return this.tableGroup.attribute?.x??0}get y(){return this.tableGroup.attribute?.y??0}get bodyRowStart(){return this.transpose||this.isPivot?this.table.columnHeaderLevelCount:this.proxy.rowStart??0}get bodyRowEnd(){return this.transpose||this.isPivot?this.table.rowCount-1:this.proxy.rowEnd??0}initSceneGraph(){this.isPivot=this.table.isPivotTable(),this.transpose=this.table.options.transpose,function(t){const e=t.table.tableNoFrameWidth,i=t.table.tableNoFrameHeight;t.tableGroup=new bj({x:0,y:0,width:e,height:i,clip:!0,pickable:!1}),t.tableGroup.role="table";const n=zG(0,0);n.role="col-header",t.colHeaderGroup=n;const r=zG(0,0);r.role="corner-header",t.cornerHeaderGroup=r;const o=zG(0,0);o.role="row-header",t.rowHeaderGroup=o;const s=zG(e,0);s.role="body",t.bodyGroup=s;const a=zG(0,0);a.role="right-frozen",t.rightFrozenGroup=a;const l=zG(0,0);l.role="bottom-frozen",t.bottomFrozenGroup=l;const h=zG(0,0);h.role="component",t.componentGroup=h;const c=zG(0,0);c.role="corner-right-top-header",t.rightTopCornerGroup=c;const u=zG(0,0);u.role="corner-right-bottom-header",t.rightBottomCornerGroup=u;const d=zG(0,0);d.role="corner-left-bottom-header",t.leftBottomCornerGroup=d,t.table.isPivotChart()&&(FG(c,t.table.theme.cornerRightTopCellStyle||t.table.theme.cornerHeaderStyle),FG(d,t.table.theme.cornerLeftBottomCellStyle||t.table.theme.cornerHeaderStyle),FG(u,t.table.theme.cornerRightBottomCellStyle||t.table.theme.cornerHeaderStyle)),t.tableGroup.addChild(s),t.tableGroup.addChild(a),t.tableGroup.addChild(l),t.tableGroup.addChild(o),t.tableGroup.addChild(n),t.tableGroup.addChild(u),t.tableGroup.addChild(c),t.tableGroup.addChild(d),t.tableGroup.addChild(r),t.tableGroup.addChild(h)}(this)}clearCells(){this.clear=!0,this.hasFrozen=!1,this.mergeMap.clear(),this.colHeaderGroup.clear(),this.rowHeaderGroup.clear(),this.cornerHeaderGroup.clear(),this.bodyGroup.clear(),this.bottomFrozenGroup.clear(),this.rightFrozenGroup.clear(),this.rightTopCornerGroup.clear(),this.rightBottomCornerGroup.clear(),this.leftBottomCornerGroup.clear(),this.colHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rowHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.cornerHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bodyGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bottomFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightTopCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.leftBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.rightBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.tableGroup.setAttributes({x:this.table.tableX,y:this.table.tableY,width:0,height:0}),this.tableGroup.border&&(this.tableGroup.parent.removeChild(this.tableGroup.border),delete this.tableGroup.border)}createComponent(){this.component=new Xj(this.table),this.component.addToGroup(this.componentGroup),this.selectedRangeComponents=new Map,this.selectingRangeComponents=new Map}createSceneGraph(){this.clear=!1,this.frozenColCount=this.table.rowHeaderLevelCount,this.frozenRowCount=this.table.columnHeaderLevelCount,this.proxy=new wG(this.table),Yj(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0,!0),this.proxy.createGroupForFirstScreen(this.cornerHeaderGroup,this.colHeaderGroup,this.rowHeaderGroup,this.rightFrozenGroup,this.bottomFrozenGroup,this.bodyGroup,0,0),this.afterScenegraphCreated()}renderSceneGraph(){this.stage.render()}getCellOld(t,e){let i;if(i=this.hasFrozen&&t<this.table.frozenColCount&&e<this.table.frozenRowCount?this.cornerHeaderGroup.getChildAt(t)?.getChildAt(e):e<this.table.frozenRowCount?this.colHeaderGroup.getChildAt(this.hasFrozen?t-this.table.frozenColCount:t)?.getChildAt(e):t<this.table.frozenColCount?this.rowHeaderGroup.getChildAt(t)?.getChildAt(e-this.table.frozenRowCount):this.bodyGroup.getChildAt(t-this.table.frozenColCount)?.getChildAt(e-this.table.frozenRowCount),i&&"shadow-cell"===i.role){const n=this.table.getCellRange(t,e);i=this.getCell(n.start.col,n.start.row)}return i||void 0}getColGroupOld(t,e=!1){let i;return i=t<this.frozenColCount&&e?this.cornerHeaderGroup.getChildAt(t):t<this.frozenColCount?this.rowHeaderGroup.getChildAt(t):e?this.rowHeaderGroup.getChildAt(t-this.frozenColCount):this.bodyGroup.getChildAt(t-this.frozenColCount),i||void 0}getCell(t,e,i){let n;if(n=this.table.rightFrozenColCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e<this.table.frozenRowCount?this.rightBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>=this.table.rowCount-this.table.bottomFrozenRowCount&&t<this.table.frozenColCount?this.leftBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e>=this.table.rowCount-this.table.bottomFrozenRowCount?this.rightBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>this.table.rowCount-1-this.table.bottomFrozenRowCount?this.bottomFrozenGroup.getColGroup(t)?.getRowGroup(e):this.getColGroup(t,e<this.frozenRowCount)?.getRowGroup(e),n&&"shadow-cell"===n.role&&!i){const i=this.table.getCellRange(t,e);i.start.col===t&&i.start.row===e||(n=this.getCell(i.start.col,i.start.row))}return n||KN}highPerformanceGetCell(t,e,i){return this.proxy.highPerformanceGetCell(t,e,i)}getColGroup(t,e=!1){let i;return i=t<this.frozenColCount&&e?this.cornerHeaderGroup.getColGroup(t):t<this.frozenColCount?this.rowHeaderGroup.getColGroup(t):e?this.colHeaderGroup.getColGroup(t):!e&&this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t):this.bodyGroup.getColGroup(t),i||void 0}getColGroupInBottom(t){if(this.table.bottomFrozenRowCount>0)return this.bottomFrozenGroup.getColGroup(t)}getColGroupInLeftBottomCorner(t){if(this.table.bottomFrozenRowCount>0)return this.leftBottomCornerGroup.getColGroup(t)}getColGroupInRightTopCorner(t){if(this.table.rightFrozenColCount>0)return this.rightTopCornerGroup.getColGroup(t)}getColGroupInRightBottomCorner(t){if(this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0)return this.rightBottomCornerGroup.getColGroup(t)}getCellSize(t,e){const i=this.getCell(t,e),n=Sk(this.table,t,e);let r=i.attribute.width,o=i.attribute.height;return n&&(r/=n.end.col-n.start.col+1,o/=n.end.row-n.start.row+1),{width:r,height:o}}updateNextFrame(){this.resetAllSelectComponent(),this.stage.renderNextFrame()}resetAllSelectComponent(){var t;(t=this).selectingRangeComponents.forEach(((e,i)=>{xG(e,i,t)})),t.selectedRangeComponents.forEach(((e,i)=>{xG(e,i,t)}))}hideHoverIcon(t,e){if(-1===t||-1===e)return;VG(this,this.getCell(t,e),"mouseenter_cell")}showHoverIcon(t,e){if(-1===t||-1===e)return;GG(this,this.getCell(t,e),"mouseenter_cell")}hideClickIcon(t,e){if(-1===t||-1===e)return;VG(this,this.getCell(t,e),"click_cell")}showClickIcon(t,e){if(-1===t||-1===e)return;GG(this,this.getCell(t,e),"click_cell")}deactivateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.deactivate?.()}activateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.activate?.(this.table)}removeInteractionBorder(t,e){const i=this.getCell(t,e);i.setAttribute("highlightStroke",void 0),i.setAttribute("highlightStrokeArrayWidth",void 0),i.setAttribute("highlightStrokeArrayColor",void 0)}createCellSelectBorder(t,e,i,n,r,o,s){!function(t,e,i,n,r,o,s,a){const l=Math.min(e,n),h=Math.min(i,r),c=Math.max(e,n),u=Math.max(i,r);let d;for(let e=l;e<=c;e++)for(let i=h;i<=u;i++){const n=t.highPerformanceGetCell(e,i);if("shadow-cell"===n.role)continue;n.AABBBounds.width();const r=n.globalAABBBounds;d?d.union(r):d=r}const p=t.table.theme,f=p.selectionStyle?.cellBorderColor,g=p.selectionStyle?.cellBorderLineWidth,m=eT({pickable:!1,fill:p.selectionStyle?.cellBgColor??"rgba(0, 0, 255,0.1)",lineWidth:g,stroke:a.map((t=>!!t&&f)),x:d.x1-t.tableGroup.attribute.x,y:d.y1-t.tableGroup.attribute.y,width:d.width(),height:d.height(),visible:!0});t.lastSelectId=s,t.selectingRangeComponents.set(`${l}-${h}-${c}-${u}-${s}`,{rect:m,role:o}),t.tableGroup.insertAfter(m,"body"===o?t.bodyGroup:"columnHeader"===o?t.colHeaderGroup:"rowHeader"===o?t.rowHeaderGroup:t.cornerHeaderGroup)}(this,t,e,i,n,r,o,s)}moveSelectingRangeComponentsToSelectedRangeComponents(){var t;(t=this).selectingRangeComponents.forEach(((e,i)=>{t.selectedRangeComponents.get(i)&&t.selectedRangeComponents.get(i).rect.delete(),t.selectedRangeComponents.set(i,e)})),t.selectingRangeComponents=new Map,t.updateNextFrame()}deleteLastSelectedRangeComponents(){var t;(t=this).selectedRangeComponents.forEach(((e,i)=>{i.split("-")[4]===t.lastSelectId&&(e.rect.delete(),t.selectedRangeComponents.delete(i))}))}deleteAllSelectBorder(){var t;(t=this).selectedRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectedRangeComponents=new Map}updateCellSelectBorder(t,e,i,n){!function(t,e,i,n,r){let o=Math.min(n,e),s=Math.min(r,i),a=Math.max(n,e),l=Math.max(r,i);const h=()=>{let e=!1;for(let i=o;i<=a;i++){if(i===o)for(let n=s;n<=l;n++){const r=Sk(t.table,i,n);if(r&&r.start.col<o){o=r.start.col,e=!0;break}}if(!e&&i===a)for(let n=s;n<=l;n++){const r=Sk(t.table,i,n);if(r&&r.end.col>a){a=r.end.col,e=!0;break}}if(e)break}if(!e)for(let i=s;i<=l;i++){if(i===s)for(let n=o;n<=a;n++){const r=Sk(t.table,n,i);if(r&&r.start.row<s){s=r.start.row,e=!0;break}}if(!e&&i===l)for(let n=o;n<=a;n++){const r=Sk(t.table,n,i);if(r&&r.end.row>l){l=r.end.row,e=!0;break}}if(e)break}e&&h()};h(),t.selectingRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectingRangeComponents=new Map;let c=!1,u=!1,d=!1,p=!1;if(o<=t.table.frozenColCount-1&&s<=t.table.frozenRowCount-1&&(p=!0),o<=t.table.frozenColCount-1&&l>=t.table.frozenRowCount&&(c=!0),s<=t.table.frozenRowCount-1&&a>=t.table.frozenColCount&&(u=!0),a>=t.table.frozenColCount&&l>=t.table.frozenRowCount&&(d=!0),p){const e=Math.min(a,t.table.frozenColCount-1),i=Math.min(l,t.table.frozenRowCount-1),n=[!0,!u,!c,!0];t.createCellSelectBorder(o,s,e,i,"cornerHeader",`${o}${s}${a}${l}`,n)}if(u){const e=Math.max(o,t.table.frozenColCount),i=Math.min(l,t.table.frozenRowCount-1),n=[!0,!0,!d,!p];t.createCellSelectBorder(e,s,a,i,"columnHeader",`${o}${s}${a}${l}`,n)}if(c){const e=Math.max(s,t.table.frozenRowCount),i=Math.min(a,t.table.frozenColCount-1),n=[!p,!d,!0,!0];t.createCellSelectBorder(o,e,i,l,"rowHeader",`${o}${s}${a}${l}`,n)}if(d){const e=Math.max(o,t.table.frozenColCount),i=Math.max(s,t.table.frozenRowCount),n=[!u,!0,!0,!c];t.createCellSelectBorder(e,i,a,l,"body",`${o}${s}${a}${l}`,n)}}(this,t,e,i,n)}getIcon(t,e,i,n){let r;return this.getCell(t,e).forEachChildren((t=>{"icon"===t.role&&t.containsPoint(i,n,xy.GLOBAL)&&(r=t)})),r}setIconHoverStyle(t,e,i,n){if(t.attribute.backgroundColor){let e=t.parent.getChildByName("icon-back");e?e.setAttributes({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,visible:!0}):(e=eT({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,pickable:!1,visible:!0}),e.name="icon-back"),t.parent.insertBefore(e,t)}if(t.attribute.hoverImage&&t.attribute.image!==t.attribute.hoverImage&&(t.image=t.attribute.hoverImage),t.tooltip){const{x1:n,x2:r,y1:o,y2:s}=t.globalAABBBounds,a={content:t.tooltip.title,referencePosition:{rect:{left:n-this.table.tableX,right:r-this.table.tableX,top:o-this.table.tableY,bottom:s-this.table.tableY,width:t.globalAABBBounds.width(),height:t.globalAABBBounds.height()},placement:t.tooltip.placement},style:Object.assign({},this.table.internalProps.theme?.tooltipStyle,t.tooltip?.style)};this.table.internalProps.tooltipHandler.isBinded(a)||this.table.showTooltip(e,i,a)}}setIconNormalStyle(t,e,i){const n=t.parent.getChildByName("icon-back");n&&n.setAttribute("visible",!1),t.attribute.hoverImage&&t.attribute.image!==t.attribute.originImage&&(t.image=t.attribute.originImage)}updateColWidth(t,e){!function(t,e,i){const n="autoHeight"===t.table.heightMode,r=t.getColGroup(e,!0);r&&zj(r,i,n,"col-corner",t);const o=t.getColGroup(e);o&&zj(o,i,n,"row-body",t);const s=t.getColGroupInLeftBottomCorner(e);s&&zj(s,i,n,"left-bottom",t);const a=t.getColGroupInBottom(e);a&&zj(a,i,n,"bottom",t);const l=t.getColGroupInRightBottomCorner(e);l&&zj(a,i,n,"right-bottom",t),e<t.frozenColCount?(t.cornerHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.rowHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))):(t.colHeaderGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.bodyGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))),s&&t.leftBottomCornerGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),a&&t.bottomFrozenGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),l&&t.rightBottomCornerGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.table.setColWidth(e,o.attribute.width,!0)}(this,t,e),this.updateContainer()}updateChartSize(t){!function(t,e){for(let i=e;i<=t.proxy.colEnd;i++)t.getColGroup(i).getChildren().forEach((e=>{const i=t.table.getColWidth(e.col),n=t.table.getRowHeight(e.row);e.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null,t.setAttribute("width",Math.ceil(i-t.attribute.cellPadding[3]-t.attribute.cellPadding[1])),t.setAttribute("height",Math.ceil(n-t.attribute.cellPadding[0]-t.attribute.cellPadding[2])))}))}))}(this,t)}updateChartState(t){this.table.isPivotChart()&&function(t,e){const i=t.table;if(i.isPivotChart()){const n=i._selectedDataItemsInChart.length;if((null===e||0===e?.length||0===Object.keys(e).length)&&0===n)return;const r=[];if(Array.isArray(e))e.forEach((t=>{if(t&&0!==t.key&&Object.keys(t).length>0){const e={};for(const i in t)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(e[i]=t[i]);r.push(e)}}));else if(e&&0!==e.key&&Object.keys(e).length>0){const t={};for(const i in e)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(t[i]=e[i]);r.push(t)}yd(i._selectedDataItemsInChart,r)||(i._selectedDataItemsInChart=r,i.internalProps.layoutMap.updateDataStateToChartInstance(),OG(t),i.scenegraph.updateNextFrame())}}(this,t)}updateAutoColWidth(t){this.table.internalProps._widthResizedColMap.delete(t);const e=this.table.getColWidth(t),i=IN(t,0,this.table.rowCount-1,this.table);i!==e&&this.updateColWidth(t,i-e)}recalculateColWidths(){kN(this.table,0,this.table.colCount-1,!0)}recalculateRowHeights(){jN(this.table,0,this.table.rowCount-1,!0,!0)}resize(){"adaptive"===this.table.widthMode&&this.recalculateColWidths(),"adaptive"===this.table.heightMode&&this.recalculateRowHeights(),this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.updateTableSize(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),"adaptive"!==this.table.widthMode&&"adaptive"!==this.table.heightMode||this.updateChartSize(this.table.rowHeaderLevelCount),this.updateNextFrame()}updateTableSize(){this.tableGroup.setAttributes({width:Math.min(this.table.tableNoFrameWidth,Math.max(this.colHeaderGroup.attribute.width,this.bodyGroup.attribute.width,0)+Math.max(this.cornerHeaderGroup.attribute.width,this.rowHeaderGroup.attribute.width,0)+this.rightBottomCornerGroup.attribute.width),height:Math.min(this.table.tableNoFrameHeight,(this.colHeaderGroup.attribute.height??0)+(this.bodyGroup.attribute.height??0)+this.bottomFrozenGroup.attribute.height)}),this.tableGroup.border&&this.tableGroup.border.setAttributes({width:this.tableGroup.attribute.width+this.tableGroup.border.attribute.lineWidth,height:this.tableGroup.attribute.height+this.tableGroup.border.attribute.lineWidth}),this.table.bottomFrozenRowCount>0&&(this.bottomFrozenGroup.setAttribute("y",this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height),this.leftBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height,width:this.table.getFrozenColsWidth()}),this.rightBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height})),this.table.rightFrozenColCount>0&&(this.rightFrozenGroup.setAttribute("x",this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width),this.rightTopCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width,height:this.table.getFrozenRowsHeight()}),this.rightBottomCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width}))}updateRowHeight(t,e){!function(t,e,i){for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=Sk(t.table,n,e);o&&o.start.col!==n||(Fj(t,r,n,e,r.attribute.height,i,t.table.isHeader(n,e)),t.updateCellContentWhileResize(n,e))}let n=0,r=0;e<t.table.columnHeaderLevelCount?(t.colHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height+i),t.rowHeaderGroup.setAttribute("y",t.colHeaderGroup.attribute.y+i),t.bodyGroup.setAttribute("y",t.bodyGroup.attribute.y+i),n=e+1,r=t.table.columnHeaderLevelCount-1):(n=e+1,r=t.bodyRowEnd-t.table.bottomFrozenRowCount);for(let e=n;e<=r;e++)for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=Sk(t.table,n,e);(!o||o.start.col===n&&o.start.row===e)&&r.setAttribute("y",r.attribute.y+i)}t.table.setRowHeight(e,t.table.getRowHeight(e)+i,!0)}(this,t,e),this.updateContainerHeight(t,e)}updateContainerWidth(t,e){t<this.frozenColCount?(this.rowHeaderGroup.setDeltaWidth(e),this.cornerHeaderGroup.setDeltaWidth(e),this.colHeaderGroup.setDeltaX(e),this.bodyGroup.setDeltaX(e)):(this.colHeaderGroup.setDeltaWidth(e),this.bodyGroup.setDeltaWidth(e)),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}updateContainerHeight(t,e){t<this.table.frozenRowCount?(this.colHeaderGroup.setDeltaHeight(e),this.cornerHeaderGroup.setDeltaHeight(e),this.rowHeaderGroup.setDeltaY(e),this.bodyGroup.setDeltaY(e)):t>=this.table.rowCount-this.table.bottomFrozenRowCount?(this.leftBottomCornerGroup.setDeltaHeight(e),this.bottomFrozenGroup.setDeltaHeight(e),this.rightBottomCornerGroup.setDeltaHeight(e)):(this.rowHeaderGroup.setDeltaHeight(e),this.bodyGroup.setDeltaHeight(e)),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}setColWidth(t,e){const i=this.table.getColWidth(t);i!==e&&(this.updateColWidth(t,e-i),this.table._clearColRangeWidthsMap(t))}setRowHeight(t,e){const i=this.table.getRowHeight(t);i!==e&&(this.updateRowHeight(t,e-i),this.table._clearRowRangeHeightsMap(t))}setX(t){this.table.scenegraph.proxy.setX(-t)}setY(t){this.table.scenegraph.proxy.setY(-t)}setBodyAndRowHeaderY(t){this.colHeaderGroup.attribute.height+t!==this.bodyGroup.attribute.y&&(this.bodyGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.table.rightFrozenColCount>0&&this.rightFrozenGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.updateNextFrame())}setBodyAndColHeaderX(t){this.rowHeaderGroup.attribute.width+t!==this.bodyGroup.attribute.x&&(this.bodyGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.colHeaderGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.table.bottomFrozenRowCount>0&&this.bottomFrozenGroup.setAttribute("x",this.rowHeaderGroup.attribute.width+t),this.updateNextFrame())}afterScenegraphCreated(){this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.createFrameBorder(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),TG(this.table),this.updateNextFrame()}dealWidthMode(){const t=this.table;if("adaptive"===t.widthMode){const e=t.tableNoFrameWidth-t.getFrozenColsWidth()-t.getRightFrozenColsWidth();let i=0;for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)i+=t.getColWidth(e);const n=e/i;for(let i=t.frozenColCount;i<t.colCount-t.rightFrozenColCount;i++){let r;r=i===t.colCount-t.rightFrozenColCount-1?e-t.getColsWidth(t.frozenColCount,t.colCount-t.rightFrozenColCount-2):Math.round(t.getColWidth(i)*n),this.setColWidth(i,r)}}else if(t.autoFillWidth){const e=t.tableNoFrameWidth;let i=0,n=0;for(let e=0;e<t.colCount;e++){const r=t.getColWidth(e);(e<t.frozenColCount||e>=t.colCount-t.rightFrozenColCount)&&(n+=r),i+=r}if(i<e&&i-n>0){const r=(e-n)/(i-n);for(let e=t.frozenColCount;e<t.colCount-t.rightFrozenColCount;e++)this.setColWidth(e,t.getColWidth(e)*r)}}let e=0;this.bodyGroup.forEachChildrenSkipChild((t=>{e+=t.attribute.width})),this.bodyGroup.setAttribute("width",e);let i=0;this.colHeaderGroup.forEachChildrenSkipChild((t=>{i+=t.attribute.width})),this.colHeaderGroup.setAttribute("width",i);let n=0;this.rowHeaderGroup.forEachChildrenSkipChild((t=>{n+=t.attribute.width})),this.rowHeaderGroup.setAttribute("width",n);let r=0;this.cornerHeaderGroup.forEachChildrenSkipChild((t=>{r+=t.attribute.width})),this.cornerHeaderGroup.setAttribute("width",r),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height),this.bodyGroup.setAttributes({x:this.rowHeaderGroup.attribute.width,y:this.colHeaderGroup.attribute.height})}dealHeightMode(){const t=this.table;if("adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight-t.getFrozenRowsHeight()-t.getBottomFrozenRowsHeight();let i=0;for(let e=t.frozenRowCount;e<t.rowCount-t.bottomFrozenRowCount;e++)i+=t.getRowHeight(e);const n=e/i;for(let i=t.frozenRowCount;i<t.rowCount-t.bottomFrozenRowCount;i++){let r;r=i===t.rowCount-t.bottomFrozenRowCount-1?e-t.getRowsHeight(t.frozenRowCount,t.rowCount-t.bottomFrozenRowCount-2):Math.round(t.getRowHeight(i)*n),this.setRowHeight(i,r)}}}dealFrozen(){!function(t){if(t.table.frozenColCount>t.table.rowHeaderLevelCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.frozenColCount-t.table.rowHeaderLevelCount;e++)RG(t),PG(t),LG(t)}else if(t.table.frozenColCount<t.table.rowHeaderLevelCount)for(let e=0;e<t.table.rowHeaderLevelCount-t.table.frozenColCount;e++)EG(t),HG(t),kG(t);t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0,t.frozenColCount=t.table.frozenColCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0}(this)}resetFrozen(){!function(t){if(t.frozenColCount>t.table.rowHeaderLevelCount)for(let e=0;e<t.frozenColCount-t.table.rowHeaderLevelCount;e++)EG(t),HG(t),kG(t);else if(t.frozenColCount<t.table.rowHeaderLevelCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.rowHeaderLevelCount-t.frozenColCount;e++)RG(t),PG(t),LG(t)}t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0,t.frozenColCount=t.table.rowHeaderLevelCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0}(this)}updateCellLayoutWidthCertainWidth(t,e,i){const n=t.attribute.width;let r=!1;return t.forEachChildren(((t,o)=>{o+=e;const s=Sk(this.table,i,o);s?t=this.getCell(s.start.col,s.start.row):t.setAttribute("width",n);const a=RW(Cj("padding",this.table._getCellStyle(i,o),i,o,this.table)),l=t.getChildByName("text");let h=0,c=0;if(l)h=l.AABBBounds.height()+(a[0]+a[2]),l.setAttribute("maxLineWidth",n-(a[1]+a[3])),c=l.AABBBounds.height()+(a[0]+a[2]);else{const e=t.getChildAt(1);h=e.AABBBounds.height()+(a[0]+a[2]),e._cellWidth=n-(a[1]+a[3]),e.layout(),c=e.AABBBounds.height()+(a[0]+a[2])}const u=this.table.getRowHeight(o);t.attribute.height!==c&&(t.setAttribute("height",c),(u===h||c>u)&&(r=!0))})),r}updateHeaderPosition(t,e,i,n){!function(t,e,i,n,r){const o=r.scenegraph,s=r.getCellLocation(i,n),a="columnHeader"===s?"column":"rowHeader"===s?"row":void 0;let l=0,h=0,c=0,u=0,d=0,p=0,f=0,g=0;if("column"===a){const o=Sk(r,t,e),s=Sk(r,i,n);o&&s?(l=o.start.col,c=o.end.col,d=s.start.col,f=s.end.col):(l=t,c=t,d=i,f=i),h=e,u=r.rowCount-1,p=n,g=r.rowCount-1}else if("row"===a){const o=Sk(r,t,e),s=Sk(r,i,n);o&&s?(h=o.start.row,u=o.end.row,p=s.start.row,g=s.end.row):(h=e,u=e,p=n,g=n),l=t,c=r.colCount-1,d=i,f=r.colCount-1}const m=Math.min(l,d),y=Math.max(c,f),b=Math.min(h,p),v=Math.max(u,g);for(let t=m;t<=y;t++){const e=r.scenegraph.getColGroup(t,!0),i=r.scenegraph.getColGroup(t);e&&e.setAttribute("width",r.getColWidth(t)),i&&i.setAttribute("width",r.getColWidth(t))}o.updateContainer();for(let t=m;t<=y;t++){const e=r.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=b;e<=v;e++)o.updateCellContent(t,e)}}(t,e,i,n,this.table)}updateContainer(){const t=WG(this.cornerHeaderGroup),e=WG(this.rowHeaderGroup),i=WG(this.colHeaderGroup),n=WG(this.bodyGroup),r=WG(this.rightFrozenGroup);WG(this.bottomFrozenGroup),WG(this.leftBottomCornerGroup),WG(this.rightTopCornerGroup),WG(this.rightBottomCornerGroup),this.cornerHeaderGroup.setDeltaWidth(t-this.cornerHeaderGroup.attribute.width),this.leftBottomCornerGroup.setDeltaWidth(t-this.leftBottomCornerGroup.attribute.width),this.colHeaderGroup.setDeltaWidth(i-this.colHeaderGroup.attribute.width),this.rightFrozenGroup.setDeltaWidth(i-this.rightFrozenGroup.attribute.width),this.rowHeaderGroup.setDeltaWidth(e-this.rowHeaderGroup.attribute.width),this.bottomFrozenGroup.setDeltaWidth(e-this.bottomFrozenGroup.attribute.width),this.rightFrozenGroup.setDeltaWidth(r-this.rightFrozenGroup.attribute.width),this.rightTopCornerGroup.setDeltaWidth(r-this.rightTopCornerGroup.attribute.width),this.rightBottomCornerGroup.setDeltaWidth(r-this.rightBottomCornerGroup.attribute.width),this.bodyGroup.setDeltaWidth(n-this.bodyGroup.attribute.width),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.bottomFrozenGroup.setAttribute("x",this.rowHeaderGroup.attribute.width),this.bodyGroup.setAttribute("x",this.rowHeaderGroup.attribute.width),this.updateTableSize();const o=this.table.stateManeger.scroll.horizontalBarPos,s=this.table.stateManeger.scroll.verticalBarPos;this.component.updateScrollBar(),this.table.stateManeger.setScrollLeft(o),this.table.stateManeger.setScrollTop(s),this.updateNextFrame()}updateCellContentWhileResize(t,e){const i=this.table.getBodyColumnType(t,e),n=this.getCell(t,e);"image"!==i&&"video"!==i||Sj(n,t,e,this.table)}createFrameBorder(){this.updateTableSize();const t=!this.isPivot;Yj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,this.bodyGroup.role,t?[!0,!0,!0,!1]:void 0),Yj(this.rowHeaderGroup,this.isPivot?this.table.theme.rowHeaderStyle.frameStyle:this.table.theme.bodyStyle.frameStyle,this.rowHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),Yj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,this.colHeaderGroup.role,t?[!0,!0,!0,!1]:void 0),Yj(this.cornerHeaderGroup,this.isPivot?this.table.theme.cornerHeaderStyle.frameStyle:this.table.theme.headerStyle.frameStyle,this.cornerHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),Yj(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0)}getResizeColAt(t,e,i,n=8){if(i){let e;if(t<i.globalAABBBounds.x1+n?e={col:i.col-1,row:i.row,x:i.globalAABBBounds.x1}:i.globalAABBBounds.x2-n<t&&(e={col:i.col,row:i.row,x:i.globalAABBBounds.x2}),e&&this.table.rightFrozenColCount>0&&e.col===this.table.colCount-this.table.rightFrozenColCount-1&&this.table.tableNoFrameWidth-this.table.getFrozenColsWidth()-this.table.getRightFrozenColsWidth()+this.table.scrollLeft<this.bodyGroup.attribute.width&&(e.col=e.col+1,e.rightFrozen=!0),e)return e}else;return{col:-1,row:-1}}updateIcon(t,e){Lj(e,t),t.name=e.name,this.updateNextFrame()}updateFrozen(){this.clear||(this.resetFrozen(),this.dealFrozen(),this.component.updateScrollBar())}dealWidthRightFrozen(t){this.clear?this.table.internalProps.rightFrozenColCount=t:function(t,e){const{table:i,proxy:n,rightTopCornerGroup:r,rightFrozenGroup:o,rightBottomCornerGroup:s,bottomFrozenGroup:a,bodyGroup:l,colHeaderGroup:h}=e,c=e.table.rightFrozenColCount;if(t>c){for(let n=i.colCount-c-1;n>=i.colCount-t;n--)IG(o,e.getColGroup(n),o.firstChild),IG(r,e.getColGroup(n,!0),r.firstChild),IG(s,e.getColGroupInBottom(n),s.firstChild);let n=0;o.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,r.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,s.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width}))}else if(t<c){for(let n=i.colCount-c;n<i.colCount-t;n++){const t=e.getColGroup(n);t.setAttribute("x",l.lastChild.attribute.x+i.getColWidth(l.lastChild.col)),l.appendChild(t);const r=e.getColGroupInRightTopCorner(n);r.setAttribute("x",h.lastChild.attribute.x+i.getColWidth(h.lastChild.col)),h.appendChild(r);const o=e.getColGroupInRightBottomCorner(n);o.setAttribute("x",a.lastChild.attribute.x+i.getColWidth(a.lastChild.col)),a.appendChild(o)}let n=0;o.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,r.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width})),n=0,s.forEachChildren((t=>{t.setAttribute("x",n),n+=t.attribute.width}))}o.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),r.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),s.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),i.internalProps.rightFrozenColCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}dealWidthBottomFrozen(t){this.clear?this.table.internalProps.bottomFrozenRowCount=t:function(t,e){const{table:i,proxy:n,bottomFrozenGroup:r,leftBottomCornerGroup:o,rightBottomCornerGroup:s}=e;r.childrenCount||(n.table.isPivotChart()||(nG(o,0,0,0,i.rowHeaderLevelCount-1,0,-1,"rowHeader",i),nG(s,0,0,i.colCount-i.rightFrozenColCount,i.colCount-1,0,-1,"body",i)),nG(r,0,0,n.colStart,n.colEnd,0,-1,"body",i));const a=e.table.bottomFrozenRowCount;if(t>a){for(let n=0;n<i.rowHeaderLevelCount;n++){const r=e.getColGroupInLeftBottomCorner(n);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)IG(r,e.getCell(n,o,!0),r.firstChild);let o=0;r.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}for(let r=n.colStart;r<=n.colEnd;r++){const n=e.getColGroupInBottom(r);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)IG(n,e.getCell(r,o,!0),n.firstChild);let o=0;n.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let n=i.colCount-i.rightFrozenColCount;n<i.colCount;n++){const r=e.getColGroupInRightBottomCorner(n);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)IG(r,e.getCell(n,o,!0),r.firstChild);let o=0;r.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}}else if(t<a){for(let n=0;n<i.rowHeaderLevelCount;n++){const r=e.getColGroup(n);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(n,o,!0);t.setAttribute("y",r.lastChild.attribute.y+i.getRowHeight(r.lastChild.row)),r.appendChild(t)}const o=e.getColGroupInLeftBottomCorner(n);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}for(let r=n.colStart;r<=n.colEnd;r++){const n=e.getColGroup(r);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(r,o,!0);t.setAttribute("y",n.lastChild.attribute.y+i.getRowHeight(n.lastChild.row)),n.appendChild(t)}const o=e.getColGroupInBottom(r);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let n=i.colCount-i.rightFrozenColCount;n<i.colCount;n++){const r=e.getColGroup(n);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(n,o,!0);t.setAttribute("y",r.lastChild.attribute.y+i.getRowHeight(r.lastChild.row)),r.appendChild(t)}const o=e.getColGroupInRightBottomCorner(n);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}}r.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),o.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),s.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),i.internalProps.bottomFrozenRowCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}updateBorderSizeAndPosition(){this.bodyGroup.border&&(this.bodyGroup.appendChild(this.bodyGroup.border),Jj(this.bodyGroup),0===this.rowHeaderGroup.attribute.width?qj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!0]):qj(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!1])),this.colHeaderGroup.border&&(this.colHeaderGroup.appendChild(this.colHeaderGroup.border),Jj(this.colHeaderGroup),0===this.cornerHeaderGroup.attribute.width?qj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!0]):qj(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!1])),this.rowHeaderGroup.border&&(this.rowHeaderGroup.appendChild(this.rowHeaderGroup.border),Jj(this.rowHeaderGroup)),this.cornerHeaderGroup.border&&(this.cornerHeaderGroup.appendChild(this.cornerHeaderGroup.border),Jj(this.cornerHeaderGroup))}updateSortIcon(t,e,i,n,r,o,s){const a=this.table.internalProps.headerHelper.getSortIcon(n,this.table,t,e);if(i&&this.updateIcon(i,a),s!==i){const t=this.table.internalProps.headerHelper.getSortIcon("normal",this.table,r,o);if(s)this.updateIcon(s,t);else{let e;this.getCell(r,o).forEachChildren((t=>"sort"===t.attribute.funcType&&(e=t,!0))),e&&this.updateIcon(e,t)}}}updateFrozenIcon(t,e){const i=Math.max(t,e);this.colHeaderGroup.forEachChildrenSkipChild((t=>!(t.col<=i)||(t.forEachChildren((t=>{t.forEachChildren((e=>{if("frozen"===e.attribute.funcType){const i=this.table.internalProps.headerHelper.getFrozenIcon(t.col,t.row);return this.updateIcon(e,i),!0}return!1}))})),!1))),this.cornerHeaderGroup.forEachChildrenSkipChild((t=>!(t.col<=i)||(t.forEachChildren((t=>{t.forEachChildren((e=>{if("frozen"===e.attribute.funcType){const i=this.table.internalProps.headerHelper.getFrozenIcon(t.col,t.row);return this.updateIcon(e,i),!0}return!1}))})),!1)))}sortCell(){this.isPivot||(this.transpose?this.proxy.sortCellHorizontal():this.proxy.sortCellVertical())}getCellOverflowText(t,e){const i=this.getCell(t,e).getChildByName("text",!0);if(i){const t=qu(i.attribute.text)?i.attribute.text.join(""):i.attribute.text;let e="";if(Yu(i.cache.clipedText)?e=i.cache.clipedText:i.cache.layoutData.lines.forEach((t=>{e+=t.str})),e!==t)return t}return null}updateDrill(t,e,i,n,r){this.component.drillIcon.update(t,e,i,n,r,this)}updateCellContent(t,e){if(!this.clear)return tG(t,e,this.table)}setPixelRatio(t){this.stage.disableDirtyBounds(),this.stage.window.setDpr(t),this.stage.render(),this.stage.enableDirtyBounds()}updateHierarchyIcon(t,e){const i=this.getCell(t,e);let n;n=this.table.isHeader(t,e)?this.table.internalProps.headerHelper.getHierarchyIcon(i.col,i.row):this.table.internalProps.bodyHelper.getHierarchyIcon(i.col,i.row),this.findAndUpdateIcon(i,[Jc.collapse,Jc.expand],n)}updateRow(t,e){_G(t,e,this.table),this.recalculateColWidths(),this.recalculateRowHeights(),this.table.stateManeger.checkFrozen(),this.updateNextFrame()}findAndUpdateIcon(t,e,i){t.forEachChildren((t=>{if("group"===t.type)this.findAndUpdateIcon(t,e,i);else if(-1!==e.indexOf(t.attribute.funcType))return this.updateIcon(t,i),!0;return!1}))}}function GG(t,e,i){e.forEachChildren((e=>{"group"===e.type?GG(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!0,t.updateNextFrame())}))}function VG(t,e,i){e.forEachChildren((e=>{"group"===e.type?VG(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!1,t.updateNextFrame())}))}function UG(t,e,i){const n=t.getCell(e,i);if("shadow-cell"===n.role){t.getCell(n.mergeCol,n.mergeRow).addUpdateBoundTag()}else n.addUpdateBoundTag()}function KG(t,e,i,n,r){const o=t.table;for(let i=0;i<o.columnHeaderLevelCount;i++)UG(t,e,i);const s=t.getColGroup(e);return s?.addUpdateBoundTag(),!0}function $G(t,e,i,n,r,o){const s=t.table;for(let i=0;i<s.columnHeaderLevelCount;i++)UG(t,e,i);const a=t.getColGroup(e);return a?.addUpdateBoundTag(),!0}function XG(t,e,i,n,r){const o=t.table;for(let e=0;e<o.colCount;e++)UG(t,e,i);return!0}function YG(t,e,i,n,r,o){const s=t.table;for(let e=0;e<s.colCount;e++)UG(t,e,i);return!0}function qG(t,e,i){const{table:n}=t,{scenegraph:r}=n,{highlightScope:o,singleStyle:s,disableHeader:a,cellPos:l,cellPosContainHeader:h}=t.hover,c=l.col,u=l.row;if(o===Kc.none||a&&(h.col!==e||h.row!==i)){const t=h.col,n=h.row;r.hideHoverIcon(t,n),r.showHoverIcon(e,i),h.col=e,h.row=i}if((a&&n.isHeader(e,i)||o===Kc.none)&&(e=-1,i=-1),c===e&&u===i)return;r.deactivateChart(c,u),r.activateChart(e,i);let d=!1;const{ranges:p,highlightScope:f}=t.select;if(-1!==c&&-1!==u&&(d=function(t,e,i,n,r,o,s){let a=!1;o===Kc.single?a=!!function(t,e,i,n,r){return UG(t,e,i),!0}(t,e,i)||a:o===Kc.row?a=!!XG(t,0,i)||a:o===Kc.column?a=!!KG(t,e)||a:o===Kc.cross&&(a=!!XG(t,0,i)||a,a=!!KG(t,e)||a);return a}(r,c,u,0,0,o),a||r.hideHoverIcon(c,u)),-1===e||-1===i)return l.col=-1,l.row=-1,void(!d||c===e&&u===i||t.table.scenegraph.updateNextFrame());o===Kc.single?d=!!function(t,e,i,n,r){return UG(t,e,i),!0}(r,e,i)||d:o===Kc.row?d=!!YG(r,0,i)||d:o===Kc.column?d=!!$G(r,e)||d:o===Kc.cross&&(d=!!YG(r,0,i)||d,d=!!$G(r,e)||d),o===Kc.none||a||r.showHoverIcon(e,i),l.col=e,l.row=i,d&&t.table.scenegraph.updateNextFrame()}function ZG(t,e,i){let n,r=null,o=!1;if(Array.isArray(i.sortState))for(let s=0;s<i.sortState.length&&(n=i.sortState[s],n&&(r=i._getHeaderCellBySortState(n)),r&&(o=JG(t,e,r.col,r.row,i)),!o);s++);else n=i.sortState,n&&(r=i._getHeaderCellBySortState(n)),r&&(o=JG(t,e,r.col,r.row,i));const s=i.getHeaderDefine(t,e);n&&o&&s?.sort?n.order="asc"===n.order?"desc":"desc"===n.order?"normal":"asc":s?.sort?n={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"asc"}:o&&s?.showSort||(n={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"normal"});i.fireListeners(sf.SORT_CLICK,n).includes(!1)||(i.internalProps.sortState=n,i.stateManeger.setSortState(n),s?.sort&&function(t,e,i){let n;n=t.fieldKey?e.internalProps.layoutMap.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.internalProps.layoutMap.headerObjects.find((e=>e&&e.field===t.field));if(!n)return;const{field:r}=n;if(null===r)return;"function"==typeof i.sort?e.dataSource.sort(r,t.order||"asc",i.sort):e.dataSource.sort(r,t.order||"asc",Cu)}(n,i,s),i.scenegraph.sortCell(),i.stateManeger.updateSelectPos(-1,-1))}function JG(t,e,i,n,r){return r._getLayoutCellId(t,e)===r._getLayoutCellId(i,n)}const QG=Up(sf,{PIVOT_SORT_CLICK:"pivot_sort_click",DRILLMENU_CLICK:"drillmenu_click"}),tV=Up(sf,{VCHART_EVENT_TYPE:"vchart_event_type"});function eV(t){if(!("canMoveHeaderPosition"in t.table.internalProps.layoutMap))return;setTimeout((()=>{t.columnMove.moving=!1}),0);t.table.moveHeaderPosition({col:t.columnMove.colSource,row:t.columnMove.rowSource},{col:t.columnMove.colTarget,row:t.columnMove.rowTarget})&&(!function(t,e,i,n,r){const o=Math.min(t,i),s=Math.max(t,i),a=Math.min(e,n),l=Math.max(e,n);for(let t=o;t<=s;t++)r._clearColRangeWidthsMap(t);for(let t=a;t<=l;t++)r._clearRowRangeHeightsMap(t)}(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget,t.table),t.table.clearCellStyleCache(),t.table.scenegraph.updateHeaderPosition(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget)),t.updateCursor(),t.table.scenegraph.component.hideMoveCol(),t.table.scenegraph.updateNextFrame()}function iV(t){if(!t)return;const e=t.role?.startsWith("icon")?t:"richtext"===t.type?t._currentHoverIcon:void 0;return e?"richtext"===t.type?{icon:e,position:{left:t.globalAABBBounds.x1+e.globalAABBBounds.x1,right:t.globalAABBBounds.x1+e.globalAABBBounds.x2,top:t.globalAABBBounds.y1+e.globalAABBBounds.y1,bottom:t.globalAABBBounds.y1+e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"richtext-icon"}:{icon:e,position:{left:e.globalAABBBounds.x1,right:e.globalAABBBounds.x2,top:e.globalAABBBounds.y1,bottom:e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"icon"}:void 0}function nV(t,e){if("adaptive"===e.table.widthMode&&e.columnResize.col<e.table.colCount-1){const i=e.table.getColWidth(e.columnResize.col+1);i-t<0&&(t=i),e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.scenegraph.updateColWidth(e.columnResize.col+1,-t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col),e.table.internalProps._widthResizedColMap.add(e.columnResize.col+1)}else e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col)}class rV{table;interactionState;select;hover;hoverIcon;residentHoverIcon;columnResize;columnMove;menu;sort;frozen;scroll;tablePosition;drill;sparkLine;_clearVerticalScrollBar;_clearHorizontalScrollBar;resetInteractionState=lf((()=>{this.updateInteractionState(Uc.default)}),100);constructor(t){this.table=t,this.initState(),this.updateVerticalScrollBar=this.updateVerticalScrollBar.bind(this),this.updateHorizontalScrollBar=this.updateHorizontalScrollBar.bind(this)}initState(){this._initState(),this.setHoverState(),this.setSelectState(),this.setFrozenState()}_initState(){this.interactionState=Uc.default,this.select={highlightScope:Kc.single,ranges:[],cellPos:{col:-1,row:-1},selecting:!1},this.hover={highlightScope:Kc.single,cellPos:{col:-1,row:-1}},this.hoverIcon={col:-1,row:-1,icon:null},this.columnResize={col:-1,x:0,resizing:!1},this.columnMove={colSource:-1,colTarget:-1,rowSource:-1,rowTarget:-1,x:0,y:0,moving:!1},this.menu={x:-1,y:-1,isShow:!1,itemList:[],bounds:new ep,highlightIndex:-1,dropDownMenuHighlight:[]},this.sort={col:-1,row:-1,order:"normal"},this.frozen={col:-1},this.scroll={horizontalBarPos:0,verticalBarPos:0},this.tablePosition={absoluteX:0,absoluteY:0},this.drill={col:-1,row:-1},this.sparkLine={col:-1,row:-1}}setHoverState(){const{highlightMode:t,disableHover:e,disableHeaderHover:i}=this.table.options.hover??{highlightMode:"cell"};e?this.hover.highlightScope=Kc.none:"cross"===t?this.hover.highlightScope=Kc.cross:"row"===t?this.hover.highlightScope=Kc.row:"column"===t?this.hover.highlightScope=Kc.column:"cell"===t&&(this.hover.highlightScope=Kc.single),this.hover.singleStyle=!e,this.hover.disableHeader=i,(this.hover.highlightScope===Kc.none||i)&&(this.hover.cellPosContainHeader={col:-1,row:-1})}setSelectState(){const{disableSelect:t,disableHeaderSelect:e}=this.table.options?.select??{disableSelect:!1,disableHeaderSelect:!1};this.select.highlightScope=t?Kc.none:Kc.single,this.select.singleStyle=!t,this.select.disableHeader=e}isSelected(t,e){let i=!1;return this.select.ranges.forEach((n=>{qp(n,t,e)&&(i=!0)})),i}setSortState(t){this.sort.field=t.field,this.sort.fieldKey=t.fieldKey,this.sort.order=t.order}setFrozenState(){this.frozen.col=this.table.frozenColCount-1}updateInteractionState(t){this.interactionState!==t&&(this.interactionState=t)}updateHoverhighlightScope(t){this.hover.highlightScope!==t&&(this.hover.highlightScope=t)}updateHoverPos(t,e){qG(this,t,e)}updateSelectPos(t,e,i=!1,n=!1,r=!1){-1!==e&&-1!==e&&(this.select.selecting=!0),function(t,e,i,n,r,o){const{table:s,interactionState:a}=t,{scenegraph:l}=s,{highlightScope:h,disableHeader:c,cellPos:u}=t.select;if((c&&s.isHeader(e,i)||"none"===h)&&(e=-1,i=-1),u.col!==e||u.row!==i){if(-1!==e&&-1!==i&&t.select.ranges.length>0)if(a===Uc.grabing){const n=t.select.ranges[t.select.ranges.length-1];e>n.start.col&&e>n.end.col&&s._makeVisibleCell(e+1,i),i>n.start.row&&i>n.end.row&&s._makeVisibleCell(e,i+1),e<n.start.col&&e<n.end.col&&s._makeVisibleCell(e-1,i),i<n.start.row&&i<n.end.row&&s._makeVisibleCell(e,i-1)}else s._makeVisibleCell(e,i);if(o){t.select.ranges=[],l.deleteAllSelectBorder(),t.select.ranges.push({start:{col:0,row:0},end:{col:s.colCount-1,row:s.rowCount-1}});const e=t.select.ranges[t.select.ranges.length-1];l.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else if(-1===u.col||-1===u.row||-1!==e&&-1!==i){if(a===Uc.default){const o=t.select.ranges[t.select.ranges.length-1];if(n&&o){if(s.isColumnHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),n=Math.max(o.start.col,o.end.col,e),r=Math.min(o.start.row,o.end.row,i),a=s.rowCount-1;o.start={col:t,row:r},o.end={col:n,row:a}}else if(s.isRowHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),n=s.colCount-1,r=Math.min(o.start.row,o.end.row,i),a=Math.max(o.start.row,o.end.row,i);o.start={col:t,row:r},o.end={col:n,row:a}}else o.end={col:e,row:i};l.deleteLastSelectedRangeComponents(),l.updateCellSelectBorder(o.start.col,o.start.row,o.end.col,o.end.row)}else{-1===u.col||-1===u.row||r||(t.select.ranges=[],l.deleteAllSelectBorder()),s.isColumnHeader(e,i)?t.select.ranges.push({start:{col:e,row:i},end:{col:e,row:s.rowCount-1}}):s.isRowHeader(e,i)?t.select.ranges.push({start:{col:e,row:i},end:{col:s.colCount-1,row:i}}):t.select.ranges.push({start:{col:e,row:i},end:{col:e,row:i}}),u.col=e,u.row=i;const n=t.select.ranges[t.select.ranges.length-1];l.updateCellSelectBorder(n.start.col,n.start.row,n.end.col,n.end.row)}}else if(a===Uc.grabing){-1===u.col&&(u.col=e),-1===u.row&&(u.row=i);const n=t.select.ranges[t.select.ranges.length-1];n.end={col:e,row:i},u.col=e,u.row=i,l.updateCellSelectBorder(n.start.col,n.start.row,e,i)}}else u.col=-1,u.row=-1,t.select.ranges=[],l.deleteAllSelectBorder();l.updateNextFrame()}}(this,t,e,i,n,r)}checkCellRangeInSelect(t,e){return function(t,e,i,n){for(let n=0;n<i.length;n++)if(Jp(i[n],{start:t,end:e}))return!0;return!1}(t,e,this.select.ranges,this.select.highlightScope)}updateHoverIcon(t,e,i,n,r){if(i===this.residentHoverIcon?.icon)return;const o=iV(i);if(o)if("richtext-icon"===o.type){const i=o.icon;if(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame()),i.attribute.tooltip){const n={content:i.attribute.tooltip.title,referencePosition:{rect:o.position,placement:i.attribute.tooltip.placement},style:Object.assign({},this.table.internalProps.theme?.tooltipStyle,i.tooltip?.style)};this.table.internalProps.tooltipHandler.isBinded(n)||this.table.showTooltip(t,e,n)}}else{const i=o.icon;i!==this.hoverIcon.icon&&(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=t,this.hoverIcon.col=e,this.hoverIcon.icon=i,this.table.scenegraph.setIconHoverStyle(i,t,e,n),this.table.scenegraph.updateNextFrame())}else this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame())}isResizeCol(){return this.columnResize.resizing}isSelecting(){return this.select.selecting}endSelectCells(){if(this.select.selecting=!1,0===this.select.ranges.length)return;this.table.scenegraph.moveSelectingRangeComponentsToSelectedRangeComponents();const t=this.select.ranges[this.select.ranges.length-1].end.col,e=this.select.ranges[this.select.ranges.length-1].end.row;this.table.fireListeners(sf.SELECTED_CELL,{ranges:this.select.ranges,col:t,row:e})}endResizeCol(){setTimeout((()=>{this.columnResize.resizing=!1}),0),this.table.scenegraph.updateChartSize(this.columnResize.col),this.checkFrozen(),this.table.scenegraph.component.hideResizeCol(),this.table.scenegraph.updateNextFrame()}startResizeCol(t,e,i,n){this.columnResize.resizing=!0,this.columnResize.col=t,this.columnResize.x=e,this.columnResize.isRightFrozen=n,this.table.scenegraph.component.showResizeCol(t,i,n),this.table.stateManeger.updateSelectPos(-1,-1),this.table.scenegraph.updateNextFrame()}updateResizeCol(t,e){!function(t,e,i){t=Math.ceil(t),e=Math.ceil(e);let n=i.columnResize.isRightFrozen?i.columnResize.x-t:t-i.columnResize.x;if(Math.abs(n)<1)return;const r=i.table.getColWidth(i.columnResize.col);let o=r;o+=n;const s=i.table.getMinColWidth(i.columnResize.col),a=i.table.getMaxColWidth(i.columnResize.col);if(o<s||o>a){if(r===s||r===a)return;n=r-s>a-r?a-r:s-r}n=Math.ceil(n),i.columnResize.col<i.table.rowHeaderLevelCount||i.columnResize.col>=i.table.colCount-i.table.rightFrozenColCount?nV(n,i):"indicator"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;let n,r,o;if(i.indicatorsAsCol)n=i.getIndicatorKey(e.columnResize.col,e.table.columnHeaderLevelCount);else{const t=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount-1),n=t.colHeaderPaths[t.colHeaderPaths.length-1];r=n.dimensionKey,o=n.value}for(let s=e.table.rowHeaderLevelCount;s<e.table.colCount-e.table.rightFrozenColCount;s++){const a=i.getIndicatorKey(s,e.table.columnHeaderLevelCount);if(i.indicatorsAsCol&&a===n)e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s);else if(!i.indicatorsAsCol){const n=i.getCellHeaderPaths(s,e.table.columnHeaderLevelCount-1),a=n?.colHeaderPaths[n.colHeaderPaths.length-1];a&&r===a.dimensionKey&&o===a.value&&(e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s))}}}(n,i):"indicatorGroup"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap,n=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount),r=i.getHeadNode(n.colHeaderPaths.slice(0,n.colHeaderPaths.length-1)),o=r.startInTotal+e.table.frozenColCount,s=r.startInTotal+e.table.frozenColCount+r.size-1,a=e.table.getColsWidth(o,s),l=t;for(let t=o;t<=s;t++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const n=i.getBody(t,e.table.columnHeaderLevelCount);if(n?.disableColumnResize)continue}const n=e.table.getColWidth(t);e.table.scenegraph.updateColWidth(t,n/a*l),e.table.internalProps._widthResizedColMap.add(t)}}(n,i):"all"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;for(let n=e.table.options.frozenColCount;n<e.table.colCount-e.table.rightFrozenColCount;n++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const t=i.getBody(n,e.table.columnHeaderLevelCount);if(t?.disableColumnResize)continue}e.table.scenegraph.updateColWidth(n,t),e.table.internalProps._widthResizedColMap.add(n)}}(n,i):nV(n,i),i.columnResize.x=t,i.table.scenegraph.component.updateResizeCol(i.columnResize.col,e,i.columnResize.isRightFrozen),i.columnResize.col<i.table.frozenColCount&&!i.table.isPivotTable()&&!i.table.transpose&&i.table.scenegraph.component.setFrozenColumnShadow(i.table.frozenColCount-1,i.columnResize.isRightFrozen),i.table.scenegraph.updateNextFrame()}(t,e,this)}startMoveCol(t,e,i,n){!function(t,e,i,n,r){if(!("canMoveHeaderPosition"in r.table.internalProps.layoutMap))return;r.columnMove.moving=!0,r.columnMove.colSource=t,r.columnMove.rowSource=e,r.columnMove.x=i-r.table.tableX,r.columnMove.y=n-r.table.tableY;const o=r.table.getCellLocation(t,e),s="columnHeader"===o?r.columnMove.x:"rowHeader"===o?r.columnMove.y:0;r.table.scenegraph.component.showMoveCol(t,e,s),r.table.stateManeger.updateSelectPos(-1,-1),r.table.scenegraph.updateNextFrame()}(t,e,i,n,this)}updateMoveCol(t,e,i,n){!function(t,e,i,n,r){if(!("canMoveHeaderPosition"in r.table.internalProps.layoutMap))return;const o=function(t,e,i){const n=i.getCellRange(t.col,t.row);if(i.isColumnHeader(t.col,t.row)){const r=i.getCellRange(e.col,n.start.row);e.row>=i.columnHeaderLevelCount&&(e.row=i.columnHeaderLevelCount-1),e.col>=t.col?e.col=r.end.col:e.col=r.start.col}else if(i.isRowHeader(t.col,t.row)){const r=i.getCellRange(n.start.col,e.row);e.col>=i.rowHeaderLevelCount&&(e.col=i.rowHeaderLevelCount-1);const o=i.internalProps.layoutMap;if("tree"===o.rowHierarchyType){const n=o.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,r=o.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths;if(n.length<=r.length){const o=r[n.length-1];o&&(e.row>=t.row?e.row=o.startInTotal+o.size-1+i.columnHeaderLevelCount:e.row=o.startInTotal+i.columnHeaderLevelCount)}}else e.row>=t.row?e.row=r.end.row:e.row=r.start.row}return e}({col:r.columnMove.colSource,row:r.columnMove.rowSource},{col:t,row:e},r.table);let s,a,l,h;r.columnMove.x=i-r.table.tableX,r.columnMove.y=n-r.table.tableY,r.columnMove.colTarget=o.col,r.columnMove.rowTarget=o.row,r.table.internalProps.layoutMap.canMoveHeaderPosition({col:r.columnMove.colSource,row:r.columnMove.rowSource},{col:r.columnMove.colTarget,row:r.columnMove.rowTarget})?r.updateCursor("grabbing"):r.updateCursor("not-allowed");const c=r.table.getCellLocation(t,e);"columnHeader"===c?(a=r.columnMove.x,s=r.columnMove.colTarget>=r.columnMove.colSource?r.table.getColsWidth(0,r.columnMove.colTarget):r.table.getColsWidth(0,r.columnMove.colTarget-1)):"rowHeader"===c&&(h=r.columnMove.y,l=r.columnMove.rowTarget>=r.columnMove.rowSource?r.table.getRowsHeight(0,r.columnMove.rowTarget):r.table.getRowsHeight(0,r.columnMove.rowTarget-1)),r.table.scenegraph.component.updateMoveCol(a,s,h,l),r.table.scenegraph.updateNextFrame()}(t,e,i,n,this)}isMoveCol(){return this.columnMove.moving}endMoveCol(){eV(this)}checkFrozen(){if(this.table.options.frozenColCount){if(this.table.tableNoFrameWidth-this.table.getColsWidth(0,this.table.options.frozenColCount-1)<=120)return this.table._setFrozenColCount(0),this.setFrozenCol(-1),!1;if(this.table.frozenColCount!==this.table.options.frozenColCount)return this.table._setFrozenColCount(this.table.options.frozenColCount),this.setFrozenCol(this.table.options.frozenColCount),!1}return!0}setFrozenCol(t){t!==this.frozen.col?(this.frozen.col=t,this.table.scenegraph.updateFrozen(),this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)):this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)}updateVerticalScrollBar(t){const e=this.table.getAllRowsHeight();this.scroll.verticalBarPos=Math.ceil(t*(e-this.table.scenegraph.height)),this.table.scenegraph.setY(-this.scroll.verticalBarPos),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}updateHorizontalScrollBar(t){const e=this.table.getAllColsWidth();this.scroll.horizontalBarPos=Math.ceil(t*(e-this.table.scenegraph.width)),this.table.scenegraph.setX(-this.scroll.horizontalBarPos),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}setScrollTop(t){const e=this.table.getAllRowsHeight();t=Math.max(0,Math.min(t,e-this.table.scenegraph.height)),t=Math.ceil(t),this.scroll.verticalBarPos=t,this.table.scenegraph.setY(-t),this.table.scenegraph.component.updateVerticalScrollBarPos(t/(e-this.table.scenegraph.height)),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}setScrollLeft(t){const e=this.table.getAllColsWidth(),i=this.table.getFrozenColsWidth();t=Math.max(0,Math.min(t,e-this.table.scenegraph.width)),t=Math.ceil(t),this.scroll.horizontalBarPos=t,this.table.scenegraph.setX(-t),this.table.scenegraph.component.updateHorizontalScrollBarPos(t/(e-i)),this.table.stateManeger.updateHoverPos(-1,-1),this.table.fireListeners(sf.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth})}hideVerticalScrollBar(){this.table.scenegraph.component.hideVerticalScrollBar()}showVerticalScrollBar(t){this.table.scenegraph.component.showVerticalScrollBar(),t&&(clearTimeout(this._clearVerticalScrollBar),this._clearVerticalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideVerticalScrollBar()}),1e3))}hideHorizontalScrollBar(){this.table.scenegraph.component.hideHorizontalScrollBar()}showHorizontalScrollBar(t){this.table.scenegraph.component.showHorizontalScrollBar(),t&&(clearTimeout(this._clearHorizontalScrollBar),this._clearHorizontalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideHorizontalScrollBar()}),1e3))}triggerContextMenu(t,e,i,n){this.menu.isShow&&this.menu.x===i&&this.menu.y===n?this.hideMenu():this.showContextMenu(t,e,i,n)}showContextMenu(t,e,i,n){this.table.internalProps.menu?.contextMenuItems&&("html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.menu.x=i,this.menu.y=n,this.table.scenegraph.component.menu.attach(i,n,t,e,Nj.contextmenu)),this.table.fireListeners(sf.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"contextmenu"}))}triggerDropDownMenu(t,e,i,n){this.table.fireListeners(sf.DROPDOWN_ICON_CLICK,{col:t,row:e}),this.menu.isShow?this.hideMenu():this.showDropDownMenu(t,e,i,n)}showDropDownMenu(t,e,i,n){"html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.table.scenegraph.component.menu.attach(i,n,t,e,Nj.dropDown),this.menu.bounds=this.table.scenegraph.component.menu.bounds),this.table.fireListeners(sf.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"dropDown"}),this.residentHoverIcon&&this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row);const r=this.table.scenegraph.getCell(t,e);let o;r.forEachChildren((t=>t.attribute.funcType===Jc.dropDown&&(o=t,!0))),o&&(this.residentHoverIcon={col:t,row:e,icon:o},this.table.scenegraph.setIconHoverStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row,r),o.oldVisibleTime=o.attribute.visibleTime,o.setAttribute("visibleTime","always"),o.setAttribute("visible",!0))}hideMenu(){this.table.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),this.table.fireListeners(sf.HIDE_MENU,null),this.menu.isShow=!1,this.table.scenegraph.component.menu.detach(),this.residentHoverIcon&&(this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row),this.residentHoverIcon.icon.setAttribute("visibleTime",this.residentHoverIcon.icon.oldVisibleTime),this.residentHoverIcon.icon.setAttribute("visible","always"===this.residentHoverIcon.icon.attribute.visibleTime),this.residentHoverIcon=null)}setDropDownMenuHighlight(t){this.menu.dropDownMenuHighlight=t;for(let e=0;e<t.length;e++){const{col:i,row:n}=t[e];this.table.scenegraph.updateCellContent(i,n)}}dropDownMenuIsHighlight(t,e,i){const n=this.menu.dropDownMenuHighlight;if(Array.isArray(n))for(let r=0;r<n.length;r++){const o=n[r];let{col:s,row:a}=o;const{field:l,menuKey:h}=o;if("number"!=typeof s||"number"!=typeof a)if(this.table.isPivotTable()&&(Array.isArray(l),1)){const t=this.table.internalProps.layoutMap.getPivotCellAdress(l);if(!t)continue;s=t.col,a=t.row}else{const t=this.table.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!t)continue;s=t.col,a=t.row}if(bu(s)&&bu(a)&&this.table.isCellRangeEqual(t,e,s,a)){const n=this.table._getHeaderLayoutMap(s??t,a??e).dropDownMenu||this.table.globalDropDownMenu;if(n)for(let t=0;t<n.length;t++){const e=n[t];if(ou(e)&&(e.menuKey||e.text)===(h||"")&&t===i)return!0;if(au(e)&&e===h&&t===i)return!0}}}return!1}triggerSort(t,e,i){if(this.table.isPivotTable()){const i=this.table.getPivotSortState(t,e);return void this.table.fireListeners(QG.PIVOT_SORT_CLICK,{col:t,row:e,order:i||"normal",dimensionInfo:this.table.internalProps.layoutMap.getPivotDimensionInfo(t,e),cellLocation:this.table.getCellLocation(t,e)})}const n=this.sort.col,r=this.sort.row;ZG(t,e,this.table),this.sort.col=t,this.sort.row=e,this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,i,this.sort.order,n,r,this.sort.icon),this.sort.icon=i}updateSortState(t){if(t.field===this.sort.field&&t.order===this.sort.order)return;const e=this.sort.col,i=this.sort.row,n="asc"===this.sort.order?"sort_downward":"desc"===this.sort.order?"sort_upward":"sort_normal";this.setSortState(t);const r=this.table.internalProps.layoutMap.getHeaderCellAddressByField(t.field);this.sort.col=r.col,this.sort.row=r.row;const o=this.table.scenegraph.getCell(this.sort.col,this.sort.row).getChildByName(n,!0);this.table.scenegraph.sortCell(),this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,o,this.sort.order,e,i,this.sort.icon)}triggerFreeze(t,e,i){this.table.isPivotTable()||this.table.transpose||(!function(t,e,i){i.frozenColCount>0?t!==i.frozenColCount-1?i.setFrozenColCount(t+1):i.setFrozenColCount(0):i.setFrozenColCount(t+1)}(t,0,this.table),this.frozen.icon=i)}updateCursor(t="default"){this.table.getElement().style.cursor=t}updateDrillState(t,e,i,n,r,o){this.drill.dimensionKey=t,this.drill.title=e,this.drill.drillDown=i,this.drill.drillUp=n,this.drill.col=r,this.drill.row=o,function(t,e,i,n,r){const o=r.getCellLocation(t,e);let s=0,a=0,l=!1;"columnHeader"===o?(s=r.getColsWidth(0,r.rowHeaderLevelCount-1)-(0===r.frozenColCount?r.scrollLeft:0),a=r.getRowsHeight(0,e-1)+r.getRowHeight(e)/2,l=!0):"rowHeader"===o&&(a=r.getRowsHeight(0,r.columnHeaderLevelCount-1),s=r.getColsWidth(0,t-1)+r.getColWidth(t)/2,l=!0),r.scenegraph.updateDrill(l,s,a,i,n)}(r,o,i,n,this.table)}updateSparklineHoverPose(t,e,i,n){-1!==this.sparkLine.col&&-1!==this.sparkLine.row&&function(t,e,i){const n=i.scenegraph.getCell(t,e).getChildByName("sparkline"),r=n?.getChildByName("highlight-line"),o=n?.getChildByName("highlight-symbol");r&&r.setAttributes({visible:!1,pickable:!1}),o&&o.setAttributes({visible:!1,pickable:!1}),i.scenegraph.updateNextFrame()}(this.sparkLine.col,this.sparkLine.row,this.table),-1!==t&&-1!==e&&function(t,e,i,n,r){const o=r.scenegraph.getCell(t,e).getChildByName("sparkline"),s=o?.getChildByName("sparkline-line"),a=o?.getChildByName("sparkline-symbol-group");if(!s)return;const l=s.bandwidth,h=s.min,c=s.max,u=s.attribute.points;let d;i-=o.globalAABBBounds.x1,o.globalAABBBounds.y1;for(let t=0;t<u.length;t++){const{x:e,y:n,defined:r,rawData:p}=u[t];if(Math.abs(i-e)<l/2&&(d={point:u[t],points:u,pointsBandWidth:l,pointData:p},r)){const t=o.getChildByName("highlight-line");if(t)t.setAttributes({x:e,visible:!0,pickable:!0});else{const t=QA({x:e,y:0,points:[{x:0,y:c},{x:0,y:h}],lineWidth:s.hover?.strokeWidth,stroke:s.hover?.stroke});t.name="highlight-line",o.addChild(t)}const i=o.getChildByName("highlight-symbol");if(i)i.setAttributes({x:e,y:n,visible:!0,pickable:!0});else{const t=nT({x:e,y:n,stroke:a.hover.stroke,lineWidth:a.hover.strokeWidth,fill:a.hover.fill,size:2*a.hover.size,symbolType:"circle"});t.name="highlight-symbol",o.addChild(t)}break}}if(r.scenegraph.updateNextFrame(),d){const i={col:t,row:e,field:r.getHeaderField(t,e),value:r.getCellValue(t,e),dataValue:r.getCellOriginValue(t,e),cellHeaderPaths:r.internalProps.layoutMap.getCellHeaderPaths(t,e),title:r.getBodyColumnDefine(t,e).title,cellRange:r.getCellRelativeRect(t,e),sparkline:{pointData:d.pointData},scaleRatio:r.canvas.getBoundingClientRect().width/r.canvas.offsetWidth};r.fireListeners(sf.MOUSEOVER_CHART_SYMBOL,i)}}(t,e,i,0,this.table),this.sparkLine.col=t,this.sparkLine.row=e}}function oV(t){const e={abstractPos:{x:t.x,y:t.y}},i=function(t){for(;t&&t.parent;){if("cell"===t.role)return t;t=t.parent}return null}(t.target);return i&&(e.eventArgs={col:i.col,row:i.row,event:t,targetCell:i,target:t.target}),e}let sV,aV;function lV(t){if(t.stateManeger.endResizeCol(),t.hasListeners(sf.RESIZE_COLUMN_END)){const e=[];for(let i=0;i<t.colCount;i++)e.push(t.getColWidth(i));t.fireListeners(sf.RESIZE_COLUMN_END,{col:t.stateManeger.columnResize.col,columns:e})}}function hV(t,e){let{deltaX:i,deltaY:n}=t;t.shiftKey&&t.deltaY&&(i=n,n=0);const[r,o]=function(t,e,i){const n=2,r=Math.abs(t/e),o=r<=1/n?0:t,s=r>n?0:e;return[Math.ceil(o*(i.horizontal??0)),Math.ceil(s*(i.vertical??0))]}(i,n,{horizontal:1,vertical:1});(r||o)&&e.interactionState!==Uc.scrolling&&e.updateInteractionState(Uc.scrolling),r&&(e.setScrollLeft(e.scroll.horizontalBarPos+r),e.showHorizontalScrollBar(!0)),o&&(e.setScrollTop(e.scroll.verticalBarPos+o),e.showVerticalScrollBar(!0)),e.resetInteractionState(),t.cancelable&&(0!==n&&cV(n,e)||0!==i&&uV(i,e))&&t.preventDefault()}function cV(t,e){return 0!=e.table.getAllRowsHeight()-e.table.scenegraph.height&&(!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t<=0&&e.scroll.verticalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t>=0&&Math.abs(e.scroll.verticalBarPos-i)<1}(t,e))}function uV(t,e){return 0!=e.table.getAllColsWidth()-e.table.scenegraph.width&&(!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t<=0&&e.scroll.horizontalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t>=0&&Math.abs(e.scroll.horizontalBarPos-i)<1}(t,e))}function dV(t){const e=t.table,i=e.stateManeger,n=e.scenegraph;t.touchMovePoints=[],e.scenegraph.tableGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(n.component.vScrollBar)||e.target.isChildOf(n.component.vScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))})),window.addEventListener("touchmove",(e=>{if(t.touchMove&&e.preventDefault(),!t.isTouchdown||!pV(e))return;t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,timestamp:Date.now()});const n=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,r=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;hV({deltaX:n,deltaY:r},i),e.cancelable&&(0!==r&&cV(r,i)||0!==n&&uV(n,i))&&e.preventDefault()}),{passive:!1}),window.addEventListener("touchend",(e=>{if(t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&pV(e)){if(t.touchMovePoints?.length){t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,timestamp:Date.now()});const n=t.touchMovePoints[0],r=t.touchMovePoints[t.touchMovePoints?.length-1];!function(t,e,i){let n=Date.now();const r=.95,o=()=>{const s=Date.now(),a=s-n;let l=!0;const h=Math.pow(r,a/16),c=h*t,u=h*e;let d=0,p=0;Math.abs(c)>.05&&(l=!1,d=(t+c)/2*a),Math.abs(u)>.05&&(l=!1,p=(e+u)/2*a),hV({deltaX:-d,deltaY:-p},i),l||(n=s,t=c,e=u,requestAnimationFrame(o))};requestAnimationFrame(o)}((r.x-n.x)/(r.timestamp-n.timestamp),(r.y-n.y)/(r.timestamp-n.timestamp),i)}t.isTouchdown=!1,t.touchMovePoints=[]}})),window.addEventListener("touchcancel",(e=>{t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&(t.isTouchdown=!1,t.touchMovePoints=[])}))}function pV(t){return!!t.changedTouches}function fV(t,e,i){if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"top";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom";if(t===i.rowHeaderLevelCount-1&&e>=i.rowHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left"}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left";if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"right";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom"}return"bottom"}class gV{table;isTouchdown;touchMovePoints;touchSetTimeout;touchEnd;touchMove;constructor(t){this.table=t,this.bindOuterEvent(),setTimeout((()=>{this.bindSelfEvent()}),0)}bindOuterEvent(){!function(t){const e=t.table,i=e.stateManeger;document.body.addEventListener("pointermove",(n=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const{x:r,y:o}=e._getMouseAbstractPoint(n,!1);i.interactionState!==Uc.scrolling&&i.interactionState===Uc.grabing&&i.isResizeCol()&&(t.dealColumnResize(r,o),e.hasListeners(sf.RESIZE_COLUMN)&&e.fireListeners(sf.RESIZE_COLUMN,{col:e.stateManeger.columnResize.col,colWidth:e.getColWidth(e.stateManeger.columnResize.col)}))})),e.scenegraph.tableGroup.addEventListener("pointermove",(n=>{const r=sV?.x??n.x,o=sV?.y??n.y;sV={x:n.x,y:n.y},t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const s=oV(n);if(i.interactionState===Uc.scrolling)return;if(i.interactionState===Uc.grabing&&Math.abs(r-n.x)+Math.abs(o-n.y)>=1)return void(i.isResizeCol()||(i.isMoveCol()?t.dealColumnMover(s):t.dealTableSelect(s)));i.isResizeCol()||t.checkColumnResize(s)?i.updateCursor("col-resize"):i.updateCursor();const a=n.path.find((t=>"cell"===t.role));if(e.hasListeners(sf.MOUSELEAVE_CELL)&&("cell"!==a?.role||-1===e.stateManeger.hover.cellPos.col||-1===e.stateManeger.hover.cellPos.row||a.col===e.stateManeger.hover.cellPos.col&&a.row===e.stateManeger.hover.cellPos.row||e.fireListeners(sf.MOUSELEAVE_CELL,{col:e.stateManeger.hover.cellPos.col,row:e.stateManeger.hover.cellPos.row,cellRange:e.getCellRangeRelativeRect({col:e.stateManeger.hover.cellPos.col,row:e.stateManeger.hover.cellPos.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:n.nativeEvent})),e.hasListeners(sf.MOUSEENTER_CELL)&&"cell"===a?.role&&Uu(a.col)&&Uu(a.row)&&(a.col!==e.stateManeger.hover.cellPos.col||a.row!==e.stateManeger.hover.cellPos.row)&&e.fireListeners(sf.MOUSEENTER_CELL,{col:a.col,row:a.row,cellRange:e.getCellRangeRelativeRect({col:a.col,row:a.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:n.nativeEvent}),t.dealIconHover(s),t.dealTableHover(s),s.eventArgs&&e.hasListeners(sf.MOUSEMOVE_CELL)){let t,i;if(s.eventArgs?.target){const e=iV(s.eventArgs?.target);e&&(t=e.icon,i=e.position)}e.fireListeners(sf.MOUSEMOVE_CELL,{col:s.eventArgs.col,row:s.eventArgs.row,x:s.abstractPos.x,y:s.abstractPos.y,event:n.nativeEvent,targetIcon:t?{name:t.name,position:i,funcType:t.attribute.funcType}:void 0})}})),e.scenegraph.tableGroup.addEventListener("pointerout",(e=>{const i=oV(e),n=i?.eventArgs?.target;"table"===n?.role&&t.dealTableHover()})),e.scenegraph.tableGroup.addEventListener("pointerover",(t=>{const i=oV(t),n=i?.eventArgs?.target;if(e.hasListeners(sf.MOUSEOVER_CHART_SYMBOL)&&"symbol"===n.type){const i=t.composedPath().find((t=>"cell"===t.roll));if(i){const{col:n,row:r}=i,o={col:n,row:r,field:e.getHeaderField(n,r),value:e.getCellValue(n,r),dataValue:e.getCellOriginValue(n,r),cellHeaderPaths:e.internalProps.layoutMap.getCellHeaderPaths(n,r),title:e.getBodyColumnDefine(n,r).title,cellRange:e.getCellRelativeRect(n,r),event:t.nativeEvent,sparkline:{pointData:void 0},scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};e.fireListeners(sf.MOUSEOVER_CHART_SYMBOL,o)}}})),e.scenegraph.tableGroup.addEventListener("pointerleave",(n=>{i.isResizeCol()||(i.updateInteractionState(Uc.default),i.updateCursor()),t.dealTableHover();const r=n.target;r&&!r.isDescendantsOf(e.scenegraph.tableGroup)&&e.fireListeners(sf.MOUSELEAVE_TABLE,{col:-1,row:-1,event:n.nativeEvent})})),e.scenegraph.tableGroup.addEventListener("pointerupoutside",(n=>{console.log("pointerupoutside"),i.isResizeCol()&&lV(e),i.updateInteractionState(Uc.default),t.dealTableHover(),t.dealTableSelect()})),e.scenegraph.tableGroup.addEventListener("pointerdown",(n=>{if(sV={x:n.x,y:n.y},0!==n.button)return;const r=oV(n);if(i.interactionState!==Uc.default)return;e.isPivotChart()&&"chart"!==r?.eventArgs?.target.type&&e.scenegraph.updateChartState(null),i.menu.isShow&&r.eventArgs&&r.eventArgs.target!==i.residentHoverIcon?.icon&&i.hideMenu();const o=r?.eventArgs?.target?.role?.startsWith("icon")?r.eventArgs.target:void 0;if(!o||!1===o.attribute.interactive)if("touch"===n.pointerType)t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.touchMove=!0,(!t.touchEnd&&t.checkColumnResize(r,!0)||!t.touchEnd&&t.chechColumnMover(r)||t.dealTableSelect(r)&&!t.touchEnd)&&i.updateInteractionState(Uc.grabing)}),500);else{if(t.checkColumnResize(r,!0))return e.scenegraph.updateChartState(null),void i.updateInteractionState(Uc.grabing);if(t.chechColumnMover(r))return void i.updateInteractionState(Uc.grabing);t.dealTableSelect(r)&&i.updateInteractionState(Uc.grabing)}if(e.hasListeners(sf.MOUSEDOWN_CELL)){const t=oV(n);t.eventArgs&&e.fireListeners(sf.MOUSEDOWN_CELL,{col:t.eventArgs.col,row:t.eventArgs.row,event:n.nativeEvent})}})),e.scenegraph.tableGroup.addEventListener("pointerup",(t=>{if(0===t.button){if("grabing"===i.interactionState){if(i.updateInteractionState(Uc.default),i.isResizeCol())lV(e);else if(i.isMoveCol()){e.stateManeger.endMoveCol();const i=oV(t);i.eventArgs&&e.hasListeners(sf.CHANGE_HEADER_POSITION)&&e.fireListeners(sf.CHANGE_HEADER_POSITION,{target:{col:i.eventArgs.col,row:i.eventArgs.row},source:{col:e.stateManeger.columnMove.colSource,row:e.stateManeger.columnMove.colSource}})}else if(i.isSelecting()){e.stateManeger.endSelectCells();const i=oV(t);if(i.eventArgs&&e.hasListeners(sf.DRAG_SELECT_END)){const n={event:t.nativeEvent,cells:[],col:i.eventArgs.target.col,row:i.eventArgs.target.row,scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};n.cells=e.getSelectedCellInfos(),e.fireListeners(sf.DRAG_SELECT_END,n)}}}else i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default);if(e.hasListeners(sf.MOUSEUP_CELL)){const i=oV(t);i.eventArgs&&e.fireListeners(sf.MOUSEUP_CELL,{col:i.eventArgs.col,row:i.eventArgs.row,event:t.nativeEvent})}}})),e.scenegraph.tableGroup.addEventListener("rightdown",(t=>{const n=oV(t);if(n.eventArgs){i.triggerContextMenu(n.eventArgs.col,n.eventArgs.row,n.abstractPos.x,n.abstractPos.y);const{col:r,row:o}=n.eventArgs;if(e.hasListeners(sf.CONTEXTMENU_CELL)){const i=e.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=iV(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...i,event:t.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};!function(t,e,i){for(let n=0;n<t.length;n++){const r=t[n];if(r.start.col<=e&&e<=r.end.col&&r.start.row<=i&&i<=r.end.row||r.end.col<=e&&e<=r.start.col&&r.end.row<=i&&i<=r.start.row)return!0}return!1}(e.stateManeger.select.ranges,r,o)?l.cells=[[i]]:l.cells=e.getSelectedCellInfos(),e.fireListeners(sf.CONTEXTMENU_CELL,l)}}})),e.scenegraph.tableGroup.addEventListener("click",(i=>{if(console.log("click",i.clone()),e.stateManeger.columnResize.resizing||e.stateManeger.columnMove.moving)return;const n=oV(i);if(t.dealIconClick(i,n),!n?.eventArgs)return;const{col:r,row:o}=n.eventArgs;if(e.hasListeners(sf.CLICK_CELL)){const t=e.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=iV(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...t,event:i.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};e.fireListeners(sf.CLICK_CELL,l)}})),e.scenegraph.stage.addEventListener("click",(n=>{console.log("stage click");const r=n.target;r&&!r.isDescendantsOf(e.scenegraph.tableGroup)&&r!==e.scenegraph.tableGroup&&(console.log("pointerup outside table"),i.updateInteractionState(Uc.default),t.dealTableHover(),t.dealTableSelect(),i.updateCursor(),e.scenegraph.updateChartState(null))})),e.scenegraph.tableGroup.addEventListener("dblclick",(t=>{const i=oV(t),n=i.eventArgs.targetCell.globalAABBBounds,{col:r,row:o}=i.eventArgs,s=e.getCellValue(r,o);if(e.internalProps.focusControl.setFocusRect(new gf(n.x1+e.scrollLeft,n.y1+e.scrollTop,n.x2-n.x1,n.y2-n.y1),s),e.hasListeners(sf.DBLCLICK_CELL)){const n=e.getCellInfo(r,o);let s,a;if(i.eventArgs?.target){const t=iV(i.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,event:t.nativeEvent,federatedEvent:t,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};e.fireListeners(sf.DBLCLICK_CELL,l)}}))}(this),function(t){const e=t.table,i=e.stateManeger,n=e.internalProps.handler;n.on(e.getElement(),"blur",(e=>{console.log("blur"),t.dealTableHover()})),n.on(e.getElement(),"wheel",(t=>{hV(t,i)})),n.on(e.getElement(),"keydown",(i=>{if(e.keyboardOptions?.selectAllOnCtrlA&&"a"===i.key&&(i.ctrlKey||i.metaKey)&&(i.preventDefault(),t.deelTableSelectAll()),e.hasListeners(sf.KEYDOWN)){const t={keyCode:i.keyCode??i.which,code:i.code,event:i,cells:e.getSelectedCellInfos(),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};e.fireListeners(sf.KEYDOWN,t)}})),n.on(e.getElement(),"copy",(t=>{if(e.keyboardOptions?.copySelected){const i=e.getCopyValue();Uu(i)&&(t.preventDefault(),Qp?window.clipboardData.setData("Text",i):t.clipboardData.setData("text/plain",i))}})),n.on(e.getElement(),"contextmenu",(t=>{t.preventDefault()})),n.on(e.getContainer(),"resize",(()=>{e.resize()}))}(this),function(t){const e=t.table,i=e.stateManeger,n=e.scenegraph;n.component.vScrollBar.addEventListener("pointerover",(t=>{i.showVerticalScrollBar()})),n.component.hScrollBar.addEventListener("pointerover",(t=>{i.showHorizontalScrollBar()})),n.component.vScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==Uc.scrolling&&i.hideVerticalScrollBar()})),n.component.hScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==Uc.scrolling&&i.hideHorizontalScrollBar()})),n.component.vScrollBar._slider.addEventListener("pointerdown",(()=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling)})),n.component.vScrollBar.addEventListener("pointerup",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.vScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.hScrollBar._slider.addEventListener("pointerdown",(()=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling)})),n.component.hScrollBar.addEventListener("pointerup",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)})),n.component.hScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===Uc.scrolling&&i.updateInteractionState(Uc.default)}));const r=gu(i.updateVerticalScrollBar,20),o=gu(i.updateHorizontalScrollBar,20);n.component.vScrollBar.addEventListener("scroll",(t=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);r(e,t)})),n.component.hScrollBar.addEventListener("scroll",(t=>{i.interactionState!==Uc.scrolling&&i.updateInteractionState(Uc.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);o(e)}))}(this),dV(this)}bindSelfEvent(){const t=this.table.stateManeger;var e;this.table.on(sf.ICON_CLICK,(e=>{const{col:i,row:n,x:r,y:o,funcType:s,icon:a}=e;var l;s===Jc.dropDown?t.triggerDropDownMenu(i,n,r,o):s===Jc.sort?t.triggerSort(i,n,a):s===Jc.frozen?t.triggerFreeze(i,n,a):s===Jc.drillDown?(l=this.table).fireListeners(QG.DRILLMENU_CLICK,l.stateManeger.drill):s!==Jc.collapse&&s!==Jc.expand||this.table.toggleHierarchyState(i,n)})),this.table.on(sf.DROPDOWNMENU_CLICK,(()=>{t.hideMenu()})),function(t){const e=t.internalProps.layoutMap.headerObjects,i=t.internalProps.layoutMap.columnObjects;for(let t=0;t<e.length;t++){const i=e[t];if(i&&i.style?.textStick)return console.log("checkHaveTextStick",!0),!0}for(let t=0;t<i.length;t++){const e=i[t];if(e&&e.style?.textStick)return console.log("checkHaveTextStick",!0),!0}return console.log("checkHaveTextStick",!1),!1}(this.table)&&this.table.on(sf.SCROLL,(t=>{TG(this.table)})),e=this.table,"browser"===hf.mode&&e.on(sf.CLICK_CELL,(t=>{const{col:i,row:n}=t;let r;r=e.internalProps.layoutMap.isHeader(i,n)?e.isPivotTable()?e._getHeaderLayoutMap(i,n).headerType:e.getHeaderDefine(i,n).headerType:e.getBodyColumnType(i,n);const o=e.isHeader(i,n)?e.getHeaderDefine(i,n):e.getBodyColumnDefine(i,n),s=e.getCellValue(i,n),a=e.getCellOriginValue(i,n);if("link"===o.cellType){if(!1===o.linkJump)return;const t=o.templateLink,r=!1!==o.linkDetect;let l;if(t){const r=e.getCellOriginRecord(i,n),o=Object.assign({__value:s,__dataValue:a},r),h=/\{\s*(\S+?)\s*\}/g;l=t.replace(h,((t,e)=>o[e]))}else if(r){if(!_f.test(s))return;l=s}else l=s;window.open(l)}else if("image"===r){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=new Image;e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",t.appendChild(e),document.body.appendChild(t)}else if("video"===r){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=document.createElement("video");e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",e.setAttribute("preload","auto"),e.setAttribute("controls","true"),t.appendChild(e),document.body.appendChild(t)}})),this.table.on(sf.DBLCLICK_CELL,(t=>{if(t.federatedEvent){const e=oV(t.federatedEvent),i=this.table.scenegraph.getResizeColAt(e.abstractPos.x,e.abstractPos.y,e.eventArgs?.targetCell);this.table._canResizeColumn(i.col,i.row)&&i.col>=0&&this.table.scenegraph.updateAutoColWidth(i.col)}})),this.table.isPivotTable()&&function(t){const e=t.internalProps.layoutMap.rowsDefine,i=t.internalProps.layoutMap.columnsDefine;for(let t=0;t<e.length;t++){const i=e[t];if("string"!=typeof i&&(i.drillDown||i.drillUp))return!0}for(let t=0;t<i.length;t++){const e=i[t];if("string"!=typeof e&&(e.drillDown||e.drillUp))return!0}return!1}(this.table)&&function(t){t.on(sf.MOUSEENTER_CELL,(e=>{const{col:i,row:n}=e;if(-1===i||-1===n)return;const r=t.internalProps.layoutMap.getHeaderDimension(i,n);r?.drillDown||r?.drillUp?t.stateManeger.updateDrillState(r.dimensionKey,r.title,r.drillDown,r.drillUp,i,n):t.stateManeger.updateDrillState(void 0,void 0,!1,!1,-1,-1)})),t.on(sf.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateDrillState(void 0,void 0,!1,!1,-1,-1)}))}(this.table),function(t){let e=!1;e=t.isPivotTable()?t.internalProps.layoutMap.indicatorsDefine.some((t=>"string"!=typeof t&&"sparkline"===t.cellType)):t.internalProps.layoutMap.columnObjects.some((t=>"sparkline"===t.cellType));e&&(t.on(sf.MOUSEMOVE_CELL,(e=>{const{col:i,row:n,x:r,y:o}=e;"sparkline"!==t.getBodyColumnType(i,n)&&t.stateManeger.updateSparklineHoverPose(-1,-1,0,0),t.stateManeger.updateSparklineHoverPose(i,n,r,o)})),t.on(sf.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateSparklineHoverPose(-1,-1,0,0)})))}(this.table),function(t){t.isPivotChart()&&t.scenegraph.tableGroup.addEventListener("click",(e=>{if(!t.stateManeger.columnMove.moving&&!t.stateManeger.columnResize.resizing)if("axis-label"===e.target.name){const i=oV(e),{col:n,row:r}=i.eventArgs,o=t.internalProps.layoutMap;let s,a;o.indicatorsAsCol?(s=o.getDimensionKeyInChartSpec(o.rowHeaderLevelCount,r)[0],a=o.getCellHeaderPaths(o.rowHeaderLevelCount-2,r).rowHeaderPaths):(s=o.getDimensionKeyInChartSpec(n,o.columnHeaderLevelCount)[0],a=o.getCellHeaderPaths(n,o.columnHeaderLevelCount-1).colHeaderPaths);const l=a.map((t=>({key:t.dimensionKey,value:t.value}))).filter((t=>t.key));if(l.push({key:s,value:e.target.attribute.text}),t._selectedDimensionInChart.length&&function(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i].key!==e[i].key||t[i].value!==e[i].value)return!1;return!0}(t._selectedDimensionInChart,l))return;t._selectedDimensionInChart=l,o.updateDataStateToChartInstance(),OG(t.scenegraph),t.scenegraph.updateNextFrame()}else t._selectedDimensionInChart?.length&&(t._selectedDimensionInChart.length=0,t.internalProps.layoutMap.updateDataStateToChartInstance(),OG(t.scenegraph),t.scenegraph.updateNextFrame())}))}(this.table),function(t){t.isPivotChart()&&(t.on(sf.MOUSEENTER_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=fV(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(sf.MOUSEENTER_AXIS,e)}}))})),t.on(sf.MOUSELEAVE_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=fV(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(sf.MOUSELEAVE_AXIS,e)}}))})))}(this.table)}dealTableHover(t){if(!t)return void this.table.stateManeger.updateHoverPos(-1,-1);const{eventArgs:e}=t;e?this.table.stateManeger.updateHoverPos(e.col,e.row):this.table.stateManeger.updateHoverPos(-1,-1)}dealIconHover(t){const{eventArgs:e}=t;e?this.table.stateManeger.updateHoverIcon(e.col,e.row,e.target,e.targetCell,e.event):this.table.stateManeger.updateHoverIcon(-1,-1,void 0,void 0)}dealMenuHover(t){}dealTableSelect(t){if(!t)return this.table.stateManeger.updateSelectPos(-1,-1),!1;const{eventArgs:e}=t;return!!e&&(this.table.isPivotChart()||"chart"===t?.eventArgs?.target.type||this.table.stateManeger.updateHoverPos(-1,-1),!this.table.isPivotChart()||"axis-label"!==t?.eventArgs?.target.name&&"chart"!==t?.eventArgs?.target.type?(this.table.stateManeger.updateSelectPos(e.col,e.row,e.event.shiftKey,e.event.ctrlKey||e.event.metaKey),!0):(this.table.stateManeger.updateSelectPos(-1,-1),!1))}deelTableSelectAll(){this.table.stateManeger.updateSelectPos(-1,-1,!1,!1,!0)}dealMenuSelect(t){}checkColumnResize(t,e){const{eventArgs:i}=t;if(i){const n=this.table.scenegraph.getResizeColAt(t.abstractPos.x,t.abstractPos.y,i.targetCell);if(this.table._canResizeColumn(n.col,n.row)&&n.col>=0)return e&&this.table.stateManeger.startResizeCol(n.col,t.abstractPos.x,t.abstractPos.y,n.rightFrozen),!0}return!1}dealColumnResize(t,e){this.table.stateManeger.updateResizeCol(t,e)}chechColumnMover(t){const{eventArgs:e}=t;return!!(e&&this.table.isHeader(e.col,e.row)&&function(t,e,i){for(let n=0;n<i.length;n++)if(qp(i[n],t,e))return!0;return!1}(e.col,e.row,this.table.stateManeger.select.ranges)&&this.table._canDragHeaderPosition(e.col,e.row))&&(this.table.stateManeger.startMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y),!0)}dealColumnMover(t){const{eventArgs:e}=t;this.table.stateManeger.updateMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y)}startColumnResize(t){}dealIconClick(t,e){const{eventArgs:i}=e,{target:n,event:r,col:o,row:s}=i||{target:t.target,event:t,col:-1,row:-1},a=n;if(a.role&&a.role.startsWith("icon-"))return this.table.fireListeners(sf.ICON_CLICK,{name:a.name,x:(a.globalAABBBounds.x1+a.globalAABBBounds.x2)/2,y:a.globalAABBBounds.y2,col:o,row:s,funcType:a.attribute.funcType,icon:a}),!0;if(n instanceof dA){const t=n.pickIcon(r.global);if(t)return this.table.fireListeners(sf.ICON_CLICK,{name:t.attribute.id,x:t.globalX+t.globalAABBBounds.width()/2,y:t.globalY+t.AABBBounds.height(),col:o,row:s,funcType:t.attribute.funcType,icon:t}),!0}return!1}}const mV=t=>{const e=t.value;return Number(e)>80?"#20a8d8":Number(e)>50?"#4dbd74":Number(e)>20?"#ffc107":"#f86c6b"};class yV extends Ru{_showBar;_barColor;_barBgColor;_barPositiveColor;_barNegativeColor;_barAxisColor;_barHeight;_barBottom;_barPadding;_showBarMark;_barMarkPositiveColor;_barMarkNegativeColor;_barMarkWidth;_barMarkPosition;_barRightToLeft;static get DEFAULT(){return aV||(aV=new yV)}constructor(t={},e={}){super(t,e),this._showBar=t.showBar??!0,this._barColor=t.barColor??mV,this._barPositiveColor=t.barPositiveColor??"#4dbd74",this._barNegativeColor=t.barNegativeColor??"#f86c6b",this._barAxisColor=t.barAxisColor??"black",this._barBgColor=t.barBgColor,this._barHeight=t.barHeight??3,this._barHeight=t.barHeight??3,this._barBottom=t.barBottom??0,this._barPadding=t.barPadding??[1,1,1,1],this._showBarMark=t.showBarMark??!1,this._barMarkPositiveColor=t.barMarkPositiveColor??"#4dbd74",this._barMarkNegativeColor=t.barMarkNegativeColor??"#f86c6b",this._barMarkWidth=t.barMarkWidth??2,this._barMarkPosition=t.barMarkPosition??"right",this._barRightToLeft=t.barRightToLeft??!1}get showBar(){return this._showBar}set showBar(t){this._showBar=t}get barColor(){return this._barColor}set barColor(t){this._barColor=t}get barBgColor(){return this._barBgColor}set barBgColor(t){this._barBgColor=t}get barHeight(){return this._barHeight}set barHeight(t){this._barHeight=t}get barBottom(){return this._barBottom}set barBottom(t){this._barBottom=t}get barPositiveColor(){return this._barPositiveColor}set barPositiveColor(t){this._barPositiveColor=t}get barNegativeColor(){return this._barNegativeColor}set barNegativeColor(t){this._barNegativeColor=t}get barAxisColor(){return this._barAxisColor}set barAxisColor(t){this._barAxisColor=t}get barPadding(){return this._barPadding}set barPadding(t){this._barPadding=t}get showBarMark(){return this._showBarMark}set showBarMark(t){this._showBarMark=t}get barMarkPositiveColor(){return this._barMarkPositiveColor}set barMarkPositiveColor(t){this._barMarkPositiveColor=t}get barMarkNegativeColor(){return this._barMarkNegativeColor}set barMarkNegativeColor(t){this._barMarkNegativeColor=t}get barMarkWidth(){return this._barMarkWidth}set barMarkWidth(t){this._barMarkWidth=t}get barMarkPosition(){return this._barMarkPosition}set barMarkPosition(t){this._barMarkPosition=t}get barRightToLeft(){return this._barRightToLeft}set barRightToLeft(t){this._barRightToLeft=t}clone(){return new yV(this,null)}}const bV=["type","content","font","color","width","height","marginRight","marginLeft","src","svg","name","path","positionType","tooltip","hover","cursor","shape","interactive"];class vV{expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=yj();this.expandIcon=e[Qc.expandIconName],this.collapseIcon=e[Qc.collapseIconName]}getIcons(t,e,i,n,r){const o=[],{icon:s}=this._table.getBodyColumnDefine(t,e);if(s){let r;if("function"==typeof s){r=s({col:t,row:e,value:i,dataValue:n,table:this._table})}else r=s;const a=yj(),l=t=>{let e;e="string"==typeof t?a[t]:t,e&&o.push(e)};Array.isArray(r)?r.forEach(((t,e)=>{l(t)})):l(r)}const a=this.getHierarchyIcon(t,e);return a&&o.push(a),r&&o.forEach(((i,n)=>{(i.content||i.src)&&(o[n]=this.getCellIconFromRecordValue(i,t,e))})),o}getStyleClass(t){switch(t){case"text":case"link":return Eu;case"image":case"video":return Pu;case"chart":case"sparkline":return Ru;case"progressbar":return yV}}getCellIconFromRecordValue(t,e,i){if(Array.isArray(t))return t.map((t=>this.getCellIconFromRecordValue(t,e,i)));if(!tf.isObject(t)||"function"==typeof t)return this._table.getFieldData(t,e,i);const n={},r=t;return bV.forEach((t=>{if(void 0!==r[t]){const o=this._table.getFieldData(r[t],e,i);null!=o?n[t]=o:this._table._hasField(r[t],e,i)||(n[t]=r[t])}})),n}getHierarchyIcon(t,e){const i=this._table.getHierarchyState(t,e);return i===Xc.expand?this.expandIcon:i===Xc.collapse?this.collapseIcon:void 0}}function wV(t,e){const i=document.createElement(t);return e&&i.classList.add(...e),i}!function(){const t=document.createElement("style");t.id="vtable-menu-styleSheet",t.textContent="\n@keyframes vtable__menu-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__menu-element {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\tbackground-color: #fff;\n\tpadding: 6px 0;\n\t/* pointer-events: none; */\n\tuser-select: none;\n\tcolor: #000;\n\tmax-width: 300px;\n\tz-index: 99999;\n\tborder: #CCC 0.5px solid;\n\tcursor: default;\n\twidth: max-content;\n\tbox-shadow: 0px 8px 16px rgba(27, 31, 35, 0.12);\n}\n.vtable__menu-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n\tz-index: -9999;\n}\n.vtable__menu-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__menu-element--shown-animation 150ms ease-out;\n}\n.vtable__menu-element__content {\n\tfont-family: Roboto;\n\tfont-size: 12px;\n\toverflow: hidden;\n\tdisplay: inline-block;\n\t/* height: 100%; */\n\tline-height: 30px;\n}\n.vtable__menu-element__item {\n\theight: 32px;\n\tpadding: 0px 12px;\n\tcursor: pointer;\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-start;\n}\n.vtable__menu-element__item:hover {\n\tbackground-color: rgba(27, 31, 35, 0.06);\n}\n.vtable__menu-element__icon{\n\t/* vertical-align: top; */\n\tdisplay: flex;\n\t/* line-height: 30px; */\n\tmargin-right: 6px;\n}\n.vtable__menu-element__no-event {\n\tpointer-events: none;\n}\n.vtable__menu-element--select {\n\tcolor: #2E68CF;\n}.vtable__menu-element--normal {\n\tcolor: rgba(20, 20, 20, 0.9);;\n}\n.vtable__menu-element__split {\n\theight: 0px;\n\tborder: 1px solid rgb(209, 213, 218);\n\tmargin: 5px 0;\n}\n.vtable__menu-element__title {\n\tcolor: rgb(149, 149, 149);\n}\n.vtable__menu-element__arrow {\n\tposition: absolute;\n\tright: 3px;\n\tfont-weight: bold;\n\tmargin-top: 1px;\n}\n.vtable__menu-element__item-text {\n\tmargin-right: 15px;\n}\n",document.body.appendChild(t)}();const CV="vtable__menu-element",xV=`${CV}__item`,_V=`${CV}__content`,SV=`${CV}--hidden`,AV=`${CV}--shown`,TV=`${CV}--normal`,BV=`${CV}--select`,MV=`${CV}__icon`,RV=`${CV}__split`,PV=`${CV}__title`,EV=`${CV}__arrow`,HV=`${CV}__no-event`,LV=`${CV}__item-text`;function kV(){return wV("div",[CV,SV])}function IV(t,e,i,n,r,o){const s=t.getCellRange(n,r);for(let n=0;n<e.length;n++){const r=e[n];let{col:o,row:a}=r;const{field:l,menuKey:h}=r;if("number"!=typeof o||"number"!=typeof a)if(t.isPivotTable()&&(Array.isArray(l),1)){const e=t.internalProps.layoutMap.getPivotCellAdress(l);if(!e)continue;o=e.col,a=e.row}else{const e=t.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!e)continue;o=e.col,a=e.row}if(bu(o)&&bu(a)&&qp(s,o,a)&&i===h)return!0}return!1}class OV{_handler;_rootElement;_secondElement;_menuInstanceInfo;_showChildrenIndex;_mouseEnterSecondElement;constructor(t){this._handler=new df,this._rootElement=kV(),this._secondElement=kV(),this._secondElement.sub=!0,this._showChildrenIndex=-1,this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("touchend",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(SV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(SV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(e=>{if(this._rootElement.classList.contains(SV))return;e.stopPropagation();const{hasChildren:i,dropDownIndex:n,col:r,row:o,sub:s}=e.target;if(i){this._showChildrenIndex=n;const i=this._secondElement;i?.classList.remove(SV),i?.classList.add(AV),i.innerHTML="";const s=this._menuInstanceInfo.content[n]?.children;for(let e=0;e<s.length;e++){const n=s[e],a=DV(n,!!t.stateManeger.menu.dropDownMenuHighlight&&IV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof n?n?.menuKey||n?.text:n,r,o));a.col=r,a.row=o,a.dropDownIndex=e,"string"==typeof n?(a.text=n,a.menuKey=n):"object"==typeof n&&(a.text=n.text,a.menuKey=n.menuKey||n.text),a.sub=!0,a.sub=!0,i.appendChild(a)}const a=e.target.getBoundingClientRect();this._bindSecondElement(t,r,o,a.right,a.top)}else if(i&&this._showChildrenIndex===n){const t=this._secondElement;t?.classList.remove(SV),t?.classList.add(AV)}else!s&&this._secondElement?.classList.contains(AV)&&setTimeout((()=>{if(!0!==this._mouseEnterSecondElement){this._showChildrenIndex=-1;const t=this._secondElement;t?.classList.remove(AV),t?.classList.add(SV)}}),300)})),this._secondElement?.addEventListener("wheel",(t=>{t.stopPropagation()})),this._secondElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(SV)||t.stopPropagation()})),this._secondElement?.addEventListener("mouseenter",(t=>{this._mouseEnterSecondElement=!0})),this._secondElement?.addEventListener("mouseleave",(t=>{this._mouseEnterSecondElement=!1})),this._secondElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._secondElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._secondElement.classList.contains(SV))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n);let h=!1;this._menuInstanceInfo.content.forEach(((e,r)=>{if("object"==typeof e&&e.children&&e.children.length)for(let r=0;r<e.children.length;r++){const s=e.children[r];if(IV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey:s,i,n)&&o===("object"==typeof s?s?.menuKey:s))return void(h=!0)}})),t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,cellHeaderPaths:t.isPivotTable()?t.getCellHeaderPaths(i,n):void 0,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement,o=this._secondElement;if(this._menuInstanceInfo=n,r?.classList.remove(AV),r?.classList.add(SV),o?.classList.remove(AV),o?.classList.add(SV),this._canBindToCell(t,e,i)){if(r.innerHTML="",Array.isArray(n.content)){const o=n.content;for(let n=0;n<o?.length;n++){const s=o[n];let a=!!t.stateManeger.menu.dropDownMenuHighlight&&IV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey||s?.text:s,e,i);if(t.stateManeger.menu.dropDownMenuHighlight&&"object"==typeof s&&Array.isArray(s.children)&&s.children.length)for(let n=0;n<s.children.length;n++){const r=s.children[n];if(IV(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof r?r?.menuKey||r?.text:r,e,i)){a=!0;break}}const l=DV(s,a);l.col=e,l.row=i,l.dropDownIndex=n,"string"==typeof s?(l.text=s,l.menuKey=s):"object"==typeof s&&(l.text=s.text,l.menuKey=s.menuKey||s.text,s.children?.length&&(l.hasChildren=!0)),r.appendChild(l)}}if(this._bindToCell(t,e,i,n.position,n.referencePosition))return r?.classList.add(AV),r?.classList.remove(SV),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement,e=this._secondElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(AV),t.classList.add(SV)),e?.parentElement&&(e.classList.remove(AV),e.classList.add(SV))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{top:o,bottom:s,left:a,right:l}=n,{frozenRowCount:h,frozenColCount:c}=t;if(i>=h&&h>0){if(s<t.getCellRangeRelativeRect({col:e,row:h-1}).bottom)return!1}else if(s<0)return!1;if(e>=c&&c>0){if(l<t.getCellRangeRelativeRect({col:c-1,row:i}).right)return!1}else if(l<0)return!1;const{offsetHeight:u,offsetWidth:d}=r;return!(u<o)&&!(d<a)}_bindToCell(t,e,i,n,r){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const e=.8*a;o.style.maxWidth=`${e}px`;const i=o.clientWidth,h=o.clientHeight;let c,u;return n?(c=n.x+t.tableX,u=n.y+t.tableY):r&&(c=r.rect.right-i+t.tableX,u=r.rect.bottom+t.tableY),u+h>l&&(u=l-h,c+=i-2),u<0&&(u/=2),o.style.top=`${u}px`,c<0?c=0:c+i>a&&(c=a-i),o.style.left=`${c}px`,!0}return!1}_bindSecondElement(t,e,i,n,r){const o=this._secondElement,s=this._rootElement,a=t.getElement(),{width:l,left:h,top:c}=t.internalProps.element.getBoundingClientRect(),{x:u,y:d,width:p}=s.getBoundingClientRect();if(o){o.parentElement!==a&&a.appendChild(o),o.style.left="0px";const t=.8*l;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=r-4-c,s=n-h;o.style.top=`${i}px`;let u=s;return u+e>l?u=u-e-p:u+=4,o.style.left=`${u}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();if(t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5)return!0;if(this._secondElement){const{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();if(t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5)return!0}return!1}}function DV(t,e){const i=wV("div",[xV,e?BV:TV]);if("string"==typeof t){const e=wV("span",[_V,HV,LV]);e.innerHTML=t,i.appendChild(e)}else if("object"==typeof t){const n=t.type??"item";if("split"===n)return i?.classList.add(RV),i;if(t?.icon?.svg)if(_f.test(t.icon.svg)){const e=new Image;t.icon.width?e.style.width=t.icon.width.toString()+"px":e.style.width="16px",t.icon.height?e.style.height=t.icon.height.toString()+"px":e.style.height="16px",e.src=t.icon.svg,i.appendChild(e)}else{const n=wV("span",[MV,HV]);n.innerHTML=e&&t.selectedIcon&&t.selectedIcon.svg?t.selectedIcon.svg:t.icon.svg,t.icon.width&&n.children[0].setAttribute("width",t.icon.width.toString()),t.icon.height&&n.children[0].setAttribute("height",t.icon.height.toString()),i.appendChild(n)}const r=wV("span",[_V,HV,LV]);if(r.innerHTML=t.text,i.appendChild(r),"title"===n)i?.classList.add(HV,PV);else if(t?.children?.length){const t=wV("span",[_V,HV,EV]);t.innerHTML=e?'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#2E68CF" fill-opacity="0.65"></path></svg>':'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#141414" fill-opacity="0.65"></path></svg>',i.appendChild(t)}}return i}let FV;class zV extends ku{static get DEFAULT(){return FV||(FV=new zV)}constructor(t={},e={}){super(t,e),this.textAlign=(t.textAlign??e?.textAlign)||"center"}clone(){return new zV(this)}}class WV{normalIcon;upIcon;downIcon;freezeIcon;frozenIcon;frozenCurrentIcon;dropDownAbsoluteIcon;expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=yj();this.freezeIcon=e[Qc.freezeIconName],this.frozenIcon=e[Qc.frozenIconName],this.frozenCurrentIcon=e[Qc.frozenCurrentIconName],this.normalIcon=e[Qc.normalIconName],this.upIcon=e[Qc.upwardIconName],this.downIcon=e[Qc.downwardIconName],this.dropDownAbsoluteIcon=e[Qc.dropdownIconName],this.expandIcon=e[Qc.expandIconName],this.collapseIcon=e[Qc.collapseIconName]}getIcons(t,e){const i=[];if(this._table.isPivotTable()){const{showSort:n}=this._table.internalProps.layoutMap.getHeader(t,e);if(n){const n=this._table.getPivotSortState(t,e),r="asc"===n?this.downIcon:"desc"===n?this.upIcon:this.normalIcon;r&&i.push(r)}}else{const n=this._table.sortState;let r;r=void 0;const o=this._table.getCellRange(t,e);if(n)if(Array.isArray(n))for(let t=0;t<n.length;t++){const e=n[t],i=this._table._getHeaderCellBySortState(e);if(i&&qp(o,i.col,i.row)){({order:r}=e);break}}else{const t=this._table._getHeaderCellBySortState(n);t&&qp(o,t.col,t.row)&&({order:r}=n)}const s=this.getSortIcon(r,this._table,t,e);s&&i.push(s)}if(this._table.showFrozenIcon&&t<this._table.allowFrozenColCount){const n=this.getFrozenIcon(t,e);n&&i.push(n)}if(this.checkDropDownIcon(this._table,t,e)){const t=this.dropDownAbsoluteIcon;i.push(t)}const n=this.getDropDownStateIcons(this._table,t,e);n.length&&i.push(...n);const{headerIcon:r}=this._table._getHeaderLayoutMap(t,e),o=this.getHierarchyIcon(t,e);if(o&&i.push(o),r){let n;if("function"==typeof r){n=r({col:t,row:e,value:this._table.getCellValue(t,e),dataValue:this._table.getCellOriginValue(t,e),table:this._table})}else n=r;const o=yj(),s=t=>{let e;e="string"==typeof t?o[t]:t,e&&i.push(e)};Array.isArray(n)?n.forEach(((t,e)=>{s(t)})):s(n)}return i}getFrozenIcon(t,e){if(this._table.isPivotTable()||this._table.transpose)return null;if(this._table.rightFrozenColCount&&t>=this._table.colCount-this._table.rightFrozenColCount)return null;const i=this._table.getHeaderDefine(t,e);if(i.columns&&i.columns.length>0)return null;let n=this.freezeIcon;return this._table.options.frozenColCount-1>t?n=this.frozenIcon:this._table.options.frozenColCount-1===t&&(n=this.frozenCurrentIcon),n}getSortIcon(t,e,i,n){const r="asc"===t?this.downIcon:"desc"===t?this.upIcon:this.normalIcon,o=e.getHeaderDefine(i,n);return!o||!o.showSort&&!o.sort||o.columns&&o.columns.length>0?null:r}getDropDownStateIcons(t,e,i){const n=t.getHeaderDefine(e,i),r=t._getHeaderLayoutMap(e,i),{dropDownMenu:o}=r,s=[];if(Array.isArray(o)&&o.length||Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!n?.columns?.length){const n=o||t.globalDropDownMenu;let r=-1,a=-1;for(let o=0;o<n.length;o++){const s=n[o];if("object"==typeof s&&s.children&&s.children.length)for(let n=0;n<s.children.length;n++){const l=s.children[n];if(t.stateManeger.menu?.dropDownMenuHighlight&&IV(t,t.stateManeger.menu?.dropDownMenuHighlight,"object"==typeof l?l?.menuKey:l,e,i)){r=o,a=n;break}}if(t._dropDownMenuIsHighlight(e,i,o)){r=o;break}}if(-1!==r){let e;e=-1!==a?(o||t.globalDropDownMenu)[r].children[a]:(o||t.globalDropDownMenu)[r],e.stateIcon&&(e.stateIcon.svg?s.push({type:"svg",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,svg:e.stateIcon.svg,positionType:Zc.right,marginRight:0,funcType:Jc.dropDownState,interactive:!1}):e.stateIcon.src&&s.push({type:"image",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,src:e.stateIcon.src,positionType:Zc.right,marginRight:0,funcType:Jc.dropDownState,interactive:!1}))}}return s}getDropDownIconRect(t,e,i){const n=this.downIcon.hover?.width??this.downIcon?.width??0,r=this.downIcon.hover?.height??this.downIcon?.height??0,o=t.right-2-n,s=t.right-2;let a;a="middle"===i?t.top+t.height/2-n/2:"top"===i?t.top+e/2:"bottom"===i?t.bottom-2*e:t.top;return{left:o,right:s,top:a,bottom:r+a,width:n,height:r}}getHierarchyIcon(t,e){const{hierarchyState:i}=this._table._getHeaderLayoutMap(t,e);if(i){if(i===Xc.expand)return this.expandIcon;if(i===Xc.collapse)return this.collapseIcon}}checkDropDownIcon(t,e,i){if(t.isPivotTable()){const n=t._getHeaderLayoutMap(e,i);if(Array.isArray(n.dropDownMenu)&&n.dropDownMenu.length)return!0}else{const n=t.getHeaderDefine(e,i);if(Array.isArray(n.dropDownMenu)&&n.dropDownMenu.length||(!Array.isArray(n.dropDownMenu)||0!==n.dropDownMenu.length)&&Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!n?.columns?.length)return!0}return!1}getStyleClass(t){switch(t){case"text":case"link":return Ou;case"image":case"video":return zV}}}class jV{_table;_tooltipElement;constructor(t){this._table=t}release(){this.unbindTooltipElement(),this._tooltipElement&&this._tooltipElement.release?.(),this._tooltipElement=void 0}_getTooltipElement(){return this._tooltipElement||(this._tooltipElement=this.createTooltipElementInternal()),this._tooltipElement}bindTooltipElement(t,e,i,n){return this._getTooltipElement().bindToCell(this._table,t,e,i,n)}moveTooltipElement(t,e,i,n){this._getTooltipElement().move(this._table,t,e,i,n)}unbindTooltipElement(){this._getTooltipElement().unbindFromCell()}locateTooltipElement(t,e,i,n,r){this._getTooltipElement()._locate(this._table,t,e,i,n,r)}}!function(){const t=document.createElement("style");t.id="vtable-tooltip-styleSheet",t.textContent="\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\tpointer-events: none;\n\tuser-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n border: 1px solid #E6E8ED;\n box-sizing: border-box;\n border-radius: 4px;\n box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n color: #141414;\n font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow: hidden;\n\tword-wrap: break-word;\n\tposition: relative;\n\tbackground-color: #FFF;\n\tz-index: 2;\n\tborder-radius: 4px\n}\n.vtable__bubble-tooltip-element__triangle {\n\t/* font-size: .75rem; */\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tdisplay: block;\n\ttransform: rotate(45deg);\n transform-origin: 50% 50% 0;\n\tz-index: 1;\n\tbackground-color: #FFF;\n\tborder: 1px solid #E6E8ED;\n}\n",document.body.appendChild(t)}();const NV="vtable__bubble-tooltip-element",GV=`${NV}__content`,VV=`${NV}__triangle`,UV=`${NV}--hidden`,KV=`${NV}--shown`;class $V{_handler;_rootElement;_messageElement;_triangleElement;constructor(){this._handler=new df;const t=this._rootElement=wV("div",[NV,UV]),e=wV("span",[GV]),i=wV("span",[VV]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${GV}`)||void 0,this._triangleElement=t.querySelector(`.${VV}`)||void 0}bindToCell(t,e,i,n,r){const o=this._rootElement,s=this._messageElement,a=this._triangleElement;if(o?.classList.remove(KV),o?.classList.add(UV),this._canBindToCell(t,e,i)){s.setAttribute("style",""),a.setAttribute("style",""),n?.className&&o.classList.add(n.className),n?.style?.bgColor&&(s.style.backgroundColor=n?.style?.bgColor),n?.style?.bgColor&&(a.style.backgroundColor=n?.style?.bgColor),a.style.display=!0===n?.style?.arrowMark?"block":"none",n?.style?.font&&(s.style.font=n?.style?.font),n?.style?.color&&(s.style.color=n?.style?.color),n?.style?.padding&&(s.style.padding=`${n?.style?.padding.join("px ")}px`),s&&(s.textContent=n?.content);if(this._bindToCell(t,e,i,n?.position,n?.referencePosition,r,n?.style?.arrowMark))return o?.classList.add(KV),o?.classList.remove(UV),!0}else this.unbindFromCell();return!1}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler?.release?.(),delete this._rootElement,delete this._messageElement}move(t,e,i,n,r){const o=this._rootElement;this._canBindToCell(t,e,i)?(this._bindToCell(t,e,i,n?.position,n?.referencePosition,r),o?.classList.add(KV),o?.classList.remove(UV)):this.unbindFromCell()}unbindFromCell(){const t=this._rootElement;t?.parentElement&&(t.classList.remove(KV),t.classList.add(UV))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{bottom:o,left:s,right:a}=n,{frozenRowCount:l,frozenColCount:h}=t;if(i>=l&&l>0){if(o<t.getCellRangeRelativeRect({col:e,row:l-1}).bottom)return!1}else if(o<0)return!1;if(e>=h&&h>0){if(a<t.getCellRangeRelativeRect({col:h-1,row:i}).right)return!1}else if(s<0)return!1;const{offsetHeight:c,offsetWidth:u}=r;return!(c<o)&&!(u<s)}_bindToCell(t,e,i,n,r,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),h=t.getElement(),c=t.internalProps.element.offsetWidth,{width:u}=l;if(a){let l,d;a.parentElement!==h&&h.appendChild(a),a.style.left="0px";const p=Math.min(.8*c,4*u);a.style.maxWidth=`${p}px`;const f=a.clientWidth,g=a.clientHeight;if(!n&&!r)return!1;{const a=this.getComputedPosition(t,e,i,n,r,o,s);d=a.x,l=a.y}a.style.left=`${d}px`,a.style.top=`${l}px`,wu()&&(a.style.fontSize="11px");const{x1:m,x2:y,y1:b,y2:v}=t.stateManeger.menu.bounds,w=d,C=w+f,x=l,_=w+g;return!(t.stateManeger.menu.isShow&&m<C&&y>w&&v>x&&b<_)}return!1}getComputedPosition(t,e,i,n,r,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),{width:h,height:c}=t.internalProps.element.getBoundingClientRect(),{width:u}=l;let d,p;const f=Math.min(.8*h,4*u);a.style.maxWidth=`${f}px`;const g=a.clientWidth,m=a.clientHeight,y=s?6:0;if(n)p=n.x,d=n.y+y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(r){let e=r.placement??$c.bottom;const i=r.rect.left+r.rect.width/2+t.tableX,n=r.rect.top+r.rect.height/2+t.tableY,s=r.rect.top+t.tableY,a=r.rect.bottom+t.tableY,l=r.rect.left+t.tableX,u=r.rect.right+t.tableX;let f=0;const b=()=>{f++,f>=4||(this.removeStyleFromTriangle(),e===$c.top?(p=i-g/2,d=s-m-y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",o&&d<0&&(e=$c.right,b())):e===$c.bottom?(p=i-g/2,d=a+y,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",o&&d+m>c&&(e=$c.left,b())):e===$c.left?(d=n-m/2,p=l-g-y,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",o&&p<0&&(e=$c.top,b())):e===$c.right&&(d=n-m/2,p=u+y,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",o&&p+g>h&&(e=$c.bottom,b())))};b()}return o&&(p<0?p=0:p+a.offsetWidth>h&&(p=h-a.offsetWidth)),{x:p,y:d}}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,n,r,o){const s=this.getComputedPosition(t,e,i,n,r,o),a=s.x,l=s.y;this._rootElement.style.left=`${a}px`,this._rootElement.style.top=`${l}px`}}class XV extends jV{createTooltipElementInternal(){return new $V}}const YV={"bubble-tooltip":function(t){return new XV(t)}};class qV{_table;_tooltipInstances;_attachInfo;confine;constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}release(){const t=this._tooltipInstances;for(const e in t)t[e]?.release?.();delete this._tooltipInstances,this._attachInfo=null}_bindToCell(t,e,i){const n=this._attachInfo,r=this._getTooltipInstanceInfo(t,e);if(!n||r&&n.instance===r||(n.instance?.unbindTooltipElement(),this._attachInfo=null),!r)return;if(r&&r.bindTooltipElement(t,e,i,this.confine)){const n=this._table.getCellRange(t,e);this._attachInfo={range:n,instance:r,tooltipOptions:i}}}_move(t,e,i){const n=this._attachInfo;if(!n||!qp(n.range,t,e))return;const{instance:r}=n;r?.moveTooltipElement(t,e,i,this.confine)}moveToPosition(t,e,i,n){const r=this._attachInfo;if(!r||!qp(r.range,t,e))return;const{instance:o}=r;this._attachInfo.tooltipOptions.position=i,this._attachInfo.tooltipOptions.referencePosition=n,o?.locateTooltipElement(t,e,i,n,this.confine)}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindTooltipElement(),this._attachInfo=null}_isBindCell(t,e){const i=this._attachInfo;return!!i&&qp(i.range,t,e)}_bindTableEvent(t){t.on(sf.MOUSEENTER_CELL,(e=>{if(wu())return;const{x1:i,x2:n,y1:r,y2:o}=t.stateManeger.menu.bounds;if(t.stateManeger.menu.isShow&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>i&&e.x<n&&e.y>r&&e.y<o)return;const{col:s,row:a}=e;if((!e.related||!this._isBindCell(s,a))&&t.internalProps.tooltip?.isShowOverflowTextTooltip){const i=t.getCellOverflowText(s,a),n=t.getHeaderDescription(s,a),r=t.getCellRangeRelativeRect({col:s,row:a});let o;i&&(o={content:n?`${n}\n ${i}`:i,referencePosition:{placement:$c.bottom,rect:r},style:{arrowMark:!1}}),n&&(o={content:n,referencePosition:{placement:$c.bottom,rect:r},style:{arrowMark:!1}}),o&&this._bindToCell(e.col,e.row,o)}})),t.on(sf.MOUSEMOVE_CELL,(e=>{if(!wu()){if(this._attachInfo?.tooltipOptions?.referencePosition){const i=this._attachInfo.tooltipOptions.referencePosition,{event:n}=e,{left:r,right:o,top:s,bottom:a}=i.rect,l=t._getMouseAbstractPoint(n,!1);l.inTable&&l.x>=r-5&&l.x<=o+5&&l.y>=s-5&&l.y<=a+5||this._unbindFromCell()}this._attachInfo&&t.stateManeger.menu.isShow&&this._bindToCell(e.col,e.row)}})),t.on(sf.MOUSELEAVE_CELL,(t=>{t.related&&this._isBindCell(t.related.col,t.related.row)||this._unbindFromCell()})),t.on(sf.SELECTED_CELL,(t=>{this._isBindCell(t.col,t.row)&&this._unbindFromCell()})),t.on(sf.MOUSELEAVE_TABLE,(t=>{this._unbindFromCell()})),t.on(sf.SCROLL,(e=>{const i=this._attachInfo;if(i?.tooltipOptions&&i?.range?.start){const{col:e,row:n}=i.range.start,r=t.getCellRangeRelativeRect({col:e,row:n});i.tooltipOptions.referencePosition.rect=r,this._move(i.range.start.col,i.range.start.row,i.tooltipOptions)}}))}_getTooltipInstanceInfo(t,e){const i=this._table,n=this._tooltipInstances,r="bubble-tooltip";return n&&n[r]||n&&(n[r]=YV[r](i))}isBinded(t){return JSON.stringify(t)===JSON.stringify(this._attachInfo?.tooltipOptions)}}const ZV=new Map;function JV(t,e,i){const n=`${t}-${e}-${i}`,r=ZV.get(n);if(r)return r;const o=(s={fontSize:t,fontFamily:i,fontWeight:e},new Lp({defaultFontParams:{fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:11},getTextBounds:l?void 0:lT,specialCharSet:`{}()//&-/: .,@%'"~${Lp.ALPHABET_CHAR_SET}${Lp.ALPHABET_CHAR_SET.toUpperCase()}`,...a??{}},s));var s,a,l;return ZV.set(n,o),o}const QV=new class{measureText(t,e){const{fontSize:i,fontFamily:n,fontWeight:r}=e;return JV(i,r,n).measure(t)}measureTextWidth(t,e){const{fontSize:i,fontFamily:n="sans-serif",fontWeight:r="normal"}=e;return JV(i,r,n).measure(t).width}clipText(t,e,i){if(0===t.length)return{str:"",width:0};let n=this.measureTextWidth(t,e);return n<=i?{str:t,width:n}:(n=this.measureTextWidth(t[0],e),n>i?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,r){const o=Math.floor((n+r)/2),s=t.substring(0,o+1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const r=t.substring(0,o);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipText(t,e,i,n,o)}if(a<i){if(o>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,o+2);return l=this.measureTextWidth(n,e),l>=i?{str:s,width:a}:this._clipText(t,e,i,o,r)}return{str:s,width:a}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const o=this.measureTextWidth(n,e);if(o>i)return{str:"",width:0};i-=o;const s=this._clipText(t,e,i,0,t.length-1);return s.str+=n,s.width+=o,s}};class tU{_table;_menuElement;constructor(t){this._table=t}release(){this.unbindMenuElement(),this._menuElement&&this._menuElement.release(),this._menuElement=void 0}_getMenuElement(){return this._menuElement||(this._menuElement=this.createMenuElementInternal()),this._menuElement}bindMenuElement(t,e,i){return this._getMenuElement().bindToCell(this._table,t,e,i)}unbindMenuElement(){this._getMenuElement().unbindFromCell()}pointInMenuElement(t,e){return this._getMenuElement().pointInMenuElement(t,e)}}const eU="vtable__menu-element",iU=`${eU}--hidden`,nU=`${eU}--shown`;class rU{_handler;_rootElement;_menuInstanceInfo;constructor(t){this._handler=new df,this._rootElement=wV("div",[eU,iU]),this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(iU))return;const{col:i,row:n,dropDownIndex:r,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof r||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,n):t.getHeaderField(i,n),h=t._dropDownMenuIsHighlight(i,n,r);t.fireListeners(sf.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,n)}),t.fireListeners(sf.DROPDOWN_MENU_CLEAR,null),t.fireListeners(sf.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(iU)||t.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement;if(this._menuInstanceInfo=n,r?.classList.remove(nU),r?.classList.add(iU),this._canBindToCell(t,e,i)){r.innerHTML="",r.appendChild(n.content);if(this._bindCell(t,e,i,n.position,n.referencePosition))return r?.classList.add(nU),r?.classList.remove(iU),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(nU),t.classList.add(iU))}_canBindToCell(t,e,i){const n=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{top:o,bottom:s,left:a,right:l}=n,{frozenRowCount:h,frozenColCount:c}=t;if(i>=h&&h>0){if(s<t.getCellRangeRelativeRect({col:e,row:h-1}).bottom)return!1}else if(s<0)return!1;if(e>=c&&c>0){if(l<t.getCellRangeRelativeRect({col:c-1,row:i}).right)return!1}else if(l<0)return!1;const{offsetHeight:u,offsetWidth:d}=r;return!(u<o)&&!(d<a)}_bindCell(t,e,i,n,r){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const t=.8*a;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=o.clientHeight;let h,c;return n&&(h=n.x,c=n.y),r&&(h=r.rect.right-e,c=r.rect.bottom),c+i>l&&(c=l-i,h+=e-2),c<0&&(c/=2),o.style.top=`${c}px`,h<0?h=0:h+e>a&&(h=a-e),o.style.left=`${h}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:n,y:r,width:o,height:s}=i.getBoundingClientRect();return t>n-5&&t<n+o+5&&e>r-5&&e<r+s+5}}class oU extends tU{createMenuElementInternal(){return new OV(this._table)}}let sU=class extends tU{createMenuElementInternal(){return new rU(this._table)}};const aU={"dropdown-menu":function(t){return new oU(t)},"context-menu":function(t){return new oU(t)},container:t=>new sU(t)};class lU{_table;_menuInstances;_attachInfo;constructor(t){this._table=t,this._menuInstances={},this._bindTableEvent(t)}release(){const t=this._menuInstances;for(const e in t)t[e].release();delete this._menuInstances,this._attachInfo=null}_bindToCell(t,e,i,n){const r=this._attachInfo,o=this._getMenuInstanceInfo(t,e,i,n);if(!r||o&&r.instance===o.instance||(r.instance?.unbindMenuElement(),this._attachInfo=null),!o)return;const{instance:s,info:a}=o;if(s&&s.bindMenuElement(t,e,a)){const i=this._table.getCellRange(t,e);this._attachInfo={range:i,instance:s}}}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindMenuElement(),this._attachInfo=null}_isBindToCell(t,e){const i=this._attachInfo;return!!i&&qp(i.range,t,e)}pointInMenuElement(t,e){if(!this._attachInfo)return!1;const i=this._attachInfo,{instance:n}=i;return n.pointInMenuElement(t,e)}_bindTableEvent(t){t.on(sf.DROPDOWN_ICON_CLICK,(t=>{this._attachInfo&&this._isBindToCell(t.col,t.row)?this._unbindFromCell():this._bindToCell(t.col,t.row,"dropdown-menu")})),t.on(sf.DROPDOWN_MENU_CLEAR,(t=>{this._unbindFromCell()})),t.on(sf.CONTEXTMENU_CELL,(e=>{if("html"===t.internalProps.menu?.renderMode){const i=t._getMouseAbstractPoint(e.event,!1);let n=null;i.inTable&&"function"==typeof t.internalProps.menu?.contextMenuItems?n=t.internalProps.menu.contextMenuItems(t.getHeaderField(e.col,e.row),e.row):i.inTable&&Array.isArray(t.internalProps.menu?.contextMenuItems)&&(n=t.internalProps.menu?.contextMenuItems),this._bindToCell(e.col,e.row,"context-menu",{content:n,position:{x:i.x,y:i.y}})}}))}_getMenuInstanceInfo(t,e,i,n){const r=this._table,o=this._menuInstances,s=function(t,e,i,n,r){const{lineHeight:o,textBaseline:s,textStick:a}=t._getCellStyle(e,i);let l=t.getCellRangeRelativeRect(t.getCellRange(e,i));a&&(l=t.getVisibleCellRangeRelativeRect({col:e,row:i}));let{left:h,right:c,bottom:u,top:d,width:p,height:f}=l;if(t.isHeader(e,i)&&({left:h,right:c,bottom:u,top:d,width:p,height:f}=t.internalProps.headerHelper.getDropDownIconRect(l,o,s||"middle")),r?.content)return{type:n,position:r.position,referencePosition:r.referencePosition??{rect:{left:h,right:c,top:d,bottom:u,width:p,height:f}},content:r.content};if("dropdown-menu"===n){const{dropDownMenu:r=t.globalDropDownMenu,pivotInfo:o}=t._getHeaderLayoutMap(e,i);return{type:n,referencePosition:{rect:{left:h,right:c,top:d,bottom:u,width:p,height:f}},content:r,pivotInfo:o}}return null}(r,t,e,i,n);if(!s)return null;return{instance:o&&o[i]||o&&(o[i]=aU[i](r)),type:i,info:s}}}class hU extends EventTarget{_table;_input;constructor(t,e){if(super(),this._table=t,"node"===hf.mode)return;const i=document.createElement("div");i.style.opacity="0",i.dataset.vtable="vtable",i.style.pointerEvents="none",i.classList.add("input-container");const n=this._input=document.createElement("input");i.appendChild(n),n.classList.add("table-focus-control"),n.dataset.vtable="vtable",n.readOnly=!0,e.appendChild(i)}focus(){this._input.focus({preventScroll:!0})}setFocusRect(t,e){const i=this._input;i.value=e,i.select();const n=t.top-this._table.scrollTop,r=t.left-this._table.scrollLeft;i.style.top=`${n.toFixed()}px`,i.style.left=`${r.toFixed()}px`,i.style.width=`${t.width.toFixed()}px`,i.style.height=`${t.height.toFixed()}px`}get input(){return this._input}release(){}}let cU=1;Op?cU=1:(cU=Math.ceil(window.devicePixelRatio||1),cU>1&&cU%2!=0&&(cU+=1));const uU={orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fill:"#000000",fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:"#89909D",fontSize:14},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!0,visible:!0};function dU(t,e){const{title:i={},item:n={},pager:r={},background:o={},type:s,id:a,visible:l,orient:h,position:c,data:u,filter:d,regionId:p,regionIndex:f,seriesIndex:g,seriesId:m,padding:y,...b}=fd({},uU,t),v=b;return i.visible&&(v.title=nO(i)),od(n.focusIconStyle)||rO(n.focusIconStyle),oO(n.shape),oO(n.label),oO(n.value),oO(n.background),lj(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),lj(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),lj(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,od(r.textStyle)||rO(r.textStyle),oO(r.handler),v.pager=r,o.visible&&!od(o.style)&&(fd(v,o.style),Uu(o.padding)&&(v.padding=o.padding)),v}class pU{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=cd(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),e=new CI(fd({},t,{defaultSelected:this.selectedData}));e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const n=this.table.tableNoFrameWidth,r=this.table.tableNoFrameHeight,o=RW(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=n-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=r-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,u=0;"horizontal"===l?c="middle"===h?(n-e)/2:"end"===h?n-e-o[1]:o[3]:u="middle"===h?(r-i)/2:"end"===h?r-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:u,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){return{layout:"bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",items:this.getLegendItems(),maxWidth:t.width,maxHeight:t.height,...dU(this.option,t)}}getLegendItems(){return this.option.data}initEvent(){this.legendComponent&&(this.legendComponent.addEventListener(mI.legendItemClick,(t=>{const e=sd(t,"detail.currentSelected");this.table.fireListeners(sf.LEGEND_ITEM_CLICK,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(mI.legendItemHover,(t=>{const e=sd(t,"detail");this.table.fireListeners(sf.LEGEND_ITEM_HOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(mI.legendItemUnHover,(t=>{const e=sd(t,"detail");this.table.fireListeners(sf.LEGEND_ITEM_UNHOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener("legendItemAttributeUpdate",(t=>{this.table.scenegraph.updateNextFrame()})))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}const fU={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},gU={horizontal:{...fU,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...fU,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},mU={horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...fU},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...fU}};function yU(t,e){const{title:i={},handler:n={},rail:r={},track:o={},startText:s,endText:a,handlerText:l,sizeBackground:h,background:c={},type:u,id:d,visible:p,orient:f,position:g,data:m,defaultSelected:y,field:b,filter:v,regionId:w,regionIndex:C,seriesIndex:x,seriesId:_,padding:S,...A}=fd({},("color"===t.type?gU:mU)["bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"],t),T=A;return i.visible&&(T.title=nO(i)),T.showHandler=!1!==n.visible,od(n.style)||(T.handlerStyle=rO(n.style)),Uu(r.width)&&(T.railWidth=r.width),Uu(r.height)&&(T.railHeight=r.height),od(r.style)||(T.railStyle=rO(r.style)),od(o.style)||(T.trackStyle=rO(o.style)),T.startText=oO(s),T.endText=oO(a),T.handlerText=oO(l),od(h)||(T.sizeBackground=rO(h)),c.visible&&!od(c.style)&&(fd(T,c.style),Uu(c.padding)&&(T.padding=c.padding)),T}class bU{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=cd(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight});let e;e="color"===this.option.type?new QI(fd({},t,{slidable:!0})):new eO(fd({},t,{slidable:!0})),e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const n=this.table.tableNoFrameWidth,r=this.table.tableNoFrameHeight,o=RW(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=n-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=r-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,u=0;"horizontal"===l?c="middle"===h?(n-e)/2:"end"===h?n-e-o[1]:o[3]:u="middle"===h?(r-i)/2:"end"===h?r-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:u,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){const e="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.orient;return{...yU(this.option),layout:e,align:i,min:this.option.min,max:this.option.max,value:this.option.value,["color"===this.option.type?"colors":"sizeRange"]:"color"===this.option.type?this.option.colors:this.option.sizeRange}}initEvent(){this.legendComponent&&this.legendComponent.addEventListener("change",(t=>{const e=sd(t,"detail.value");this.table.fireListeners(sf.LEGEND_CHANGE,{model:this,value:e,event:t}),this.table.scenegraph.updateNextFrame()}))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}function vU(t,e){return"color"===t.type||"size"===t.type?new bU(t,e):new pU(t,e)}class wU{table;_titleOption;_titleComponent;_cacheAttrs;constructor(t,e){this.table=e,this._titleOption=t,this._titleComponent=this._createOrUpdateTitleComponent(this._getTitleAttrs())}_createOrUpdateTitleComponent(t){if(this._titleComponent)yd(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=new iO(t);e.name="title",this.table.scenegraph.stage.defaultLayer.appendChild(e),this._titleComponent=e}return this._adjustTableSize(this._titleComponent.attribute),this._titleComponent}resize(){if(!this._titleComponent)return;const t=RW(this._titleOption.padding??10),e=this._titleOption.width??this.table.tableNoFrameWidth-t[1]-t[3];this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:e,textStyle:{width:e,...this._titleOption.textStyle},subtextStyle:{width:e,...this._titleOption.subtextStyle}}),this._adjustTableSize(this._titleComponent.attribute)}_adjustTableSize(t){let e=isFinite(this._titleComponent.AABBBounds.width())?this._titleComponent.AABBBounds.width():0;const i=isFinite(this._titleComponent.AABBBounds.height())?this._titleComponent.AABBBounds.height():0,n=(this.table.tableNoFrameWidth,this.table.tableNoFrameHeight,RW(t.padding??this._titleOption.padding??10));"left"===this._titleOption.orient?n[3]:"top"===this._titleOption.orient?n[0]:"right"===this._titleOption.orient?(n[1],e+=n[1]+n[3]):"bottom"===this._titleOption.orient&&n[2],"left"===this._titleOption.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this._titleOption.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this._titleOption.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this._titleOption.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i)),this._cacheAttrs=t,"right"!==this._titleOption.orient&&"bottom"!==this._titleOption.orient||this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY})}release(){this._titleComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent),this._titleComponent=null}_getTitleAttrs(){const t=RW(this._titleOption.padding??10),e=this._titleOption.width??this.table.tableNoFrameWidth-t[1]-t[3];return{text:this._titleOption.text??"",subtext:this._titleOption.subtext??"",x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:e,height:this._titleOption.height,minWidth:this._titleOption.minWidth,maxWidth:this._titleOption.maxWidth,minHeight:this._titleOption.minHeight,maxHeight:this._titleOption.maxHeight,padding:this._titleOption.padding,align:this._titleOption.align??"left",verticalAlign:this._titleOption.verticalAlign??"top",textStyle:{width:e,...this._titleOption.textStyle},subtextStyle:{width:e,...this._titleOption.subtextStyle}}}}const{toBoxArray:CU}=rf,{isTouchEvent:xU}=nf,_U=/^\$(\d+)\$(\d+)$/;!function(){const t=document.createElement("style");t.id="vtable-style-styleSheet",t.textContent="\n.vtable .input-container {\n\tposition: absolute;\n\ttop:0px;\n}\n.vtable .table-scrollable {\n\tposition: absolute;\n\toverflow: scroll;\n}\n.vtable .table-scrollable::-webkit-scrollbar-button{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-track-piece{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-corner {\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-thumb {\n\tborder-radius : 4px;\n\tbackground-color : rgba(100, 100, 100, .5);\n}\n\n.vtable .table-scroll-end-point {\n\topacity: 0;\n\tposition: relative;\n}\n.vtable {\n\t/* 设置overflow: auto 应该是为了滚动条的某个问题 但设置了auto之后 dom的下拉菜单只能显示在vtable节点中 超出会截断;现在去掉auto 暂时滚动条的问题没有发现 */\n\t/* overflow: auto; */\n\tposition: relative;\n\twidth: 100%;\n\theight: 100%;\n\ttext-align: left;\n -webkit-font-smoothing:auto;\n}\n.vtable > canvas {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n}\n.vtable .table-focus-control {\n\tposition: relative !important;\n\twidth: 1px;\n\theight: 1px;\n\topacity: 0;\n\tpadding: 0;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n\tmax-width: 500px;\n\tmax-height: 500px;\n\tfloat: none !important;\n}\n.vtable input.table-focus-control::-ms-clear {\n\tvisibility: hidden;\n}\n.vtable input.table-focus-control.composition {\n\topacity: 1;\n\tmax-width: none;\n\tmax-height: none;\n}\n",document.body.appendChild(t)}();const SU={};class AU extends Su{internalProps;showFrozenIcon=!0;showSort=!0;padding;globalDropDownMenu;tableNoFrameWidth;tableNoFrameHeight;tableX;tableY;_widthMode;_heightMode;_autoFillWidth;customRender;canvasWidth;canvasHeight;_vDataSet;scenegraph;stateManeger;eventManeger;_pixelRatio;static get EVENT_TYPE(){return sf}options;version="0.10.3-alpha.1";pagination;id=`VTable${Date.now()}`;headerStyleCache;bodyStyleCache;container;constructor(t,e={}){if(super(),!t)throw new Error("vtable's container is undefined");const{frozenColCount:i=0,defaultRowHeight:n=40,defaultHeaderRowHeight:r,defaultColWidth:o=80,defaultHeaderColWidth:s,widthMode:a="standard",heightMode:l="standard",autoFillWidth:h=!1,keyboardOptions:c,columnResizeMode:u,dragHeaderMode:d,showFrozenIcon:p,allowFrozenColCount:f,padding:g,hover:m,menu:y,select:b,customRender:v,pixelRatio:w=cU,renderChartAsync:C,renderChartAsyncBatchCount:x}=e;this.container=t,this.options=e,this.options.container=t,this._widthMode=a,this._heightMode=l,this._autoFillWidth=h,this.customRender=v,this.padding={top:0,right:0,left:0,bottom:0},g&&("number"==typeof g?(this.padding.top=g,this.padding.left=g,this.padding.bottom=g,this.padding.right=g):(g.top&&(this.padding.top=g.top),g.bottom&&(this.padding.bottom=g.bottom),g.left&&(this.padding.left=g.left),g.right&&(this.padding.right=g.right))),this.tableNoFrameWidth=0,this.tableNoFrameHeight=0;const _=this.internalProps={};void 0!==p&&(this.showFrozenIcon=p),"number"==typeof f&&f<=0&&(this.showFrozenIcon=!1),_.handler=new df,_.element=function(t){const e=document.createElement("div");e.setAttribute("tabindex","0"),e.classList.add("vtable"),e.style.outline="none",e.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const i=(e.offsetWidth||e.parentElement?.offsetWidth||1)-1,n=(e.offsetHeight||e.parentElement?.offsetHeight||1)-1;return e.style.width=i&&i-t.left-t.right+"px"||"0px",e.style.height=n&&n-t.top-t.bottom+"px"||"0px",e}(this.padding),_.focusControl=new hU(this,_.element),_.pixelRatio=w,_.canvas=document.createElement("canvas"),_.element.appendChild(_.canvas),_.context=_.canvas.getContext("2d"),_.frozenColCount=i,_.defaultRowHeight=n,_.defaultHeaderRowHeight=r??n,_.defaultColWidth=o,_.defaultHeaderColWidth=s??o,_.keyboardOptions=c,_.columnResizeMode=u,_.dragHeaderMode=d,_.renderChartAsync=C,sN(x),_._rowHeightsMap=new ff,_._rowRangeHeightsMap=new Map,_._colRangeWidthsMap=new Map,_._widthResizedColMap=new Set,this.colWidthsMap=new ff,this.colContentWidthsMap=new ff,this.colWidthsLimit={},_.calcWidthContext={_:_,get full(){return this._.canvas.width/(this._.context.pixelRatio??window.devicePixelRatio)}},_.cellTextOverflows={},_.focusedTable=!1,_.theme=Ff.of(e.theme??Ff.DEFAULT),t?(t.innerHTML="",t.appendChild(_.element),this._updateSize()):this._updateSize(),this.options=e,_.theme=Ff.of(e.theme??Ff.DEFAULT),_.bodyHelper=new vV(this),_.headerHelper=new WV(this),_.autoWrapText=e.autoWrapText,_.allowFrozenColCount=e.allowFrozenColCount??_.colCount,_.limitMaxAutoWidth=e.limitMaxAutoWidth??450,this._vDataSet=new jz,this.scenegraph=new NG(this),this.stateManeger=new rV(this),this.eventManeger=new gV(this),e.legends&&(_.legends=vU(e.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),e.title&&(_.title=new wU(e.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),_.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},e.tooltip),"html"===_.tooltip.renderMode&&(_.tooltipHandler=new qV(this,_.tooltip.confine)),_.menu=Object.assign({renderMode:"html"},e.menu),Array.isArray(e.menu?.dropDownMenuHighlight)&&this.setDropDownMenuHighlight(e.menu?.dropDownMenuHighlight),Array.isArray(e.menu?.defaultHeaderMenuItems)&&(this.globalDropDownMenu=e.menu.defaultHeaderMenuItems),"html"===_.menu.renderMode&&(_.menuHandler=new lU(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map}throttleInvalidate=function(t,e){let i=null;return function(...n){i||(i=setTimeout((()=>{t.apply(this,n),i=null}),e))}}(this.render.bind(this),200);getContainer(){return this.container}getElement(){return this.internalProps.element}get canvas(){return this.internalProps.canvas}resize(){this._updateSize(),this.internalProps.legends&&this.internalProps.legends.resize(),this.internalProps.title&&this.internalProps.title.resize(),this.scenegraph.resize()}get rowCount(){return this.internalProps.rowCount}set rowCount(t){this.internalProps.rowCount=t}get colCount(){return this.internalProps.colCount??0}set colCount(t){this.internalProps.colCount=t}get frozenColCount(){return this.internalProps.frozenColCount??0}set frozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManeger.setFrozenCol(this.internalProps.frozenColCount)}setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManeger.setFrozenCol(this.internalProps.frozenColCount)}_setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t}_resetFrozenColCount(){this.options.frozenColCount&&(this.tableNoFrameWidth-this.getColsWidth(0,this.options.frozenColCount-1)<=120?this._setFrozenColCount(0):this.frozenColCount!==this.options.frozenColCount&&this._setFrozenColCount(this.options.frozenColCount))}get frozenRowCount(){return this.internalProps.frozenRowCount??0}set frozenRowCount(t){this.internalProps.frozenRowCount=t}get rightFrozenColCount(){return this.internalProps.rightFrozenColCount??0}set rightFrozenColCount(t){this.scenegraph.dealWidthRightFrozen(t)}get bottomFrozenRowCount(){return this.internalProps.bottomFrozenRowCount??0}set bottomFrozenRowCount(t){this.scenegraph.dealWidthBottomFrozen(t)}get defaultRowHeight(){return this.internalProps.defaultRowHeight}set defaultRowHeight(t){this.internalProps.defaultRowHeight=t,this.options.defaultRowHeight=t}get defaultHeaderRowHeight(){return this.internalProps.defaultHeaderRowHeight}set defaultHeaderRowHeight(t){this.internalProps.defaultHeaderRowHeight=t,this.options.defaultHeaderRowHeight=t}get defaultColWidth(){return this.internalProps.defaultColWidth}set defaultColWidth(t){this.internalProps.defaultColWidth=t,this.options.defaultColWidth=t}get defaultHeaderColWidth(){return this.internalProps.defaultHeaderColWidth}set defaultHeaderColWidth(t){this.internalProps.defaultHeaderColWidth=t,this.options.defaultHeaderColWidth=t}get colWidthsMap(){return this.internalProps._colWidthsMap}set colWidthsMap(t){this.internalProps._colWidthsMap=t}get colContentWidthsMap(){return this.internalProps._colContentWidthsMap}set colContentWidthsMap(t){this.internalProps._colContentWidthsMap=t}get _colRangeWidthsMap(){return this.internalProps._colRangeWidthsMap}set _colRangeWidthsMap(t){this.internalProps._colRangeWidthsMap=t}get _rowRangeHeightsMap(){return this.internalProps._rowRangeHeightsMap}set _rowRangeHeightsMap(t){this.internalProps._rowRangeHeightsMap=t}get rowHeightsMap(){return this.internalProps._rowHeightsMap}set rowHeightsMap(t){this.internalProps._rowHeightsMap=t}get colWidthsLimit(){return this.internalProps._colWidthsLimit}set colWidthsLimit(t){this.internalProps._colWidthsLimit=t}get keyboardOptions(){return this.internalProps.keyboardOptions??null}set keyboardOptions(t){this.internalProps.keyboardOptions=t??void 0}get widthMode(){return this._widthMode}set widthMode(t){t!==this._widthMode&&(this._widthMode=t,this.options.widthMode=t)}get heightMode(){return this._heightMode}set heightMode(t){t!==this._heightMode&&(this._heightMode=t,this.options.heightMode=t)}get autoFillWidth(){return this._autoFillWidth}set autoFillWidth(t){t!==this._autoFillWidth&&(this._autoFillWidth=t)}_colWidthDefineToPxWidth(t){return"auto"===t?0:dj(this,t)}_getColWidthLimits(t){const e=this.colWidthsLimit[t];if(!e)return null;const i={};return e.min&&(i.min=dj(this,e.min),i.minDef=e.min),e.max&&(i.max=dj(this,e.max),i.maxDef=e.max),i}_adjustColWidth(t,e){const i=this._getColWidthLimits(t);return Math.max(function(t,e){return t?t.min&&t.min>e?t.min:t.max&&t.max<e?t.max:e:e}(i,e),0)}setPixelRatio(t){this.internalProps.pixelRatio=t,this.scenegraph.setPixelRatio(t)}_updateSize(){const{padding:t}=this;let e=0,i=0;if("browser"===hf.mode){const n=this.getElement(),r=n.parentElement?.offsetWidth??0,o=n.parentElement?.offsetHeight??0;n.style.width=r&&r-t.left-t.right+"px"||"0px",n.style.height=o&&o-t.top-t.bottom+"px"||"0px";const{canvas:s}=this.internalProps;e=s.parentElement?.offsetWidth??0,i=s.parentElement?.offsetHeight??0,this?.scenegraph?.stage?this.scenegraph.stage.resize(e,i):(s.style.width="",s.style.height="",s.width=e,s.height=i,s.style.width=`${e}px`,s.style.height=`${i}px`)}else"node"===hf.mode&&(e=this.canvasWidth-1,i=this.canvasHeight-1);const n=Math.floor(e-Fu(this.getTheme().scrollStyle)),r=Math.floor(i-Fu(this.getTheme().scrollStyle));if(this.internalProps.theme?.frameStyle){const t=CU(this.internalProps.theme.frameStyle?.borderLineWidth??[null]),e=CU(this.internalProps.theme.frameStyle?.shadowBlur??[0]);this.tableX=(t[3]??0)+(e[3]??0),this.tableY=(t[0]??0)+(e[0]??0),this.tableNoFrameWidth=n-((t[1]??0)+(e[1]??0))-((t[3]??0)+(e[3]??0)),this.tableNoFrameHeight=r-((t[0]??0)+(e[0]??0))-((t[2]??0)+(e[2]??0))}}get rowHierarchyType(){return"grid"}setColWidths(t){t.forEach(((t,e)=>this.setColWidth(e,t)))}getColsWidth(t,e){e=Math.min(e,this.colCount-1);const i=this._colRangeWidthsMap.get(`$${t}$${e}`);if(null!=i)return i;const n=this._colRangeWidthsMap.get(`$${t}$${e-1}`);if(null!=n){const i=n+this.getColWidth(e);return t>=0&&e>=0&&!Number.isNaN(i)&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(i)),Math.round(i)}let r=0;for(let i=t;i<=e;i++)r+=this.getColWidth(i);return t>=0&&e>=0&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(r)),Math.round(r)}getRowHeight(t){return this.rowHeightsMap.get(t)?this.rowHeightsMap.get(t):this.isColumnHeader(0,t)||this.isCornerHeader(0,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[t]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.isBottomFrozenRow(this.rowHeaderLevelCount,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[this.columnHeaderLevelCount-this.bottomFrozenRowCount]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight}setRowHeight(t,e,i){this.rowHeightsMap.put(t,Math.round(e)),i&&this._clearRowRangeHeightsMap(t)}getRowsHeight(t,e){const i=this._rowRangeHeightsMap.get(`$${t}$${e}`);if(null!=i)return i;const n=this._rowRangeHeightsMap.get(`$${t}$${e-1}`);if(null!=n){const i=Math.round(n+(this.rowHeightsMap.get(e)??(this.isColumnHeader(0,e)||this.isCornerHeader(0,e)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[e]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight)));return t>=0&&e>=0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(i)),i}let r=0;if("standard"===this.heightMode&&this.internalProps.layoutMap&&e>=this.columnHeaderLevelCount&&!this.bottomFrozenRowCount&&!this.hasAutoImageColumn()){for(let e=t;e<this.columnHeaderLevelCount;e++)r+=this.getRowHeight(e);r+=this.defaultRowHeight*(e-Math.max(this.columnHeaderLevelCount,t)+1)}else for(let i=t;i<=e;i++)r+=this.getRowHeight(i);return t>=0&&e>=0&&r>0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(r)),Math.round(r)}getColWidthDefined(t){const{layoutMap:e}=this.internalProps;if("autoWidth"===this.widthMode)return"auto";const{width:i}=e?.getColumnWidthDefined(t)??{};return"number"==typeof i&&i<=0?0:i||(this.isRowHeader(t,0)||this.isCornerHeader(t,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.isRightFrozenColumn(t,this.columnHeaderLevelCount)&&this.isPivotTable()?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[this.rowHeaderLevelCount-this.rightFrozenColCount]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth)}getColWidth(t){const e=this.colWidthsMap.get(t)??0;return"adaptive"===this.widthMode&&"number"==typeof e||this.transpose&&"number"==typeof e?this._colWidthDefineToPxWidth(e):this._adjustColWidth(t,this._colWidthDefineToPxWidth(e))}setColWidth(t,e,i,n){this.colWidthsMap.put(t,"number"==typeof e?Math.round(e):e),i&&this._clearColRangeWidthsMap(t),n||this.stateManeger.checkFrozen()}_clearColRangeWidthsMap(t){if("number"!=typeof t)this._colRangeWidthsMap.clear();else{const e=this._colRangeWidthsMap.keys();for(const i of e){const e=_U.exec(i);if(e){const n=Number(e[1]),r=Number(e[2]);t>=n&&t<=r&&this._colRangeWidthsMap.delete(i)}}}}_clearRowRangeHeightsMap(t){if("number"!=typeof t)this._rowRangeHeightsMap.clear();else{const e=this._rowRangeHeightsMap.keys();for(const i of e){const e=_U.exec(i);if(e){const n=Number(e[1]),r=Number(e[2]);t>=n&&t<=r&&this._rowRangeHeightsMap.delete(i)}}}}_getColContentWidth(t){return Number(this.colContentWidthsMap.get(t))}_setColContentWidth(t,e){this.colContentWidthsMap.put(t,e)}getAllRowsHeight(){if(this.internalProps.rowCount<=0)return 0;return this.getRowsHeight(0,this.internalProps.rowCount-1)}getAllColsWidth(){if(this.internalProps.colCount<=0)return 0;return this.getColsWidth(0,this.internalProps.colCount-1)}getMaxColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.max)??1/0;return"string"==typeof i&&(i=dj(this,i)),i}setMaxColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).max=e}getMinColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.min)??0;return"string"==typeof i&&(i=dj(this,i)),i}setMinColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).min=e}getCellRect(t,e){const i=this.isFrozenCell(t,e);let n=this.getColsWidth(0,t-1)||0;const r=this.getColWidth(t);i&&i.col&&(n+=this.scrollLeft);let o=this.getRowsHeight(0,e-1);const s=this.getRowHeight(e);return i&&i.row&&(o+=this.scrollTop),new gf(Math.round(n),Math.round(o),Math.round(r),Math.round(s))}getMergeCellRect(t,e){const i=this.getCellRange(t,e),n=this.getColsWidth(0,i.start.col-1)||0,r=this.getColsWidth(i.start.col,i.end.col),o=this.getRowsHeight(0,i.start.row-1)||0,s=this.getRowsHeight(i.start.row,i.end.row);return new gf(Math.round(n),Math.round(o),Math.round(r),Math.round(s))}getCellRelativeRect(t,e){return this._toRelativeRect(this.getCellRect(t,e))}getCellRangeRelativeRect(t){if(t.start)return this._toRelativeRect(this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row));const e=this.getCellRange(t.col,t.row);return this._toRelativeRect(this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row))}getVisibleCellRangeRelativeRect(t){let e;return e=t.start?t:this.getCellRange(t.col,t.row),this._getVisiableRect(this.getCellRangeRelativeRect(t),e)}_getVisiableRect(t,e){const i=e.start.col>=this.frozenColCount?Math.max(t.left,this.frozenColCount>=1?this.getColsWidth(0,this.frozenColCount-1):0):t.left,n=Math.min(t.right,this.tableNoFrameWidth),r=t.copy();r.left=i,r.right=n;const o=e.start.row>=this.frozenRowCount?Math.max(t.top,this.frozenRowCount>=1?this.getRowsHeight(0,this.frozenRowCount-1):0):t.top,s=Math.min(t.bottom,this.tableNoFrameHeight);return r.top=o,r.bottom=s,r}getCellsRect(t,e,i,n){const r=this.isFrozenCell(t,e),o=this.isFrozenCell(i,n);let s=this.getColsWidth(0,t-1)||0,a=this.getColsWidth(t,i);if(r&&r.col){const e=this.scrollLeft;s+=e,o&&o.col||(a-=e,a=Math.max(a,this.getColsWidth(t,this.frozenColCount-1)))}let l=this.getRowsHeight(0,e-1),h=this.getRowsHeight(e,n);if(r&&r.row){const t=this.scrollTop;l+=t,o&&o.row||(h-=t,h=Math.max(h,this.getRowsHeight(e,this.frozenRowCount-1)))}return new gf(Math.round(s),Math.round(l),Math.round(a),Math.round(h))}getCellsRectWidth(t,e,i,n){const r=this.isFrozenCell(t,e),o=this.isFrozenCell(i,n);let s=this.getColsWidth(t,i);if(r&&r.col){const e=this.scrollLeft;o&&o.col||(s-=e,s=Math.max(s,this.getColsWidth(t,this.frozenColCount-1)))}return s}getCellRangeRect(t){if(t.start)return this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row)}getCellRangeRectWidth(t){if(t.start)return this.getCellsRectWidth(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRectWidth(e.start.col,e.start.row,e.end.col,e.end.row)}isFrozenCell(t,e){const{frozenRowCount:i,frozenColCount:n}=this.internalProps,r=i>0&&e<i||this.isBottomFrozenRow(t,e),o=n>0&&t<n||this.isRightFrozenColumn(t,e);return r||o?{row:r,col:o}:null}getRowAt(t){const e=function(t,e){if(!t.internalProps.frozenRowCount)return null;let{scrollTop:i}=t;const n=t.internalProps.frozenRowCount;for(let r=0;r<n;r++){const n=t.getRowHeight(r),o=i+n;if(o>e)return{top:i,row:r,bottom:o,height:n};i=o}return null}(this,t);if(e)return e;let i=this.getTargetRowAt(t);return i||(i={top:-1,row:-1,bottom:-1,height:-1}),i}getColAt(t){const e=function(t,e){if(!t.internalProps.frozenColCount)return null;let{scrollLeft:i}=t;const n=t.internalProps.frozenColCount;for(let r=0;r<n;r++){const n=t.getColWidth(r),o=i+n;if(o>e)return{left:i,col:r,right:o,width:n};i=o}return null}(this,t);if(e)return e;let i=this.getTargetColAt(t);return i||(i={left:-1,col:-1,right:-1,width:1}),i}getCellAt(t,e){const i=this.getRowAt(e),{row:n,top:r,bottom:o,height:s}=i,a=this.getColAt(t),{col:l,left:h,right:c,width:u}=a;return{row:n,col:l,rect:{left:h,right:c,top:r,bottom:o,width:u,height:s}}}_checkRowCol(t,e){return t>=0&&t<this.colCount&&e>=0&&e<this.rowCount}_makeVisibleCell(t,e){if(this._checkRowCol(t,e)){const i=this.isFrozenCell(t,e);if(i&&i.col&&i.row)return;const n=this.getCellRect(t,e),r=function(t){let e=0;t.internalProps.frozenColCount>0&&(e=t.getFrozenColsWidth());let i=0;return t.internalProps.frozenRowCount>0&&(i=t.getFrozenRowsHeight()),new gf(t.scrollLeft+e,t.scrollTop+i,t.tableNoFrameWidth-e,t.tableNoFrameHeight-i)}(this);if(r.contains(n))return;i&&i.col||this.getColsWidth(0,this.frozenColCount-1)+n.width>this.canvas.width||(n.left<r.left?this.scrollLeft-=r.left-n.left:r.right<n.right&&(this.scrollLeft-=r.right-n.right)),i&&i.row||this.getRowsHeight(0,this.frozenRowCount-1)+n.height>this.canvas.height||(n.top<r.top?this.scrollTop-=r.top-n.top:r.bottom<n.bottom&&(this.scrollTop-=r.bottom-n.bottom))}}render(){this.scenegraph.renderSceneGraph()}_toRelativeRect(t){const e=t.copy(),i=this.getVisibleRect();return e.offsetLeft(-i.left),e.offsetTop(-i.top),e}getVisibleRect(){const{scrollTop:t,scrollLeft:e}=this,i=this.tableNoFrameWidth,n=this.tableNoFrameHeight;return new gf(e,t,i,n)}get visibleRowCount(){const{frozenRowCount:t}=this,e=this.getVisibleRect(),i=t>0?e.top+this.getRowsHeight(0,t-1):e.top,n=this.getTargetRowAt(i);if(!n)return 0;const r=Math.max(n.top>=i?n.row:n.row+1,t);let o=this.getRowsHeight(0,r-1),s=0;const{rowCount:a}=this;for(let t=r;t<a;t++){const i=o+this.getRowHeight(t);if(e.bottom<i)break;s++,o=i}return s}get visibleColCount(){const{frozenColCount:t}=this,e=this.getVisibleRect(),i=t>0?e.left+this.getColsWidth(0,t-1):e.left,n=this.getTargetColAt(i);if(!n)return 0;const r=Math.max(n.left>=i?n.col:n.col+1,t);let o=this.getColsWidth(0,r-1),s=0;const{colCount:a}=this;for(let t=r;t<a;t++){const i=o+this.getColWidth(t);if(e.right<i)break;s++,o=i}return s}get scrollTop(){return this.stateManeger.scroll.verticalBarPos}set scrollTop(t){this.stateManeger.setScrollTop(t)}get scrollLeft(){return this.stateManeger.scroll.horizontalBarPos}set scrollLeft(t){this.stateManeger.setScrollLeft(t)}getScrollLeft(){return this.scrollLeft}getScrollTop(){return this.scrollTop}setScrollLeft(t){this.scrollLeft=Math.ceil(t)}setScrollTop(t){this.scrollTop=Math.ceil(t)}getCellOverflowText(t,e){return this.scenegraph.getCellOverflowText(t,e)}addReleaseObj(t){if(!t||!t.release||"function"!=typeof t.release)throw new Error("not releaseObj!");(this.internalProps.releaseList=this.internalProps.releaseList||[]).push(t)}dispose(){this.release()}release(){const t=this.internalProps;t.tooltipHandler?.release?.(),t.menuHandler?.release?.(),gj.clearAll(),super.release?.(),t.handler?.release?.(),t.focusControl?.release?.(),t.releaseList&&(t.releaseList.forEach((t=>t?.release?.())),t.releaseList=null),this.scenegraph.stage.release();const{parentElement:e}=t.element;e&&e.removeChild(t.element)}fireListeners(t,e){return super.fireListeners(t,e)}updateOption(t){this.options=t;const{frozenColCount:e=0,defaultRowHeight:i=40,defaultHeaderRowHeight:n,defaultColWidth:r=80,defaultHeaderColWidth:o=80,keyboardOptions:s,columnResizeMode:a,dragHeaderMode:l,showFrozenIcon:h,allowFrozenColCount:c,padding:u,hover:d,menu:p,select:f,pixelRatio:g,widthMode:m,heightMode:y,autoFillWidth:b,customRender:v,renderChartAsync:w,renderChartAsyncBatchCount:C}=t;g&&g!==this.internalProps.pixelRatio&&(this.internalProps.pixelRatio=g),u&&("number"==typeof u?(this.padding.top=u,this.padding.left=u,this.padding.bottom=u,this.padding.right=u):(u.top&&(this.padding.top=u.top),u.bottom&&(this.padding.bottom=u.bottom),u.left&&(this.padding.left=u.left),u.right&&(this.padding.right=u.right))),this.showFrozenIcon="boolean"!=typeof h||h,"number"==typeof c&&c<=0&&(this.showFrozenIcon=!1),this.widthMode=m??"standard",this.heightMode=y??"standard",this.autoFillWidth=b??!1,this.customRender=v;const x=this.internalProps;"node"!==hf.mode&&function(t,e){t.style.margin=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`;const i=(t.offsetWidth||t.parentElement?.offsetWidth||1)-1,n=(t.offsetHeight||t.parentElement?.offsetHeight||1)-1;t.style.width=i&&i-e.left-e.right+"px"||"0px",t.style.height=n&&n-e.top-e.bottom+"px"||"0px"}(x.element,this.padding),x.frozenColCount=e,x.defaultRowHeight=i,x.defaultHeaderRowHeight=n??i,x.defaultColWidth=r,x.defaultHeaderColWidth=o??r,x.keyboardOptions=s,x.columnResizeMode=a,x.dragHeaderMode=l,x.renderChartAsync=w,sN(C),x.cellTextOverflows={},x._rowHeightsMap=new ff,x._rowRangeHeightsMap=new Map,x._colRangeWidthsMap=new Map,x._widthResizedColMap=new Set,this.colWidthsMap=new ff,this.colContentWidthsMap=new ff,this.colWidthsLimit={},x.theme=Ff.of(t.theme??Ff.DEFAULT),x.autoWrapText=t.autoWrapText,x.allowFrozenColCount=t.allowFrozenColCount??x.colCount,x.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this._vDataSet=new jz,x.legends?.release(),x.title?.release(),x.layoutMap.release(),this.scenegraph.clearCells(),this.stateManeger.initState(),this._updateSize(),t.legends&&(x.legends=vU(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(x.title=new wU(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),x.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"!==x.tooltip.renderMode||x.tooltipHandler||(x.tooltipHandler=new qV(this,x.tooltip.confine)),x.menu=Object.assign({renderMode:"html"},t.menu),"html"!==x.menu.renderMode||x.menuHandler||(x.menuHandler=new lU(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.clearColWidthCache(),this.clearRowHeightCache()}renderWithRecreateCells(){this.refreshHeader(),this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}getFrozenRowsHeight(){return this.getRowsHeight(0,this.frozenRowCount-1)}getFrozenColsWidth(){return this.getColsWidth(0,this.frozenColCount-1)}getBottomFrozenRowsHeight(){if(this.bottomFrozenRowCount>0){return this.getRowsHeight(this.rowCount-this.bottomFrozenRowCount,this.rowCount-1)}return 0}getRightFrozenColsWidth(){if(this.rightFrozenColCount>0){return this.getColsWidth(this.colCount-this.rightFrozenColCount,this.colCount-1)}return 0}getDrawRange(){const t=Math.min(this.tableNoFrameWidth,this.getAllColsWidth()),e=Math.min(this.tableNoFrameHeight,this.getAllRowsHeight());return new gf(this.tableX,this.tableY,t,e)}_getMouseAbstractPoint(t,e=!0){const i=this;let n;if(!t)return{inTable:!1,x:void 0,y:void 0};n=xU(t)?t.changedTouches[0]:t;const r=n.clientX||n.pageX+window.scrollX,o=n.clientY||n.pageY+window.scrollY,s=i.internalProps.canvas.getBoundingClientRect();let a=!0;s.right<=r&&(a=!1),s.bottom<=o&&(a=!1);const l=s.width,h=l/(this.canvas.offsetWidth||l),c=s.height,u=c/(this.canvas.offsetHeight||c);return{x:(r-s.left)/h+(e?i.scrollLeft:0)-i.tableX,y:(o-s.top)/u+(e?i.scrollTop:0)-i.tableY,inTable:a}}getTheme(){return this.internalProps.theme}getTargetColAt(t){if(0===t)return{left:0,col:0,right:0,width:0};const e=(e,i)=>{let n=i-this.getColWidth(e);const{colCount:r}=this.internalProps;for(let i=e;i<r;i++){const e=this.getColWidth(i),r=n+e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{left:n,col:i,right:r,width:e};n=r}return null},i=this.computeTargetColByX(t),n=this.getColsWidth(0,i);return t>=n?e(i,n):((e,i)=>{let n=i;for(let i=e;i>=0;i--){const e=this.getColWidth(i),r=n-e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{left:r,col:i,right:n,width:e};n=r}return null})(i,n)}getTargetRowAt(t){if(0===t)return{top:0,row:0,bottom:0,height:0};const e=(e,i)=>{let n=i-this.getRowHeight(e);const{rowCount:r}=this.internalProps;for(let i=e;i<r;i++){const e=this.getRowHeight(i),r=n+e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{top:n,row:i,bottom:r,height:e};n=r}return null},i=this.computeTargetRowByY(t),n=this.getRowsHeight(0,i);return t>=n?e(i,n):((e,i)=>{let n=i;for(let i=e;i>=0;i--){const e=this.getRowHeight(i),r=n-e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{top:r,row:i,bottom:n,height:e};n=r}return null})(i,n)}computeTargetRowByY(t){if(this._rowRangeHeightsMap.get("$0$"+(this.rowCount-1))){let e=0,i=this.rowCount-1;for(;i-e>1;){const n=Math.floor((e+i)/2);if(t<this._rowRangeHeightsMap.get(`$0$${n}`))i=n;else{if(!(t>this._rowRangeHeightsMap.get(`$0$${n}`)))return n;e=n}}return i}return Math.min(Math.ceil(t/this.internalProps.defaultRowHeight),this.rowCount-1)}computeTargetColByX(t){if(this._colRangeWidthsMap.get("$0$"+(this.colCount-1))){let e=0,i=this.colCount-1;for(;i-e>1;){const n=Math.floor((e+i)/2);if(t<this._colRangeWidthsMap.get(`$0$${n}`))i=n;else{if(!(t>this._colRangeWidthsMap.get(`$0$${n}`)))return n;e=n}}return i}return Math.min(Math.ceil(t/this.internalProps.defaultColWidth),this.colCount-1)}clearSelected(){this.stateManeger.updateSelectPos(-1,-1)}selectCell(t,e){this.stateManeger.updateSelectPos(t,e),this.stateManeger.endSelectCells()}get allowFrozenColCount(){return this.internalProps.allowFrozenColCount}get rowHeaderLevelCount(){return this.internalProps.layoutMap.rowHeaderLevelCount}get columnHeaderLevelCount(){return this.internalProps.layoutMap.columnHeaderLevelCount}get records(){return this.internalProps.records}get dataSource(){return this.internalProps.dataSource}set dataSource(t){this.scenegraph.clearCells(),uj(this,t),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()}get autoWrapText(){return this.internalProps.autoWrapText}set autoWrapText(t){this.internalProps.autoWrapText=t,this.options.autoWrapText=t}updateAutoWrapText(t){this.internalProps.autoWrapText!==t&&(this.internalProps.autoWrapText=t,this.options.autoWrapText=t,this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render())}get theme(){return this.internalProps.theme}set theme(t){this.internalProps.theme=Ff.of(t??Ff.DEFAULT),this.options.theme=t}updateTheme(t){this.internalProps.theme=Ff.of(t??Ff.DEFAULT),this.options.theme=t,this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}getBodyField(t,e){return this.internalProps.layoutMap.getBody(t,e).field}getBodyColumnDefine(t,e){const i=this.internalProps.layoutMap.getBody(t,e);return i?.define}getBodyColumnType(t,e){return this.internalProps.layoutMap.getBody(t,e).cellType}getHeaderField(t,e){return this.internalProps.layoutMap.getHeaderField(t,e)}getHeaderFieldKey(t,e){return this.internalProps.layoutMap.getHeaderFieldKey(t,e)}getHeaderDefine(t,e){const i=this.internalProps.layoutMap.getHeader(t,e);return i?.define}getCellLocation(t,e){return this.internalProps.layoutMap.getCellLocation(t,e)}getCellHeaderPaths(t,e){return this.internalProps.layoutMap.getCellHeaderPaths(t,e)}getHeadersDefine(t,e){const i=[];for(;;){const n=this.getHeaderDefine(t,e);if(!n||!n.field&&!n.columns)break;i.push(n),e++}return i}_getHeaderLayoutMap(t,e){return this.internalProps.layoutMap.getHeader(t,e)}_getBodyLayoutMap(t,e){return this.internalProps.layoutMap.getBody(t,e)}getContext(){return this.internalProps.context}getRecordByRowCol(t,e){if(!this.internalProps.layoutMap.isHeader(t,e))return this.internalProps.dataSource?.get(this.getRecordIndexByRow(t,e))}getRecordStartRowByRecordIndex(t){return this.internalProps.layoutMap.getRecordStartRowByRecordIndex(t)}_getHeaderCellBySortState(t){const{layoutMap:e}=this.internalProps;let i;if(i=t.fieldKey?e.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.headerObjects.find((e=>e&&e.field===t.field)),i){return e.getHeaderCellAdress(i.id)}}getCellRange(t,e){return this.internalProps.layoutMap.getCellRange(t,e)}isCellRangeEqual(t,e,i,n){return this.internalProps.layoutMap.isCellRangeEqual(t,e,i,n)}_getLayoutCellId(t,e){return this.internalProps.layoutMap.getCellId(t,e)}getHeaderDescription(t,e){const i=this._getHeaderLayoutMap(t,e),n=i?.define,r=n?.description??i?.description;if("function"==typeof r){return r({col:t,row:e,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e)})}return r}setRecords(t,e){const i="undefined"!=typeof window?window.performance.now():0;if(this.scenegraph.clearCells(),void 0!==e&&(this.internalProps.sortState=e,this.stateManeger.setSortState(this.sortState)),t){if(cj(this,t),this.sortState){let t,e,i;if(Array.isArray(this.sortState)?0!==this.sortState.length&&({order:t,field:e,fieldKey:i}=this.sortState?.[0]):({order:t,field:e,fieldKey:i}=this.sortState),t&&e&&"normal"!==t){const n=this._getSortFuncFromHeaderOption(void 0,e,i);let r;r=i?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===i)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===e)),r?.define?.sort&&this.dataSource.sort(r.field,t,n??Cu)}}this.refreshRowColCount()}else cj(this,t);this.scenegraph.createSceneGraph(),this.render(),console.log("setRecords cost time:",("undefined"!=typeof window?window.performance.now():0)-i)}setRecord(t,e,i){const n=this.getRecordIndexByRow(e,i);this.dataSource.setRecord(t,n)}setDropDownMenuHighlight(t){this.stateManeger.setDropDownMenuHighlight(t)}_dropDownMenuIsHighlight(t,e,i){return this.stateManeger.dropDownMenuIsHighlight(t,e,i)}isHeader(t,e){return this.internalProps.layoutMap&&this.internalProps.layoutMap.isHeader(t,e)}isColumnHeader(t,e){return this.internalProps.layoutMap?.isColumnHeader(t,e)}isRowHeader(t,e){return this.internalProps.layoutMap?.isRowHeader(t,e)}isCornerHeader(t,e){return this.internalProps.layoutMap?.isCornerHeader(t,e)}isRightFrozenColumn(t,e){return this.internalProps.layoutMap?.isRightFrozenColumn(t,e)}isBottomFrozenRow(t,e){return this.internalProps.layoutMap?.isBottomFrozenRow(t,e)}getCellInfo(t,e){const i=this.isHeader(t,e)?this.getHeaderDefine(t,e):this.getBodyColumnDefine(t,e);return{col:t,row:e,field:this.getHeaderField(t,e),cellHeaderPaths:this.internalProps.layoutMap.getCellHeaderPaths(t,e),title:i.title,cellType:i.cellType?"string"==typeof i.cellType?i.cellType:"progressbar":"text",originData:this.getCellOriginRecord(t,e),cellRange:this.getCellRangeRelativeRect({col:t,row:e}),value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellLocation:this.getCellLocation(t,e),scaleRatio:this.canvas.getBoundingClientRect().width/this.canvas.offsetWidth}}_hasField(t,e,i){if(null==t)return!1;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return!1;const r=n.getRecordIndexByRow(e,i);return n.internalProps.dataSource.hasField(r,t)}_getCellStyle(t,e){const{layoutMap:i}=this.internalProps;if(i.isHeader(t,e)){let n=this.headerStyleCache.get(`${t}-${e}`);if(n)return n;const r=i.getHeader(t,e);if((!r||r.isEmpty)&&(i.isLeftBottomCorner(t,e)||i.isRightBottomCorner(t,e)||i.isCornerHeader(t,e)||i.isRightTopCorner(t,e)))return SU;const o=this.internalProps.headerHelper.getStyleClass(r?.headerType||"text");if(i.isBottomFrozenRow(t,e)&&this.theme.bottomFrozenStyle)n=Du({},this.theme.bottomFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText);else if(i.isRightFrozenColumn(t,e)&&this.theme.rightFrozenStyle)n=Du({},this.theme.rightFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText);else{n=Du(r?.style||{},i.isColumnHeader(t,e)||i.isBottomFrozenRow(t,e)?this.theme.headerStyle:i.isRowHeader(t,e)||i.isRightFrozenColumn(t,e)?this.theme.rowHeaderStyle:this.theme.cornerHeaderStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},o,this.options.autoWrapText)}return this.headerStyleCache.set(`${t}-${e}`,n),n}let n;n=this.isListTable()&&!this.transpose||this.isPivotTable()&&this.internalProps.layoutMap.indicatorsAsCol?t:e;let r=this.bodyStyleCache.get(n);if(r)return r;const o=i.getBody(t,e),s=this.internalProps.bodyHelper.getStyleClass(o.cellType),a=o?.style;return r=Hu(a,this.theme.bodyStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},s,this.options.autoWrapText),Gu(a)||this.bodyStyleCache.set(n,r),r}clearCellStyleCache(){this.headerStyleCache.clear()}clearRowHeightCache(){this.internalProps._rowHeightsMap.clear(),this._clearRowRangeHeightsMap()}clearColWidthCache(){this.internalProps._colWidthsMap.clear(),this._clearColRangeWidthsMap()}_canResizeColumn(t,e){if(!(t>=0&&e>=0))return!1;if(this.isCellRangeEqual(t,e,t+1,e))return!1;if("none"===this.internalProps.columnResizeMode)return!1;if("header"===this.internalProps.columnResizeMode){if(!this.isHeader(t,e))return!1}else if("body"===this.internalProps.columnResizeMode&&this.isHeader(t,e))return!1;const i=this.colWidthsLimit[t];return!(i&&i.min&&i.max)||i.max!==i.min}_canDragHeaderPosition(t,e){if(this.isHeader(t,e)&&this.stateManeger.isSelected(t,e)){const i=this.stateManeger.select.ranges[0];if(this.isColumnHeader(t,e)){if(i.end.row!==this.rowCount-1)return!1}else{if(!this.isRowHeader(t,e))return!1;if(i.end.col!==this.colCount-1)return!1}const n=this.getHeaderDefine(t,e);if(void 0===n.dragHeader){if("all"===this.internalProps.dragHeaderMode)return!0;if("column"===this.internalProps.dragHeaderMode){if(this.isColumnHeader(t,e))return!0}else if("row"===this.internalProps.dragHeaderMode&&this.isRowHeader(t,e))return!0;return!1}return n.dragHeader}return!1}getCellIcons(t,e){let i;if(this.isHeader(t,e))i=this.internalProps.headerHelper.getIcons(t,e);else{const n=this.getCellValue(t,e),r=this.getCellOriginValue(t,e),o=this.internalProps.context;i=this.internalProps.bodyHelper.getIcons(t,e,n,r,o)}return i}showDropDownMenu(t,e,i){let n="dropdown-menu";i&&(n=Array.isArray(i.content)?"dropdown-menu":"container"),"html"===this.internalProps.menu.renderMode&&(this.stateManeger.menu.isShow=!0,this.internalProps.menuHandler._bindToCell(t,e,n,i))}showTooltip(t,e,i){"html"===this.internalProps.tooltip.renderMode&&this.internalProps.tooltipHandler._bindToCell(t,e,i)}getCellStyle(t,e){const i=this._getCellStyle(t,e),n=pj(i,this,t,e,Cj).theme,{autoWrapText:r,lineClamp:o,textOverflow:s}=i;return{textAlign:n.text.textAlign,textBaseline:n.text.textBaseline,bgColor:Nu(n.group.fill)?Cj("bgColor",i,t,e,this):n.group.fill,color:Nu(n.text.fill)?Cj("color",i,t,e,this):n.text.fill,fontFamily:n.text.fontFamily,fontSize:n.text.fontSize,fontWeight:n.text.fontWeight,fontVariant:n.text.fontVariant,fontStyle:n.text.fontStyle,lineHeight:n.text.lineHeight,autoWrapText:r??!1,lineClamp:o??"auto",textOverflow:s,borderColor:Nu(n.group.stroke)?Cj("borderColor",i,t,e,this):n.group.stroke,borderLineWidth:n.group.lineWidth,borderLineDash:n.group.lineDash,underline:!!n.text.underline,lineThrough:!!n.text.lineThrough,padding:n._vtable.padding,underlineWidth:n.text.underline,lineThroughLineWidth:n.text.lineThrough}}getAllBodyCells(t,e){const i=this.rowHeaderLevelCount,n=this.columnHeaderLevelCount,r=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-n+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,r-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+n)))))}getAllCells(t,e){const i=0,n=0,r=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-n+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,r-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+n)))))}getAllColumnHeaderCells(){const t=this.rowHeaderLevelCount,e=0,i=this.colCount-1,n=this.columnHeaderLevelCount-1;return Array(n-e+1).fill(0).map(((n,r)=>Array(i-t+1).fill(0).map(((i,n)=>this.getCellInfo(n+t,r+e)))))}getAllRowHeaderCells(){const t=0,e=this.columnHeaderLevelCount,i=this.rowHeaderLevelCount-1,n=this.rowCount-1;return Array(n-e+1).fill(0).map(((n,r)=>Array(i-t+1).fill(0).map(((i,n)=>this.getCellInfo(n+t,r+e)))))}scrollToCell(t){const e=this.getDrawRange();if(bu(t.col)&&t.col>=this.frozenColCount){const i=this.getFrozenColsWidth(),n=this.getColsWidth(0,t.col-1);this.scrollLeft=Math.min(n-i,this.getAllColsWidth()-e.width)}if(bu(t.row)&&t.row>=this.frozenRowCount){const i=this.getFrozenRowsHeight(),n=this.getRowsHeight(0,t.row-1);this.scrollTop=Math.min(n-i,this.getAllRowsHeight()-e.height)}this.render()}getCopyValue(){const t=this.stateManeger.select.ranges;let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),n=Math.min(t[0].start.row,t[0].end.row),r=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),n=Math.min(n,t.start.row,t.end.row),r=Math.max(r,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),r=Math.max(t.start.row,t.end.row);n<=e&&r>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.col,t.end.col),r=Math.max(t.start.col,t.end.col);n<=e&&r>=e&&(i=!0)})),i},a=(e,i)=>{let n;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&r<=i&&o>=i&&(n=t)})),n},l=(t,e,i)=>{const n=this.getCellRange(t,e);let r=n.start.col,o=n.start.row;if(i){const t=Math.min(i.start.col,i.end.col),e=Math.min(i.start.row,i.end.row);r=Math.max(t,n.start.col),o=Math.max(e,n.start.row)}if(r!==t||o!==e)return"";return this.getCellValue(t,e)};let h="";for(let t=n;t<=r;t++){if(o(t)){for(let n=e;n<=i;n++){if(s(n)){const e=a(n,t);if(e){const r=l(n,t,e);if("undefined"!=typeof Promise&&r instanceof Promise);else{const t=`${r}`;/^\[object .*\]$/.exec(t)||(h+=t)}(n<e.end.col||n<i)&&(h+="\t")}else h+="\t"}}h+="\n"}}return h}getSelectedCellInfos(){const t=this.stateManeger.select.ranges;let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),n=Math.min(t[0].start.row,t[0].end.row),r=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),n=Math.min(n,t.start.row,t.end.row),r=Math.max(r,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),r=Math.max(t.start.row,t.end.row);n<=e&&r>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const n=Math.min(t.start.col,t.end.col),r=Math.max(t.start.col,t.end.col);n<=e&&r>=e&&(i=!0)})),i},a=(e,i)=>{let n;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&r<=i&&o>=i&&(n=t)})),n},l=[];for(let t=n;t<=r;t++){if(o(t)){const n=[];for(let r=e;r<=i;r++){if(s(r)){if(a(r,t)){const e=this.getCellInfo(r,t);n.push(e)}}}l.push(n)}}return l}measureText(t,e){return QV.measureText(t,e)}getCustomRender(t,e){let i;if("body"!==this.getCellLocation(t,e)){const n=this.getHeaderDefine(t,e);i=n?.headerCustomRender}else{const n=this.getBodyColumnDefine(t,e);i=n?.customRender||this.customRender}return i}getCustomLayout(t,e){let i;if("body"!==this.getCellLocation(t,e)){const n=this.getHeaderDefine(t,e);i=n?.headerCustomLayout}else{const n=this.getBodyColumnDefine(t,e);i=n?.customLayout}return i}hasAutoImageColumn(){return this.internalProps.layoutMap.columnObjects.find((t=>!("image"!==t.cellType||!t.define.imageAutoSizing)))}_getActiveChartInstance(){const t=this.scenegraph.getCell(this.stateManeger.hover?.cellPos?.col,this.stateManeger.hover?.cellPos?.row);return"chart"===t?.getChildren()?.[0]?.type?t.getChildren()[0].activeChartInstance:null}cellIsInVisualView(t,e){const i=this.getDrawRange(),n=this.getCellRelativeRect(t,e);return t<this.frozenColCount&&e<this.frozenRowCount||n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}exportImg(){return this.scenegraph.stage.toCanvas().toDataURL()}exportCellImg(t,e){this.cellIsInVisualView(t,e)||this.scrollToCell({col:t,row:e});const i=this.getCellRelativeRect(t,e);return this.scenegraph.stage.toCanvas(!1,(new ip).set(i.left+this.tableX+1,i.top+this.tableY+1,i.right+this.tableX,i.bottom+this.tableY)).toDataURL()}}var TU=Object.freeze({__proto__:null,BaseTable:AU});function BU(t,e,i){const n=t[e];return t[e]=i,n}function MU(t){for(const e in t)delete t[e]}function RU(){MU(Cf),MU(fj),MU($N)}var PU=Object.freeze({__proto__:null,chartModule:function(t,e){return null!=e?BU($N,t,e):$N[t]},clearAll:RU,icon:function(t,e){return null!=e?BU(fj,t,e):fj[t]},theme:function(t,e){return null!=e?BU(Cf,t,e):Cf[t]}});var EU=Object.freeze({__proto__:null,dateFormat:function(t,e,i,n,r){null==i&&(i=!1),null==n&&(n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==r&&(r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);const o=i?"UTC":"",s=function(t){return`0${t}`.substring(0,2)};return function(i){const a=new Date(Date.parse(i[t]));return e.replace(/%(.)/g,(function(t,e){switch(e){case"y":return a[`get${o}FullYear`]();case"m":return s(a[`get${o}Month`]()+1);case"n":return n[a[`get${o}Month`]()];case"d":return s(a[`get${o}Date`]());case"w":return r[a[`get${o}Day`]()];case"x":return a[`get${o}Day`]();case"H":return s(a[`get${o}Hours`]());case"M":return s(a[`get${o}Minutes`]());case"S":return s(a[`get${o}Seconds`]());default:return`%${e}`}}))}},numberFormat:function(t){return t=Object.assign({},{digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},t),function(e){if(isNaN(e)||!isFinite(e))return"";const i=function(t,e,i){const n=(t+="").split(".");let r=n[0];const o=n.length>1?i+n[1]:"";return r=function(t,e){return t.replace(/\d+/,(function(t){return t.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return`${t}${e}`}))}))}(r,e),r+o}((t.scaler*e).toFixed(t.digitsAfterDecimal),t.thousandsSep,t.decimalSep);return`${t.prefix}${i}${t.suffix}`}}});const HU="NO_AXISID_FRO_VTABLE";function LU(t,e,i){const n=i.getCellHeaderPaths(t,e);let r;if(i.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=i.columnObjects.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=i.columnObjects.find((e=>e.indicatorKey===t))}const o=r?.chartSpec;return o}function kU(t,e,i){const n=i.getRawChartSpec(t,e);if(n?.series){const t={};return n.data?.id&&(t[n.data.id]=void 0),n?.series.forEach((e=>{if(!e.data?.fromDataId)if(e.data?.transforms)t[e.data?.id??n.data?.id??"data"]=void 0;else{const i="horizontal"===e.direction?e.xField:e.yField;t[e.data?.id??n.data?.id??"data"]=e.data?.id?i:void 0}})),t}return n.data.id}let IU=0;class OU{_headerObjects;_headerObjectMap;_headerCellIds;_columns;bodyRowCount=1;hierarchyIndent;_transpose=!1;_showHeader=!0;_recordsCount=0;_table;_cellRangeMap;constructor(t,e,i,n){this._cellRangeMap=new Map,this._showHeader=i,this._table=t,this._columns=[],this._headerCellIds=[],this.hierarchyIndent=n??20,this._headerObjects=this._addHeaders(0,e,[]),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{})}get transpose(){return this._transpose}set transpose(t){this._transpose=t}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}isHeader(t,e){return!!(this.transpose&&t<this.headerLevelCount)||!this.transpose&&e<this.headerLevelCount}getCellLocation(t,e){return this.isHeader(t,e)?this.transpose?"rowHeader":"columnHeader":"body"}isColumnHeader(t,e){return!this.transpose&&e<this.headerLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isCornerHeader(t,e){return!1}isRowHeader(t,e){return!!(this.transpose&&t<this.headerLevelCount)}getColumnHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getRowHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getCornerHeaderRange(){}getBodyRange(){return this.transpose?{start:{col:this.headerLevelCount,row:0},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:this.headerLevelCount},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}}get headerLevelCount(){return this.showHeader?this._headerCellIds.length:0}get columnHeaderLevelCount(){return this.transpose?0:this.headerLevelCount}get rowHeaderLevelCount(){return this.transpose?this.headerLevelCount:0}get bottomFrozenRowCount(){return 0}get rightFrozenColCount(){return 0}get colCount(){return this.transpose?this.headerLevelCount+this.recordsCount:this._columns.length}get rowCount(){return this.transpose?this._columns.length:this.headerLevelCount+this.recordsCount}get recordsCount(){return this._recordsCount}set recordsCount(t){this._recordsCount=t}get headerObjects(){return this._headerObjects}get columnObjects(){return this._columns}get columnWidths(){return this._columns}getColumnWidthDefined(t){if(this.transpose){let e,i,n=0;if(t>=this.rowHeaderLevelCount){let t;return this.columnObjects.forEach(((r,o)=>{"number"==typeof r.width?n=Math.max(r.width,n):"auto"===r.width&&(t=!0),"number"==typeof r.minWidth&&(i=Math.max(r.minWidth,i)),"number"==typeof r.maxWidth&&(e=Math.max(r.maxWidth,e))})),n=n>0?n:t?"auto":void 0,{width:n,minWidth:i,maxWidth:e}}if(this.isRowHeader(t,0)){const e=Array.isArray(this._table.defaultHeaderColWidth)?this._table.defaultHeaderColWidth[t]??this._table.defaultColWidth:this._table.defaultHeaderColWidth;return"auto"===e?{width:"auto"}:{width:e}}}return this._columns[t]}getCellId(t,e){return this.transpose?this.headerLevelCount<=t?this._columns[e]?.id:this._headerCellIds[t]?.[e]:this.headerLevelCount<=e?this._columns[t]?.id:this._headerCellIds[e]?.[t]}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]}getHeaderFieldKey(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.fieldKey||(this.transpose?this._columns[e]?.fieldKey:this._columns[t]?.fieldKey)}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||(this.transpose?this._columns[e]&&this._columns[e].field:this._columns[t]&&this._columns[t].field)}getHeaderCellAdress(t){for(let e=0;e<this._headerCellIds.length;e++){const i=this._headerCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return this.transpose?{col:e,row:n}:{col:n,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdress(e.id)}getBody(t,e){return this.transpose?this._columns[e]:this._columns[t]}getBodyLayoutRangeById(t){if(this.transpose){for(let e=0;e<(this.rowCount??0);e++)if(t===this._columns[e].id)return{start:{col:0,row:e},end:{col:0,row:e}}}else for(let e=0;e<(this.colCount??0);e++)if(t===this._columns[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getBodyCellValue(t,e){if(this.isHeader(t,e))return null;const{field:i,fieldFormat:n}=this.getBody(t,e);return this._table.getFieldData(n||i,t,e)}getCellRange(t,e){if(-1===t||-1===e)return{start:{col:t,row:e},end:{col:t,row:e}};if(this._cellRangeMap.has(`$${t}$${e}`))return this._cellRangeMap.get(`$${t}$${e}`);let i={start:{col:t,row:e},end:{col:t,row:e}};if(this.transpose)i=this.getCellRangeTranspose(t,e);else if(this.headerLevelCount<=e){if(this.headerLevelCount<=e&&this.columnObjects[t]?.define?.mergeCell){const n=this.getBodyCellValue(t,e);for(let r=e-1;r>=this.headerLevelCount&&n===this.getBodyCellValue(t,r);r--)i.start.row=r;for(let r=e+1;r<this.rowCount&&n===this.getBodyCellValue(t,r);r++)i.end.row=r}}else{const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<this.headerLevelCount&&n===this.getCellId(t,r);r++)i.end.row=r}return this._cellRangeMap.set(`$${t}$${e}`,i),i}getCellRangeTranspose(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(this.headerLevelCount<=t||-1===t&&-1===e){if(this.headerLevelCount<=t&&this.columnObjects[e]?.define?.mergeCell){const n=this.getBodyCellValue(t,e);for(let r=t-1;r>=this.headerLevelCount&&n===this.getBodyCellValue(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getBodyCellValue(r,e);r++)i.end.col=r}return i}const n=this.getCellId(t,e);for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r;for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<this.headerLevelCount&&n===this.getCellId(r,e);r++)i.end.col=r;return i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t,e){return this.transpose?t<this.headerLevelCount?-1:t-this.headerLevelCount:e<this.headerLevelCount?-1:e-this.headerLevelCount}getRecordStartRowByRecordIndex(t){return this.headerLevelCount+t}_addHeaders(t,e,i,n){const r=[],o=this._newRow(t,n);return e.forEach((e=>{const s=this._columns.length,a=IU++,l={id:a,title:e.title??e.caption,headerIcon:e.headerIcon,field:e.field,fieldKey:e?.fieldKey,fieldFormat:e.fieldFormat,style:e.headerStyle,headerType:e.headerType??"text",dropDownMenu:e.dropDownMenu,define:e,columnWidthComputeMode:e.columnWidthComputeMode};r[a]=l;for(let e=t-1;e>=0;e--)this._headerCellIds[e][s]=i[e];if(o[s]=n?this._headerCellIds[t-1][s]:a,e.columns)this._addHeaders(t+1,e.columns,[...i,a],e.hideColumnsSubHeader).forEach((t=>r.push(t)));else{const i=e;this._columns.push({id:IU++,field:i.field,fieldKey:i.fieldKey,fieldFormat:i.fieldFormat,width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth,icon:i.icon,cellType:i.cellType??i.columnType??"text",chartModule:"chartModule"in i?i.chartModule:null,chartSpec:"chartSpec"in i?i.chartSpec:null,sparklineSpec:"sparklineSpec"in i?i.sparklineSpec:Af,style:i.style,define:i,columnWidthComputeMode:i.columnWidthComputeMode,disableColumnResize:i?.disableColumnResize});for(let e=t+1;e<this._headerCellIds.length;e++)this._headerCellIds[e][s]=a}})),r}_newRow(t,e=!1){if(this._headerCellIds[t]){const e=this._headerCellIds[t-1];if(e.length>this._headerCellIds[t].length)for(let i=this._headerCellIds[t].length;i<e.length;i++)this._headerCellIds[t][i]=e[i];return this._headerCellIds[t]}if(e)return[];const i=this._headerCellIds[t]=[];if(!this._columns.length)return i;const n=this._headerCellIds[t-1];for(let t=0;t<n.length;t++)i[t]=n[t];return i}getCellHeaderPaths(t,e){let i=[],n=[];return this.transpose?n=[{field:this._columns[e].field}]:i=[{field:this._columns[t].field}],{colHeaderPaths:i,rowHeaderPaths:n}}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}canMoveHeaderPosition(t,e){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)){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const n=i.end.col-i.start.col+1;let r;const o=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?o.end.col-n+1:o.start.col,r===i.start.col)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.col,n);e.unshift(r,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.col,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.col,targetIndex:r,moveSize:n,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){const n=i.end.row-i.start.row+1;let r;const o=this.getCellRange(i.start.col,e.row);if(r=e.row>=t.row?o.end.row-n+1:o.start.row,r===i.start.row)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.row,n);e.unshift(r,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.row,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.row,targetIndex:r,moveSize:n,moveType:"row"}}}return null}toggleHierarchyState(t){const e=t.add.map((t=>({col:0,row:this._table.frozenRowCount+t}))),i=t.remove.map((t=>({col:0,row:this._table.frozenRowCount+t})));return{addCellPositions:e,removeCellPositions:i}}setChartInstance(t,e,i){(this.transpose?this._columns[e]:this._columns[t]).chartInstance=i}getChartInstance(t,e){return(this.transpose?this._columns[e]:this._columns[t]).chartInstance}getAxisConfigInPivotChart(t,e){}isEmpty(t,e){return!1}getChartAxes(t,e){return[]}getRawChartSpec(t,e){const i=this.getBody(t,e);return i?.chartSpec}getChartDataId(t,e){return kU(t,e,this)}release(){const t=this._table._getActiveChartInstance();t?.release(),this.columnObjects.forEach((t=>{t.chartInstance?.release()}))}}class DU{sizeIncludeParent=!1;rowExpandLevel;hierarchyType;tree={id:0,dimensionKey:"",value:"",children:[],level:-1,startIndex:0,size:0,startInTotal:0,hierarchyState:void 0};totalLevel=0;dimensionKeys=new ff;constructor(t,e="grid",i=void 0){this.sizeIncludeParent=null!=i,this.rowExpandLevel=i,this.hierarchyType=e,this.reset(t)}reset(t,e=!1){this.dimensionKeys=new ff,this.tree.children=t,this.setTreeNode(this.tree,0,this.tree),this.totalLevel=this.dimensionKeys.count()}setTreeNode(t,e,i){t.startIndex=e,t.startInTotal=(i.startInTotal??0)+t.startIndex,(t.dimensionKey??t.indicatorKey)&&(!this.dimensionKeys.contain(t.indicatorKey?Sf:t.dimensionKey)&&this.dimensionKeys.put(t.level,t.indicatorKey?Sf:t.dimensionKey),t.id||(t.id=++FU));let n=t.dimensionKey&&this.sizeIncludeParent?1:0;return"grid"===this.hierarchyType?t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):n=1:t.hierarchyState===Xc.expand&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):t.hierarchyState===Xc.collapse&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)})):!t.hierarchyState&&t.level+1<this.rowExpandLevel&&t.children?(t.hierarchyState=Xc.expand,t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)}))):t.children?(t.hierarchyState=Xc.collapse,t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)}))):(t.hierarchyState=Xc.none,n=1),t.size=n,n}getTreePath(t,e=30){const i=[];return this.searchPath(t,this.tree,i,e),i.shift(),i}searchPath(t,e,i,n){if(!e)return!1;if(t<e.startIndex||t>=e.startIndex+e.size)return!1;if(i.push(e),!e.children||0===e.children.length)return!0;if(e.level>=n)return!0;const r=t-e.startIndex;return e.children.some((t=>this.searchPath(r,t,i,n))),!0}movePosition(t,e,i){let n,r,o;const s=(a,l)=>{if((void 0===r||void 0===o)&&(a.level===t&&(a.startInTotal===e&&(r=l),a.startInTotal<=i&&i<=a.startInTotal+a.size-1&&(o=l)),a.children&&a.level<t)){n=a;for(let t=0;t<a.children.length;t++)(e>=a.children[t].startInTotal&&e<=a.children[t].startInTotal+a.children[t].size||i>=a.children[t].startInTotal&&i<=a.children[t].startInTotal+a.children[t].size)&&s(a.children[t],t)}};s(this.tree,0);const a=n.children.splice(r,1);a.unshift(o,0),Array.prototype.splice.apply(n.children,a)}}let FU=0,zU=0;class WU{_showHeader=!0;rowDimensionTree;columnDimensionTree;rowTree;columnTree;cornerHeaderObjs;columnHeaderObjs=[];rowHeaderObjs=[];_cornerHeaderCellIds=[];_columnHeaderCellIds=[];_rowHeaderCellIds=[];_columnWidths=[];rowsDefine;columnsDefine;indicatorsDefine;columnPaths=[];_headerObjects=[];_headerObjectMap={};_indicators=[];indicatorTitle;indicatorsAsCol=!0;hideIndicatorName=!1;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;cornerSetting;_indicatorShowType="column";rowHierarchyType;rowExpandLevel;rowHierarchyIndent;rowDimensionKeys=[];colDimensionKeys=[];indicatorKeys=[];indicatorDimensionKey=Sf;_cellRangeMap;_CellHeaderPathMap;_table;constructor(t){if(this._table=t,this._cellRangeMap=new Map,this._CellHeaderPathMap=new Map,this.rowTree=t.options.rowTree,this.columnTree=t.options.columnTree,this.rowsDefine=t.options.rows??[],this.columnsDefine=t.options.columns??[],this.indicatorsDefine=t.options.indicators??[],this.indicatorTitle=t.options.indicatorTitle,this.hideIndicatorName=t.options.hideIndicatorName??!1,this.showRowHeader=t.options.showRowHeader??!0,this.showColumnHeader=t.options.showColumnHeader??!0,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.rowHierarchyType=t.options.rowHierarchyType??"grid",this.rowExpandLevel=t.options.rowExpandLevel??1,this.rowHierarchyIndent=t.options.rowHierarchyIndent??20,this.cornerSetting=t.options.corner??{titleOnDimension:"column"},this.indicatorsDefine?.forEach((t=>{"string"==typeof t?this.indicatorKeys.push(t):this.indicatorKeys.push(t.indicatorKey)})),this.columnDimensionTree=new DU(this.columnTree??[]),this.rowDimensionTree=new DU(this.rowTree??[],this.rowHierarchyType,"tree"===this.rowHierarchyType?this.rowExpandLevel:void 0),this.colDimensionKeys=this.columnDimensionTree.dimensionKeys.valueArr(),this.rowDimensionKeys=this.rowDimensionTree.dimensionKeys.valueArr(),this.cornerHeaderObjs="column"===this.cornerSetting.titleOnDimension?this._addCornerHeaders(this.columnHeaderTitle?[""].concat(this.colDimensionKeys):this.colDimensionKeys):"row"===this.cornerSetting.titleOnDimension?this._addCornerHeaders(this.rowHeaderTitle?[""].concat(this.rowDimensionKeys):this.rowDimensionKeys):this._addCornerHeaders(null),this.columnDimensionTree.tree.children&&(this.columnHeaderObjs=this._addHeaders(this._columnHeaderCellIds,0,this.columnDimensionTree.tree.children,[]),this.columnHeaderTitle)){const t=++FU,e=Array(this.colCount-this.rowHeaderLevelCount).fill(t);this._columnHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{id:t}};this.columnHeaderObjs.push(i),this._headerObjects[t]=i}if(zU=0,this.rowDimensionTree.tree.children&&(this.rowHeaderObjs="tree"===this.rowHierarchyType?this._addHeadersForTreeMode(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0):this._addHeaders(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[])),this.rowHeaderTitle){const t=++FU,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{id:t}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}zU=0,this.indicatorsAsCol=!bu(this.rowDimensionKeys.find((t=>t===this.indicatorDimensionKey))),this._rowHeaderCellIds=fu(this._rowHeaderCellIds),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.setColumnWidths()}_addHeaders(t,e,i,n){const r=[];return t[e]||function(e){const i=t[e]=[];if(0===zU)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const o=i.id,s=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),a=this.indicatorsDefine?.find((t=>"string"!=typeof t&&(i.indicatorKey?t.indicatorKey===i.indicatorKey:t.title===i.value))),l={id:o,title:i.value??a.title,field:i.dimensionKey,style:"function"==typeof(a??s)?.headerStyle?(a??s)?.headerStyle:Object.assign({},(a??s)?.headerStyle),headerType:a?.headerType??s?.headerType??"text",headerIcon:a?.headerIcon??s?.headerIcon,define:Object.assign({},i,a??s),fieldFormat:a?.headerFormat??s?.headerFormat,dropDownMenu:a?.dropDownMenu??s?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},width:s?.width,minWidth:s?.minWidth,maxWidth:s?.maxWidth,showSort:a?.showSort??s?.showSort,description:s?.description};a?(a.customRender&&(i.customRender=a.customRender),bu(this._indicators?.find((t=>t.indicatorKey===a.indicatorKey)))||this._indicators?.push({id:++FU,indicatorKey:a.indicatorKey,field:a.indicatorKey,fieldFormat:a?.format,cellType:a?.cellType??a?.columnType??"text",chartModule:"chartModule"in a?a.chartModule:null,chartSpec:"chartSpec"in a?a.chartSpec:null,sparklineSpec:"sparklineSpec"in a?a.sparklineSpec:null,style:a?.style,icon:a?.icon,define:Object.assign({},i,a,{dragHeader:s?.dragHeader}),width:a?.width,minWidth:a?.minWidth,maxWidth:a?.maxWidth,disableColumnResize:a?.disableColumnResize})):i.indicatorKey&&(bu(this._indicators?.find((t=>t.indicatorKey===i.indicatorKey)))||this._indicators?.push({id:++FU,indicatorKey:i.indicatorKey,field:i.indicatorKey,cellType:"text",define:Object.assign({},i)})),r[o]=l,this._headerObjects[o]=l,t[e][zU]=o;for(let i=e-1;i>=0;i--)t[i][zU]=n[i];if(i.children)this._addHeaders(t,e+1,i.children??[],[...n,o]).forEach((t=>r.push(t)));else{for(let i=e+1;i<t.length;i++)t[i][zU]=o;zU++}})),r}_addHeadersForTreeMode(t,e,i,n,r,o){const s=[];return t[e]||function(e){const i=t[e]=[];if(0===zU)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const a=i.id,l=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),h={id:a,title:i.value,field:i.dimensionKey,style:i.level+1===r||"function"==typeof l?.headerStyle?l?.headerStyle:Object.assign({},l?.headerStyle,{textAlign:"left"}),headerType:l?.headerType??"text",headerIcon:l?.headerIcon,define:Object.assign(i,{linkJump:l?.linkJump,linkDetect:l?.linkDetect,templateLink:l?.templateLink,keepAspectRatio:l?.keepAspectRatio??!1,imageAutoSizing:l?.imageAutoSizing,headerCustomRender:l?.headerCustomRender,headerCustomLayout:l?.headerCustomLayout,dragHeader:l?.dragHeader}),fieldFormat:l?.headerFormat,dropDownMenu:l?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},hierarchyLevel:i.level,dimensionTotalLevel:r,hierarchyState:i.level+1===r?void 0:i.hierarchyState,width:l?.width,minWidth:l?.minWidth,maxWidth:l?.maxWidth};s[a]=h,this._headerObjects[a]=h,t[e][zU]=a;for(let i=e-1;i>=0;i--)t[i][zU]=n[i];if(i.hierarchyState===Xc.expand&&i.children)o&&zU++,this._addHeadersForTreeMode(t,e,i.children??[],[...n,a],r,o&&i.hierarchyState===Xc.expand).forEach((t=>s.push(t)));else{o&&zU++;for(let i=e+1;i<t.length;i++)t[i][zU]=a}})),s}_addCornerHeaders(t){const e=[];if(t)t.forEach(((t,i)=>{const n=++FU,r=this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)),o={id:n,title:t===this.indicatorDimensionKey?this.indicatorTitle:r?.title??"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:n,value:t},dropDownMenu:r?.cornerDropDownMenu,pivotInfo:{value:r?.title??"",dimensionKey:t,isPivotCorner:!0},description:r?.cornerDescription};if(e[n]=o,this._headerObjects[n]=o,"column"===this.cornerSetting.titleOnDimension){this._cornerHeaderCellIds[i]||(this._cornerHeaderCellIds[i]=[]);for(let t=0;t<this.rowHeaderLevelCount;t++)this._cornerHeaderCellIds[i][t]=n}else if("row"===this.cornerSetting.titleOnDimension)for(let t=0;t<this.columnHeaderLevelCount;t++)this._cornerHeaderCellIds[t]||(this._cornerHeaderCellIds[t]=[]),this._cornerHeaderCellIds[t][i]=n}));else{const t=++FU,i={id:t,title:"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:t,value:""}};e[t]=i,this._headerObjects[t]=i;for(let e=0;e<this.columnHeaderLevelCount;e++)for(let i=0;i<this.rowHeaderLevelCount;i++)this._cornerHeaderCellIds[e]||(this._cornerHeaderCellIds[e]=[]),this._cornerHeaderCellIds[e][i]=t}return e}setColumnWidths(){const t=new Array(this.colCount).fill(void 0);if(this.showHeader&&this.showRowHeader&&(this.rowHeaderTitle&&(t[0]={}),this.rowDimensionKeys.forEach(((e,i)=>{const n=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));n&&(t[i+(this.rowHeaderTitle?1:0)]={width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth})}))),this.indicatorsAsCol)for(let e=this.rowHeaderLevelCount;e<this.colCount;e++){const i=this.getBody(e,this.columnHeaderLevelCount);t[e]={width:i?.width,minWidth:i?.minWidth,maxWidth:i?.maxWidth}}else{let e,i,n,r=0;this._indicators?.forEach(((t,o)=>{"number"==typeof t.width?r=Math.max(t.width,r):"auto"===t.width&&(n=!0),"number"==typeof t.minWidth&&(i=Math.max(t.minWidth,i)),"number"==typeof t.maxWidth&&(e=Math.max(t.maxWidth,e))})),r=r>0?r:n?"auto":void 0,t.fill({width:r,minWidth:i,maxWidth:e},this.rowHeaderLevelCount,this.colCount)}this._columnWidths=t}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.rowHeaderLevelCount||(e<this.columnHeaderLevelCount||(t>=this.colCount-this.rightFrozenColCount||e>=this.rowCount-this.bottomFrozenRowCount))}isCornerHeader(t,e){return t<this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isRowHeader(t,e){return t<this.rowHeaderLevelCount&&e>=this.columnHeaderLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}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 headerLevelCount(){return this.columnHeaderLevelCount}get columnHeaderLevelCount(){if(this.showHeader&&this.showColumnHeader){let t=this.indicatorsAsCol&&this.hideIndicatorName&&this.colDimensionKeys[this.colDimensionKeys.length-1]===this.indicatorDimensionKey?this.columnDimensionTree.totalLevel-1:this.columnDimensionTree.totalLevel;return this.columnHeaderTitle&&(t+=1),t}return 0}get rowHeaderLevelCount(){if(this.showHeader&&this.showRowHeader){if("tree"===this.rowHierarchyType)return this.rowHeaderTitle?2:1;let t=this.indicatorsAsCol?this.rowDimensionTree.totalLevel:this.hideIndicatorName&&this.rowDimensionKeys[this.rowDimensionKeys.length-1]===this.indicatorDimensionKey?this.rowDimensionTree.totalLevel-1:this.rowDimensionTree.totalLevel;return this.rowHeaderTitle&&(t+=1),t}return 0}get colCount(){return this.columnDimensionTree.tree.size+this.rowHeaderLevelCount+this.rightFrozenColCount}get rowCount(){return this.rowDimensionTree.tree.size+this.columnHeaderLevelCount+this.bottomFrozenRowCount}get bodyRowCount(){return this.rowDimensionTree.tree.size}get bottomFrozenRowCount(){return this.showHeader&&this.showColumnHeader&&this.indicatorsAsCol&&!this.hideIndicatorName&&this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0}get rightFrozenColCount(){return this.showHeader&&this.showColumnHeader&&!this.indicatorsAsCol&&!this.hideIndicatorName&&this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicators}getCellId(t,e){if(e>=0&&t>=0){if(this.isCornerHeader(t,e))return this._cornerHeaderCellIds[e][t];if(this.isColumnHeader(t,e))return this._columnHeaderCellIds[e][t-this.rowHeaderLevelCount];if(this.isRowHeader(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount]?.[t];if(this.isRightFrozenColumn(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount][this.rowHeaderLevelCount-1];if(this.isBottomFrozenRow(t,e))return this._columnHeaderCellIds[this.columnHeaderLevelCount-1]?.[t-this.rowHeaderLevelCount]}}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||this.getBody(t,e)?.field}getHeaderCellAdress(t){for(let e=0;e<this._columnHeaderCellIds.length;e++){const i=this._columnHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n+this._table.frozenColCount,row:e}}for(let e=0;e<this._rowHeaderCellIds.length;e++){const i=this._rowHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n,row:e+this._table.frozenRowCount}}for(let e=0;e<this._cornerHeaderCellIds.length;e++){const i=this._cornerHeaderCellIds[e];for(let n=0;n<i.length;n++)if(i[n]===t)return{col:n,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdress(e.id)}getBody(t,e){const i=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators?.find((e=>e.indicatorKey===t))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}const n=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators?.find((t=>t.indicatorKey===n))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}getBodyLayoutRangeById(t){for(let e=0;e<(this.colCount??0);e++)if(t===this.columnObjects[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getCellRange(t,e){if(-1===t||-1===e)return{start:{col:t,row:e},end:{col:t,row:e}};if(this._cellRangeMap.has(`${t}-${e}`))return this._cellRangeMap.get(`${t}-${e}`);const i={start:{col:t,row:e},end:{col:t,row:e}};if(this.isHeader(t,e)&&-1!==t&&-1!==e){const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r}return this._cellRangeMap.set(`${t}-${e}`,i),i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t){return t<this.columnHeaderLevelCount||t>=this.rowCount-this.bottomFrozenRowCount?-1:t-this.columnHeaderLevelCount}getRecordIndexByCol(t){return t<this.rowHeaderLevelCount||t>=this.colCount-this.rightFrozenColCount?-1:t-this.rowHeaderLevelCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getCellHeaderPathsWidthTreeNode(t,e){if(this._CellHeaderPathMap.has(`${t}-${e}`))return this._CellHeaderPathMap.get(`${t}-${e}`);const i=this.getRecordIndexByCol(t),n=this.getRecordIndexByRow(e);let r,o;if(t>=0&&(r=this.columnDimensionTree.getTreePath(i,this.showHeader&&this.showColumnHeader?e-(this.columnHeaderTitle?1:0):this.columnDimensionTree.totalLevel)),e>=0)if("tree"===this.rowHierarchyType)if(t>=this.rowHeaderLevelCount)o=this.rowDimensionTree.getTreePath(n,t+this.rowDimensionTree.totalLevel);else{const i=this.getHeader(t,e);o=this.rowDimensionTree.getTreePath(n,t+i.hierarchyLevel)}else o=this.rowDimensionTree.getTreePath(n,this.showHeader&&this.showRowHeader?t-(this.rowHeaderTitle?1:0):this.rowDimensionTree.totalLevel);const s={colHeaderPaths:r,rowHeaderPaths:o};return this._CellHeaderPathMap.set(`${t}-${e}`,s),s}getCellHeaderPaths(t,e){const i=this.getCellHeaderPathsWidthTreeNode(t,e),n={colHeaderPaths:[],rowHeaderPaths:[]};return i.colHeaderPaths.forEach((t=>{const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",n.colHeaderPaths.push(e)})),i.rowHeaderPaths.forEach((t=>{const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",n.rowHeaderPaths.push(e)})),n}getIndicatorInfoByIndicatorKey(t){const e=this.indicatorsDefine?.find((e=>"string"!=typeof e&&(!!t&&e.indicatorKey===t)));return e}getHeaderDimension(t,e){if(this.isHeader(t,e)){const i=this.getHeader(t,e);return this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))}}isColumnIndicatorHeader(t,e){return"column"===this._indicatorShowType&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return"row"===this._indicatorShowType&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}toggleHierarchyState(t,e){const i=this._rowHeaderCellIds.slice(0),n=i.map((t=>this.getHeaderCellAdress(t[0]))),r=this.getHeader(t,e);if(r.define.hierarchyState=r.define.hierarchyState===Xc.collapse?Xc.expand:Xc.collapse,this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._rowHeaderCellIds=[],this.rowHeaderObjs=this._addHeadersForTreeMode(this._rowHeaderCellIds,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0),this.rowHeaderTitle){const t=++FU,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{field:"",headerType:"text",cellType:"text"}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}return zU=0,this._rowHeaderCellIds=fu(this._rowHeaderCellIds),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this._CellHeaderPathMap=new Map,function(t,e,i,n){const r=t.map((t=>t[0])),o=e.map((t=>t[0])),s=[],a=[];for(let t=0;t<r.length;t++)o.includes(r[t])||a.push(i[t]);for(let t=0;t<o.length;t++)r.includes(o[t])||s.push(n.getHeaderCellAdress(o[t]));return{addCellPositions:s,removeCellPositions:a}}(i,this._rowHeaderCellIds,n,this)}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}getPivotCellAdress(t){if(!Array.isArray(t))return;let e,i,n=this.rowTree,r=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1){if("row"===this?.cornerSetting?.titleOnDimension){let t=0;return"grid"===this.rowHierarchyType&&(t=this.rowDimensionKeys.indexOf(s.dimensionKey)),-1===t?void 0:{col:this.rowHeaderTitle?t+1:t,row:0}}const t=this.colDimensionKeys.indexOf(s.dimensionKey);return-1===t?void 0:{col:0,row:this.columnHeaderTitle?t+1:t}}let a=!1;for(let t=0;t<r.length;t++){const e=r[t];if((bu(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){r=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<n.length;t++){const i=n[t];if((bu(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){n=i.children,e=i;break}}}let o=0,s=0;if(e){s=this.columnHeaderLevelCount;const{startInTotal:t,level:i}=e;return s+=t,o="grid"===this.rowHierarchyType?this.rowHeaderTitle?i+1:i:0,{col:o,row:s}}if(i){o=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=i;return o+=t,s=this.columnHeaderTitle?e+1:e,{col:o,row:s}}}getPivotDimensionInfo(t,e){const{colHeaderPaths:i,rowHeaderPaths:n}=this.getCellHeaderPaths(t,e),r=[];return i.length?i.forEach(((t,e)=>{r.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):n.length?n.forEach(((t,e)=>{r.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):this.isCornerHeader(t,e)&&("row"===this?.cornerSetting?.titleOnDimension?r.push({dimensionKey:this.rowDimensionKeys[this.rowHeaderTitle?t-1:t],isPivotCorner:!0}):r.push({dimensionKey:this.colDimensionKeys[this.columnHeaderTitle?e-1:e],isPivotCorner:!0})),r}getIndicatorKey(t,e){return this.getBody(t,e)?.indicatorKey}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}canMoveHeaderPosition(t,e){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("tree"!==this.rowHierarchyType){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}{const i=du(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths),n=du(this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths);if(i.pop(),n.pop(),i.length<=n.length)return i.length!==n.length||!i.find(((t,e)=>t.dimensionKey!==n[e].dimensionKey||t.value!==n[e].value))}}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 n=i.end.col-i.start.col+1;let r;const o=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?o.end.col-n+1:o.start.col,r===i.end.col)return null;for(let t=0;t<this._columnHeaderCellIds.length;t++){const e=this._columnHeaderCellIds[t].splice(i.start.col-this.rowHeaderLevelCount,n);e.unshift(r-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this._columnHeaderCellIds[t],e)}const s=this._columnWidths.splice(i.start.col,n);return s.unshift(r,0),Array.prototype.splice.apply(this._columnWidths,s),this.columnDimensionTree.movePosition(t.row,i.start.col-this.rowHeaderLevelCount,r-this.rowHeaderLevelCount),this.columnDimensionTree.reset(this.columnDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._cellRangeMap=new Map,{sourceIndex:i.start.col,targetIndex:r,moveSize:n,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){let n;const r=this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,o=this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths,s=r[r.length-1],a=o[r.length-1],l=s.size;if(n=e.row>=t.row?a.startInTotal+a.size-l:a.startInTotal,n===t.row||n===i.end.row)return null;const h=this._rowHeaderCellIds.splice(i.start.row-this.columnHeaderLevelCount,l);return h.unshift(n,0),Array.prototype.splice.apply(this._rowHeaderCellIds,h),this.rowDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths.length-1,i.start.row-this.columnHeaderLevelCount,n+(e.row>t.row?s.size-1:0)),this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._cellRangeMap=new Map,{sourceIndex:i.start.row,targetIndex:n+this.columnHeaderLevelCount,moveSize:l,moveType:"row"}}}return null}getCellAdressByHeaderPath(t){let e,i;if(Array.isArray(t)){if(t.length>this.rowDimensionKeys.length+this.colDimensionKeys.length)return;e=t.filter((t=>this.colDimensionKeys.indexOf(t.dimensionKey)>=0)),i=t.filter((t=>this.rowDimensionKeys.indexOf(t.dimensionKey)>=0))}else e=t.colHeaderPaths,i=t.rowHeaderPaths;if(!Array.isArray(e)&&!Array.isArray(i))return;e?.sort(((t,e)=>this.colDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.colDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey))),i?.sort(((t,e)=>this.rowDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.rowDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey)));let n,r,o,s,a=!1;e?.length>=1&&i?.length>=1&&(a=!0);let l,h,c=this.rowTree,u=this.columnTree;if(e)for(let t=0;t<e.length;t++){const i=e[t];for(let t=0;t<u.length;t++){const e=u[t];if(!bu(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value||bu(i.indicatorKey)&&e.indicatorKey===i.indicatorKey){u=e.children,a&&!u?h=e:a||(h=e);break}}}if(i)for(let t=0;t<i.length;t++){const e=i[t];for(let t=0;t<c.length;t++){const i=c[t];if((!bu(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value||bu(e.indicatorKey)&&i.indicatorKey===e.indicatorKey)&&i.value===e.value){c=i.children,a&&!c?l=i:a||(l=i);break}}}if(!a||l&&h){if(l){r=this.columnHeaderLevelCount;const{startInTotal:t,level:e}=l;r+=t,o="grid"===this.rowHierarchyType?this.rowHeaderTitle?e+1:e:0}if(h){n=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=h;n+=t,s=this.columnHeaderTitle?e+1:e}return bu(n)||bu(r)?{col:n??o,row:r??s}:void 0}}setChartInstance(t,e,i){const n=this.getCellHeaderPaths(t,e);let r;if(this.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators?.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators?.find((e=>e.indicatorKey===t))}r&&(r.chartInstance=i)}getChartInstance(t,e){const i=this.getCellHeaderPaths(t,e);let n;if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators?.find((e=>e.indicatorKey===t))}else{const t=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators?.find((e=>e.indicatorKey===t))}return n?.chartInstance}getDimension(t,e){return"column"===e?this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):"row"===e?this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):void 0}getAxisConfigInPivotChart(t,e){}isEmpty(t,e){return!1}getChartAxes(t,e){return[]}getRawChartSpec(t,e){return LU(t,e,this)}getChartDataId(t,e){return kU(t,e,this)}release(){const t=this._table._getActiveChartInstance();t?.release(),this._indicators?.forEach((t=>{t.chartInstance?.release()}))}getHeadNode(t){if(!Array.isArray(t))return;let e,i,n=this.rowTree,r=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1)return;let a=!1;for(let t=0;t<r.length;t++){const e=r[t];if((bu(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){r=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<n.length;t++){const i=n[t];if((bu(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||bu(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){n=i.children,e=i;break}}}return e||(i||void 0)}}const jU={isEmpty:!0,id:void 0,field:void 0,headerType:void 0,define:void 0};class NU{_headerObjects=[];_headerObjectMap={};_indicatorObjects=[];_columnWidths=[];rowTree;columnTree;rowsDefine;columnsDefine;indicatorsDefine;indicatorKeys;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;_indicatorShowType="column";indicatorsAsCol=!0;hideIndicatorName=!1;indicatorDimensionKey=Sf;indicatorTitle;rowKeysPath;colKeysPath;convertColKeys;rows;columns;rowShowAttrs;colShowAttrs;tree;dataset;dataConfig;_rowCount;_colCount;_bodyRowCount;cornerSetting;_table;hasTwoIndicatorAxes;_chartItemSpanSize;constructor(t,e){this._table=t,this._chartItemSpanSize=0,this.rowTree=t.options.rowTree,this.columnTree=t.options.columnTree,this.rowsDefine=t.options.rows??[],this.columnsDefine=t.options.columns??[],this.indicatorsDefine=t.options.indicators??[],this.indicatorTitle=t.options.indicatorTitle,this.dataset=e,this.dataConfig=e.dataConfig,this.indicatorKeys=e.indicatorKeys,this.indicatorsAsCol=t.options.indicatorsAsCol??!0,this.hideIndicatorName=t.options.hideIndicatorName??!1,this.showRowHeader=t.options.showRowHeader??!0,this.showColumnHeader=t.options.showColumnHeader??!0,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.cornerSetting=t.options.corner??{titleOnDimension:"column"},this.columns=e.columns,this.rows=e.rows,this.rowKeysPath=e.rowKeysPath,this.colKeysPath=e.colKeysPath,this.tree=e.tree,this.initState(),this.convertColKeys=fu(this.colKeysPath)}initState(){if(this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.colShowAttrs="column"===this._indicatorShowType?this.columns.concat(this.indicatorDimensionKey):Array.from(this.columns),this.rowShowAttrs="row"===this._indicatorShowType?this.rows.concat(this.indicatorDimensionKey):Array.from(this.rows),this._bodyRowCount=this.rowKeysPath.length*(this.indicatorsAsCol?1:this.indicatorKeys.length),this.initHeaderObjects(),this.initIndicatorObjects(),this.rowHeaderTitle){const t="rowHeaderTitle",e="string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),"");this._headerObjectMap[e]={id:e,title:e,field:t,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[e]),this._headerObjects.push(this._headerObjectMap[t]),this.rowShowAttrs.unshift(t),this.rowKeysPath.forEach(((t,i)=>{t.unshift(e)}))}if(this.columnHeaderTitle){const t="columnHeaderTitleCell",e="string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),"");this._headerObjectMap[e]={id:e,title:e,field:t,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[e]),this._headerObjects.push(this._headerObjectMap[t]),this.colShowAttrs.unshift(t),this.colKeysPath.forEach(((t,i)=>{t.unshift(e)}))}if(this._table.isPivotChart())if(this.hasTwoIndicatorAxes=this._indicatorObjects.some((t=>!!(t.chartSpec&&t.chartSpec.series&&t.chartSpec.series.length>1))),this._chartItemSpanSize=0,this._indicatorObjects.find((t=>(t.chartSpec?.barWidth&&(this._chartItemSpanSize=t.chartSpec?.barWidth),this._chartItemSpanSize>0||(t.chartSpec.series?.find((t=>(t.barWidth&&(this._chartItemSpanSize=t.barWidth),this._chartItemSpanSize>0))),this._chartItemSpanSize>0)))),this.indicatorsAsCol){const t="rowHeaderEmpty";this._headerObjectMap[t]={id:t,title:"",field:t,headerType:this.cornerSetting.headerType??"text",style:this.cornerSetting.headerStyle,define:{}},this._headerObjects.push(this._headerObjectMap[t]),this.rowShowAttrs.push(t),this.hasTwoIndicatorAxes||this.colShowAttrs.pop()}else{const t=this._table.pivotChartAxes.find((t=>"left"===t.orient));!1===t?.visible&&this.rowShowAttrs.pop()}this._colCount=(0===this.colKeysPath.length?1:this.colKeysPath.length)*(this.indicatorsAsCol?this.indicatorKeys.length:1)+this.rowHeaderLevelCount+this.rightFrozenColCount,this._rowCount=(0===this.rowKeysPath.length?1:this.rowKeysPath.length)*(this.indicatorsAsCol?1:this.indicatorKeys.length)+this.columnHeaderLevelCount+this.bottomFrozenRowCount,this.setColumnWidths()}setColumnWidths(){const t=new Array(this.colCount).fill(void 0);if(this.showRowHeader&&(this.rowHeaderTitle&&(t[0]={}),this.rowShowAttrs.forEach(((e,i)=>{const n=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));n&&(t[i+(this.rowHeaderTitle?1:0)]={width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth})}))),this.indicatorsAsCol)for(let e=this.rowHeaderLevelCount;e<this.colCount;e++){const i=this.getBody(e,this.columnHeaderLevelCount);t[e]={width:i?.width,minWidth:i?.minWidth,maxWidth:i?.maxWidth}}else{let e,i,n,r=0;this._indicatorObjects.forEach(((t,o)=>{"number"==typeof t.width?r=Math.max(t.width,r):"auto"===t.width&&(n=!0),"number"==typeof t.minWidth&&(i=Math.max(t.minWidth,i)),"number"==typeof t.maxWidth&&(e=Math.max(t.maxWidth,e))})),r=r>0?r:n?"auto":void 0,t.fill({width:r,minWidth:i,maxWidth:e},this.rowHeaderLevelCount,this.colCount-this.rightFrozenColCount)}this._columnWidths=t}get columnWidths(){return this._columnWidths}getColumnWidthDefined(t){return this._columnWidths[t]}getDimensionInfo(t){return this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))}getIndicatorInfo(t,e=""){const i=this.indicatorsDefine?.find((i=>"string"!=typeof i&&(t?i.indicatorKey===t:!!e&&i.title===e)));return i}getColKeysPath(){return this.colKeysPath}getRowKeysPath(){return this.rowKeysPath}initHeaderObjects(){for(let t=0,e=this.rowKeysPath.length;t<=e-1;t++){const e=this.rowKeysPath[t];for(let t=0,i=e.length;t<=i-1;t++)if(!this._headerObjectMap[e[t]]){const i=e[t].split(this.dataset.stringJoinChar),n=this.getDimensionInfo(this.rows[i.length-1]);this._headerObjectMap[e[t]]={id:e[t],field:n?.dimensionKey??this.rows[i.length-1],title:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.rows[i.length-1],headerType:n?.headerType??"text",cellType:"text"},fieldFormat:n?.headerFormat,dropDownMenu:n?.dropDownMenu,headerType:n?.headerType??"text",width:n?.width},this._headerObjects.push(this._headerObjectMap[e[t]])}}for(let t=0,e=this.colKeysPath.length;t<=e-1;t++){const e=this.colKeysPath[t];for(let t=0,i=e.length;t<=i-1;t++)if(!this._headerObjectMap[e[t]]){const i=e[t].split(this.dataset.stringJoinChar),n=this.getDimensionInfo(this.columns[i.length-1]);this._headerObjectMap[e[t]]={id:e[t],field:n?.dimensionKey??this.columns[i.length-1],title:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.columns[i.length-1],headerType:n?.headerType??"text",cellType:"text"},fieldFormat:n?.headerFormat,dropDownMenu:n?.dropDownMenu,headerType:n?.headerType??"text",width:n?.width},this._headerObjects.push(this._headerObjectMap[e[t]])}}let t;this.indicatorsDefine.forEach((t=>{const e="string"==typeof t?t:t.indicatorKey,i="string"==typeof t?void 0:t;this._headerObjectMap[e]||(this._headerObjectMap[e]={id:e,field:this.indicatorDimensionKey,title:i?.title??e,style:i?.headerStyle,define:{field:this.indicatorDimensionKey,headerType:i?.headerType??"text",cellType:"text"},dropDownMenu:i?.dropDownMenu,headerType:i?.headerType??"text",width:i?.width},this._headerObjects.push(this._headerObjectMap[e]))})),"column"===this.cornerSetting.titleOnDimension?t=this.colShowAttrs:"row"===this.cornerSetting.titleOnDimension&&(t=this.rowShowAttrs),t?.forEach((t=>{if(!this._headerObjectMap[t]){const e=this.getDimensionInfo(t);this._headerObjectMap[t]={id:t,field:t,title:t===this.indicatorDimensionKey?this.indicatorTitle:e?.title??t,style:this.cornerSetting?.headerStyle,define:{field:t,headerType:this.cornerSetting?.headerType??"text",cellType:"text"},dropDownMenu:e?.dropDownMenu,headerType:this.cornerSetting?.headerType??"text",width:e?.width},this._headerObjects.push(this._headerObjectMap[t])}}))}initIndicatorObjects(){this.indicatorKeys.forEach((t=>{const e=this.indicatorsDefine?.find((e=>"string"!=typeof e&&e.indicatorKey===t));this._indicatorObjects.push({id:t,indicatorKey:t,field:t,define:Object.assign({field:t,headerType:"text",cellType:e?.cellType??e?.columnType??"text"},e),fieldFormat:e?.format,cellType:e?.cellType??e?.columnType??"text",chartModule:e&&("chartModule"in e?e?.chartModule:null),chartSpec:e&&("chartSpec"in e?e?.chartSpec:null),sparklineSpec:e&&("sparklineSpec"in e?e?.sparklineSpec:null),style:e?.style,icon:e?.icon,width:e?.width,minWidth:e?.minWidth,maxWidth:e?.maxWidth,disableColumnResize:e?.disableColumnResize})}))}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}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.rowHeaderLevelCount||(e<this.columnHeaderLevelCount||(t>=this.colCount-this.rightFrozenColCount||e>=this.rowCount-this.bottomFrozenRowCount))}isCornerHeader(t,e){return t<this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount&&e<this.columnHeaderLevelCount}isRightFrozenColumn(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.columnHeaderLevelCount&&e<this.rowCount-this.bottomFrozenRowCount}isBottomFrozenRow(t,e){return t>=this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount&&t<this.colCount-this.rightFrozenColCount}isLeftBottomCorner(t,e){return t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRowHeader(t,e){return t<this.rowHeaderLevelCount&&e>=this.columnHeaderLevelCount}isColumnIndicatorHeader(t,e){return"column"===this._indicatorShowType&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return"row"===this._indicatorShowType&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}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 headerLevelCount(){return this.columnHeaderLevelCount}get columnHeaderLevelCount(){const t=this.colShowAttrs.length;if(this.showColumnHeader){return this.indicatorsAsCol&&this.hideIndicatorName&&this.colShowAttrs[this.colShowAttrs.length-1]===this.indicatorDimensionKey?t-1:t}return this.indicatorsAsCol?this.hideIndicatorName?0:1:0}get rowHeaderLevelCount(){const t=this.rowShowAttrs.length;if(this.showRowHeader){return this.indicatorsAsCol?t:this.hideIndicatorName&&this.rowShowAttrs[this.rowShowAttrs.length-1]===this.indicatorDimensionKey?t-1:t}return this.indicatorsAsCol||this.hideIndicatorName?0:1}get colCount(){return this._colCount}get rowCount(){return this._rowCount}get bodyRowCount(){return this._bodyRowCount}get bottomFrozenRowCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"bottom"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}get rightFrozenColCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"right"===t.orient));return!1===t?.visible||this.indicatorsAsCol?0:this.hasTwoIndicatorAxes?1:0}get leftAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"left"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}get topAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"top"===t.orient));return!1===t?.visible?0:this.indicatorsAsCol&&this.hasTwoIndicatorAxes?1:0}get rightAxesCount(){return this.rightFrozenColCount}get bottomAxesCount(){return this.bottomFrozenRowCount}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicatorObjects}getCellId(t,e){if(t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount||e<this.columnHeaderLevelCount&&t>=this.colCount-this.rightFrozenColCount)return 0;if(e>=0&&t>=0)if(this.isCornerHeader(t,e)){if("column"===this.cornerSetting.titleOnDimension)return this.colShowAttrs[e];if("row"===this.cornerSetting.titleOnDimension)return this.rowShowAttrs[t]}else{if(this.isColumnHeader(t,e))return e<this.columns.length+(this.columnHeaderTitle?1:0)?this.convertColKeys[e]?.[this.indicatorsAsCol?Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length):t-this.rowHeaderLevelCount]??`colHeaderAxis-${t}-${e}`:this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length];if(this.isRowHeader(t,e))return t<this.rows.length+(this.rowHeaderTitle?1:0)?this.rowKeysPath[this.indicatorsAsCol?e-this.columnHeaderLevelCount:Math.floor((e-this.columnHeaderLevelCount)/this.indicatorKeys.length)]?.[t]??`rowHeaderAxis-${t}-${e}`:this.indicatorsAsCol&&t===this.rowHeaderLevelCount-1?`rowHeaderAxis-${t}-${e}`:this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length];if(this.isRightFrozenColumn(t,e))return this.indicatorsAsCol?this.rowKeysPath[e-this.columnHeaderLevelCount][this.rowHeaderLevelCount-1]:this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length];if(this.isBottomFrozenRow(t,e))return this.indicatorsAsCol?this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length]:this.convertColKeys[this.convertColKeys.length-1]?.[Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length)]}return 0}getIndicatorKey(t,e){if(this.isHeader(t,e))return"";if(this.indicatorsAsCol){const e=t-this.rowHeaderLevelCount;return this.indicatorKeys[e%this.indicatorKeys.length]}const i=e-this.columnHeaderLevelCount;return this.indicatorKeys[i%this.indicatorKeys.length]}getHeader(t,e){let i=this.getCellId(t,e);return i?.toString().startsWith("rowHeaderAxis")&&(i="rowHeaderEmpty"),this._headerObjectMap[i]??jU}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||this.getBody(t,e)?.field}getHeaderFieldKey(t,e){}getHeaderCellAdress(t){}getHeaderCellAddressByField(t){throw new Error(`Method not implemented.${t}`)}getBody(t,e){const i=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicatorObjects.find((e=>e.indicatorKey===t))??this._indicatorObjects[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}const n=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;return this._indicatorObjects.find((t=>t.indicatorKey===n))??this._indicatorObjects[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:void 0,define:void 0}}getBodyLayoutRangeById(t){for(let e=0;e<(this.colCount??0);e++)if(t===this.columnObjects[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getCellRange(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(!this.isHeader(t,e)||-1===t||-1===e||this.isIndicatorHeader(t,e))return i;if(this.isRightFrozenColumn(t,e)||this.isBottomFrozenRow(t,e))return i;const n=this.getCellId(t,e);for(let r=t-1;r>=0&&n===this.getCellId(r,e);r--)i.start.col=r;for(let r=t+1;r<(this.colCount??0)&&n===this.getCellId(r,e);r++)i.end.col=r;for(let r=e-1;r>=0&&n===this.getCellId(t,r);r--)i.start.row=r;for(let r=e+1;r<(this.rowCount??0)&&n===this.getCellId(t,r);r++)i.end.row=r;return i}isCellRangeEqual(t,e,i,n){const r=this.getCellRange(t,e),o=this.getCellRange(i,n);return r.start.col===o.start.col&&r.end.col===o.end.col&&r.start.row===o.start.row&&r.end.row===o.end.row}getRecordIndexByRow(t){return t<this.columnHeaderLevelCount?-1:this.indicatorsAsCol?t-this.columnHeaderLevelCount:Math.floor((t-this.columnHeaderLevelCount)/this.indicatorKeys.length)}getRecordIndexByCol(t){return t<this.rowHeaderLevelCount?-1:this.indicatorsAsCol?Math.floor((t-this.rowHeaderLevelCount)/this.indicatorKeys.length):t-this.rowHeaderLevelCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getCellHeaderPaths(t,e){const i=this.getRecordIndexByCol(t),n=this.getRecordIndexByRow(e);let r,o,s,a;return i>=0&&(r=this.colKeysPath[i],s=r?.[r.length-1]?.split(this.dataset.stringJoinChar),s&&this.showColumnHeader&&e<this.columns.length-1?s=s.slice(0,e+1):s||(s=[])),n>=0&&(o=this.rowKeysPath[n],a=o?.[o.length-1]?.split(this.dataset.stringJoinChar),a&&this.showRowHeader&&t<this.rows.length-1?a=a.slice(0,t+1):a||(a=[])),s&&this.indicatorsAsCol&&t>=this.rowHeaderLevelCount?s.push(this.indicatorKeys[(t-this.rowHeaderLevelCount)%this.indicatorKeys.length]):a&&e>=this.columnHeaderLevelCount&&a.push(this.indicatorKeys[(e-this.columnHeaderLevelCount)%this.indicatorKeys.length]),{colHeaderPaths:s?.map(((t,e)=>{const i=this._indicatorObjects.find((e=>e.indicatorKey===t));return{dimensionKey:i?void 0:this.colShowAttrs[e],indicatorKey:i?t:void 0,value:i?i.define.title:t}}))??[],rowHeaderPaths:a?.map(((t,e)=>{const i=this._indicatorObjects.find((e=>e.indicatorKey===t));return{dimensionKey:i?void 0:this.rowShowAttrs[e],indicatorKey:i?t:void 0,value:i?i.define.title:t}}))??[]}}getCellAdressByHeaderPath(t){let e,i;if(Array.isArray(t)){if(t.length>this.rowShowAttrs.length+this.colShowAttrs.length)return;e=t.filter((t=>this.colShowAttrs.indexOf(t.dimensionKey)>=0)),i=t.filter((t=>this.rowShowAttrs.indexOf(t.dimensionKey)>=0))}else e=t.colHeaderPaths,i=t.rowHeaderPaths;if(!Array.isArray(e)&&!Array.isArray(i))return;e?.sort(((t,e)=>this.colShowAttrs.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.colShowAttrs.indexOf(e.dimensionKey??this.indicatorDimensionKey))),i?.sort(((t,e)=>this.rowShowAttrs.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.rowShowAttrs.indexOf(e.dimensionKey??this.indicatorDimensionKey))),e?.length>=1&&i?.length;let n,r=0,o=0,s=this.rowTree,a=this.columnTree;if(e)for(let t=0;t<e.length;t++){const i=e[t];if(i.indicatorKey){n=i.indicatorKey;break}for(let t=0;t<a.length;t++){const e=a[t];if(!bu(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value){a=e.children,a&&0!==a.length&&!a?.[0]?.indicatorKey||(r+=t);break}r+=e.children?.[0]?.indicatorKey?0:e.children?.length??0}}if(i)for(let t=0;t<i.length;t++){const e=i[t];if(e.indicatorKey){n=e.indicatorKey;break}for(let t=0;t<s.length;t++){const i=s[t];if(!bu(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value){s=i.children,s&&0!==s.length&&!s?.[0]?.indicatorKey||(o+=t);break}o+=i.children?.[0]?.indicatorKey?0:i.children?.length??0}}return r=(this.indicatorsAsCol?r*this.indicatorKeys.length+this.indicatorKeys.indexOf(n):r)+this.rowHeaderLevelCount,o=(this.indicatorsAsCol?o:o*this.indicatorKeys.length+this.indicatorKeys.indexOf(n))+this.columnHeaderLevelCount,bu(r)||bu(o)?{col:r??undefined,row:o??undefined}:void 0}getHeaderDimension(t,e){if(this.isHeader(t,e)){const i=this.getHeader(t,e);return this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))}}updateDataset(t){this.dataset=t,this.dataConfig=t.dataConfig,this.rowKeysPath=t.rowKeysPath,this.colKeysPath=t.colKeysPath,this.tree=t.tree,this._indicatorObjects=[],this._headerObjects=[],this._headerObjectMap={},this.initState(),this.convertColKeys=fu(this.colKeysPath)}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}setChartInstance(t,e,i){const n=this.getCellHeaderPaths(t,e);let r;if(this.indicatorsAsCol){const t=n.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicatorObjects.find((e=>e.indicatorKey===t))}else{const t=n.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicatorObjects.find((e=>e.indicatorKey===t))}r&&(r.chartInstance=i)}getChartInstance(t,e){const i=this.getCellHeaderPaths(t,e);let n;if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicatorObjects.find((e=>e.indicatorKey===t))}else{const t=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicatorObjects.find((e=>e.indicatorKey===t))}return n?.chartInstance}_generateChartState(){return{vtable_selected:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}},vtable_selected_reverse:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}}}}updateDataStateToChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();this._indicatorObjects.forEach((t=>{t.chartInstance.updateState(e)})),t?.updateState(e)}updateDataStateToActiveChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();t?.updateState(e)}getOptimunWidthForChart(t){const e=this.getCellHeaderPaths(t,this.columnHeaderLevelCount).colHeaderPaths;let i;for(const t in this.dataset.collectValuesBy)if("xField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t][e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}const n=this._chartItemSpanSize||25;return(i?.length??0)*(n+n/3)}getOptimunHeightForChart(t){const e=this.getCellHeaderPaths(this.rowHeaderLevelCount,t).rowHeaderPaths;let i;for(const t in this.dataset.collectValuesBy)if("yField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t][e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}const n=this._chartItemSpanSize||25;return(i?.length??0)*(n+n/3)}getIndicatorKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),n=[];return i?(!1===this.indicatorsAsCol?i.series?i.series.forEach((t=>{const e=t.yField;n.push(e)})):n.push(i.yField):i.series?i.series.forEach((t=>{const e=t.xField;n.push(e)})):n.push(i.xField),n):null}getDimensionKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),n=[];return i?(!1===this.indicatorsAsCol?n.push(i.xField??i?.series[0]?.xField):n.push(i.yField??i?.series[0]?.yField),n):null}getAxisConfigInPivotChart(t,e){return BN(t,e,this)}getRawChartSpec(t,e){return LU(t,e,this)}getChartSpec(t,e){return function(t,e,i){let n=i.getRawChartSpec(t,e);return n?(n=cd(n),n.axes=i.getChartAxes(t,e),n.padding=0,n.dataZoom=[],n):null}(t,e,this)}getChartAxes(t,e){return function(t,e,i){const n=[];if(i.indicatorsAsCol){const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByCol(t);r.forEach(((r,s)=>{qu(r)&&(r=r[0]);const a=RN(t,e,0===s?"bottom":"top",i),l=i.dataset.collectedValues[r+(a?"_align":"")]?i.dataset.collectedValues[r+(a?"_align":"")]:i.dataset.collectedValues[r],h=l?.[i.getColKeysPath()?.[o]?.[Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]]??{min:0,max:1},{axisOption:c,isPercent:u}=MN(t,e,0===s?"bottom":"top",i);u&&(h.min=0,h.max=1),(c?.zero||h.min===h.max)&&(h.min=Math.min(h.min,0),h.max=Math.max(h.max,0)),n.push(fd({range:h},c,{type:"linear",orient:0===s?"bottom":"top",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:s,height:-1,sync:{axisId:HU}}))}));let s=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,t)[0];qu(s)&&(s=s[0]);const a=i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[],l=i.getRecordIndexByRow(e),h=i.getRowKeysPath()[l],c=a[h[h.length-1]],{axisOption:u,isPercent:d}=MN(t,e,"left",i);n.push(fd({domain:Array.from(c)},u,{type:"band",orient:"left",label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},width:-1}))}else{const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByRow(e);r.forEach(((r,s)=>{qu(r)&&(r=r[0]);const a=RN(t,e,0===s?"left":"right",i),l=i.dataset.collectedValues[r+(a?"_align":"")]?i.dataset.collectedValues[r+(a?"_align":"")]:i.dataset.collectedValues[r],h=l?.[i.getRowKeysPath()[o]?.[Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]??""]??{min:0,max:1},{axisOption:c,isPercent:u}=MN(t,e,0===s?"left":"right",i);u&&(h.min=0,h.max=1),(c?.zero||h.min===h.max)&&(h.min=Math.min(h.min,0),h.max=Math.max(h.max,0)),n.push(fd({range:h},c,{type:"linear",orient:0===s?"left":"right",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:s,width:-1,sync:{axisId:HU}}))}));let s=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];qu(s)&&(s=s[0]);const a=i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[],l=i.getRecordIndexByCol(t),h=i.getColKeysPath()[l],c=a?.[h?.[h?.length-1]??""]??[],{axisOption:u,isPercent:d}=MN(t,e,"bottom",i);n.push(fd({domain:Array.from(c)},u,{type:"band",orient:"bottom",visible:!0,label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},height:-1}))}return n}(t,e,this)}getChartDataId(t,e){return kU(t,e,this)}isEmpty(t,e){return!!this._table.isPivotChart()&&(t>this.colCount-this.rightFrozenColCount-1||e>this.rowCount-this.bottomFrozenRowCount-1||!(!this.hasTwoIndicatorAxes||!this.indicatorsAsCol||e!==this.columnHeaderLevelCount-1))}release(){const t=this._table._getActiveChartInstance();t?.release(),this._indicatorObjects.forEach((t=>{t.chartInstance?.release()}))}}class GU{dataConfig;records;tree={};colFlatKeys={};rowFlatKeys={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;constructor(t,e){if(this.dataConfig=t,e){this.records=e;const t="undefined"!=typeof window?window.performance.now():0;this.setRecords(e);const i="undefined"!=typeof window?window.performance.now():0;console.log("processRecords:",i-t)}delete this.rowFlatKeys,delete this.colFlatKeys}setRecords(t){this.processRecords()}processRecords(){for(let t=0,e=this.records.length;t<e;t++){const e=this.records[t];this.processRecord(e)}}processRecord(t){const e=[],i=[];for(let e=0,n=this.dataConfig.rows.length;e<n;e++){const n=this.dataConfig.rows[e];void 0!==t[n]&&n!==this.dataConfig.indicatorDimensionKey&&i.push(t[n])}for(let i=0,n=this.dataConfig.columns.length;i<n;i++){const n=this.dataConfig.columns[i];void 0!==t[n]&&n!==this.dataConfig.indicatorDimensionKey&&e.push(t[n])}this.dataConfig.indicators?.forEach((n=>{const r=t[n];void 0!==r&&(this.dataConfig.indicatorsAsCol?e.push(n):i.push(n));const o=i.join(this.stringJoinChar),s=e.join(this.stringJoinChar);0!==i.length&&(this.rowFlatKeys[o]||(this.rowFlatKeys[o]=1)),0!==e.length&&(this.colFlatKeys[s]||(this.colFlatKeys[s]=1)),0===e.length&&0===i.length||(this.tree[o]||(this.tree[o]={}),void 0!==r&&(this.tree[o][s]={value:r,record:t},this.dataConfig.indicatorsAsCol?e.pop():i.pop()))}))}getTreeNode(t=[],e=[],i){let n,r;if("string"==typeof t)n=t;else{let e=!1;t.map(((n,r)=>{n===i&&(t.splice(r,1),e=!0)})),e&&t.push(i),n=t.join(this.stringJoinChar)}if("string"==typeof e)r=e;else{let t=!1;e.map(((n,r)=>{n===i&&(e.splice(r,1),t=!0)})),t&&e.push(i),r=e.join(this.stringJoinChar)}return this.tree?.[n]?.[r]??void 0}}class VU{className="Aggregator";isRecord=!0;records=[];type;field;formatFun;_formatedValue;constructor(t,e,i){this.field=t,this.formatFun=e,this.isRecord=i??this.isRecord}formatValue(){return this._formatedValue||(this.formatFun?this._formatedValue=this.formatFun(this.value()):this._formatedValue=this.value()),this._formatedValue}reset(){this.records=[]}}class UU extends VU{type=Yc.RECORD;isRecord=!0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t))}value(){return this.records}reset(){this.records=[]}}class KU extends VU{type=Yc.SUM;sum=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.sum+=t.value():isNaN(parseFloat(t[this.field]))||(this.sum+=parseFloat(t[this.field]))}value(){return this.sum}reset(){this.records=[],this.sum=0}}class $U extends VU{type=Yc.COUNT;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.count+=t.value():this.count++}value(){return this.count}reset(){this.records=[],this.count=0}}class XU extends VU{type=Yc.AVG;sum=0;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className&&t.type===Yc.AVG?(this.sum+=t.sum,this.count+=t.count):isNaN(parseFloat(t[this.field]))||(this.sum+=parseFloat(t[this.field]),this.count++)}value(){return this.sum/this.count}reset(){this.records=[],this.sum=0,this.count=0}}class YU extends VU{type=Yc.MAX;max=Number.MIN_SAFE_INTEGER;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.max=t.max>this.max?t.max:this.max:"number"==typeof t?this.max=t>this.max?t:this.max:"number"==typeof t[this.field]?this.max=t[this.field]>this.max?t[this.field]:this.max:isNaN(t[this.field])||(this.max=parseFloat(t[this.field])>this.max?parseFloat(t[this.field]):this.max)}value(){return this.max}reset(){this.records=[],this.max=Number.MIN_SAFE_INTEGER}}class qU extends VU{type=Yc.MIN;min=Number.MAX_SAFE_INTEGER;isRecord=!1;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.min=t.min<this.min?t.min:this.min:"number"==typeof t?this.min=t<this.min?t:this.min:"number"==typeof t[this.field]&&(this.min=t[this.field]<this.min?t[this.field]:this.min)}value(){return this.min}reset(){this.records=[],this.min=Number.MAX_SAFE_INTEGER}}function ZU(t,e){return t&&e?t.toString().localeCompare(e.toString(),"zh"):t?1:-1}function JU(t,e){const i=/(\d+)|(\D+)/g,n=/\d/,r=/^0/;let o,s,a,l,h=0,c=0;if(null!==e&&null===t)return-1;if(null!==t&&null===e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(h=+t,c=+e,h<c)return-1;if(h>c)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(c)&&!isNaN(h))return-1;if(isNaN(h)&&!isNaN(c))return 1;if(o=String(t),a=String(e),o===a)return 0;if(!n.test(o)||!n.test(a))return o>a?1:-1;for(o=o.match(i),a=a.match(i);o.length&&a.length;)if(s=o.shift(),l=a.shift(),s!==l)return n.test(s)&&n.test(l)?s.replace(r,".0")-l.replace(r,".0"):s>l?1:-1;return o.length-a.length}function QU(t){return 2===t.length&&td(t[0])&&td(t[1])&&t[1]>=t[0]}function tK(t){const e=t[1]-t[0],i=t[1]*t[0]<0;let n=t[0]<=0?0-t[0]:0,r=t[1]>0?t[1]-0:0;return 0===e?t[0]<0?(n=1,r=0):t[0]>0&&(n=0,r=1):(n/=e,r/=e),{total:e,negative:n,positive:r,includeZero:i,domain:t,extendable_min:!0,extendable_max:!0}}function eK(t,e){const{positive:i,negative:n,extendable_min:r,extendable_max:o,domain:s}=t,{positive:a,negative:l,extendable_min:h,extendable_max:c,domain:u}=e;if(a>0){if(!h)return!1;let t=n/i;o&&(t=n/Math.max(i,a),s[1]=-s[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;r&&(t=i/Math.max(n,n),s[0]=-s[1]/t),u[1]=-u[0]*t}return!0}function iK(t,e){const{extendable_min:i,extendable_max:n,domain:r}=t,{positive:o,negative:s,domain:a}=e;return(0!==o||0!==s)&&(!(o>0&&!n)&&(!(s>0&&!i)&&(r[0]=a[0],r[1]=a[1],!0)))}function nK(t,e){const{positive:i,negative:n,extendable_max:r,domain:o}=t,{positive:s,negative:a,extendable_min:l,domain:h}=e;if(r&&l){const t=Math.max(n,a)/Math.max(i,s);o[1]=-o[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!r)return!1;{const t=a/s;o[1]=-o[0]/t}}return!0}function rK(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:r,domain:o}=e;return!(!i||!r)&&(n[0]=-n[1],o[1]=-o[0],!0)}function oK(t,e){const i=[t.min,t.max],n=[e.min,e.max];if(!QU(i)||!QU(n))return;const r=tK(i),o=tK(n),{positive:s,negative:a,extendable_min:l,extendable_max:h,includeZero:c}=r,{positive:u,negative:d,extendable_min:p,extendable_max:f,includeZero:g}=o;if(0===s&&0===a){if(!iK(r,o))return}else if(0===u&&0===d){if(!iK(o,r))return}else if(c||g)if(c&&!g){if(!eK(r,o))return}else if(g&&!c){if(!eK(o,r))return}else{if(a===d)return;if(a>d){if(!nK(r,o))return}else if(!nK(o,r))return}else{if(0===a&&0===u){if(!rK(r,o))return}else if(0===d&&0===s&&!rK(o,r))return;if(0===a&&0===d)if(0===i[0]&&n[0]>0){if(!p)return;n[0]=0}else{if(!(0===n[0]&&i[0]>0))return;if(!l)return;i[0]=0}if(0===s&&0===u)if(0===i[1]&&n[1]>0){if(!f)return;n[1]=0}else{if(!(0===n[1]&&i[1]>0))return;if(!h)return;i[1]=0}}return{range1:i,range2:n}}class sK{dataConfig;pagination;records;tree={};colFlatKeys={};rowFlatKeys={};colKeys=[];rowKeys=[];rowKeysPath;colKeysPath;rowOrder="key_a_to_z";colOrder="key_a_to_z";sorted=!1;sortRules;filterRules;aggregationRules;derivedFieldRules;mappingRules;totals;indicatorStatistics=[];aggregators={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;collectValuesBy;collectedValues={};cacheCollectedValues={};rows;columns;indicatorKeys;rowKeysPath_FULL;constructor(t,e,i,n,r,o,s,a){this.registerAggregators(),this.dataConfig=t,this.sortRules=this.dataConfig?.sortRules,this.aggregationRules=this.dataConfig?.aggregationRules,this.derivedFieldRules=this.dataConfig?.derivedFieldRules,this.mappingRules=this.dataConfig?.mappingRules,this.totals=this.dataConfig?.totals,this.rows=i,this.columns=n,this.indicatorKeys=r,this.colGrandTotalLabel=this.totals?.column?.grandTotalLabel??"总计",this.colSubTotalLabel=this.totals?.column?.subTotalLabel??"小计",this.rowGrandTotalLabel=this.totals?.row?.grandTotalLabel??"总计",this.rowSubTotalLabel=this.totals?.row?.subTotalLabel??"小计",this.collectValuesBy=this.dataConfig?.collectValuesBy,this.rowsIsTotal=new Array(this.rows.length).fill(!1),this.colsIsTotal=new Array(this.columns.length).fill(!1);for(let t=0,e=this.totals?.row?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.row.subTotalsDimensions[t],i=this.rows.indexOf(e);this.rowsIsTotal[i]=!0}for(let t=0,e=this.totals?.column?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.column.subTotalsDimensions[t],i=this.columns.indexOf(e);this.colsIsTotal[i]=!0}if(this.rowKeysPath=[],this.rowKeysPath_FULL=[],this.colKeysPath=[],o){this.records=o;const t="undefined"!=typeof window?window.performance.now():0;this.setRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy();const e="undefined"!=typeof window?window.performance.now():0;console.log("processRecords:",e-t);const i="undefined"!=typeof window?window.performance.now():0;this.totalStatistics();const n="undefined"!=typeof window?window.performance.now():0;console.log("totalStatistics:",n-i);const r="undefined"!=typeof window?window.performance.now():0;this.sortKeys();const l="undefined"!=typeof window?window.performance.now():0;console.log("sortKeys:",l-r);const h="undefined"!=typeof window?window.performance.now():0;this.rowKeysPath_FULL=a?this.TreeToArr2(a):this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=s?this.TreeToArr2(s):this.TreeToArr(this.ArrToTree(this.colKeys,this.colsIsTotal,this.totals?.column?.showGrandTotals,this.colGrandTotalLabel,this.colSubTotalLabel));const c="undefined"!=typeof window?window.performance.now():0;console.log("TreeToArr:",c-h),this.dataConfig?.isPivotChart&&(this.dealWithZeroAlign(),this.cacheDeminsionCollectedValues())}this.updatePagination(e)}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(Yc.RECORD,UU),this.registerAggregator(Yc.SUM,KU),this.registerAggregator(Yc.COUNT,$U),this.registerAggregator(Yc.MAX,YU),this.registerAggregator(Yc.MIN,qU),this.registerAggregator(Yc.AVG,XU)}setRecords(){this.processRecords()}processCollectedValuesWithSumBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sumBy)for(const e in this.collectedValues[t]){const i=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()>t?e.value():t),Number.MIN_SAFE_INTEGER),n=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()<t?e.value():t),Number.MAX_SAFE_INTEGER);this.collectedValues[t][e]={},this.collectedValues[t][e].max=i,this.collectedValues[t][e].min=n}}processCollectedValuesWithSortBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sortBy)for(const e in this.collectedValues[t])this.collectedValues[t][e]=this.collectedValues[t][e].sort(((e,i)=>this.collectValuesBy[t]?.sortBy.indexOf(e)-this.collectValuesBy[t]?.sortBy.indexOf(i)))}processRecords(){let t=!1;if(this.dataConfig?.filterRules?.length>=1&&(t=!0),Array.isArray(this.records))for(let e=0,i=this.records.length;e<i;e++){const i=this.records[e];t&&!this.filterRecord(i)||this.processRecord(i)}else for(const e in this.records)for(let i=0,n=this.records[e].length;i<n;i++){const n=this.records[e][i];t&&!this.filterRecord(n)||this.processRecord(n,e)}this.rowFlatKeys={},this.colFlatKeys={}}filterRecord(t){let e=!0;for(let i=0;i<this.dataConfig.filterRules.length;i++){const n=this.dataConfig?.filterRules[i];if(n.filterKey){const i=t[n.filterKey];if(-1===n.filteredValues.indexOf(i)){e=!1;break}}else if(!n.filterFunc?.(t)){e=!1;break}}return e}processRecord(t,e){this.derivedFieldRules?.forEach(((e,i)=>{t[e.fieldName]=e.derivedFunc(t)}));const i=[],n=[];for(let e=0,i=this.rows.length;e<i;e++){const i=this.rows[e];n.push(t[i])}for(let e=0,n=this.columns.length;e<n;e++){const n=this.columns[e];i.push(t[n])}for(const e in this.collectValuesBy)if(t[e]){this.collectedValues[e]||(this.collectedValues[e]={});const i=this.collectValuesBy[e].by.map((e=>t[e])).join(this.stringJoinChar);if(this.collectedValues[e][i]||(this.collectValuesBy[e].sumBy?this.collectedValues[e][i]={}:this.collectValuesBy[e].range?this.collectedValues[e][i]={min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}:this.collectedValues[e][i]=[]),this.collectValuesBy[e].sumBy){const n=this.collectValuesBy[e].sumBy.map((e=>t[e])).join(this.stringJoinChar);this.collectedValues[e][i][n]||(this.collectedValues[e][i][n]=new this.aggregators[Yc.SUM](e)),this.collectedValues[e][i][n].push(t)}else if(this.collectValuesBy[e].range){const n=this.collectedValues[e][i];n.max=Math.max(t[e],n.max),n.min=Math.min(t[e],n.min)}else{const n=this.collectedValues[e][i];-1===n.indexOf(t[e])&&n.push(t[e])}}const r=n.join(this.stringJoinChar),o=i.join(this.stringJoinChar);0!==n.length&&(this.rowFlatKeys[r]||(this.rowKeys.push(n),this.rowFlatKeys[r]=1)),0!==i.length&&(this.colFlatKeys[o]||(this.colKeys.push(i),this.colFlatKeys[o]=1)),this.tree[r]||(this.tree[r]={}),this.tree[r]?.[o]||(this.tree[r][o]=[]);for(let i=0;i<this.indicatorKeys.length;i++){const n=this.getAggregatorRule(this.indicatorKeys[i]);if(this.tree[r]?.[o]?.[i]||(this.tree[r][o][i]=new this.aggregators[n?.aggregationType??Yc.SUM](n?.field??this.indicatorKeys[i],n?.formatFun)),e)this.indicatorKeys[i]===e&&this.tree[r]?.[o]?.[i].push(t);else if(n?.field)if("string"==typeof n?.field)n?.field in t&&this.tree[r]?.[o]?.[i].push(t);else{const e=n?.field.find((e=>e in t));e&&this.tree[r]?.[o]?.[i].push(t)}else this.indicatorKeys[i]in t&&this.tree[r]?.[o]?.[i].push(t)}if(this.mappingRules)for(let e=0;e<this.indicatorKeys.length;e++){if(!this.indicatorStatistics[e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.indicatorStatistics[e]={max:new this.aggregators[Yc.MAX](this.indicatorKeys[e]),min:new this.aggregators[Yc.MIN](this.indicatorKeys[e]),total:new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}}this.indicatorStatistics[e].max.push(this.tree[r]?.[o]?.[e].value()),this.indicatorStatistics[e].min.push(this.tree[r]?.[o]?.[e].value()),this.indicatorStatistics[e].total.push(t)}}updateSortRules(t){this.sorted=!1,this.sortRules=t,this.sortKeys(),this.rowKeysPath_FULL=this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals||0===this.columns.length,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=this.TreeToArr(this.ArrToTree(this.colKeys,this.colsIsTotal,this.totals?.column?.showGrandTotals||0===this.rows.length,this.colGrandTotalLabel,this.colSubTotalLabel))}updateFilterRules(t,e=!1){if(this.filterRules=t,e)this.tree={};else for(const t in this.tree)for(const e in this.tree[t])for(let i=0;i<this.tree[t][e].length;i++)this.tree[t][e][i].reset();this.collectedValues={},this.processRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy(),this.dataConfig?.isPivotChart&&this.dealWithZeroAlign()}updatePagination(t){if(this.pagination=t,bu(this.pagination?.perPageCount)&&bu(this.pagination?.currentPage)){this.pagination.perPageCount=Math.ceil(this.pagination.perPageCount/this.indicatorKeys.length)*this.indicatorKeys.length;const{perPageCount:t,currentPage:e}=this.pagination,i=Math.ceil(t*(e||0)/this.indicatorKeys.length),n=i+Math.ceil(t/this.indicatorKeys.length);this.rowKeysPath=this.rowKeysPath_FULL?.slice(i,n)}else this.rowKeysPath=this.rowKeysPath_FULL;this.pagination&&(this.pagination.totalCount=this.rowKeysPath_FULL?.length)}getAggregatorRule(t){return this.aggregationRules?.find(((e,i)=>t===e.indicatorKey))}getAggregator(t=[],e=[],i){const n=this.indicatorKeys.indexOf(i);let r,o,s;return o="string"==typeof t?t:t.join(this.stringJoinChar),s="string"==typeof e?e:e.join(this.stringJoinChar),r=this.tree[o]?.[s]?.[n],r||{className:"",push(){},value:()=>null,formatValue:()=>"",reset(){}}}sortKeys(){const t=this;if(!this.sorted){this.sorted=!0;const e=function(e,i){return t.getAggregator(e,i,"").value()};switch(this.rowOrder){case"value_a_to_z":this.rowKeys.sort((function(t,i){return JU(e(t,[]),e(i,[]))}));break;case"value_z_to_a":this.rowKeys.sort((function(t,i){return-JU(e(t,[]),e(i,[]))}));break;default:this.rowKeys.sort(this.arrSort(this.rows,!0))}switch(this.colOrder){case"value_a_to_z":this.colKeys.sort((function(t,i){return JU(e([],t),e([],i))}));break;case"value_z_to_a":this.colKeys.sort((function(t,i){return-JU(e([],t),e([],i))}));break;default:const t=this.arrSort(this.columns,!1);this.colKeys.sort(t)}}}arrSort(t,e){let i;const n=this,r=function(r){const o=[];for(let r=0,s=t.length;r<s;r++){i=t[r];let s=!1;if(n.sortRules)for(let t=0,a=n.sortRules.length;t<a;t++)n.sortRules[t].sortField===i&&(s=!0,o.push({field:i,fieldIndex:r,sortRule:n.sortRules[t],func:n.getSort(n.sortRules[t],e)}));s||o.push({field:i,fieldIndex:r,func:JU})}return o}.call(this);return function(i,o){let s,a;for(let l=0;l<r.length;l++){if(a=r[l],a.sortRule?.sortByIndicator){let r=i,l=o;a.fieldIndex<t.length-1&&(r=i.slice(0,a.fieldIndex+1),r.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel),l=o.slice(0,a.fieldIndex+1),l.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel)),s=a.func(r,l)}else s=a.func(i[a.fieldIndex],o[a.fieldIndex]);if(0!==s)return s*(a.sortRule?.sortType===qc.DESC?-1:1)}return 0}}getSort(t,e){const i=this;return t.sortByIndicator?(n,r)=>{const o=function(e,n){return e.length<i.rows.length&&e[e.length-1]!==i.rowSubTotalLabel&&e[e.length-1]!==i.rowGrandTotalLabel&&e.push(i.rowSubTotalLabel),n.length<i.columns.length&&n[n.length-1]!==i.colSubTotalLabel&&n[n.length-1]!==i.colGrandTotalLabel&&n.push(i.colSubTotalLabel),i.getAggregator(e,n,t.sortByIndicator).value()};return e?JU(o(n,t.query),o(r,t.query)):JU(o(t.query,n),o(t.query,r))}:t.sortBy?function(t){let e;const i={},n={};for(let r=0;r<t.length;r++)e=t[r],i[e]=r,"string"==typeof e&&(n[e.toLowerCase()]=r);return function(t,e){return null!==i[t]&&void 0!==i[t]&&null!==i[e]&&void 0!==i[e]?i[t]-i[e]:null!==i[t]&&void 0!==i[t]?-1:null!==i[e]&&void 0!==i[e]?1:null!==n[t]&&void 0!==i[t]&&null!==n[e]&&void 0!==i[e]?n[t]-n[e]:null===n[t]||void 0===i[t]||null===n[e]||void 0===i[e]?0:null!==n[t]&&void 0!==i[t]?-1:null!==n[e]&&void 0!==i[e]?1:JU(t,e)}}(t.sortBy):t.sortType?ZU:t.sortFunc?t.sortFunc:JU}totalStatistics(){const t=this;if(t?.totals?.column?.showSubTotals&&t?.totals?.column?.subTotalsDimensions?.length>=1||t?.totals?.row?.showSubTotals&&t?.totals?.row?.subTotalsDimensions?.length>=1||t?.totals?.column?.showGrandTotals||t?.totals?.row?.showGrandTotals){const e=[],i=(e,i)=>{const n=i.split(this.stringJoinChar);for(let r=0,o=t.totals?.column?.subTotalsDimensions?.length;r<o;r++){const o=t.totals.column.subTotalsDimensions[r],s=t.columns.indexOf(o);if(s>=0){const r=n.slice(0,s+1);r.push(t.totals?.column?.subTotalLabel??"小计");const o=r.join(this.stringJoinChar);this.tree[e][o]||(this.tree[e][o]=[]);for(let n=0;n<this.indicatorKeys.length;n++){if(!this.tree[e][o][n]){const t=this.getAggregatorRule(this.indicatorKeys[n]);this.tree[e][o][n]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[n],t?.formatFun)}this.tree[e][o][n].push(t.tree[e]?.[i]?.[n])}}}if(t.totals?.column?.showGrandTotals||0===this.rows.length){const n=t.colGrandTotalLabel;this.tree[e][n]||(this.tree[e][n]=[]);for(let r=0;r<this.indicatorKeys.length;r++){if(!this.tree[e][n][r]){const t=this.getAggregatorRule(this.indicatorKeys[r]);this.tree[e][n][r]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[r],t?.formatFun)}this.tree[e][n][r].push(t.tree[e]?.[i]?.[r])}}};Object.keys(t.tree).forEach((n=>{const r=n.split(this.stringJoinChar);Object.keys(t.tree[n]).forEach((o=>{for(let i=0,s=t.totals?.row?.subTotalsDimensions?.length;i<s;i++){const s=t.totals.row.subTotalsDimensions[i],a=t.rows.indexOf(s);if(a>=0){const i=r.slice(0,a+1);i.push(t.totals?.row?.subTotalLabel??"小计");const s=i.join(this.stringJoinChar);if(this.tree[s]||(this.tree[s]={},e.push(s)),!this.tree[s][o]){this.tree[s][o]=[];for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[s][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[s][o][e]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[s][o][e].push(t.tree[n]?.[o]?.[e])}}}}if(t.totals?.row?.showGrandTotals||0===this.columns.length){const i=t.rowGrandTotalLabel;this.tree[i]||(this.tree[i]={},e.push(i)),this.tree[i][o]||(this.tree[i][o]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[i][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[i][o][e]=new this.aggregators[t?.aggregationType??Yc.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[i][o][e].push(t.tree[n]?.[o]?.[e])}}i(n,o)}))})),e.forEach((e=>{Object.keys(t.tree[e]).forEach((t=>{i(e,t)}))}))}}ArrToTree(t,e,i,n,r){const o=[],s=this.stringJoinChar,a=new Map;if(t.forEach((t=>function(t){const i=[];let n;t.forEach(((l,h)=>{i.push(l);const c=i.join(s);let u=a.get(c);if(!u){if(u={id:c,children:[]},e[h]){let e=u.children;for(let i=h;i<t.length-1;i++){const t={id:`${c}${s}${r}`,children:[]};e.push(t),e=t.children}}a.set(c,u),n?e[h-1]?n.children.splice(n.children.length-1,0,u):n.children.push(u):o.push(u)}n=u}))}(t))),i){const t={id:n,children:[]};let i=t.children;for(let t=1;t<e.length;t++){const t={id:n,children:[]};i.push(t),i=t.children}o.push(t)}return o}TreeToArr(t){const e=[];function i(t,n){n.push(t.id),t.children.length>0?t.children?.forEach((t=>i(t,[...n]))):e.push(n)}return t.forEach((t=>i(t,[]))),e}TreeToArr2(t){const e=[];function i(t,n){n.push(n.length>0?[n[n.length-1],t.value].join(String.fromCharCode(0)):t.value),t.children?.length>0&&!t.children[0].indicatorKey?t.children?.forEach((t=>i(t,[...n]))):e.push(n)}return t.forEach((t=>i(t,[]))),e}dealWithZeroAlign(){const t=[];for(let e=0;e<this.aggregationRules.length;e++){const i=this.aggregationRules[e];qu(i.field)&&2===i.field.length&&t.push(i.field)}t.forEach((t=>{const e=t[0],i=t[1],n=this.collectedValues[e],r=this.collectedValues[i];this.collectedValues[e+"_align"]={},this.collectedValues[i+"_align"]={};const o=n||r;for(const t in o){const o=n?.[t]??{min:0,max:1},s=r?.[t]??{min:0,max:1},a=oK(o,s);if(a){const{range1:n,range2:r}=a;this.collectedValues[e+"_align"][t]={min:n[0],max:n[1]},this.collectedValues[i+"_align"][t]={min:r[0],max:r[1]}}else this.collectedValues[e+"_align"][t]={min:o.min,max:o.max},this.collectedValues[i+"_align"][t]={min:s.min,max:s.max}}}))}cacheDeminsionCollectedValues(){for(const t in this.collectValuesBy)"xField"!==this.collectValuesBy[t].type&&"yField"!==this.collectValuesBy[t].type||(this.dataConfig.dimensionSortArray?this.cacheCollectedValues[t]=aK(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}}function aK(t,e){return t.sort(((t,i)=>{const n=e.indexOf(t),r=e.indexOf(i);return n<r?-1:n>r?1:0}))}class lK{type;id;x=0;y=0;width=0;height=0;marginLeft;marginRight;marginTop;marginBottom;layoutWidth;layoutHeight;dx=0;dy=0;background;constructor(t){this.id=t.id,this.marginLeft=t.marginLeft??0,this.marginRight=t.marginRight??0,this.marginTop=t.marginTop??0,this.marginBottom=t.marginBottom??0,this.background=t.background||void 0}getSize(t){this.initLayoutSize()}initLayoutSize(){this.layoutWidth=this.width+this.marginLeft+this.marginRight,this.layoutHeight=this.height+this.marginTop+this.marginBottom,this.background&&(this.layoutWidth+=2*(this.background.expandX||0),this.layoutHeight+=2*(this.background.expandY||0)),this.dx=this.marginLeft,this.dy=this.marginTop}}const hK={row:{x:"x",y:"y",width:"width",height:"height",layoutWidth:"layoutWidth",layoutHeight:"layoutHeight",widthLimit:"widthLimit",heightLimit:"heightLimit",parentX:"parentX",parentY:"parentY",dx:"dx",dy:"dy"},column:{x:"y",y:"x",width:"height",height:"width",layoutWidth:"layoutHeight",layoutHeight:"layoutWidth",widthLimit:"heightLimit",heightLimit:"widthLimit",parentX:"parentY",parentY:"parentX",dx:"dy",dy:"dx"}};class cK{width=0;height=0;y=0;x=0;children=[];addAble=!0;widthLimit=0;heightLimit=0;direction;directionKey;offsetX=0;justifyContent;alignItems;constructor(t,e,i,n){this.direction=e,this.directionKey=hK[this.direction],this.justifyContent=i,this.alignItems=n,this[this.directionKey.widthLimit]=t}add(t){t[this.directionKey.x]=this[this.directionKey.width],this[this.directionKey.width]+=t[this.directionKey.layoutWidth],this.children.push(t),this.updateHeight(t)}canAdd(t){return!(this[this.directionKey.width]+t[this.directionKey.layoutWidth]>this[this.directionKey.widthLimit])}updateHeight(t){t[this.directionKey.layoutHeight]>this[this.directionKey.height]&&(this[this.directionKey.height]=t[this.directionKey.layoutHeight])}lineFinish(){this.updateXAlign()}updateXAlign(){const t=this[this.directionKey.widthLimit]-this[this.directionKey.width];"center"===this.justifyContent?this.offsetX=t/2:"start"===this.justifyContent?this.offsetX=0:this.offsetX=t}getOffsetY(t){switch(this.alignItems){case"start":default:return 0;case"center":return(this[this.directionKey.height]-t[this.directionKey.layoutHeight])/2;case"end":return this[this.directionKey.height]-t[this.directionKey.layoutHeight]}}getContentSize(){const t={width:0,height:0};for(let e=0;e<this.children.length;e++){const i=this.children[e];let n;n="container"===i.type?i.getContentSize():{width:i.layoutWidth,height:i.layoutHeight},t[this.directionKey.height]<n[this.directionKey.height]&&(t[this.directionKey.height]=n[this.directionKey.height]),t[this.directionKey.width]+=n[this.directionKey.width]}return t}getElements(t={parentX:0,parentY:0},e=!1,i=!1){const n=[];for(let r=0;r<this.children.length;r++){const o=this.children[r];if("container"===o.type||"group-element"===o.type){const r=o.getElements({[this.directionKey.parentX]:this.offsetX+this[this.directionKey.x]+t.parentX,[this.directionKey.parentY]:this.getOffsetY(o)+this[this.directionKey.y]+t.parentY},e,i);n.push(...r)}else{if("icon"===o.type&&("mouseenter_cell"===o.cache?.visibleTime&&!e||"click_cell"===o.cache?.visibleTime&&!i))continue;o[this.directionKey.x]+=this.offsetX+this[this.directionKey.x]+t.parentX,o[this.directionKey.y]+=this.getOffsetY(o)+this[this.directionKey.y]+t.parentY,n.push(o)}}return n}}class uK extends lK{type="rect";lineWidth;cornerRadius;radius;fill;stroke;constructor(t){super(t),this.width=t.width,this.height=t.height,this.lineWidth=t.lineWidth||0,this.cornerRadius=t.cornerRadius||0,this.radius=this.cornerRadius,this.fill=t.fill||"#777",this.stroke=t.stroke||void 0,this.initLayoutSize()}}var dK=Object.freeze({__proto__:null,Circle:class extends lK{type="circle";radius;radian;lineWidth;fill;stroke;constructor(t){super(t),this.radius=t.radius,this.radian=t.radian,this.lineWidth=t.lineWidth,this.fill=t.fill,this.stroke=t.stroke,this.width=2*this.radius,this.height=2*this.radius,this.initLayoutSize(),this.dx+=this.radius,this.dy+=this.radius}},Container:class extends lK{type="container";_widthObj;_heightObj;needCalcSize=!1;direction;justifyContent;alignItems;alignContent;lines=[];currentLine;currentLineY=0;table;directionKey;showBounds;offsetY=0;isRoot;constructor(t){super(t),this.direction=t.direction||"row",this.justifyContent=t.justifyContent||"start",this.alignItems=t.alignItems||"start",this.alignContent=t.alignContent||"start",lu(t.width)?this.width=t.width:(this._widthObj=t.width,this.needCalcSize=!0),lu(t.height)?this.height=t.height:(this._heightObj=t.height,this.needCalcSize=!0),this.directionKey=hK[this.direction],this.showBounds=t.showBounds||!1,this.initLayoutSize()}add(t){if(this.needCalcSize)throw new Error("Need to specify a parent element before adding a child element when use percent size!");"container"===t.type&&t.calcSize(this.width,this.height),this.currentLine&&this.currentLine.canAdd(t)?this.currentLine.add(t):(this.currentLine&&(this.currentLine.addAble=!1,this.currentLineY+=this.currentLine[this.directionKey.height],this.currentLine.lineFinish()),this.currentLine=new cK(this[this.directionKey.width],this.direction,this.justifyContent,this.alignItems),this.currentLine[this.directionKey.y]=this.currentLineY,this.currentLine.add(t),this.lines.push(this.currentLine))}updateYAlign(){const t=this[this.directionKey.height]-this.currentLineY;"center"===this.alignContent?this.offsetY=t/2:"start"===this.alignContent?this.offsetY=0:this.offsetY=t}getSize(){const t={width:0,height:0};this.currentLine&&this.currentLine.addAble?t[this.directionKey.height]=this.currentLineY+this.currentLine[this.directionKey.height]:t[this.directionKey.height]=this.currentLineY;for(let e=0;e<this.lines.length;e++){const i=this.lines[e];t[this.directionKey.width]<i[this.directionKey.width]&&(t[this.directionKey.width]=i[this.directionKey.width])}return t}getContentSize(){const t={width:0,height:0},e={width:!0,height:!0};this.isRoot||this._heightObj||(e.height=!1,t.height=this.height),this.isRoot||this._widthObj||(e.width=!1,t.width=this.width);for(let i=0;i<this.lines.length;i++){const n=this.lines[i].getContentSize();e[this.directionKey.width]&&t[this.directionKey.width]<n[this.directionKey.width]&&(t[this.directionKey.width]=n[this.directionKey.width]),e[this.directionKey.height]&&(t[this.directionKey.height]+=n[this.directionKey.height])}return t}calcSize(t,e){this._heightObj&&(this.height=e*this._heightObj.percent/100+this._heightObj.delta,this.needCalcSize=!1,this.initLayoutSize()),this._widthObj&&(this.width=t*this._widthObj.percent/100+this._widthObj.delta,this.needCalcSize=!1,this.initLayoutSize())}getElements(t={parentX:0,parentY:0},e=!1,i=!1){this.currentLine&&this.currentLine.addAble&&(this.currentLine.addAble=!1,this.currentLineY+=this.currentLine[this.directionKey.height],this.currentLine.lineFinish()),this.updateYAlign();const n=[];if(this.background&&this.background.fill){const e=new uK({width:this.width,height:this.height,stroke:this.background.stroke??!1,fill:this.background.fill,cornerRadius:this.background.cornerRadius??0,lineWidth:this.background.lineWidth??1});e.x+=this.x+t.parentX,e.y+=this.y+t.parentY,n.push(e)}if(this.showBounds){const e=new uK({width:this.width,height:this.height,cornerRadius:0,stroke:"red",fill:"rgba(255, 0, 0, 0.2)",lineWidth:4});e.x+=this.x+t.parentX,e.y+=this.y+t.parentY,n.push(e)}for(let r=0;r<this.lines.length;r++){const o=this.lines[r];o[this.directionKey.y]+=this.offsetY;const s=o.getElements({[this.directionKey.parentX]:this.x+t.parentX,[this.directionKey.parentY]:this.y+t.parentY},e,i);n.push(...s)}return n}},GroupElement:class extends lK{type="group-element";direction;alignItems;width=0;height=0;children=[];directionKey;constructor(t){super(t),this.direction=t.direction||"row",this.alignItems=t.alignItems||"start",this.directionKey=hK[this.direction]}add(t){t.x=this.width,this.width+=t.layoutWidth,this.children.push(t),this.updateHeight(t),this.initLayoutSize()}updateHeight(t){t.layoutHeight>this.height&&(this.height=t.layoutHeight)}getOffsetY(t){switch(this.alignItems){case"start":default:return 0;case"center":return(this[this.directionKey.height]-t[this.directionKey.layoutHeight])/2;case"end":return this[this.directionKey.height]-t[this.directionKey.layoutHeight]}}getElements(t={parentX:0,parentY:0},e=!1,i=!1){const n=[];for(let r=0;r<this.children.length;r++){const o=this.children[r];"icon"===o.type&&("mouseenter_cell"===o.cache?.visibleTime&&!e||"click_cell"===o.cache?.visibleTime&&!i)||(o[this.directionKey.x]+=this[this.directionKey.dx]+this[this.directionKey.x]+t.parentX,o[this.directionKey.y]+=this.getOffsetY(o)+this[this.directionKey.dy]+this[this.directionKey.y]+t.parentY,n.push(o))}return n}},Icon:class extends lK{type="icon";svg;iconName;cursor;cache;constructor(t){if(super(t),this.iconName=t.iconName,au(this.iconName)){const t=yj()[this.iconName];t&&(this.cache=t,this.width=t.width,this.height=t.height,this.svg=t.svg,this.cursor=t.cursor)}this.width=t.width??this.width,this.height=t.height??this.height,this.svg=t.svg??this.svg,this.initLayoutSize()}},Image:class extends lK{type="image";src;cursor;cache;shape;constructor(t){super(t),this.width=t.width??this.width,this.height=t.height??this.height,this.src=t.src??this.src,this.shape=t.shape??this.shape,this.initLayoutSize()}},Rect:uK,Sector:class extends lK{type="arc";radius;startDegree=0;endDegree=360;clockWise=!0;lineWidth;fill;stroke;constructor(t){super(t),this.radius=t.radius,this.startDegree=t.startDegree,this.endDegree=t.endDegree,this.clockWise=t.clockWise,this.lineWidth=t.lineWidth,this.fill=t.fill,this.stroke=t.stroke,this.width=2*this.radius,this.height=2*this.radius,this.initLayoutSize(),this.dx+=this.radius,this.dy+=this.radius}},Text:class extends lK{type="text";text;fill;color;stroke;lineWidth;fontSize;fontFamily;fontWeight;fontVariant;fontStyle;ellipsis;maxLineWidth;textAlign;textBaseline;lineHeight;underline;lineThrough;heightLimit;lineClamp;constructor(t){super(t),this.text=t.text,this.fontSize=t.fontSize||12,this.fontFamily=t.fontFamily||"sans-serif",this.fill=t.color||t.fill||"black",this.textBaseline=t.textBaseline||"top",this.textAlign=t.textAlign||"left",t.stroke&&(this.stroke=t.stroke),t.lineWidth&&(this.lineWidth=t.lineWidth),t.fontWeight&&(this.fontWeight=t.fontWeight),t.fontVariant&&(this.fontVariant=t.fontVariant),t.fontStyle&&(this.fontStyle=t.fontStyle),t.ellipsis&&(this.ellipsis=t.ellipsis),t.maxLineWidth&&(this.maxLineWidth=t.maxLineWidth),t.lineHeight&&(this.lineHeight=t.lineHeight),t.underline&&(this.underline=t.underline),t.lineThrough&&(this.lineThrough=t.lineThrough),t.heightLimit&&(this.heightLimit=t.heightLimit),t.lineClamp&&(this.lineClamp=t.lineClamp)}getSize(t){const{width:e,height:i}=t.measureText(this.text,{fontSize:this.fontSize,fontWeight:this.fontWeight,fontFamily:this.fontFamily});this.width=e,this.height=i,this.initLayoutSize(),this.background&&(this.dx+=this.background.expandX||0,this.dy+=this.background.expandY||0)}},percentCalc:function(t,e=0){return{percent:t,delta:e}}});t.CustomLayout=dK,t.DataStatistics=EU,t.ListTable=class extends AU{showHeader=!0;constructor(t,e){t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e);const i=this.internalProps;this.pagination=e.pagination,i.sortState=e.sortState,i.columns=e.columns?du(e.columns):e.header?du(e.header):[],this.showHeader=e.showHeader??!0,this.transpose=e.transpose??!1,this.refreshHeader(),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,i.sortState):this.setRecords([])}isListTable(){return!0}isPivotTable(){return!1}isPivotChart(){return!1}get sortState(){return this.internalProps.sortState}get columns(){return this.internalProps.columns}set columns(t){this.internalProps.columns=t,this.options.columns=t}updateColumns(t){this.internalProps.columns=t,this.options.columns=t,this.refreshHeader(),this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.scenegraph.createSceneGraph(),this.render()}get header(){return this.internalProps.columns}set header(t){this.internalProps.columns=t,this.options.header=t,this.refreshHeader(),setTimeout((()=>{this.render()}),0)}get transpose(){return this.internalProps.transpose??!1}set transpose(t){this.internalProps.transpose!==t&&(this.internalProps.transpose=t,this.options.transpose=t,this.internalProps.layoutMap&&(this.internalProps.layoutMap.transpose=t,this.refreshRowColCount(),this._resetFrozenColCount(),this.render()))}getCellValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}const{field:n,fieldFormat:r}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(r||n,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getRecordIndexByRow(t,e){const{layoutMap:i}=this.internalProps;return i.getRecordIndexByRow(t,e)}getCellOriginRecord(t,e){const i=this,n=i.getRecordIndexByRow(t,e);if(n>-1)return i.dataSource.get(n)}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.transpose){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;return super.updateOption(t),this.pagination=t.pagination,this.showHeader=t.showHeader??!0,i.columns=t.columns?du(t.columns):t.header?du(t.header):[],this.transpose=t.transpose??!1,this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,t.sortState):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){this.pagination&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.dataSource.updatePagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){const t=this,e=t.internalProps,i=t.transpose,n=t.showHeader;e.headerEvents&&e.headerEvents.forEach((e=>t.off(e)));const r=e.layoutMap=new OU(this,e.columns??[],n,t.options.hierarchyIndent);if(r.transpose=i,!i)for(let e=0;e<r.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:o}=r.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&t.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&t.setMinColWidth(e,n),o&&("number"==typeof o&&o>0||"string"==typeof o)&&t.setMaxColWidth(e,o)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(e.recordsCount=t.internalProps.dataSource?.length??0,t.transpose?(t.rowCount=e.rowCount??0,t.colCount=(t.internalProps.dataSource?.length??0)*e.bodyRowCount+e.headerLevelCount,t.frozenRowCount=0,t.frozenColCount=e.headerLevelCount,t.rightFrozenColCount=this.options.rightFrozenColCount??0):(t.colCount=e.colCount??0,t.rowCount=(t.internalProps.dataSource?.length??0)*e.bodyRowCount+e.headerLevelCount,t.frozenColCount=t.options.frozenColCount??0,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0,t.rightFrozenColCount=this.options.rightFrozenColCount??0))}getFieldData(t,e,i){if(null===t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=n.getRecordIndexByRow(e,i);return n.internalProps.dataSource.getField(r,t)}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize),!this.transpose){this.colWidthsLimit={};for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearColRangeWidthsMap(i)}else{const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearRowRangeHeightsMap(i)}return!0}return!1}getCellAddress(t,e){let i;for(let e=0;e<this.internalProps.records.length;e++){const n=this.internalProps.records[e];if("function"==typeof t)t(n)&&(i=e);else{let r=!0;for(const e in t)if(n[e]!==t[e]){r=!1;break}r&&(i=e)}if(bu(i))break}const n=this.getCellRangeByField(e,i);if(n)return{row:n.start.row,col:n.start.col}}getCellRangeByField(t,e){const{layoutMap:i}=this.internalProps,n=i.columnObjects.find((e=>e.field===t));if(n){const t=i.getBodyLayoutRangeById(n.id);let r;return bu(e)&&(r=i.getRecordStartRowByRecordIndex(e)),this.transpose?{start:{row:t.start.row,col:bu(r)?r+t.start.col:void 0},end:{row:t.end.row,col:bu(r)?r+t.end.col:void 0}}:{start:{col:t.start.col,row:bu(r)?r+t.start.row:void 0},end:{col:t.end.col,row:bu(r)?r+t.end.row:void 0}}}return null}getHierarchyState(t,e){if(!this.getBodyColumnDefine(t,e).tree)return Xc.none;const i=this.getRecordIndexByRow(t,e);return this.dataSource.getHierarchyState(i)}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(sf.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(sf.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.getRecordIndexByRow(t,e),r=this.dataSource.toggleHierarchyState(n),o=this.internalProps.layoutMap.toggleHierarchyState(r);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(o.removeCellPositions,o.addCellPositions)}hasHierarchyTreeHeader(){return(this.options.columns??this.options.header)?.some(((t,e)=>t.tree))}getMenuInfo(t,e,i){return{field:this.getHeaderField(t,e),value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e)}}_getSortFuncFromHeaderOption(t,e,i){if(t||(t=this.internalProps.columns),e&&t&&t.length>0)for(let n=0;n<t.length;n++){const r=t[n];if((i&&i===r.fieldKey||!i&&r.field===e)&&r.sort&&"function"==typeof r.sort)return r.sort;if(r.columns){const t=this._getSortFuncFromHeaderOption(r.columns,e,i);if(t)return t}}}updateSortState(t,e=!0){if(t)this.internalProps.sortState=t;else if(this.internalProps.sortState)if(Array.isArray(this.internalProps.sortState))for(let t=0;t<this.internalProps.sortState.length;t++){this.internalProps.sortState[t].order="normal"}else this.internalProps.sortState.order="normal";let i,n,r;if(Array.isArray(this.internalProps.sortState)?({order:i,field:n,fieldKey:r}=this.internalProps.sortState?.[0]):({order:i,field:n,fieldKey:r}=this.internalProps.sortState),n&&e){const t=this._getSortFuncFromHeaderOption(this.internalProps.columns,n,r);let e;e=r?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===r)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===n)),e?.define?.sort&&(this.dataSource.sort(e.field,i,t),this.scenegraph.sortCell())}this.stateManeger.updateSortState(t)}},t.PivotChart=class extends AU{pivotSortState;dataset;_selectedDataItemsInChart=[];_selectedDimensionInChart=[];_chartEventMap={};_axes;constructor(t,e){t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.setCustomStateNameToSpec(),this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig={isPivotChart:!0},this._axes=qu(e.axes)?e.axes:[];const i=e.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],n=e.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],r=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(n,i),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new sK(this.internalProps.dataConfig,null,i,n,r,e.records,e.columnTree,e.rowTree),this.refreshHeader(),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return tV}get pivotChartAxes(){return this._axes}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!0}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;if(super.updateOption(t),this.setCustomStateNameToSpec(),i.columnResizeType=t.columnResizeType??"column",i.dataConfig={},this._axes=qu(t.axes)?t.axes:[],t.rows||t.columns){const e=t.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),i=t.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=t.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[]);this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(i,e),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.dataset=new sK(this.internalProps.dataConfig,null,e,i,n,t.records??this.internalProps.records,t.columnTree,t.rowTree)}return this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(){}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.off(t))),t.layoutMap=new NU(this,this.dataset);for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:r}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMinColWidth(e,n),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMaxColWidth(e,r)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.frozenColCount=e.rowHeaderLevelCount,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=e?.bottomFrozenRowCount??0,t.rightFrozenColCount=e?.rightFrozenColCount??0)}_getSortFuncFromHeaderOption(t,e,i){}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{t?.children?.[i]&&e&&this.syncHierarchyState(t.children[i],e)})))}getRecordIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByRow(t)}getRecordIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByCol(t)}getFieldData(t,e,i){if(null==t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=this.getRecordIndexByRow(i),o=this.getRecordIndexByCol(e),s=n.dataSource?.getField(r,o);if("string"!=typeof t){return fW({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,of)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:n}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n(i):i}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}const{field:i,fieldFormat:n}=this.internalProps.layoutMap.getBody(t,e);return this.getFieldData(n||i,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getCellOriginRecord(t,e){if(!this.internalProps.layoutMap.isHeader(t,e)&&this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[];return this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e)).records}}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.internalProps.layoutMap.updateDataset(this.dataset),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:n}=t[e],r=this.internalProps.layoutMap.getPivotCellAdress(i);r&&this.pivotSortState.push({col:r.col,row:r.row,order:n})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:n,order:r}=this.pivotSortState[t];if(qp(i,e,n))return r}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(tV.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(tV.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(n.removeCellPositions,n.addCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;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);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const n=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:n[n.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}_generateCollectValuesConfig(t,e){const i=this.options,n={};for(let r=0,o=i.indicators?.length;r<o;r++)if("string"!=typeof i.indicators[r]&&i.indicators[r].chartSpec)if(!1===i.indicatorsAsCol){const o=i.indicators[r];if(n[o.indicatorKey]={by:e,range:!0,sumBy:!1!==o.chartSpec?.stack&&t.concat(o.chartSpec?.xField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const r="string"==typeof i.xField?i.xField:i.xField[0];n[r]={by:t,type:"horizontal"!==i.direction?"xField":void 0,range:"horizontal"===i.direction,sortBy:"horizontal"!==i.direction?i?.data?.fields?.[r]?.domain??o.chartSpec?.data?.fields?.[r]?.domain:void 0};const s=i.yField;n[s]={by:e,range:"horizontal"!==i.direction,sumBy:!1!==i.stack&&t.concat(r),sortBy:"horizontal"===i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.xField?o.chartSpec.xField:o.chartSpec.xField[0];n[s]={by:t,type:"horizontal"!==o.chartSpec.direction?"xField":void 0,range:"horizontal"===o.chartSpec.direction,sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.yField;n[a]={by:e,range:"horizontal"!==i.indicators[r].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&t.concat(s),sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}else{const o=i.indicators[r];if(n[o.indicatorKey]={by:t,range:!0,sumBy:!1!==o.chartSpec?.stack&&e.concat(o.chartSpec?.yField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const r="string"==typeof i.yField?i.yField:i.yField[0];n[r]={by:e,type:"horizontal"===i.direction?"yField":void 0,range:"horizontal"!==i.direction,sortBy:"horizontal"===i.direction?i?.data?.fields?.[r]?.domain??o.chartSpec?.data?.fields?.[r]?.domain:void 0};const s=i.xField;n[s]={by:t,range:"horizontal"===i.direction,sumBy:!1!==i.stack&&e.concat(r),sortBy:"horizontal"!==i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.yField?o.chartSpec.yField:o.chartSpec.yField[0];n[s]={by:e,type:"horizontal"===o.chartSpec.direction?"yField":void 0,range:"horizontal"!==o.chartSpec.direction,sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.xField;n[a]={by:t,range:"horizontal"===i.indicators[r].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&e.concat(s),sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}return n}_generateAggregationRules(){const t=[];return this.options.indicators?.forEach((e=>{if("string"==typeof e)t.push({indicatorKey:e,field:e,aggregationType:Yc.RECORD});else if(e.chartSpec?.series){const i=[];e.chartSpec?.series.forEach((t=>{const e=!1===this.options.indicatorsAsCol?t.yField:t.xField;-1===i.indexOf(e)&&i.push(e)})),t.push({indicatorKey:e.indicatorKey,field:i,aggregationType:Yc.RECORD})}else{const i=!1===this.options.indicatorsAsCol?e.chartSpec.yField:e.chartSpec.xField;t.push({indicatorKey:e.indicatorKey,field:i??e.indicatorKey,aggregationType:Yc.RECORD})}})),t}setCustomStateNameToSpec(){const t=t=>{t.bar?.state?.selected&&(t.bar.state.vtable_selected=t.bar.state.selected,t.bar.state.vtable_selected_reverse=t.bar.state.selected_reverse,delete t.bar.state.selected,delete t.bar.state.selected_reverse),t.point?.state?.selected&&(t.point.state.vtable_selected=t.point.state.selected,t.point.state.vtable_selected_reverse=t.point.state.selected_reverse,delete t.point.state.selected,delete t.point.state.selected_reverse),t.line?.state?.selected&&(t.line.state.vtable_selected=t.line.state.selected,t.line.state.vtable_selected_reverse=t.line.state.selected_reverse,delete t.line.state.selected,delete t.line.state.selected_reverse),t.area?.state?.selected&&(t.area.state.vtable_selected=t.area.state.selected,t.area.state.vtable_selected_reverse=t.area.state.selected_reverse,delete t.area.state.selected,delete t.area.state.selected_reverse)};this.options.indicators?.forEach((e=>{if(e.chartSpec){const i=e.chartSpec;i.series?i.series.forEach((e=>{t(e)})):t(i)}}))}onVChartEvent(t,e,i){this._chartEventMap[t]="function"==typeof e?{callback:e}:{callback:i,query:e}}offVChartEvent(t){delete this._chartEventMap[t]}_bindChartEvent(t){if(t)for(const e in this._chartEventMap)this._chartEventMap[e].query?t.on(e,this._chartEventMap[e].query,this._chartEventMap[e].callback):t.on(e,this._chartEventMap[e].callback)}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),OG(this.scenegraph),function(t){const e=t.table;for(let i=t.proxy.colStart;i<=t.proxy.colEnd;i++)t.getColGroup(i).getChildren().forEach((t=>{const i=t.col,n=t.row;t.children.forEach((t=>{if("chart"===t.type){t.updateData(e.getCellValue(i,n));const r=e.internalProps.layoutMap.getChartAxes(i,n);t.setAttribute("axes",r);const o=t.attribute.spec;o.axes=r,t.setAttribute("spec",o)}}))}));DG(t.rowHeaderGroup,t.table),DG(t.colHeaderGroup,t.table),DG(t.rightFrozenGroup,t.table),DG(t.bottomFrozenGroup,t.table)}(this.scenegraph),this.render()}setLegendSelected(t){this.internalProps.legends.legendComponent.setSelected(t)}getChartDatumPosition(t,e){const i=this.getCellAddressByHeaderPaths(e),n=this.getCellRelativeRect(i.col,i.row);console.log(n);const r=this.scenegraph.getCell(i.col,i.row);let o;const s=r?.getChildren()?.[0];if(s.attribute.chartInstance){const e=s.attribute.chartInstance,{dataId:i,data:n,axes:r}=s.attribute,a=s.getViewBox();r.forEach(((t,i)=>{if("linear"===t.type){e._chart._components[i]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const n=e._chart._components[i];n._spec.domain=t.domain.slice(0),n.updateScaleDomain()}})),e.updateViewBox({x1:a.x1-s.getRootNode().table.scrollLeft,x2:a.x2-s.getRootNode().table.scrollLeft,y1:a.y1-s.getRootNode().table.scrollTop,y2:a.y2-s.getRootNode().table.scrollTop},!1),e.updateDataSync(i,n),o=e.convertDatumToPosition(t),this.render()}return o?{x:Math.round(o.x+n.bounds.x1),y:Math.round(o.y+n.bounds.y1)}:null}_getDimensionSortArray(){if(this.options?.axes?.length){const t=this.options.indicatorsAsCol?"left":"bottom",e=this.options.axes.find((e=>e.orient===t));if(e&&qu(e.domain))return e.domain}}},t.PivotTable=class extends AU{pivotSortState;dataset;flatDataToObjects;constructor(t,e){if(t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.pagination=e.pagination,this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig=e.dataConfig,this.internalProps.enableDataAnalysis=e.enableDataAnalysis,this.internalProps.enableDataAnalysis){const t=e.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],i=e.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],n=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.dataset=new sK(this.internalProps.dataConfig,this.pagination,t,i,n,e.records)}this.refreshHeader(),this.pivotSortState=[],e.pivotSortState&&this.updatePivotSortState(e.pivotSortState),e.dataSource?uj(this,e.dataSource):e.records?this.setRecords(e.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return QG}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!1}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;if(super.updateOption(t),this.pagination=t.pagination,i.columnResizeType=t.columnResizeType??"column",i.dataConfig=t.dataConfig,i.enableDataAnalysis=t.enableDataAnalysis,"tree"===t?.rowHierarchyType&&"tree"===this.internalProps.layoutMap.rowHierarchyType&&this.internalProps.layoutMap.rowExpandLevel===t?.rowExpandLevel){const t=this.internalProps.layoutMap.rowDimensionTree.tree.children;this.internalProps.layoutMap.rowTree.forEach(((e,i)=>{this.syncHierarchyState(t[i],e)}))}if(this.internalProps.enableDataAnalysis&&(t.rows||t.columns)){const e=t.rows.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=t.columns.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),r=t.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[]);this.dataset=new sK(i.dataConfig,this.pagination,e,n,r,t.records)}return this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?uj(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){this.pagination&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.dataset.updatePagination(this.pagination),this.refreshHeader(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.off(t)));const e=this.options.records??this.internalProps.records;this.options.enableDataAnalysis?t.layoutMap=new NU(this,this.dataset):(Array.isArray(this.options.columnTree)||Array.isArray(this.options.rowTree))&&(t.layoutMap=new WU(this),e?.[0]?.constructor!==Array&&(this.flatDataToObjects=new GU({rows:t.layoutMap.rowDimensionKeys,columns:t.layoutMap.colDimensionKeys,indicators:t.layoutMap.indicatorKeys,indicatorsAsCol:t.layoutMap.indicatorsAsCol,indicatorDimensionKey:t.layoutMap.indicatorDimensionKey},e)));for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:n,maxWidth:r}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this.setColWidth(e,i),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMinColWidth(e,n),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMaxColWidth(e,r)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.frozenColCount=e.rowHeaderLevelCount,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0,t.rightFrozenColCount=this.options.rightFrozenColCount??0)}_getSortFuncFromHeaderOption(t,e,i){}get rowHierarchyType(){return this.internalProps.layoutMap.rowHierarchyType}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{t?.children?.[i]&&e&&this.syncHierarchyState(t.children[i],e)})))}getRecordIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByRow(t)}getRecordIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getRecordIndexByCol(t)}getFieldData(t,e,i){if(null==t)return null;const n=this;if(n.internalProps.layoutMap.isHeader(e,i))return null;const r=this.getRecordIndexByRow(i),o=this.getRecordIndexByCol(e),s=n.dataSource?.getField(r,o);if("string"!=typeof t){return fW({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,of)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:n}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n(i):i}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.formatValue?r.formatValue():""}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey),{fieldFormat:s}=this.internalProps.layoutMap.getBody(t,e);return"function"==typeof s?s(o?.record):o?.value??""}const{field:i,fieldFormat:n}=this.internalProps.layoutMap.getBody(t,e);return this.getFieldData(n||i,t,e)}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:n}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof n?n():n}if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[],r=this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e));return r.value?r.value():void 0}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return o?.value}const{field:n}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(n,t,e)}getCellOriginRecord(t,e){if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.dataset){const i=this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(t)]??[],n=this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(e)]??[];return this.dataset.getAggregator(n[n.length-1],i[i.length-1],this.internalProps.layoutMap.getIndicatorKey(t,e)).records}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),r=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(r,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return o?.record}}}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.internalProps.layoutMap.updateDataset(this.dataset),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:n}=t[e],r=this.internalProps.layoutMap.getPivotCellAdress(i);r&&this.pivotSortState.push({col:r.col,row:r.row,order:n})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:n,order:r}=this.pivotSortState[t];if(qp(i,e,n))return r}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===Xc.expand?this.fireListeners(QG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.collapse}):i===Xc.collapse&&this.fireListeners(QG.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Xc.expand,originData:this.getCellOriginRecord(t,e)});const n=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(n.removeCellPositions,n.addCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;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);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const n=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:n[n.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}},t.TYPES=nu,t.clearGlobal=function(){RU()},t.core=TU,t.data=bW,t.getIcons=function(){return yj()},t.register=PU,t.themes=zf,t.version="0.10.3-alpha.1"}));