@visactor/vtable 0.9.3-alpha.3 → 0.9.3-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/cjs/ListTable.js +3 -4
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.d.ts +4 -4
  4. package/cjs/PivotChart.js +18 -17
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.js +6 -7
  7. package/cjs/PivotTable.js.map +1 -1
  8. package/cjs/components/axis/axis.js +1 -1
  9. package/cjs/components/axis/axis.js.map +1 -1
  10. package/cjs/components/legend/legend.js +3 -3
  11. package/cjs/components/legend/legend.js.map +1 -1
  12. package/cjs/components/title/title.js +3 -3
  13. package/cjs/components/title/title.js.map +1 -1
  14. package/cjs/core/BaseTable.d.ts +1 -1
  15. package/cjs/core/BaseTable.js +5 -4
  16. package/cjs/core/BaseTable.js.map +1 -1
  17. package/cjs/dataset/dataset.d.ts +4 -4
  18. package/cjs/dataset/dataset.js +16 -13
  19. package/cjs/dataset/dataset.js.map +1 -1
  20. package/cjs/index.d.ts +1 -1
  21. package/cjs/index.js +1 -1
  22. package/cjs/index.js.map +1 -1
  23. package/cjs/layout/chart-helper/get-axis-config.d.ts +1 -0
  24. package/cjs/layout/chart-helper/get-axis-config.js +18 -9
  25. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  26. package/cjs/layout/chart-helper/get-chart-spec.js +13 -7
  27. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  28. package/cjs/layout/pivot-layout.d.ts +1 -0
  29. package/cjs/layout/pivot-layout.js +11 -0
  30. package/cjs/layout/pivot-layout.js.map +1 -1
  31. package/cjs/scenegraph/graphic/chart.d.ts +6 -6
  32. package/cjs/scenegraph/graphic/chart.js +16 -2
  33. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  34. package/cjs/scenegraph/graphic/contributions/chart-render.js +1 -1
  35. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  36. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +0 -6
  37. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  38. package/cjs/scenegraph/group-creater/progress/proxy.js +2 -1
  39. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  40. package/cjs/scenegraph/layout/compute-row-height.js +10 -2
  41. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  42. package/cjs/scenegraph/refresh-node/update-chart.js +1 -7
  43. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.js.map +1 -1
  45. package/cjs/ts-types/base-table.d.ts +8 -3
  46. package/cjs/ts-types/base-table.js.map +1 -1
  47. package/cjs/ts-types/table-engine.d.ts +6 -1
  48. package/cjs/ts-types/table-engine.js.map +1 -1
  49. package/dist/vtable.js +327 -281
  50. package/dist/vtable.min.js +2 -2
  51. package/es/ListTable.js +3 -3
  52. package/es/ListTable.js.map +1 -1
  53. package/es/PivotChart.d.ts +4 -4
  54. package/es/PivotChart.js +18 -16
  55. package/es/PivotChart.js.map +1 -1
  56. package/es/PivotTable.js +6 -6
  57. package/es/PivotTable.js.map +1 -1
  58. package/es/components/axis/axis.js +1 -1
  59. package/es/components/axis/axis.js.map +1 -1
  60. package/es/components/legend/legend.js +3 -3
  61. package/es/components/legend/legend.js.map +1 -1
  62. package/es/components/title/title.js +3 -3
  63. package/es/components/title/title.js.map +1 -1
  64. package/es/core/BaseTable.d.ts +1 -1
  65. package/es/core/BaseTable.js +5 -4
  66. package/es/core/BaseTable.js.map +1 -1
  67. package/es/dataset/dataset.d.ts +4 -4
  68. package/es/dataset/dataset.js +15 -12
  69. package/es/dataset/dataset.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/layout/chart-helper/get-axis-config.d.ts +1 -0
  74. package/es/layout/chart-helper/get-axis-config.js +16 -7
  75. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  76. package/es/layout/chart-helper/get-chart-spec.js +10 -6
  77. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  78. package/es/layout/pivot-layout.d.ts +1 -0
  79. package/es/layout/pivot-layout.js +11 -0
  80. package/es/layout/pivot-layout.js.map +1 -1
  81. package/es/scenegraph/graphic/chart.d.ts +6 -6
  82. package/es/scenegraph/graphic/chart.js +16 -2
  83. package/es/scenegraph/graphic/chart.js.map +1 -1
  84. package/es/scenegraph/graphic/contributions/chart-render.js +1 -1
  85. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  86. package/es/scenegraph/group-creater/cell-type/chart-cell.js +0 -6
  87. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  88. package/es/scenegraph/group-creater/progress/proxy.js +2 -1
  89. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  90. package/es/scenegraph/layout/compute-row-height.js +10 -2
  91. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  92. package/es/scenegraph/refresh-node/update-chart.js +1 -7
  93. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  94. package/es/scenegraph/scenegraph.js.map +1 -1
  95. package/es/ts-types/base-table.d.ts +8 -3
  96. package/es/ts-types/base-table.js.map +1 -1
  97. package/es/ts-types/table-engine.d.ts +6 -1
  98. package/es/ts-types/table-engine.js.map +1 -1
  99. package/package.json +10 -10
@@ -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,i,n,r,o,s,a,l,h;!function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(e||(e={})),function(t){t.single="single",t.column="column",t.row="row",t.cross="cross",t.none="none"}(i||(i={})),function(t){t.top="top",t.bottom="bottom",t.left="left",t.right="right"}(n||(n={})),function(t){t.expand="expand",t.collapse="collapse",t.none="none"}(r||(r={})),function(t){t.RECORD="RECORD",t.SUM="SUM",t.MIN="MIN",t.MAX="MAX",t.AVG="AVG",t.COUNT="COUNT"}(o||(o={})),function(t){t.ASC="ASC",t.DESC="DESC"}(s||(s={})),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"}(a||(a={})),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"}(l||(l={})),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"}(h||(h={}));var c=Object.freeze({__proto__:null,get AggregationType(){return o},get HierarchyState(){return r},get HighlightScope(){return i},get IconFuncTypeEnum(){return l},get IconPosition(){return a},get InteractionState(){return e},get InternalIconName(){return h},get Placement(){return n},get SortType(){return s}});const u=(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,d=t=>u(t,"object"),p=t=>u(t,"function"),f=t=>u(t,"string"),g=t=>u(t,"number"),y=t=>u(t,"undefined"),m=t=>u(t,"null");function b(t,...e){if(!e.length)return t||{};const i=e.shift();if(d(t)&&d(i))for(const e in i)d(i[e])?(t[e]||Object.assign(t,{[e]:{}}),d(t[e])||Object.assign(t,{[e]:i[e]}),b(t[e],i[e])):null!==i[e]&&void 0!==i[e]&&Object.assign(t,{[e]:i[e]});return b(t,...e)}function v(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]=v(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]=v(t[i])}else e=t;return e}function w(t){return"function"==typeof t&&(t=t()),A(t)?`${t}`:""}function C(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 x(t,e){let i=null;return function(...n){i||(t.apply(this,n),i=setTimeout((()=>{i=null}),e)),console.log("throttle")}}function _(t,e){for(t=`${t}`;t.length<e;)t="0"+t;return t}function S(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&&A(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}`:""})`:["#",_(Math[i?"max":"min"](parseInt(s[0],10)+n,i?0:255).toString(16),2),_(Math[i?"max":"min"](parseInt(s[1],10)+n,i?0:255).toString(16),2),_(Math[i?"max":"min"](parseInt(s[2],10)+n,i?0:255).toString(16),2)].join("")}function A(t){return!y(t)&&!m(t)}function T(t){return y(t)||m(t)?"":t.toString()}function B(){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 R(t,e,i){return"desc"!==i?t===e?0:t>e?1:-1:t===e?0:t<e?1:-1}let M,P=1,E=class{listenersData={listeners:{},listenerData:{}};listen(t,e){const i=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);i.push(e);const n=P++;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}unlisten(t){this.listenersData&&this.listenersData.listenerData[t].remove()}addEventListener(t,e,i){this.listen(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.unlisten(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=>A(t))):[]}dispose(){delete this.listenersData}};const H={CHANGE_STYLE:"change_style"};let L,k,I,O=class t extends E{_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 H}static get DEFAULT(){return M||(M=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)}},D=class t extends O{static get DEFAULT(){return L||(L=new t)}constructor(t={},e={}){super(t,e)}clone(){return new t(this,null)}};class F extends O{_autoWrapText;_lineClamp;static get DEFAULT(){return k||(k=new F)}constructor(t={},e={}){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new F(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 W(t,e,i,n=O,r){return t||e?t instanceof O?t:"function"==typeof t?W(t(i),e,i,n,r):(t||(t={}),r&&!A(t.autoWrapText)&&(t.autoWrapText=!0),new n(t??{},e??{})):n.DEFAULT}const z={CHANGE_STYLE:"change_style"};class j extends E{_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 z}static get DEFAULT(){return I||(I=new j)}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 j(this)}}let N;class G extends j{_autoWrapText;_lineClamp;static get DEFAULT(){return N||(N=new G)}constructor(t={},e=null){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new G(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 K(t,e,i,n,r){return t||e?t instanceof j?t:"function"==typeof t?K(t(i),e,i,n,r):(t||(t={}),r&&!A(t.autoWrapText)&&(t.autoWrapText=!0),new n(t??{},e??{})):n.DEFAULT}function U(t){return t?.hoverOn||"none"===t?.visible?0:t?.width??7}const V="undefined"==typeof window||void 0===window.window;let $,Y;const X={get find(){return $||($=Array.prototype.find?(t,e)=>Array.prototype.find.call(t,e):(t,e)=>{const i=X.findIndex(t,e);return i>=0?t[i]:void 0},$)},get findIndex(){return Y||(Y=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},Y)}};const{IE:q,Chrome:Z,Firefox:J,Edge:Q,Safari:et}=function(){if(V)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 it(...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 nt(t,e,...i){let n=t;for(let t=0;t<i.length&&null!=n;t++)n=e(n,i[t]);return n}function rt(t,...e){return nt(t,((t,e)=>t[e]),...e)}function ot(t,...e){return"function"==typeof t?t(...e):t}function st(t){return Boolean(t&&"function"==typeof t.then)}function at(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 lt(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 ht(t,e){const i=lt(t),n=lt(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 ct=q,ut={isObject:function(t){return t===Object(t)}},dt={endsWith:function(t,e,i){const n=T(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}},pt={isTouchEvent:function(t){return!!t.changedTouches}},ft={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]}},gt=Function.prototype,yt={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",MOUSEENTER_AXIS:"mouseenter_axis",MOUSELEAVE_AXIS:"mouseleave_axis"},mt=(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 bt(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 y(t){const i=t-l;return void 0===l||i>=e||i<0||c&&t-h>=o}function m(){const t=Date.now();if(y(t))return function(t){return a=void 0,d&&n?f(t):(r=void 0,n=void 0,s)}(t);a=g(m,function(t){const i=t-h,n=e&&-(t-l);return c?Math.min(n,o-i):n}(t))}return e=+e||0,mt(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=y(i);if(n=t,r=this,l=i,o){if(void 0===a)return function(t){return h=t,a=g(m,e),u?f(t):s}(l);if(c)return a=g(m,e),f(l)}return void 0===a&&(a=g(m,e)),s}}class vt{static _mode;static get mode(){return vt._mode||(vt._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}()),vt._mode}static set mode(t){vt._mode=t}static dpr=0;static CreateCanvas;static LoadImage;static RequestAnimationFrame;static CancelAnimationFrame;static RegisterCreateCanvas(t){vt.CreateCanvas=t}static RegisterLoadImage(t){vt.LoadImage=t}static GetCreateCanvasFunc(){return vt.CreateCanvas?vt.CreateCanvas:"worker"===vt.mode?(t=200,e=200)=>new OffscreenCanvas(t,e):void 0}static RegisterRequestAnimationFrame(t){vt.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if(vt.RequestAnimationFrame)return vt.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){vt.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if(vt.CancelAnimationFrame)return vt.CancelAnimationFrame}}let wt=1;class Ct{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=bt(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 xt{listeners={};reseizeListeners={};on(t,e,i,...n){if("node"===vt.mode)return-1;const r=wt++;if(t?.addEventListener)if("resize"!==e||t===window)t?.addEventListener(e,i,...n);else{const e=new Ct(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"===vt.mode)return-1;const r=this.on(t,e,((...t)=>{this.off(r),i(...t)}),...n);return r}off(t){if("node"===vt.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"!==vt.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"===vt.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"!==vt.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={}}}dispose(){"node"!==vt.mode&&(this.clear(),this.listeners=null)}}const _t=(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 St{_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=_t(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=_t(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 A(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=_t(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}}var At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Tt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Bt(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 Rt={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}(Rt);var Mt=Tt(Rt.exports);const Pt=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,Et=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Pt(t,"Boolean")},Ht=t=>"function"==typeof t,Lt=t=>null==t,kt=t=>null!=t,It=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},Ot=function(t){if(!(t=>"object"==typeof t&&null!==t)(t)||!Pt(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},Dt=t=>void 0===t,Ft=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Pt(t,"String")},Wt=t=>Array.isArray?Array.isArray(t):Pt(t,"Array"),zt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},jt=t=>Pt(t,"Date"),Nt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Pt(t,"Number")},Gt=t=>Nt(t)&&Number.isFinite(t),Kt=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),Ut=Object.prototype,Vt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ut)},$t=Object.prototype.hasOwnProperty;function Yt(t){if(Lt(t))return!0;if(zt(t))return!t.length;const e=Kt(t);if("Map"===e||"Set"===e)return!t.size;if(Vt(t))return!Object.keys(t).length;for(const e in t)if($t.call(t,e))return!1;return!0}const Xt=(t,e,i)=>{const n=Ft(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},qt=Object.prototype.hasOwnProperty,Zt=(t,e)=>null!=t&&qt.call(t,e);function Jt(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(Wt(i)?a=[]:Pt(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=jt(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 Qt(t){let e;if(!kt(t)||"object"!=typeof t)return t;const i=Wt(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:Et(t)||Nt(t)||Ft(t)?t:jt(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]=Qt(n)}return e}function te(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(kt(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];kt(n[o])&&"object"==typeof n[o]?ee(t,e,o,i):ie(t,o,n[o])}}}}function ee(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(Wt(o)){if(n)s=[];else if(Wt(r))s=r;else if(zt(r)){s=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)s[t]=r[t]}}else Ot(o)?(s=r,"function"!=typeof r&&"object"==typeof r||(s={})):a=!1;a&&te(s,o,n),ie(t,i,s)}function ie(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 ne(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)te(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function re(t){return Object.prototype.toString.call(t)}function oe(t){return Object.keys(t)}function se(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(re(t)!==re(e))return!1;if(Ht(t))return!1;if("object"!=typeof t)return!1;if(Wt(t)){if(t.length!==e.length)return!1;for(let i=t.length-1;i>=0;i--)if(!se(t[i],e[i]))return!1;return!0}if(!Ot(t))return!1;const i=oe(t),n=oe(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(!se(t[r],e[r]))return!1}return!0}function ae(t){if(zt(t))return t[t.length-1]}function le(t,e){if(!Wt(t)||!Wt(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 he(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ce(t){return Number(t)}const ue=1e-10,de=1e-10;function pe(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ue,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:de)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function fe(t,e,i,n){return t>e&&!pe(t,e,i,n)}function ge(t,e,i,n){return t<e&&!pe(t,e,i,n)}const ye=function(t,e,i){return t<e?e:t>i?i:t},me=(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 be(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let ve=!1;try{ve="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){ve=!1}function we(t,e){return i=>t*(1-i)+e*i}function Ce(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}ve=!1;const xe=1e-12,_e=Math.PI,Se=_e/2,Ae=2*_e,Te=2*Math.PI,Be=Math.abs,Re=Math.atan2,Me=Math.cos,Pe=Math.max,Ee=Math.min,He=Math.sin,Le=Math.sqrt,ke=Math.pow;function Ie(t){return t>1?0:t<-1?_e:Math.acos(t)}function Oe(t){return t>=1?Se:t<=-1?-Se:Math.asin(t)}function De(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 Fe{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 Fe(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return Nt(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return Nt(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class We{static distancePP(t,e){return Le(ke(t.x-e.x,2)+ke(t.y-e.y,2))}static distanceNN(t,e,i,n){return Le(ke(t-i,2)+ke(e-n,2))}static distancePN(t,e,i){return Le(ke(e-t.x,2)+ke(i-t.y,2))}static pointAtPP(t,e,i){return new Fe((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ze(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 je{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new je(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 Wt(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 ze(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 Ne extends je{}function Ge(t){return t*(Math.PI/180)}const Ke=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Ae;)t+=Ae;else if(t>0)for(;t>Ae;)t-=Ae;return t};function Ue(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}class Ve{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 Ve,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 Ve;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:y}=t;e.x=g*h+y*u+p,e.y=g*c+y*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 Ve(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 $e(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 Ye(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 Xe=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return Nt(t)?new ei(t>>16,t>>8&255,255&t,1):Wt(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}class ti{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ti?t:new ti(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(kt(qe[t]))return function(t){return Nt(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):Wt(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(qe[t]);if(kt(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=Xe.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ei(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 ei(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=$e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ye(this.color.r,this.color.g,this.color.b),o=$e(Lt(t)?r.h:ye(t,0,360),Lt(e)?r.s:e>=0&&e<=1?100*e:e,Lt(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new ei(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 ei{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)),kt(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}var ii=Object.freeze({__proto__:null,Color:ti,DEFAULT_COLORS:Ze,RGB:ei,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:$e,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 ei(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:Ye});let ni,ri,oi,si,ai,li,hi,ci;var ui;function di(t,e,i){return!(t&&e&&(i?(ni=t.x1,ri=t.x2,oi=t.y1,si=t.y2,ai=e.x1,li=e.x2,hi=e.y1,ci=e.y2,ni>ri&&([ni,ri]=[ri,ni]),oi>si&&([oi,si]=[si,oi]),ai>li&&([ai,li]=[li,ai]),hi>ci&&([hi,ci]=[ci,hi]),ni>li||ri<ai||oi>ci||si<hi):t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1))}function pi(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function fi(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 gi(t){return t/180*Math.PI}function yi(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function mi(t,e){const i=e?t.angle:gi(t.angle),n=yi(t);return[fi({x:t.x1,y:t.y1},i,n),fi({x:t.x2,y:t.y1},i,n),fi({x:t.x2,y:t.y2},i,n),fi({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"}(ui||(ui={}));const bi=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 vi{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(),kt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=kt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Lt(this._canvas)&&(kt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Lt(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&kt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Lt(this._context)&&kt(this._canvas)){const t=this._canvas.getContext("2d");kt(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!Lt(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(Lt(t))return{width:0,height:0};if(Lt(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);Lt(r)&&vi.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),Lt(r)&&["F","W"].includes(bi(n))&&(r=this._measureFullSizeChar()),Lt(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(bi(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(Lt(t))return r;if(Wt(t)){const o=t.filter(kt).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(Lt(this._numberCharSize)){const t=this._standardMethod(vi.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/vi.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return Lt(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(vi.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Lt(this._letterCharSize)){const t=this._standardMethod(vi.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/vi.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return kt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){kt(this._canvas)&&(this._canvas=null),kt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}var wi;function Ci(t){if(Gt(t))return[t,t,t,t];if(Wt(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(It(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]}vi.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",vi.NUMBERS_CHAR_SET="0123456789",vi.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"}(wi||(wi={}));let xi=class t{bounds;constructor(t,e,i,n){this.bounds=new je,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 _i={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 Si={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 Ai={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 Ti={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 Bi={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 Ri={},Mi=[],Pi=/^(https?|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/,Ei="$$indicator$$",Hi={type:"line"};function Li(t,e,i,n){return rt(t,...i)||rt(e,...i)||n&&rt(t,...n)||n&&rt(e,...n)}class ki{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 Li(t,e,["font"],["bodyStyle","font"])}get underlayBackgroundColor(){const{obj:t,superTheme:e}=this.internalTheme;return Li(t,e,["underlayBackgroundColor"])}get defaultStyle(){if(!this._defaultStyle){const{obj:t,superTheme:e}=this.internalTheme,i=b({},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??Mi},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?S(i.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return i.hover?.inlineRowBgColor??(i.hover?.cellBgColor&&"string"==typeof i.hover?.cellBgColor?S(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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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=b({},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 Ii(e,t)||Ii(i,t)}extends(t){return new ki(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?S(t.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return t.hover?.inlineRowBgColor??(t.hover?.cellBgColor&&"string"==typeof t.hover?.cellBgColor?S(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 Ii(t,e){if(t instanceof ki)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 Oi=new ki(_i,_i),Di=new ki(Si,Si),Fi=new ki(Ai,Ai),Wi=new ki(Ti,Ti),zi=new ki(Bi,Bi),ji={DEFAULT:Wi,SIMPLIFY:zi,ARCO:Fi,DARK:Oi,BRIGHT:Di},Ni={TableTheme:ki};function Gi(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]}(Ki(),t);return e?e instanceof ki?e:new ki(e,e):null}return t instanceof ki?t:new ki(t,t)}function Ki(){return it(ji,Ri)}var Ui={DARK:Oi,BRIGHT:Di,ARCO:Fi,DEFAULT:Wi,SIMPLIFY:zi,theme:Ni,of:Gi,get:Ki},Vi=Object.freeze({__proto__:null,ARCO:Fi,BRIGHT:Di,DARK:Oi,DEFAULT:Wi,SIMPLIFY:zi,default:Ui,get:Ki,of:Gi,theme:Ni}),$i=function(t){return t&&t.Math==Math&&t},Yi=$i("object"==typeof globalThis&&globalThis)||$i("object"==typeof window&&window)||$i("object"==typeof self&&self)||$i("object"==typeof At&&At)||function(){return this}()||At||Function("return this")(),Xi={},qi=function(t){try{return!!t()}catch(t){return!0}},Zi=!qi((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ji=!qi((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Qi=Ji,tn=Function.prototype.call,en=Qi?tn.bind(tn):function(){return tn.apply(tn,arguments)},nn={},rn={}.propertyIsEnumerable,on=Object.getOwnPropertyDescriptor,sn=on&&!rn.call({1:2},1);nn.f=sn?function(t){var e=on(this,t);return!!e&&e.enumerable}:rn;var an,ln,hn=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},cn=Ji,un=Function.prototype,dn=un.call,pn=cn&&un.bind.bind(dn,dn),fn=cn?pn:function(t){return function(){return dn.apply(t,arguments)}},gn=fn,yn=gn({}.toString),mn=gn("".slice),bn=function(t){return mn(yn(t),8,-1)},vn=qi,wn=bn,Cn=Object,xn=fn("".split),_n=vn((function(){return!Cn("z").propertyIsEnumerable(0)}))?function(t){return"String"==wn(t)?xn(t,""):Cn(t)}:Cn,Sn=function(t){return null==t},An=Sn,Tn=TypeError,Bn=function(t){if(An(t))throw Tn("Can't call method on "+t);return t},Rn=_n,Mn=Bn,Pn=function(t){return Rn(Mn(t))},En="object"==typeof document&&document.all,Hn={all:En,IS_HTMLDDA:void 0===En&&void 0!==En},Ln=Hn.all,kn=Hn.IS_HTMLDDA?function(t){return"function"==typeof t||t===Ln}:function(t){return"function"==typeof t},In=kn,On=Hn.all,Dn=Hn.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:In(t)||t===On}:function(t){return"object"==typeof t?null!==t:In(t)},Fn=Yi,Wn=kn,zn=function(t,e){return arguments.length<2?(i=Fn[t],Wn(i)?i:void 0):Fn[t]&&Fn[t][e];var i},jn=fn({}.isPrototypeOf),Nn=Yi,Gn="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Kn=Nn.process,Un=Nn.Deno,Vn=Kn&&Kn.versions||Un&&Un.version,$n=Vn&&Vn.v8;$n&&(ln=(an=$n.split("."))[0]>0&&an[0]<4?1:+(an[0]+an[1])),!ln&&Gn&&(!(an=Gn.match(/Edge\/(\d+)/))||an[1]>=74)&&(an=Gn.match(/Chrome\/(\d+)/))&&(ln=+an[1]);var Yn=ln,Xn=qi,qn=Yi.String,Zn=!!Object.getOwnPropertySymbols&&!Xn((function(){var t=Symbol();return!qn(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Yn&&Yn<41})),Jn=Zn&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Qn=zn,tr=kn,er=jn,ir=Object,nr=Jn?function(t){return"symbol"==typeof t}:function(t){var e=Qn("Symbol");return tr(e)&&er(e.prototype,ir(t))},rr=String,or=function(t){try{return rr(t)}catch(t){return"Object"}},sr=kn,ar=or,lr=TypeError,hr=function(t){if(sr(t))return t;throw lr(ar(t)+" is not a function")},cr=hr,ur=Sn,dr=function(t,e){var i=t[e];return ur(i)?void 0:cr(i)},pr=en,fr=kn,gr=Dn,yr=TypeError,mr={exports:{}},br=Yi,vr=Object.defineProperty,wr=function(t,e){try{vr(br,t,{value:e,configurable:!0,writable:!0})}catch(i){br[t]=e}return e},Cr=wr,xr="__core-js_shared__",_r=Yi[xr]||Cr(xr,{}),Sr=_r;(mr.exports=function(t,e){return Sr[t]||(Sr[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 Ar=mr.exports,Tr=Bn,Br=Object,Rr=function(t){return Br(Tr(t))},Mr=Rr,Pr=fn({}.hasOwnProperty),Er=Object.hasOwn||function(t,e){return Pr(Mr(t),e)},Hr=fn,Lr=0,kr=Math.random(),Ir=Hr(1..toString),Or=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Ir(++Lr+kr,36)},Dr=Ar,Fr=Er,Wr=Or,zr=Zn,jr=Jn,Nr=Yi.Symbol,Gr=Dr("wks"),Kr=jr?Nr.for||Nr:Nr&&Nr.withoutSetter||Wr,Ur=function(t){return Fr(Gr,t)||(Gr[t]=zr&&Fr(Nr,t)?Nr[t]:Kr("Symbol."+t)),Gr[t]},Vr=en,$r=Dn,Yr=nr,Xr=dr,qr=function(t,e){var i,n;if("string"===e&&fr(i=t.toString)&&!gr(n=pr(i,t)))return n;if(fr(i=t.valueOf)&&!gr(n=pr(i,t)))return n;if("string"!==e&&fr(i=t.toString)&&!gr(n=pr(i,t)))return n;throw yr("Can't convert object to primitive value")},Zr=TypeError,Jr=Ur("toPrimitive"),Qr=function(t,e){if(!$r(t)||Yr(t))return t;var i,n=Xr(t,Jr);if(n){if(void 0===e&&(e="default"),i=Vr(n,t,e),!$r(i)||Yr(i))return i;throw Zr("Can't convert object to primitive value")}return void 0===e&&(e="number"),qr(t,e)},to=nr,eo=function(t){var e=Qr(t,"string");return to(e)?e:e+""},io=Dn,no=Yi.document,ro=io(no)&&io(no.createElement),oo=function(t){return ro?no.createElement(t):{}},so=oo,ao=!Zi&&!qi((function(){return 7!=Object.defineProperty(so("div"),"a",{get:function(){return 7}}).a})),lo=Zi,ho=en,co=nn,uo=hn,po=Pn,fo=eo,go=Er,yo=ao,mo=Object.getOwnPropertyDescriptor;Xi.f=lo?mo:function(t,e){if(t=po(t),e=fo(e),yo)try{return mo(t,e)}catch(t){}if(go(t,e))return uo(!ho(co.f,t,e),t[e])};var bo={},vo=Zi&&qi((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),wo=Dn,Co=String,xo=TypeError,_o=function(t){if(wo(t))return t;throw xo(Co(t)+" is not an object")},So=Zi,Ao=ao,To=vo,Bo=_o,Ro=eo,Mo=TypeError,Po=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,Ho="enumerable",Lo="configurable",ko="writable";bo.f=So?To?function(t,e,i){if(Bo(t),e=Ro(e),Bo(i),"function"==typeof t&&"prototype"===e&&"value"in i&&ko in i&&!i[ko]){var n=Eo(t,e);n&&n[ko]&&(t[e]=i.value,i={configurable:Lo in i?i[Lo]:n[Lo],enumerable:Ho in i?i[Ho]:n[Ho],writable:!1})}return Po(t,e,i)}:Po:function(t,e,i){if(Bo(t),e=Ro(e),Bo(i),Ao)try{return Po(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Mo("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Io=bo,Oo=hn,Do=Zi?function(t,e,i){return Io.f(t,e,Oo(1,i))}:function(t,e,i){return t[e]=i,t},Fo={exports:{}},Wo=Zi,zo=Er,jo=Function.prototype,No=Wo&&Object.getOwnPropertyDescriptor,Go=zo(jo,"name"),Ko={EXISTS:Go,PROPER:Go&&"something"===function(){}.name,CONFIGURABLE:Go&&(!Wo||Wo&&No(jo,"name").configurable)},Uo=kn,Vo=_r,$o=fn(Function.toString);Uo(Vo.inspectSource)||(Vo.inspectSource=function(t){return $o(t)});var Yo,Xo,qo,Zo=Vo.inspectSource,Jo=kn,Qo=Yi.WeakMap,ts=Jo(Qo)&&/native code/.test(String(Qo)),es=Or,is=Ar("keys"),ns=function(t){return is[t]||(is[t]=es(t))},rs={},os=ts,ss=Yi,as=Dn,ls=Do,hs=Er,cs=_r,us=ns,ds=rs,ps="Object already initialized",fs=ss.TypeError,gs=ss.WeakMap;if(os||cs.state){var ys=cs.state||(cs.state=new gs);ys.get=ys.get,ys.has=ys.has,ys.set=ys.set,Yo=function(t,e){if(ys.has(t))throw fs(ps);return e.facade=t,ys.set(t,e),e},Xo=function(t){return ys.get(t)||{}},qo=function(t){return ys.has(t)}}else{var ms=us("state");ds[ms]=!0,Yo=function(t,e){if(hs(t,ms))throw fs(ps);return e.facade=t,ls(t,ms,e),e},Xo=function(t){return hs(t,ms)?t[ms]:{}},qo=function(t){return hs(t,ms)}}var bs={set:Yo,get:Xo,has:qo,enforce:function(t){return qo(t)?Xo(t):Yo(t,{})},getterFor:function(t){return function(e){var i;if(!as(e)||(i=Xo(e)).type!==t)throw fs("Incompatible receiver, "+t+" required");return i}}},vs=fn,ws=qi,Cs=kn,xs=Er,_s=Zi,Ss=Ko.CONFIGURABLE,As=Zo,Ts=bs.enforce,Bs=bs.get,Rs=String,Ms=Object.defineProperty,Ps=vs("".slice),Es=vs("".replace),Hs=vs([].join),Ls=_s&&!ws((function(){return 8!==Ms((function(){}),"length",{value:8}).length})),ks=String(String).split("String"),Is=Fo.exports=function(t,e,i){"Symbol("===Ps(Rs(e),0,7)&&(e="["+Es(Rs(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!xs(t,"name")||Ss&&t.name!==e)&&(_s?Ms(t,"name",{value:e,configurable:!0}):t.name=e),Ls&&i&&xs(i,"arity")&&t.length!==i.arity&&Ms(t,"length",{value:i.arity});try{i&&xs(i,"constructor")&&i.constructor?_s&&Ms(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Ts(t);return xs(n,"source")||(n.source=Hs(ks,"string"==typeof e?e:"")),t};Function.prototype.toString=Is((function(){return Cs(this)&&Bs(this).source||As(this)}),"toString");var Os=Fo.exports,Ds=kn,Fs=bo,Ws=Os,zs=wr,js=function(t,e,i,n){n||(n={});var r=n.enumerable,o=void 0!==n.name?n.name:e;if(Ds(i)&&Ws(i,o,n),n.global)r?t[e]=i:zs(e,i);else{try{n.unsafe?t[e]&&(r=!0):delete t[e]}catch(t){}r?t[e]=i:Fs.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Ns={},Gs=Math.ceil,Ks=Math.floor,Us=Math.trunc||function(t){var e=+t;return(e>0?Ks:Gs)(e)},Vs=function(t){var e=+t;return e!=e||0===e?0:Us(e)},$s=Vs,Ys=Math.max,Xs=Math.min,qs=function(t,e){var i=$s(t);return i<0?Ys(i+e,0):Xs(i,e)},Zs=Vs,Js=Math.min,Qs=function(t){return t>0?Js(Zs(t),9007199254740991):0},ta=function(t){return Qs(t.length)},ea=Pn,ia=qs,na=ta,ra=function(t){return function(e,i,n){var r,o=ea(e),s=na(o),a=ia(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}},oa={includes:ra(!0),indexOf:ra(!1)},sa=Er,aa=Pn,la=oa.indexOf,ha=rs,ca=fn([].push),ua=function(t,e){var i,n=aa(t),r=0,o=[];for(i in n)!sa(ha,i)&&sa(n,i)&&ca(o,i);for(;e.length>r;)sa(n,i=e[r++])&&(~la(o,i)||ca(o,i));return o},da=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],pa=ua,fa=da.concat("length","prototype");Ns.f=Object.getOwnPropertyNames||function(t){return pa(t,fa)};var ga={};ga.f=Object.getOwnPropertySymbols;var ya=zn,ma=Ns,ba=ga,va=_o,wa=fn([].concat),Ca=ya("Reflect","ownKeys")||function(t){var e=ma.f(va(t)),i=ba.f;return i?wa(e,i(t)):e},xa=Er,_a=Ca,Sa=Xi,Aa=bo,Ta=qi,Ba=kn,Ra=/#|\.prototype\./,Ma=function(t,e){var i=Ea[Pa(t)];return i==La||i!=Ha&&(Ba(e)?Ta(e):!!e)},Pa=Ma.normalize=function(t){return String(t).replace(Ra,".").toLowerCase()},Ea=Ma.data={},Ha=Ma.NATIVE="N",La=Ma.POLYFILL="P",ka=Ma,Ia=Yi,Oa=Xi.f,Da=Do,Fa=js,Wa=wr,za=function(t,e,i){for(var n=_a(e),r=Aa.f,o=Sa.f,s=0;s<n.length;s++){var a=n[s];xa(t,a)||i&&xa(i,a)||r(t,a,o(e,a))}},ja=ka,Na=function(t,e){var i,n,r,o,s,a=t.target,l=t.global,h=t.stat;if(i=l?Ia:h?Ia[a]||Wa(a,{}):(Ia[a]||{}).prototype)for(n in e){if(o=e[n],r=t.dontCallGetSet?(s=Oa(i,n))&&s.value:i[n],!ja(l?n:a+(h?".":"#")+n,t.forced)&&void 0!==r){if(typeof o==typeof r)continue;za(o,r)}(t.sham||r&&r.sham)&&Da(o,"sham",!0),Fa(i,n,o,t)}},Ga={exports:{}},Ka={},Ua=eo,Va=bo,$a=hn,Ya=qs,Xa=ta,qa=function(t,e,i){var n=Ua(e);n in t?Va.f(t,n,$a(0,i)):t[n]=i},Za=Array,Ja=Math.max,Qa=bn,tl=Pn,el=Ns.f,il=function(t,e,i){for(var n=Xa(t),r=Ya(e,n),o=Ya(void 0===i?n:i,n),s=Za(Ja(o-r,0)),a=0;r<o;r++,a++)qa(s,a,t[r]);return s.length=a,s},nl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ka.f=function(t){return nl&&"Window"==Qa(t)?function(t){try{return el(t)}catch(t){return il(nl)}}(t):el(tl(t))};var rl=qi((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),ol=qi,sl=Dn,al=bn,ll=rl,hl=Object.isExtensible,cl=ol((function(){hl(1)}))||ll?function(t){return!!sl(t)&&((!ll||"ArrayBuffer"!=al(t))&&(!hl||hl(t)))}:hl,ul=!qi((function(){return Object.isExtensible(Object.preventExtensions({}))})),dl=Na,pl=fn,fl=rs,gl=Dn,yl=Er,ml=bo.f,bl=Ns,vl=Ka,wl=cl,Cl=ul,xl=!1,_l=Or("meta"),Sl=0,Al=function(t){ml(t,_l,{value:{objectID:"O"+Sl++,weakData:{}}})},Tl=Ga.exports={enable:function(){Tl.enable=function(){},xl=!0;var t=bl.f,e=pl([].splice),i={};i[_l]=1,t(i).length&&(bl.f=function(i){for(var n=t(i),r=0,o=n.length;r<o;r++)if(n[r]===_l){e(n,r,1);break}return n},dl({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:vl.f}))},fastKey:function(t,e){if(!gl(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!yl(t,_l)){if(!wl(t))return"F";if(!e)return"E";Al(t)}return t[_l].objectID},getWeakData:function(t,e){if(!yl(t,_l)){if(!wl(t))return!0;if(!e)return!1;Al(t)}return t[_l].weakData},onFreeze:function(t){return Cl&&xl&&wl(t)&&!yl(t,_l)&&Al(t),t}};fl[_l]=!0;var Bl=Ga.exports,Rl=bn,Ml=fn,Pl=function(t){if("Function"===Rl(t))return Ml(t)},El=hr,Hl=Ji,Ll=Pl(Pl.bind),kl=function(t,e){return El(t),void 0===e?t:Hl?Ll(t,e):function(){return t.apply(e,arguments)}},Il={},Ol=Il,Dl=Ur("iterator"),Fl=Array.prototype,Wl={};Wl[Ur("toStringTag")]="z";var zl="[object z]"===String(Wl),jl=kn,Nl=bn,Gl=Ur("toStringTag"),Kl=Object,Ul="Arguments"==Nl(function(){return arguments}()),Vl=zl?Nl: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=Kl(t),Gl))?i:Ul?Nl(e):"Object"==(n=Nl(e))&&jl(e.callee)?"Arguments":n},$l=Vl,Yl=dr,Xl=Sn,ql=Il,Zl=Ur("iterator"),Jl=function(t){if(!Xl(t))return Yl(t,Zl)||Yl(t,"@@iterator")||ql[$l(t)]},Ql=en,th=hr,eh=_o,ih=or,nh=Jl,rh=TypeError,oh=en,sh=_o,ah=dr,lh=kl,hh=en,ch=_o,uh=or,dh=function(t){return void 0!==t&&(Ol.Array===t||Fl[Dl]===t)},ph=ta,fh=jn,gh=function(t,e){var i=arguments.length<2?nh(t):e;if(th(i))return eh(Ql(i,t));throw rh(ih(t)+" is not iterable")},yh=Jl,mh=function(t,e,i){var n,r;sh(t);try{if(!(n=ah(t,"return"))){if("throw"===e)throw i;return i}n=oh(n,t)}catch(t){r=!0,n=t}if("throw"===e)throw i;if(r)throw n;return sh(n),i},bh=TypeError,vh=function(t,e){this.stopped=t,this.result=e},wh=vh.prototype,Ch=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=lh(e,c),y=function(t){return n&&mh(n,"normal",t),new vh(!0,t)},m=function(t){return u?(ch(t),f?g(t[0],t[1],y):g(t[0],t[1])):f?g(t,y):g(t)};if(d)n=t.iterator;else if(p)n=t;else{if(!(r=yh(t)))throw bh(uh(t)+" is not iterable");if(dh(r)){for(o=0,s=ph(t);s>o;o++)if((a=m(t[o]))&&fh(wh,a))return a;return new vh(!1)}n=gh(t,r)}for(l=d?t.next:n.next;!(h=hh(l,n)).done;){try{a=m(h.value)}catch(t){mh(n,"throw",t)}if("object"==typeof a&&a&&fh(wh,a))return a}return new vh(!1)},xh=jn,_h=TypeError,Sh=function(t,e){if(xh(e,t))return t;throw _h("Incorrect invocation")},Ah=Ur("iterator"),Th=!1;try{var Bh=0,Rh={next:function(){return{done:!!Bh++}},return:function(){Th=!0}};Rh[Ah]=function(){return this},Array.from(Rh,(function(){throw 2}))}catch(t){}var Mh=bo.f,Ph=Er,Eh=Ur("toStringTag"),Hh=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Ph(t,Eh)&&Mh(t,Eh,{configurable:!0,value:e})},Lh=fn,kh=hr,Ih=kn,Oh=String,Dh=TypeError,Fh=function(t,e,i){try{return Lh(kh(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Wh=_o,zh=function(t){if("object"==typeof t||Ih(t))return t;throw Dh("Can't set "+Oh(t)+" as a prototype")},jh=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Fh(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Wh(i),zh(n),e?t(i,n):i.__proto__=n,i}}():void 0),Nh=kn,Gh=Dn,Kh=jh,Uh=Na,Vh=Yi,$h=fn,Yh=ka,Xh=js,qh=Bl,Zh=Ch,Jh=Sh,Qh=kn,tc=Sn,ec=Dn,ic=qi,nc=function(t,e){if(!e&&!Th)return!1;var i=!1;try{var n={};n[Ah]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},rc=Hh,oc=function(t,e,i){var n,r;return Kh&&Nh(n=e.constructor)&&n!==i&&Gh(r=n.prototype)&&r!==i.prototype&&Kh(t,r),t},sc=function(t,e,i){var n=-1!==t.indexOf("Map"),r=-1!==t.indexOf("Weak"),o=n?"set":"add",s=Vh[t],a=s&&s.prototype,l=s,h={},c=function(t){var e=$h(a[t]);Xh(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(r&&!ec(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return r&&!ec(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!ec(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Yh(t,!Qh(s)||!(r||a.forEach&&!ic((function(){(new s).entries().next()})))))l=i.getConstructor(e,t,n,o),qh.enable();else if(Yh(t,!0)){var u=new l,d=u[o](r?{}:-0,1)!=u,p=ic((function(){u.has(1)})),f=nc((function(t){new s(t)})),g=!r&&ic((function(){for(var t=new s,e=5;e--;)t[o](e,e);return!t.has(-0)}));f||((l=e((function(t,e){Jh(t,a);var i=oc(new s,t,l);return tc(e)||Zh(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,Uh({global:!0,constructor:!0,forced:l!=s},h),rc(l,t),r||i.setStrong(l,t,n),l},ac={},lc=ua,hc=da,cc=Object.keys||function(t){return lc(t,hc)},uc=Zi,dc=vo,pc=bo,fc=_o,gc=Pn,yc=cc;ac.f=uc&&!dc?Object.defineProperties:function(t,e){fc(t);for(var i,n=gc(e),r=yc(e),o=r.length,s=0;o>s;)pc.f(t,i=r[s++],n[i]);return t};var mc,bc=zn("document","documentElement"),vc=_o,wc=ac,Cc=da,xc=rs,_c=bc,Sc=oo,Ac="prototype",Tc="script",Bc=ns("IE_PROTO"),Rc=function(){},Mc=function(t){return"<"+Tc+">"+t+"</"+Tc+">"},Pc=function(t){t.write(Mc("")),t.close();var e=t.parentWindow.Object;return t=null,e},Ec=function(){try{mc=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Ec="undefined"!=typeof document?document.domain&&mc?Pc(mc):(e=Sc("iframe"),i="java"+Tc+":",e.style.display="none",_c.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Mc("document.F=Object")),t.close(),t.F):Pc(mc);for(var n=Cc.length;n--;)delete Ec[Ac][Cc[n]];return Ec()};xc[Bc]=!0;var Hc,Lc,kc,Ic=Object.create||function(t,e){var i;return null!==t?(Rc[Ac]=vc(t),i=new Rc,Rc[Ac]=null,i[Bc]=t):i=Ec(),void 0===e?i:wc.f(i,e)},Oc=Os,Dc=bo,Fc=function(t,e,i){return i.get&&Oc(i.get,e,{getter:!0}),i.set&&Oc(i.set,e,{setter:!0}),Dc.f(t,e,i)},Wc=js,zc=function(t,e,i){for(var n in e)Wc(t,n,e[n],i);return t},jc=!qi((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Nc=Er,Gc=kn,Kc=Rr,Uc=jc,Vc=ns("IE_PROTO"),$c=Object,Yc=$c.prototype,Xc=Uc?$c.getPrototypeOf:function(t){var e=Kc(t);if(Nc(e,Vc))return e[Vc];var i=e.constructor;return Gc(i)&&e instanceof i?i.prototype:e instanceof $c?Yc:null},qc=qi,Zc=kn,Jc=Dn,Qc=Xc,tu=js,eu=Ur("iterator"),iu=!1;[].keys&&("next"in(kc=[].keys())?(Lc=Qc(Qc(kc)))!==Object.prototype&&(Hc=Lc):iu=!0);var nu=!Jc(Hc)||qc((function(){var t={};return Hc[eu].call(t)!==t}));nu&&(Hc={}),Zc(Hc[eu])||tu(Hc,eu,(function(){return this}));var ru={IteratorPrototype:Hc,BUGGY_SAFARI_ITERATORS:iu},ou=ru.IteratorPrototype,su=Ic,au=hn,lu=Hh,hu=Il,cu=function(){return this},uu=Na,du=en,pu=kn,fu=function(t,e,i,n){var r=e+" Iterator";return t.prototype=su(ou,{next:au(+!n,i)}),lu(t,r,!1),hu[r]=cu,t},gu=Xc,yu=jh,mu=Hh,bu=Do,vu=js,wu=Il,Cu=Ko.PROPER,xu=Ko.CONFIGURABLE,_u=ru.IteratorPrototype,Su=ru.BUGGY_SAFARI_ITERATORS,Au=Ur("iterator"),Tu="keys",Bu="values",Ru="entries",Mu=function(){return this},Pu=zn,Eu=Fc,Hu=Zi,Lu=Ur("species"),ku=Ic,Iu=Fc,Ou=zc,Du=kl,Fu=Sh,Wu=Sn,zu=Ch,ju=function(t,e,i,n,r,o,s){fu(i,e,n);var a,l,h,c=function(t){if(t===r&&g)return g;if(!Su&&t in p)return p[t];switch(t){case Tu:case Bu:case Ru:return function(){return new i(this,t)}}return function(){return new i(this)}},u=e+" Iterator",d=!1,p=t.prototype,f=p[Au]||p["@@iterator"]||r&&p[r],g=!Su&&f||c(r),y="Array"==e&&p.entries||f;if(y&&(a=gu(y.call(new t)))!==Object.prototype&&a.next&&(gu(a)!==_u&&(yu?yu(a,_u):pu(a[Au])||vu(a,Au,Mu)),mu(a,u,!0)),Cu&&r==Bu&&f&&f.name!==Bu&&(xu?bu(p,"name",Bu):(d=!0,g=function(){return du(f,this)})),r)if(l={values:c(Bu),keys:o?g:c(Tu),entries:c(Ru)},s)for(h in l)(Su||d||!(h in p))&&vu(p,h,l[h]);else uu({target:e,proto:!0,forced:Su||d},l);return p[Au]!==g&&vu(p,Au,g,{name:r}),wu[e]=g,l},Nu=function(t,e){return{value:t,done:e}},Gu=function(t){var e=Pu(t);Hu&&e&&!e[Lu]&&Eu(e,Lu,{configurable:!0,get:function(){return this}})},Ku=Zi,Uu=Bl.fastKey,Vu=bs.set,$u=bs.getterFor,Yu={getConstructor:function(t,e,i,n){var r=t((function(t,r){Fu(t,o),Vu(t,{type:e,index:ku(null),first:void 0,last:void 0,size:0}),Ku||(t.size=0),Wu(r)||zu(r,t[n],{that:t,AS_ENTRIES:i})})),o=r.prototype,s=$u(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=Uu(e,!0),key:e,value:i,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),Ku?o.size++:t.size++,"F"!==r&&(o.index[r]=a)),t},l=function(t,e){var i,n=s(t),r=Uu(e);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==e)return i};return Ou(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,Ku?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),Ku?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=s(this),n=Du(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)}}),Ou(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)}}),Ku&&Iu(o,"size",{configurable:!0,get:function(){return s(this).size}}),r},setStrong:function(t,e,i){var n=e+" Iterator",r=$u(e),o=$u(n);ju(t,e,(function(t,e){Vu(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)?Nu("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,Nu(void 0,!0))}),i?"entries":"values",!i,!0),Gu(e)}};sc("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Yu);var Xu=bn,qu=Array.isArray||function(t){return"Array"==Xu(t)},Zu=fn,Ju=qi,Qu=kn,td=Vl,ed=Zo,id=function(){},nd=[],rd=zn("Reflect","construct"),od=/^\s*(?:class|function)\b/,sd=Zu(od.exec),ad=!od.exec(id),ld=function(t){if(!Qu(t))return!1;try{return rd(id,nd,t),!0}catch(t){return!1}},hd=function(t){if(!Qu(t))return!1;switch(td(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ad||!!sd(od,ed(t))}catch(t){return!0}};hd.sham=!0;var cd=!rd||Ju((function(){var t;return ld(ld.call)||!ld(Object)||!ld((function(){t=!0}))||t}))?hd:ld,ud=qu,dd=cd,pd=Dn,fd=Ur("species"),gd=Array,yd=function(t){var e;return ud(t)&&(e=t.constructor,(dd(e)&&(e===gd||ud(e.prototype))||pd(e)&&null===(e=e[fd]))&&(e=void 0)),void 0===e?gd:e},md=kl,bd=_n,vd=Rr,wd=ta,Cd=function(t,e){return new(yd(t))(0===e?0:e)},xd=fn([].push),_d=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=vd(l),g=bd(f),y=md(h,c),m=wd(g),b=0,v=u||Cd,w=e?v(l,m):i||s?v(l,0):void 0;m>b;b++)if((a||b in g)&&(p=y(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:xd(w,d)}else switch(t){case 4:return!1;case 7:xd(w,d)}return o?-1:n||r?r:w}},Sd={forEach:_d(0),map:_d(1),filter:_d(2),some:_d(3),every:_d(4),find:_d(5),findIndex:_d(6),filterReject:_d(7)},Ad=fn,Td=zc,Bd=Bl.getWeakData,Rd=Sh,Md=_o,Pd=Sn,Ed=Dn,Hd=Ch,Ld=Er,kd=bs.set,Id=bs.getterFor,Od=Sd.find,Dd=Sd.findIndex,Fd=Ad([].splice),Wd=0,zd=function(t){return t.frozen||(t.frozen=new jd)},jd=function(){this.entries=[]},Nd=function(t,e){return Od(t.entries,(function(t){return t[0]===e}))};jd.prototype={get:function(t){var e=Nd(this,t);if(e)return e[1]},has:function(t){return!!Nd(this,t)},set:function(t,e){var i=Nd(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Dd(this.entries,(function(e){return e[0]===t}));return~e&&Fd(this.entries,e,1),!!~e}};var Gd,Kd={getConstructor:function(t,e,i,n){var r=t((function(t,r){Rd(t,o),kd(t,{type:e,id:Wd++,frozen:void 0}),Pd(r)||Hd(r,t[n],{that:t,AS_ENTRIES:i})})),o=r.prototype,s=Id(e),a=function(t,e,i){var n=s(t),r=Bd(Md(e),!0);return!0===r?zd(n).set(e,i):r[n.id]=i,t};return Td(o,{delete:function(t){var e=s(this);if(!Ed(t))return!1;var i=Bd(t);return!0===i?zd(e).delete(t):i&&Ld(i,e.id)&&delete i[e.id]},has:function(t){var e=s(this);if(!Ed(t))return!1;var i=Bd(t);return!0===i?zd(e).has(t):i&&Ld(i,e.id)}}),Td(o,i?{get:function(t){var e=s(this);if(Ed(t)){var i=Bd(t);return!0===i?zd(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}},Ud=ul,Vd=Yi,$d=fn,Yd=zc,Xd=Bl,qd=sc,Zd=Kd,Jd=Dn,Qd=bs.enforce,tp=qi,ep=ts,ip=Object,np=Array.isArray,rp=ip.isExtensible,op=ip.isFrozen,sp=ip.isSealed,ap=ip.freeze,lp=ip.seal,hp={},cp={},up=!Vd.ActiveXObject&&"ActiveXObject"in Vd,dp=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},pp=qd("WeakMap",dp,Zd),fp=pp.prototype,gp=$d(fp.set);if(ep)if(up){Gd=Zd.getConstructor(dp,"WeakMap",!0),Xd.enable();var yp=$d(fp.delete),mp=$d(fp.has),bp=$d(fp.get);Yd(fp,{delete:function(t){if(Jd(t)&&!rp(t)){var e=Qd(this);return e.frozen||(e.frozen=new Gd),yp(this,t)||e.frozen.delete(t)}return yp(this,t)},has:function(t){if(Jd(t)&&!rp(t)){var e=Qd(this);return e.frozen||(e.frozen=new Gd),mp(this,t)||e.frozen.has(t)}return mp(this,t)},get:function(t){if(Jd(t)&&!rp(t)){var e=Qd(this);return e.frozen||(e.frozen=new Gd),mp(this,t)?bp(this,t):e.frozen.get(t)}return bp(this,t)},set:function(t,e){if(Jd(t)&&!rp(t)){var i=Qd(this);i.frozen||(i.frozen=new Gd),mp(this,t)?gp(this,t,e):i.frozen.set(t,e)}else gp(this,t,e);return this}})}else Ud&&tp((function(){var t=ap([]);return gp(new pp,t,1),!op(t)}))&&Yd(fp,{set:function(t,e){var i;return np(t)&&(op(t)?i=hp:sp(t)&&(i=cp)),gp(this,t,e),i==hp&&ap(t),i==cp&&lp(t),this}});var vp=zn,wp=fn,Cp=Ar,xp=vp("Map"),_p=vp("WeakMap"),Sp=wp([].push),Ap=Cp("metadata"),Tp=Ap.store||(Ap.store=new _p),Bp=function(t,e,i){var n=Tp.get(t);if(!n){if(!i)return;Tp.set(t,n=new xp)}var r=n.get(e);if(!r){if(!i)return;n.set(e,r=new xp)}return r},Rp={store:Tp,getMap:Bp,has:function(t,e,i){var n=Bp(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Bp(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Bp(i,n,!0).set(t,e)},keys:function(t,e){var i=Bp(t,e,!1),n=[];return i&&i.forEach((function(t,e){Sp(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Mp=_o,Pp=Rp.toKey,Ep=Rp.set;Na({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Pp(arguments[3]);Ep(t,e,Mp(i),n)}});var Hp=_o,Lp=Rp.toKey,kp=Rp.getMap,Ip=Rp.store;Na({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Lp(arguments[2]),n=kp(Hp(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var r=Ip.get(e);return r.delete(i),!!r.size||Ip.delete(e)}});var Op=_o,Dp=Xc,Fp=Rp.has,Wp=Rp.get,zp=Rp.toKey,jp=function(t,e,i){if(Fp(t,e,i))return Wp(t,e,i);var n=Dp(e);return null!==n?jp(t,n,i):void 0};Na({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:zp(arguments[2]);return jp(t,Op(e),i)}});var Np=fn,Gp=Map.prototype,Kp={Map:Map,set:Np(Gp.set),get:Np(Gp.get),has:Np(Gp.has),remove:Np(Gp.delete),proto:Gp},Up=en,Vp=fn,$p=function(t,e,i){for(var n,r,o=i||t.next;!(n=Up(o,t)).done;)if(void 0!==(r=e(n.value)))return r},Yp=Kp.Map,Xp=Kp.proto,qp=Vp(Xp.forEach),Zp=Vp(Xp.entries),Jp=Zp(new Yp).next,Qp=hr,tf=Sn,ef=ta,nf=Rr,rf=function(t,e,i){return i?$p(Zp(t),(function(t){return e(t[1],t[0])}),Jp):qp(t,e)},of=Kp.Map,sf=Kp.has,af=Kp.set,lf=fn([].push),hf=Na,cf=fn,uf=Rp,df=_o,pf=Xc,ff=function(t){var e,i,n,r=nf(this),o=ef(r),s=[],a=new of,l=tf(t)?function(t){return t}:Qp(t);for(e=0;e<o;e++)n=l(i=r[e]),sf(a,n)||af(a,n,i);return rf(a,(function(t){lf(s,t)})),s},gf=cf(ff),yf=cf([].concat),mf=uf.keys,bf=uf.toKey,vf=function(t,e){var i=mf(t,e),n=pf(t);if(null===n)return i;var r=vf(n,e);return r.length?i.length?gf(yf(i,r)):r:i};hf({target:"Reflect",stat:!0},{getMetadataKeys:function(t){var e=arguments.length<2?void 0:bf(arguments[1]);return vf(df(t),e)}});var wf=_o,Cf=Rp.get,xf=Rp.toKey;Na({target:"Reflect",stat:!0},{getOwnMetadata:function(t,e){var i=arguments.length<3?void 0:xf(arguments[2]);return Cf(t,wf(e),i)}});var _f=_o,Sf=Rp.keys,Af=Rp.toKey;Na({target:"Reflect",stat:!0},{getOwnMetadataKeys:function(t){var e=arguments.length<2?void 0:Af(arguments[1]);return Sf(_f(t),e)}});var Tf=_o,Bf=Xc,Rf=Rp.has,Mf=Rp.toKey,Pf=function(t,e,i){if(Rf(t,e,i))return!0;var n=Bf(e);return null!==n&&Pf(t,n,i)};Na({target:"Reflect",stat:!0},{hasMetadata:function(t,e){var i=arguments.length<3?void 0:Mf(arguments[2]);return Pf(t,Tf(e),i)}});var Ef=_o,Hf=Rp.has,Lf=Rp.toKey;Na({target:"Reflect",stat:!0},{hasOwnMetadata:function(t,e){var i=arguments.length<3?void 0:Lf(arguments[2]);return Hf(t,Ef(e),i)}});var kf=_o,If=Rp.toKey,Of=Rp.set;Na({target:"Reflect",stat:!0},{metadata:function(t,e){return function(i,n){Of(t,e,kf(i),If(n))}}});var Df="named",Ff="name",Wf="unmanaged",zf="optional",jf="inject",Nf="multi_inject",Gf="inversify:tagged",Kf="inversify:tagged_props",Uf="inversify:paramtypes",Vf="post_construct",$f="pre_destroy";var Yf=[jf,Nf,Ff,Wf,Df,zf],Xf={Request:"Request",Singleton:"Singleton",Transient:"Transient"},qf={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},Zf={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},Jf=0;function Qf(){return Jf++}var tg=function(){function t(t,e){this.id=Qf(),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===Xf.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}(),eg="Metadata key was used more than once in a parameter:",ig="NULL argument",ng="Key Not Found",rg="Ambiguous match found for serviceIdentifier:",og="No matching bindings found for serviceIdentifier:",sg="Missing required @injectable annotation in:",ag="Missing required @inject or @multiInject annotation in:",lg="Circular dependency found:",hg="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",cg=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."},ug=function(t,e){return"@postConstruct error in class "+t+": "+e},dg=function(t,e){return"@preDestroy error in class "+t+": "+e},pg=function(t,e){return"onDeactivation() error in class "+t+": "+e},fg="Maximum call stack size exceeded",gg=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Uf,t),userGeneratedMetadata:Reflect.getMetadata(Gf,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Kf,t)||[]},t}(),yg={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function mg(t){return t instanceof RangeError||t.message===fg}function bg(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function vg(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=xg(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function wg(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||wg(t.parentRequest,e))}function Cg(t){t.childRequests.forEach((function(t){if(wg(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=bg(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(lg+" "+e)}Cg(t)}))}function xg(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 _g=function(){function t(t){this.id=Qf(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),Sg=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Df?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),Ag=function(t,e){this.parentContext=t,this.rootRequest=e},Tg=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),Bg=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}(),Rg=function(){function t(t,e,i,n){this.id=Qf(),this.type=t,this.serviceIdentifier=i;var r="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new Bg(r||""),this.identifier=e,this.metadata=new Array;var o=null;"string"==typeof n?o=new Sg(Df,n):n instanceof Sg&&(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(Nf)},t.prototype.matchesArray=function(t){return this.matchesTag(Nf)(t)},t.prototype.isNamed=function(){return this.hasTag(Df)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return Yf.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(zf)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===Df}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return Yf.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(Df)(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}(),Mg=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 Pg(t,e,i,n){var r=t.getConstructorMetadata(i),o=r.compilerGeneratedMetadata;if(void 0===o)throw new Error(sg+" "+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=Eg(s,t,e,i,n);null!==a&&o.push(a)}return o}(n,e,o,s,l||h?a.length:i.length),u=Lg(t,i,e);return Mg(Mg([],c,!0),u,!0)}function Eg(t,e,i,n,r){var o=r[t.toString()]||[],s=Ig(o),a=!0!==s.unmanaged,l=n[t],h=s.inject||s.multiInject;if((l=h||l)instanceof Tg&&(l=l.unwrap()),a){if(!e&&(l===Object||l===Function||void 0===l))throw new Error(ag+" argument "+t+" in class "+i+".");var c=new Rg(Zf.ConstructorArgument,s.targetName,l);return c.metadata=o,c}return null}function Hg(t,e,i,n){var r=t||e;if(void 0===r){var o=sg+" for property "+String(i)+" in class "+n+".";throw new Error(o)}return r}function Lg(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=Ig(h),u=c.targetName||l,d=Hg(c.inject,c.multiInject,l,i),p=new Rg(Zf.ClassProperty,u,d);p.metadata=h,r.push(p)}var f=Object.getPrototypeOf(e.prototype).constructor;if(f!==Object){var g=Lg(t,f,i);r=Mg(Mg([],r,!0),g,!0)}return r}function kg(t,e){var i=Object.getPrototypeOf(e.prototype).constructor;if(i!==Object){var n=Pg(t,xg(i),i,!0),r=n.map((function(t){return t.metadata.filter((function(t){return t.key===Wf}))})),o=[].concat.apply([],r).length,s=n.length-o;return s>0?s:kg(t,i)}return 0}function Ig(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[jf],multiInject:e[Nf],targetName:e[Ff],unmanaged:e[Wf]}}var Og=function(){function t(t,e,i,n,r){this.id=Qf(),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 Dg(t){return t._bindingDictionary}function Fg(t,e,i,n,r){var o=zg(i.container,r.serviceIdentifier),s=[];return o.length===yg.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof r.serviceIdentifier&&t.getConstructorMetadata(r.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(r.serviceIdentifier).toSelf(),o=zg(i.container,r.serviceIdentifier)),s=e?o:o.filter((function(t){var e=new Og(t.serviceIdentifier,i,n,t,r);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case yg.NoBindingsAvailable:if(i.isOptional())return e;var r=bg(t),o=og;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+=vg(n,r,zg),new Error(o);case yg.OnlyOneBindingAvailable:return e;case yg.MultipleBindingsAvailable:default:if(i.isArray())return e;r=bg(t),o=rg+" "+r;throw o+=vg(n,r,zg),new Error(o)}}(r.serviceIdentifier,s,r,i.container),s}function Wg(t,e,i,n,r,o){var s,a;if(null===r){s=Fg(t,e,n,null,o),a=new Og(i,n,null,s,o);var l=new Ag(n,a);n.addPlan(l)}else s=Fg(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 Pg(t,xg(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var s=kg(t,e.implementationType);if(r.length<s){var l=cg(xg(e.implementationType));throw new Error(l)}}r.forEach((function(e){Wg(t,!1,e.serviceIdentifier,n,i,e)}))}}))}function zg(t,e){var i=[],n=Dg(t);return n.hasKey(e)?i=n.get(e):null!==t.parent&&(i=zg(t.parent,e)),i}function jg(t,e,i,n,r,o,s,a){void 0===a&&(a=!1);var l=new _g(e),h=function(t,e,i,n,r,o){var s=new Sg(t?Nf:jf,i),a=new Rg(e,n,i,s);if(void 0!==r){var l=new Sg(r,o);a.metadata.push(l)}return a}(i,n,r,"",o,s);try{return Wg(t,a,r,l,null,h),l}catch(t){throw mg(t)&&Cg(l.plan.rootRequest),t}}function Ng(t){return("object"==typeof t&&null!==t||"function"==typeof t)&&"function"==typeof t.then}function Gg(t){return!!Ng(t)||Array.isArray(t)&&t.some(Ng)}var Kg,Ug=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())}))},Vg=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])}}},$g=function(t,e,i){t.has(e.id)||t.set(e.id,i)},Yg=function(t,e){t.cache=e,t.activated=!0,Ng(e)&&Xg(t,e)},Xg=function(t,e){return Ug(void 0,void 0,void 0,(function(){var i,n;return Vg(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"}(Kg||(Kg={}));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)},Zg=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())}))},Jg=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){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 ty(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===Zf.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=Gg(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),o=qg(qg({},r),{constr:t});n=r.isAsync?function(t){return Zg(this,void 0,void 0,(function(){var e,i;return Jg(this,(function(n){switch(n.label){case 0:return[4,iy(t.constructorInjections)];case 1:return e=n.sent(),[4,iy(t.propertyInjections)];case 2:return i=n.sent(),[2,ey(qg(qg({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(o):ey(o)}else n=new t;return n}function ey(t){var e,i=new((e=t.constr).bind.apply(e,Qg([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 iy(t){return Zg(this,void 0,void 0,(function(){var e,i,n,r;return Jg(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 ny(t,e){var i=function(t,e){var i,n;if(Reflect.hasMetadata(Vf,t)){var r=Reflect.getMetadata(Vf,t);try{return null===(n=(i=e)[r.value])||void 0===n?void 0:n.call(i)}catch(e){throw new Error(ug(t.name,e.message))}}}(t,e);return Ng(i)?i.then((function(){return e})):e}function ry(t,e){t.scope!==Xf.Singleton&&function(t,e){var i="Class cannot be instantiated in "+(t.scope===Xf.Request?"request":"transient")+" scope.";if("function"==typeof t.onDeactivation)throw new Error(pg(e.name,i));if(Reflect.hasMetadata($f,e))throw new Error(dg(e.name,i))}(t,e)}var oy=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())}))},sy=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])}}},ay=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 ay(t)(e)}));if(!e.target.isOptional()||0!==i.length){var s=i[0];return uy(t,e,s)}}},ly=function(t,e){var i=function(t){switch(t.type){case qf.Factory:return{factory:t.factory,factoryType:Kg.Factory};case qf.Provider:return{factory:t.provider,factoryType:Kg.Provider};case qf.DynamicValue:return{factory:t.dynamicValue,factoryType:Kg.DynamicValue};default:throw new Error("Unexpected factory type "+t.type)}}(t);return function(t,e){try{return t()}catch(t){throw mg(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}))},hy=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=bg(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){ry(t,e);var r=ty(e,i,n);return Ng(r)?r.then((function(t){return ny(e,t)})):ny(e,r)}(i,i.implementationType,r,ay(t));break;default:n=ly(i,e.parentContext)}return n},cy=function(t,e,i){var n=function(t,e){return e.scope===Xf.Singleton&&e.activated?e.cache:e.scope===Xf.Request&&t.has(e.id)?t.get(e.id):null}(t,e);return null!==n||function(t,e,i){e.scope===Xf.Singleton&&Yg(e,i),e.scope===Xf.Request&&$g(t,e,i)}(t,e,n=i()),n},uy=function(t,e,i){return cy(t,i,(function(){var n=hy(t,e,i);return n=Ng(n)?n.then((function(t){return dy(e,i,t)})):dy(e,i,n)}))};function dy(t,e,i){var n,r=py(t.parentContext,e,i),o=my(t.parentContext.container),s=o.next();do{n=s.value;var a=t.parentContext,l=t.serviceIdentifier,h=yy(n,l);r=Ng(r)?gy(h,a,r):fy(h,a,r),s=o.next()}while(!0!==s.done&&!Dg(n).hasKey(t.serviceIdentifier));return r}var py=function(t,e,i){return"function"==typeof e.onActivation?e.onActivation(t,i):i},fy=function(t,e,i){for(var n=t.next();!n.done;){if(Ng(i=n.value(e,i)))return gy(t,e,i);n=t.next()}return i},gy=function(t,e,i){return oy(void 0,void 0,void 0,(function(){var n,r;return sy(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]}}))}))},yy=function(t,e){var i=t._activations;return i.hasKey(e)?i.get(e).values():[].values()},my=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 by=function(t,e){var i=t.parentRequest;return null!==i&&(!!e(i)||by(i,e))},vy=function(t){return function(e){var i=function(i){return null!==i&&null!==i.target&&i.target.matchesTag(t)(e)};return i.metaData=new Sg(t,e),i}},wy=vy(Df),Cy=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}},xy=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new _y(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=wy(t),new _y(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 _y(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=vy(t)(e),new _y(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return null!==e&&Cy(t)(e.parentRequest)},new _y(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return null!==e&&wy(t)(e.parentRequest)},new _y(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&vy(t)(e)(i.parentRequest)},new _y(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&by(e,Cy(t))},new _y(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&!by(e,Cy(t))},new _y(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&by(e,wy(t))},new _y(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&!by(e,wy(t))},new _y(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&by(i,vy(t)(e))},new _y(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(i){return null!==i&&!by(i,vy(t)(e))},new _y(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&by(e,t)},new _y(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&!by(e,t)},new _y(this._binding)},t}(),_y=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new xy(this._binding)},t.prototype.onDeactivation=function(t){return this._binding.onDeactivation=t,new xy(this._binding)},t}(),Sy=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new xy(this._binding),this._bindingOnSyntax=new _y(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}(),Ay=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=Xf.Request,new Sy(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=Xf.Singleton,new Sy(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=Xf.Transient,new Sy(this._binding)},t}(),Ty=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new xy(this._binding),this._bindingOnSyntax=new _y(this._binding),this._bindingInSyntax=new Ay(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}(),By=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=qf.Instance,this._binding.implementationType=t,new Ty(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=Xf.Singleton,new Sy(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 Ty(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=qf.Constructor,this._binding.implementationType=t,this._binding.scope=Xf.Singleton,new Sy(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=qf.Factory,this._binding.factory=t,this._binding.scope=Xf.Singleton,new Sy(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=Xf.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=Xf.Singleton,new Sy(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 Sy(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=qf.Provider,this._binding.provider=t,this._binding.scope=Xf.Singleton,new Sy(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}(),Ry=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 My=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(ig);if(null==e)throw new Error(ig);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(ig);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(ng)},t.prototype.remove=function(t){if(null==t)throw new Error(ig);if(!this._map.delete(t))throw new Error(ng)},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(ig);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}(),Py=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 My,onDeactivations:new My}},t}(),Ey=function(){return Ey=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},Ey.apply(this,arguments)},Hy=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())}))},Ly=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])}}},ky=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))},Iy=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=Xf.Transient;else if(e.defaultScope!==Xf.Singleton&&e.defaultScope!==Xf.Transient&&e.defaultScope!==Xf.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=Qf(),this._bindingDictionary=new My,this._snapshots=[],this._middleware=null,this._activations=new My,this._deactivations=new My,this.parent=null,this._metadataReader=new gg,this._moduleActivationStore=new Py}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=ky([e,i],n,!0).map((function(t){return Dg(t)})),a=Dg(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 Hy(this,void 0,void 0,(function(){var e,i,n,r,o;return Ly(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 Hy(this,void 0,void 0,(function(){var e,i,n,r;return Ly(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||Xf.Transient,i=new tg(t,e);return this._bindingDictionary.add(t,i),new By(i)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.rebindAsync=function(t){return Hy(this,void 0,void 0,(function(){return Ly(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 Hy(this,void 0,void 0,(function(){var e;return Ly(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 My},t.prototype.unbindAllAsync=function(){return Hy(this,void 0,void 0,(function(){var t,e=this;return Ly(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 My,[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,Df,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 Rg(Zf.Variable,"",e,new Sg(i,n)),o=new _g(t);return new Og(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(Ry.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 Hy(this,void 0,void 0,(function(){var e;return Ly(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 Hy(this,void 0,void 0,(function(){var n;return Ly(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,Df,e)},t.prototype.getNamedAsync=function(t,e){return this.getTaggedAsync(t,Df,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,Df,e)},t.prototype.getAllNamedAsync=function(t,e){return this.getAllTaggedAsync(t,Df,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($f,t))return e[Reflect.getMetadata($f,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(Ng(r))return this._handleDeactivationError(r.then((function(){return i._propagateContainerDeactivationThenBindingAndPreDestroyAsync(t,e,n)})),n)}var o=this._propagateContainerDeactivationThenBindingAndPreDestroy(t,e,n);if(Ng(o))return this._handleDeactivationError(o,n)}catch(t){throw new Error(pg(n.name,t.message))}},t.prototype._handleDeactivationError=function(t,e){return Hy(this,void 0,void 0,(function(){var i;return Ly(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(pg(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(Ng(r))return r.then((function(){return i._deactivateContainerAsync(t,e)}));n=e.next()}},t.prototype._deactivateContainerAsync=function(t,e){return Hy(this,void 0,void 0,(function(){var i;return Ly(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=Ey(Ey({},t),{contextInterceptor:function(t){return t},targetType:Zf.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(Gg(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=jg(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return ay(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(i=e.contextInterceptor(i))}},t.prototype._deactivateIfSingleton=function(t){var e=this;if(t.activated)return Ng(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(Ng(this._deactivateIfSingleton(n)))throw new Error("Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)")}},t.prototype._deactivateSingletonsAsync=function(t){return Hy(this,void 0,void 0,(function(){var e=this;return Ly(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 Hy(this,void 0,void 0,(function(){return Ly(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: "+bg(t))}},t.prototype._bindingDeactivationAndPreDestroy=function(t,e,i){var n=this;if("function"==typeof t.onDeactivation){var r=t.onDeactivation(e);if(Ng(r))return r.then((function(){return n._preDestroy(i,e)}))}return this._preDestroy(i,e)},t.prototype._bindingDeactivationAndPreDestroyAsync=function(t,e,i){return Hy(this,void 0,void 0,(function(){return Ly(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}(),Oy=function(t){this.id=Qf(),this.registry=t};function Dy(t,e,i,n){!function(t){if(void 0!==t)throw new Error(hg)}(e),Wy(Gf,t,i.toString(),n)}function Fy(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(eg+" "+i.toString())}else e=[t];return e}function Wy(t,e,i,n){var r=Fy(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(eg+" "+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 zy(t){return function(e,i,n){"number"==typeof n?Dy(e,i,n,t):function(t,e,i){if(void 0!==t.prototype)throw new Error(hg);Wy(Kf,t.constructor,e,i)}(e,i,t)}}function jy(){return function(t){if(Reflect.hasOwnMetadata(Uf,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(Uf,e,t),t}}function Ny(t){return zy(new Sg(Df,t))}function Gy(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 zy(new Sg(t,e))(i,n,r)}}}var Ky=Gy(jf),Uy=Gy(Nf);var Vy,$y,Yy=(Vy=Vf,$y="Cannot apply @postConstruct decorator multiple times in the same class",function(){return function(t,e){var i=new Sg(Vy,e);if(Reflect.hasOwnMetadata(Vy,t.constructor))throw new Error($y);Reflect.defineMetadata(Vy,i,t.constructor)}});const Xy=Symbol("ContributionProvider");class qy{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 Zy(t,e){t(Xy).toDynamicValue((t=>{let{container:i}=t;return new qy(e,i)})).inSingletonScope().whenTargetNamed(e)}class Jy{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 Qy extends Jy{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 tm=Symbol.for("EnvContribution"),em=Symbol.for("Global");var im=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},nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rm=function(t,e){return function(i,n){e(i,n,t)}};let om=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 Qy(["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)}};om=im([jy(),rm(0,Ky(Xy)),rm(0,Ny(tm)),nm("design:paramtypes",[Object])],om);const sm=Ae-1e-8;class am{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,o){if(Math.abs(r-n)>sm)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%=Ae)<0&&(n+=Ae),(r%=Ae)<0&&(r+=Ae),r<n&&(o=!o,s=n,n=r,r=s),o)for(r-=Ae,s=n-n%Se,a=0;a<4&&s>r;++a,s-=Se)f(s);else for(s=n-n%Se+Se,a=0;a<4&&s<r;++a,s+=Se)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 lm{constructor(){this.curves=[],this.bounds=new Ne}getCurveLengths(){return this.curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const hm=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,cm={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},um={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let dm,pm,fm,gm,ym,mm;var bm,vm,wm,Cm,xm,_m,Sm,Am,Tm;function Bm(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),y=Math.sin(r),m=.5*(r-n),b=Math.sin(.5*m),v=8/3*b*b/Math.sin(m),w=e+p-v*f,C=i+f+v*p,x=e+g,_=i+y,S=x+v*y,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 Rm(t,e,i,n){const r=function(t,e,i,n,r,o,s,a,l){const h=Ge(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,y=c/i,m=-c/n,b=u/n,v=g*a+y*l,w=m*a+b*l,C=g*t+y*e,x=m*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 R=Math.atan2(x-T,C-A)-B;R<0&&1===o?R+=Ae:R>0&&0===o&&(R-=Ae);const M=Math.ceil(Math.abs(R/(Se+.001))),P=[];for(let t=0;t<M;++t){const e=B+t*R/M,r=B+(t+1)*R/M;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=Bm(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=51]="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"}(bm||(bm={})),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"}(vm||(vm={})),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"}(wm||(wm={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Cm||(Cm={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"}(xm||(xm={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(_m||(_m={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Sm||(Sm={})),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"}(Am||(Am={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Tm||(Tm={}));const Mm=[(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 Pm(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];Mm[l[0]](l,e,i,n,r,o,s)}}class Em{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Hm(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+=We.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 Lm(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 km(t,e,i,n,r){const o=Lm(t.x,e.x,i.x,n.x,r),s=Lm(t.y,e.y,i.y,n.y,r);return new Fe(o,s)}function Im(t,e){const{p0:i,p1:n,p2:r,p3:o}=t,s=km(i,n,r,o,e),a=We.pointAtPP(i,n,e),l=We.pointAtPP(n,r,e),h=We.pointAtPP(r,o,e),c=We.pointAtPP(a,l,e),u=We.pointAtPP(l,h,e);return[new Om(i,a,c,s),new Om(s,u,h,o)]}class Om extends Em{constructor(t,e,i,n){super(),this.type=Am.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 km(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Hm(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===Sm.ROW?Be(this.p0.x-this.p3.x):t===Sm.COLUMN?Be(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Pe(t-.01,0),i=Ee(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return Re(r.y-n.y,r.x-n.x)}}function Dm(t,e){const{p0:i,p1:n}=t,r=We.pointAtPP(i,n,e);return[new Fm(i,r),new Fm(r,n)]}class Fm extends Em{constructor(t,e){super(),this.type=Am.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return We.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Re(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()?We.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Sm.ROW?Be(this.p0.x-this.p1.x):t===Sm.COLUMN?Be(this.p0.y-this.p1.y):0}}class Wm{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){const a=new Om(new Fe(this._lastX,this._lastY),new Fe(t,e),new Fe(i,n),new Fe(r,o));a.defined=s,this.curves.push(a),this._lastX=r,this._lastY=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i){const n=this.addLinearCurve(t,e,i);this.curves.push(n),this._lastX=t,this._lastY=e}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,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){const n=new Fm(new Fe(this._lastX,this._lastY),new Fe(t,e));return n.defined=i,n}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){if(t===Sm.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Be(t.p0.y-e.p1.y)}if(t===Sm.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Be(t.p0.x-e.p1.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class zm extends Wm{bezierCurveTo(t,e,i,n,r,o,s){return super.bezierCurveTo(e,t,n,i,o,r,s)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function jm(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 Nm{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Gm(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 Wm("linear",null!=i?i:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new Nm(r,n),t),r}function Km(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class Um{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&&Km(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:Km(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vm(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 Gm(t,e);const r=new Wm("basis",null!=i?i:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new Um(r,n),t),r}function $m(t){return t<0?-1:1}function Ym(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($m(o)+$m(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function Xm(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function qm(t,e,i,n){const r=t._x0,o=t._y0,s=t._x1,a=t._y1,l=(s-r)/3;t.context.bezierCurveTo(r+l,o+l*e,s-l,a-l*i,s,a,n)}class Zm{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:qm(this,this._t0,Xm(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,qm(this,Xm(this,e=Ym(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:qm(this,this._t0,e=Ym(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class Jm extends Zm{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Qm(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 Gm(t,e);const r=new Wm("monotoneX",null!=i?i:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new Zm(r,n),t),r}function tb(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 Gm(t,e);const r=new zm("monotoneY",null!=i?i:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new Jm(r,n),t),r}let eb=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._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):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function ib(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 Wm("step",null!=n?n:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new eb(o,e,r),t),o}class nb{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function rb(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 Wm("linear",null!=i?i:Be(t[t.length-1].x-t[0].x)>Be(t[t.length-1].y-t[0].y)?Sm.ROW:Sm.COLUMN);return function(t,e){jm(t,e)}(new nb(r,n),t),r}function ob(t,e,i){switch(e){case"linear":default:return Gm(t,i);case"basis":return Vm(t,i);case"monotoneX":return Qm(t,i);case"monotoneY":return tb(t,i);case"step":return ib(t,.5,i);case"stepBefore":return ib(t,0,i);case"stepAfter":return ib(t,1,i);case"linearClosed":return rb(t,i)}}class sb extends lm{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new am(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([um.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([um.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([um.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([um.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([um.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([um.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([um.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([um.A,t,e,i,n,r,o]),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this}closePath(){return this.commandList.push([um.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[um.M]=t=>`M${t[1]} ${t[2]}`,t[um.L]=t=>`L${t[1]} ${t[2]}`,t[um.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[um.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[um.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,y=d*o+n,m=p*s+r,b=o*l*h,v=s*l*h;t.push(f-b*u,g+v*c,y+b*p,m-v*d,y,m)})(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[um.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(dm=e[t],pm=dm.slice(1),fm=dm[0],i=[fm],n=pm.match(hm),null!==n){for(let t=0,e=n.length;t<e;t++)gm=n[t],ym=parseFloat(gm),Number.isNaN(ym)||i.push(ym);if(mm=cm[fm],i.length-1>mm){let t;for(let e=1,n=i.length;e<n;e+=mm){t=[fm];for(let n=e,r=e+mm;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=ob(e,i);"x"===n?this.direction=Sm.ROW:"y"===n?this.direction=Sm.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[um.M]=this.moveToTransform,t[um.L]=this.lineToTransform,t[um.Q]=this.quadraticCurveToTransform,t[um.C]=this.bezierCurveToTransform,t[um.AT]=this.arcToTransform,t[um.E]=this.ellipseTransform,t[um.R]=this.rectTransform,t[um.A]=this.arcTransform,t[um.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,y=t.length;g<y;++g){switch(e=t[g],1===l&&1===h||(e=lb(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":Rm(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":Rm(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 um.L:this.lineToTransform(s,e,i,n,r);break;case um.M:this.moveToTransform(s,e,i,n,r);break;case um.C:this.bezierCurveToTransform(s,e,i,n,r);break;case um.Q:this.quadraticCurveToTransform(s,e,i,n,r);break;case um.A:this.arcToTransform(s,e,i,n,r);break;case um.E:this.ellipseTransform(s,e,i,n,r);break;case um.R:this.rectTransform(s,e,i,n,r);break;case um.AT:this.arcToTransform(s,e,i,n,r);break;case um.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Pm(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Sm.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Be(t.p0.y-e.p1.y)}if(this.direction===Sm.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Be(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 ab=["l",0,0,0,0,0,0,0];function lb(t,e,i){const n=ab[0]=t[0];if("a"===n||"A"===n)ab[1]=e*t[1],ab[2]=i*t[2],ab[3]=t[3],ab[4]=t[4],ab[5]=t[5],ab[6]=e*t[6],ab[7]=i*t[7];else if("h"===n||"H"===n)ab[1]=e*t[1];else if("v"===n||"V"===n)ab[1]=i*t[1];else for(let n=1,r=t.length;n<r;++n)ab[n]=(n%2==1?e:i)*t[n];return ab}const hb={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 Ve},cb={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},ub={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},db=Object.assign({outerBorder:Object.assign(Object.assign({},ub),{distance:0}),innerBorder:Object.assign(Object.assign({},ub),{distance:0})},ub),pb={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},fb=Object.assign(Object.assign({opacity:1,background:null,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:0,blur:0,cursor:null},cb),db),gb=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},fb),hb),yb=Object.assign(Object.assign({},gb),{startAngle:0,endAngle:Te,innerRadius:0,outerRadius:1,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),mb=Object.assign(Object.assign({},gb),{points:[],segments:[],curveType:"linear",clipRange:1}),bb=Object.assign(Object.assign({},gb),{radius:1,startAngle:0,endAngle:Te}),vb=Object.assign(Object.assign({},gb),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0}),wb=Object.assign(Object.assign({},gb),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Cb=Object.assign(Object.assign({},gb),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default"}),xb=Object.assign(Object.assign({},gb),{path:new sb,customPath:()=>{console.warn("空函数")}}),_b=Object.assign(Object.assign({},gb),{points:[],cornerRadius:0}),Sb=Object.assign(Object.assign({},gb),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Ab=Object.assign(Object.assign({},gb),{width:0,height:0,cornerRadius:0,length:0}),Tb=Object.assign(Object.assign({},gb),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bb=Object.assign(Object.assign(Object.assign({},gb),pb),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rb=Object.assign(Object.assign({},gb),{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}),Mb=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},gb),{fill:!0}),Pb=Object.assign(Object.assign({},Mb),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Eb=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 Hb=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=Bb.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:pb.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:pb.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)}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}};Hb=Eb([jy()],Hb);var Lb=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 kb=Symbol.for("TextMeasureContribution");let Ib=class extends Hb{};Ib=Lb([jy()],Ib);const Ob=new Iy;const Db=new class{},Fb=Symbol.for("CanvasFactory"),Wb=Symbol.for("Context2dFactory");function zb(t){return Ob.getNamed(Fb,Db.global.env)(t)}const jb=1e-4,Nb=Math.sqrt(3),Gb=1/3;function Kb(t){return t>-rv&&t<rv}function Ub(t){return t>rv||t<-rv}const Vb=[0,0],$b=[0,0],Yb=[0,0];function Xb(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function qb(t,e,i,n){const r=1-n;return r*(r*t+2*n*e)+n*n*i}function Zb(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 Jb(t){return(t%=Te)<0&&(t+=Te),t}function Qb(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 tv(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;Vb[0]=s,Vb[1]=a;for(let s=0;s<1;s+=.05){$b[0]=qb(t,i,r,s),$b[1]=qb(e,n,o,s);const a=Xb(Vb,$b);a<u&&(h=s,u=a)}u=1/0;for(let s=0;s<32&&!(c<jb);s++){const s=h-c,a=h+c;$b[0]=qb(t,i,r,s),$b[1]=qb(e,n,o,s);const l=Xb($b,Vb);if(s>=0&&l<u)h=s,u=l;else{Yb[0]=qb(t,i,r,a),Yb[1]=qb(e,n,o,a);const s=Xb(Yb,Vb);a<=1&&s<u?(h=a,u=s):c*=.5}}return l&&(l[0]=qb(t,i,r,h),l[1]=qb(e,n,o,h)),Math.sqrt(u)}(t,e,i,n,r,o,a,l,null)<=h/2}function ev(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,y=.005,m=1/0;Vb[0]=l,Vb[1]=h;for(let l=0;l<1;l+=.05)$b[0]=Zb(t,i,r,s,l),$b[1]=Zb(e,n,o,a,l),p=Xb(Vb,$b),p<m&&(g=l,m=p);m=1/0;for(let l=0;l<32&&!(y<jb);l++)u=g-y,d=g+y,$b[0]=Zb(t,i,r,s,u),$b[1]=Zb(e,n,o,a,u),p=Xb($b,Vb),u>=0&&p<m?(g=u,m=p):(Yb[0]=Zb(t,i,r,s,d),Yb[1]=Zb(e,n,o,a,d),f=Xb(Yb,Vb),d<=1&&f<m?(g=d,m=f):y*=.5);return c&&(c[0]=Zb(t,i,r,s,g),c[1]=Zb(e,n,o,a,g)),Math.sqrt(m)}(t,e,i,n,r,o,s,a,h,c,null)<=u/2}function iv(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)%Te<1e-4)return!0;if(o){const t=n;n=Jb(r),r=Jb(t)}else n=Jb(n),r=Jb(r);n>r&&(r+=Te);let u=Math.atan2(l,a);return u<0&&(u+=Te),u>=n&&u<=r||u+Te>=n&&u+Te<=r}function nv(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 rv=1e-4;function ov(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(Kb(s)){if(Ub(o)){const t=-a/o;t>=0&&t<=1&&(r[l++]=t)}}else{const t=o*o-4*s*a;if(Kb(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 sv=[-1,-1,-1],av=[-1,-1];function lv(){const t=av[0];av[0]=av[1],av[1]=t}function hv(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(Kb(c)&&Kb(u))if(Kb(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(Kb(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,Gb):Math.pow(i,Gb),n=n<0?-Math.pow(-n,Gb):Math.pow(n,Gb);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+Nb*Math.sin(e)))/(3*s),h=(-a+i*(n-Nb*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,sv);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=sv[h],g=0===c||1===c?.5:1;Zb(t,i,r,s,c)<l||(d<0&&(d=ov(e,n,o,a,av),av[1]<av[0]&&d>1&&lv(),p=Zb(e,n,o,a,av[0]),d>1&&(f=Zb(e,n,o,a,av[1]))),2===d?c<av[0]?u+=p<e?g:-g:c<av[1]?u+=f<p?g:-g:u+=a<f?g:-g:c<av[0]?u+=p<e?g:-g:u+=a<p?g:-g)}return u}function cv(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(Kb(o)){if(Ub(s)){const t=-a/s;t>=0&&t<=1&&(r[l++]=t)}}else{const t=s*s-4*o*a;if(Kb(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,sv);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=qb(e,n,o,h);for(let n=0;n<l;n++){const l=0===sv[n]||1===sv[n]?.5:1;qb(t,i,r,sv[n])<s||(sv[n]<h?a+=c<e?l:-l:a+=o<c?l:-l)}return a}const c=0===sv[0]||1===sv[0]?.5:1;return qb(t,i,r,sv[0])<s?0:o<e?c:-c}function uv(t,e,i,n,r,o,s,a){if((a-=e)>i||a<-i)return 0;const l=Math.sqrt(i*i-a*a);sv[0]=-l,sv[1]=l;const h=Math.abs(n-r);if(h<1e-4)return 0;if(h>=Te-1e-4){n=0,r=Te;const e=o?1:-1;return s>=sv[0]+t&&s<=sv[1]+t?e:0}if(n>r){const t=n;n=r,r=t}n<0&&(n+=Te,r+=Te);let c=0;for(let e=0;e<2;e++){const i=sv[e];if(i+t>s){let t=Math.atan2(a,i),e=o?1:-1;t<0&&(t=Te+t),(t>=n&&t<=r||t+Te>=n&&t+Te<=r)&&(t>_e/2&&t<1.5*_e&&(e=-e),c+=e)}}return c}function dv(t){return Math.round(t/_e*1e8)/1e8%2*_e}function pv(t,e){let i=dv(t[0]);i<0&&(i+=Te);const n=i-t[0];let r=t[1];r+=n,!e&&r-i>=Te?r=i+Te:e&&i-r>=Te?r=i-Te:!e&&i>r?r=i+(Te-dv(i-r)):e&&i<r&&(r=i-(Te-dv(r-i))),t[0]=i,t[1]=r}const fv=[0,0];function gv(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]===um.M&&t>1&&(i||(h+=Qb(c,u,d,p,n,r))),f&&(c=s[1],u=s[2],d=c,p=u);const g=s[0],y=s[1],m=s[2],b=s[3],v=s[4],w=s[5],C=s[6];let x=v,_=w;fv[0]=x,fv[1]=_,pv(fv,Boolean(s[6])),x=fv[0],_=fv[1];const S=x,A=_-x,T=!!(1-(s[6]?0:1)),B=(n-y)*b/b+y;switch(g){case um.M:d=y,p=m,c=d,u=p;break;case um.L:if(i){if(nv(c,u,y,m,e,n,r))return!0}else h+=Qb(c,u,y,m,n,r)||0;c=y,u=m;break;case um.C:if(i){if(ev(c,u,y,m,b,v,w,C,e,n,r))return!0}else h+=hv(c,u,y,m,b,v,w,C,n,r)||0;c=w,u=C;break;case um.Q:if(i){if(tv(c,u,y,m,b,v,e,n,r))return!0}else h+=cv(c,u,y,m,b,v,n,r)||0;c=b,u=v;break;case um.A:if(a=Math.cos(S)*b+y,l=Math.sin(S)*b+m,f?(d=a,p=l):h+=Qb(c,u,a,l,n,r),i){if(iv(y,m,b,S,S+A,T,e,B,r))return!0}else h+=uv(y,m,b,S,S+A,T,B,r);c=Math.cos(S+A)*b+y,u=Math.sin(S+A)*b+m;break;case um.R:if(d=c=y,p=u=m,a=d+b,l=p+v,i){if(nv(d,p,a,p,e,n,r)||nv(a,p,a,l,e,n,r)||nv(a,l,d,l,e,n,r)||nv(d,l,d,p,e,n,r))return!0}else h+=Qb(a,p,a,l,n,r),h+=Qb(d,l,d,p,n,r);break;case um.Z:if(i){if(nv(c,u,d,p,e,n,r))return!0}else h+=Qb(c,u,d,p,n,r);c=d,u=p}}return i||(f=u,g=p,Math.abs(f-g)<rv)||(h+=Qb(c,u,d,p,n,r)||0),0!==h;var f,g}var yv=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},mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bv=function(t,e){return function(i,n){e(i,n,t)}};let vv=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=zb({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:pb.fontSize};return this.global.measureTextMethod=r,o}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new vi(Object.assign({defaultFontParams:{fontFamily:pb.fontFamily,fontSize:pb.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+vi.ALPHABET_CHAR_SET+vi.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var wv;vv=yv([jy(),bv(0,Ky(Xy)),bv(0,Ny(kb)),bv(1,Ky(em)),mv("design:paramtypes",[Object,Object])],vv),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(wv||(wv={}));const Cv=new Ve;let xv=class{constructor(){this.matrix=new Ve}init(t){return this.mode=wv.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=wv.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Cv.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(Cv.a,Cv.b,Cv.c,Cv.d,Cv.e,Cv.f),this}scale(t,e,i){return this.mode===wv.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cv.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cv.a,Cv.b,Cv.c,Cv.d,Cv.e,Cv.f),this}translate(t,e){return this.mode===wv.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===wv.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};xv=yv([jy(),mv("design:paramtypes",[])],xv);const _v={arc:yb,area:mb,circle:bb,line:Cb,path:xb,symbol:Tb,text:Bb,rect:Sb,rect3d:Ab,polygon:_b,richtext:Rb,richtextIcon:Pb,image:Mb,group:vb,glyph:wb},Sv=Object.keys(_v);function Av(){return{arc:Object.assign({},_v.arc),area:Object.assign({},_v.area),circle:Object.assign({},_v.circle),line:Object.assign({},_v.line),path:Object.assign({},_v.path),symbol:Object.assign({},_v.symbol),text:Object.assign({},_v.text),rect:Object.assign({},_v.rect),rect3d:Object.assign({},_v.rect3d),polygon:Object.assign({},_v.polygon),richtext:Object.assign({},_v.richtext),richtextIcon:Object.assign({},_v.richtextIcon),image:Object.assign({},_v.image),group:Object.assign({},_v.group),glyph:Object.assign({},_v.glyph)}}function Tv(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 Bv=new Array(60).fill(0).map((()=>Av()));class Rv{constructor(){this._defaultTheme=Bv.pop()||Av(),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?Tv(this.userTheme,t.userTheme,!1):this.userTheme=Jt(t.userTheme),Tv(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);Sv.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 Mv=new Rv;function Pv(t,e){return t.glyphHost?Pv(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)):Mv.getTheme()}return null}(t)||Mv.getTheme()}class Ev{static GenAutoIncrementId(){return Ev.auto_increment_id++}}Ev.auto_increment_id=0;var Hv=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 Lv extends Mt{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=Ev.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 Hv(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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=Et(i,!0)&&i||It(i)&&i.capture,r=It(i)&&i.once,o=Ht(e)?void 0:e;return t=n?`${t}capture`:t,e=Ht(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=Et(i,!0)&&i||It(i)&&i.capture,r=Ht(e)?void 0:e;t=n?`${t}capture`:t,e=Ht(e)?e:e.handleEvent;const o=It(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 It(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 kv{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=kv.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Fe,this.page=new Fe,this.canvas=new Fe,this.viewport=new Fe,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 Iv extends kv{constructor(){super(...arguments),this.client=new Fe,this.movement=new Fe,this.offset=new Fe,this.global=new Fe,this.screen=new Fe}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 Ov extends Iv{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 Ov(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 Dv extends Iv{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 Dv(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}}Dv.DOM_DELTA_PIXEL=0,Dv.DOM_DELTA_LINE=1,Dv.DOM_DELTA_PAGE=2;class Fv extends kv{constructor(t,e){super(),this.type=t,this.detail=e}}const Wv="object"==typeof performance&&performance.now?performance:Date;function zv(t){return"mouse"===t||"pen"===t}class jv{constructor(t){this.dispatch=new Mt,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Ov))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(zv(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 Ov))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e),o=zv(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 Ov))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=zv(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 Ov))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=zv(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 Ov))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=Wv.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(zv(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(zv(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,zv(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 Ov))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"):zv(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 Dv))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const r=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[r])?n=this._prePointTargetCache[r]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[r]:n}),i)for(let e=0,r=i.length;e<r;e++)i[e].fn(t,n);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(Ov);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(Dv);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(Ov);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 Ov&&e instanceof Ov&&(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 Iv&&e instanceof Iv&&(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=Wv.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);else 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<=Xt(this.rootTarget,"width")&&e>=0&&e<=Xt(this.rootTarget,"height")?this.rootTarget:null,i}}const Nv={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof kv))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 Fv(t,e))}},Gv={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Kv{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 jv(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 Ov,this.rootWheelEvent=new Dv,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&&Ft(t)&&!Zt(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];Dt(n.button)&&(n.button=0),Dt(n.buttons)&&(n.buttons=1),Dt(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),Dt(n.width)&&(n.width=n.radiusX||1),Dt(n.height)&&(n.height=n.radiusY||1),Dt(n.tiltX)&&(n.tiltX=0),Dt(n.tiltY)&&(n.tiltY=0),Dt(n.pointerType)&&(n.pointerType="touch"),Dt(n.pointerId)&&(n.pointerId=n.identifier||0),Dt(n.pressure)&&(n.pressure=n.force||.5),Dt(n.twist)&&(n.twist=0),Dt(n.tangentialPressure)&&(n.tangentialPressure=0),Dt(n.layerX)&&(n.layerX=n.offsetX=n.clientX),Dt(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;Dt(i.isPrimary)&&(i.isPrimary=!0),Dt(i.width)&&(i.width=1),Dt(i.height)&&(i.height=1),Dt(i.tiltX)&&(i.tiltX=0),Dt(i.tiltY)&&(i.tiltY=0),Dt(i.pointerType)&&(i.pointerType="mouse"),Dt(i.pointerId)&&(i.pointerId=1),Dt(i.pressure)&&(i.pressure=.5),Dt(i.twist)&&(i.twist=0),Dt(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=Gv[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Wv.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 Uv{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Uv.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 Vv{static Avaliable(){return!0}avaliable(){return Vv.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 $v{static Avaliable(){return!!Db.global.getRequestAnimationFrame()}avaliable(){return $v.Avaliable()}tick(t,e){Db.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var Yv;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Yv||(Yv={}));class Xv{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-Xv.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Xv.bounceIn(2*t):.5*Xv.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Te*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Te/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Te*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Te/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Te*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Te/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Te/e)*.5+1}}}Xv.quadIn=Xv.getPowIn(2),Xv.quadOut=Xv.getPowOut(2),Xv.quadInOut=Xv.getPowInOut(2),Xv.cubicIn=Xv.getPowIn(3),Xv.cubicOut=Xv.getPowOut(3),Xv.cubicInOut=Xv.getPowInOut(3),Xv.quartIn=Xv.getPowIn(4),Xv.quartOut=Xv.getPowOut(4),Xv.quartInOut=Xv.getPowInOut(4),Xv.quintIn=Xv.getPowIn(5),Xv.quintOut=Xv.getPowOut(5),Xv.quintInOut=Xv.getPowInOut(5),Xv.backIn=Xv.getBackIn(1.7),Xv.backOut=Xv.getBackOut(1.7),Xv.backInOut=Xv.getBackInOut(1.7),Xv.elasticIn=Xv.getElasticIn(1,.3),Xv.elasticOut=Xv.getElasticOut(1,.3),Xv.elasticInOut=Xv.getElasticInOut(1,.3*1.5);const qv=new class{constructor(){this.id=Ev.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===Cm.END?this.removeAnimate(e):e.status===Cm.RUNNING||e.status===Cm.INITIAL?(this.animateCount++,e.advance(t)):e.status===Cm.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class Zv{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 Jv extends Zv{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class Qv{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ev.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qv;this.id=t,this.timeline=e,this.status=Cm.INITIAL,this.tailAnimate=new tw(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pe(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){Qv.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]:Qv.mode;t&&e&xm.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:wm.ANIMATE_PLAY})}runCb(t){const e=new Jv((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,o){const s=Qv.interpolateMap.get(t)||Qv.interpolateMap.get("");return!!s&&s(t,e,i,n,r,o)}pause(){this.status===Cm.RUNNING&&(this.status=Cm.PAUSED)}resume(){this.status===Cm.PAUSED&&(this.status=Cm.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 tw(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===Cm.INITIAL&&(this.status=Cm.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Cm.RUNNING&&(this.status=Cm.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=Cm.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()}}Qv.mode=xm.NORMAL,Qv.interpolateMap=new Map;class tw{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 ew(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?Xv[i]:i,r=this._addStep(e,null,n);return r.type=_m.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?Xv[i]:i,o=this._addStep(e,null,r);return o.type=_m.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=_m.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=_m.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 ew(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 ew{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 iw=200,nw="cubicOut";var rw;!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"}(rw||(rw={}));const ow=[!1,!1,!1,!1],sw=[0,0,0,0],aw=t=>t?Wt(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(sw[0]=t[0],sw[2]=t[0],sw[1]=t[1],sw[3]=t[1],sw):t:t:0,lw=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],hw=[1,2,3,0,1,2,3,0];function cw(t,e,i,n){for(;t>=Te;)t-=Te;for(;t<0;)t+=Te;for(;t>e;)e+=Te;lw[0].x=i,lw[1].y=i,lw[2].x=-i,lw[3].y=-i;const r=Math.ceil(t/Se)%4,o=Math.ceil(e/Se)%4;if(n.add(Me(t)*i,He(t)*i),n.add(Me(e)*i,He(e)*i),r!==o||e-t>_e){let t=!1;for(let e=0;e<hw.length;e++)if(t||r!==hw[e]){if(t&&o===hw[e])break;if(t){const t=lw[hw[e]];n.add(t.x,t.y)}}else{t=!0;const e=lw[r];n.add(e.x,e.y)}}}function uw(t,e,i){const{x:n,y:r}=De(t.x,t.y,e.x,e.y,i),{x:o,y:s}=De(t.x1,t.y1,e.x1,e.y1,i),a=new Fe(n,r,o,s);return a.defined=e.defined,a}function dw(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 Fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)n[r]=uw(t[r],e[r],i)}else{n=e.map((t=>{const e=new Fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)n[r]=uw(t[r],e[r],i)}return n}function pw(t,e){if(Wt(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}var fw;!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"}(fw||(fw={}));var gw={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 yw={};for(const t in gw)Zt(gw,t)&&(yw[gw[t]]=t);const mw={to:{},get:{}};function bw(t,e,i){return Math.min(Math.max(e,t),i)}function vw(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}mw.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=mw.get.hsl(t,n),i="hsl";break;case"hwb":e=mw.get.hwb(t,n),i="hwb";break;default:e=mw.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},mw.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=gw[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]=bw(e[n],0,255);return e[3]=bw(e[3],0,1),e},mw.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]=bw(parseFloat(i[2]),0,100),e[2]=bw(parseFloat(i[3]),0,100),e[3]=bw(isNaN(t)?1:t,0,1),e}return null},mw.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]=bw(parseFloat(i[2]),0,100),e[2]=bw(parseFloat(i[3]),0,100),e[3]=bw(isNaN(t)?1:t,0,1),e}return null},mw.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"#"+vw(n[0])+vw(n[1])+vw(n[2])+(n[3]<1?vw(Math.round(255*n[3])):"")},mw.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]+")"},mw.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]+")"},mw.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]+")"},mw.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+")"},mw.to.keyword=function(t){return yw[t.slice(0,3)]};const ww=mw;var Cw;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Cw||(Cw={}));class xw{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cw.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Cw.Color1){let e=xw.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=mw.get(t),e&&e.value){const n=e.value,r=[n[0]/255,n[1]/255,n[2]/255,n[3]];xw.store1[t]=r,xw.store255[t]=n,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3]}return i}let n=xw.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=mw.get(t),n&&n.value){const e=n.value;xw.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],xw.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===Cw.Color1){if(xw.store1[t])return;xw.store1[t]=i,xw.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(xw.store255[t])return;xw.store255[t]=i,xw.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function _w(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 Sw(t,e,i,n,r){if(!t||!e)return t&&_w(t)||e&&_w(e)||!1;let o,s,a=!1,l=!1;if(Array.isArray(t)?o=t:"string"==typeof t?o=xw.Get(t,Cw.Color255):a=!0,Array.isArray(e)?s=e:"string"==typeof e?s=xw.Get(e,Cw.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:_w(s)})))});return a?Sw(o,l,i,n,r):Sw(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:Bw(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:Bw(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:Bw(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),_w(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)}xw.store255={},xw.store1={};const Aw=[0,0,0,0],Tw=[0,0,0,0];function Bw(t,e,i){return xw.Get(t,Cw.Color255,Aw),xw.Get(e,Cw.Color255,Tw),`rgba(${Math.round(Aw[0]+(Tw[0]-Aw[0])*i)},${Math.round(Aw[1]+(Tw[1]-Aw[1])*i)},${Math.round(Aw[2]+(Tw[2]-Aw[2])*i)},${Aw[3]+(Tw[3]-Aw[3])*i})`}class Rw{static GetImage(t,e){var i;let n=Rw.cache.get(t);n?"fail"===n.loadState?Db.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Db.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},Rw.cache.set(t,n),n.dataPromise=Db.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=Rw.cache.get(t);n?"fail"===n.loadState?Db.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Db.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},Rw.cache.set(t,n),n.dataPromise=Db.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=Rw.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"},Rw.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Db.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Db.global.loadBlob(t):"json"===e&&(i.dataPromise=Db.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}Rw.cache=new Map;const Mw=new Ve,Pw=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],Ew=["x","y"],Hw=["scaleX","scaleY"],Lw=["angle"],kw=new Fe;class Iw extends Lv{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(Iw.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 Ne,this._updateTag=bm.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=Pv(this.parent).group,{scrollX:e=t.scrollX,scrollY:r=t.scrollY}=this.parent.attribute;kw.x=i+e,kw.y=n+r}else kw.x=i,kw.y=n;return kw}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Db.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Db.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 Ve),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bm.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bm.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&bm.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&bm.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&bm.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&bm.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=bm.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===vm.GLOBAL){const i=new Fe(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.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):Lt(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.onAttributeUpdate(n)):this.normalAttrs[t]=e,"background"===t&&this.loadImage(e,!0)}needUpdateTags(t){for(let e=0;e<Pw.length;e++){const i=Pw[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Pw.length;e++)if(t===Pw[e])return!0;return!1}initAttributes(t){const e={type:wm.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background&&this.loadImage(t.background,!0),this._updateTag=bm.INIT,this.onAttributeUpdate(e)}translate(t,e){var i,n;if(0===t&&0===e)return this;const r={type:wm.TRANSLATE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Ew,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?Db.transformUtil.fromMatrix(a,a).translate(t,e):(s.x=(null!==(i=s.x)&&void 0!==i?i:hb.x)+t,s.y=(null!==(n=s.y)&&void 0!==n?n:hb.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(r),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const n={type:wm.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Ew,n);return r?(this._setAttributes(r,!1,n),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(n),this)}scale(t,e,i){var n,r;if(1===t&&1===e)return this;const o={type:wm.SCALE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,Hw,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 Ve,a.postMatrix=n),Db.transformUtil.fromMatrix(n,n).scale(t,e,i)}else a.scaleX=(null!==(n=a.scaleX)&&void 0!==n?n:hb.scaleX)*t,a.scaleY=(null!==(r=a.scaleY)&&void 0!==r?r:hb.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(o),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const n={type:wm.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Hw,n);return r?(this._setAttributes(r,!1,n),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(n),this)}rotate(t){var e;if(0===t)return this;const i={type:wm.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Lw,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:hb.angle)+t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(i),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:wm.ROTATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Lw,i);return n?(this._setAttributes(n,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new Qv(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){Db.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)&&(!!Lt(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:iw,null!==(a=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.easing)&&void 0!==a?a:nw)}else this.setAttributes(t,!1,{type:wm.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();Zt(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|=bm.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=bm.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=bm.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&bm.UPDATE_SHAPE_AND_BOUNDS)===bm.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=bm.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bm.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=bm.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=bm.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=bm.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=hb.x,y:e=hb.y,scaleX:i=hb.scaleX,scaleY:n=hb.scaleY,angle:r=hb.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=Me(s),g=He(s);let y,m;a?(y=a[0],m=a[1]):(y=i,m=n);const b=y-i,v=m-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*y+c*m-w*b-x*v,t.f=p+h*y+u*m-C*b-_*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,o&&a);const l=this.getOffsetXY(hb);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,s){const t=Mw.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Db.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:wm.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:wm.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=Sw(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=Sw(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=Sw(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 Pv(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:Db.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 Ft(t,!0)?this.pathProxy=(new sb).fromString(t):this.pathProxy=new sb,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var 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)?(Rw.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("<svg")&&(Rw.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 Fv(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)}}}function Ow(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}Iw.mixin(Nv);let Dw=0;function Fw(){return Dw++}const Ww=Fw(),zw=Fw(),jw=Fw(),Nw=Fw(),Gw=Fw(),Kw=Fw(),Uw=Fw(),Vw=Fw(),$w=Fw(),Yw=Fw(),Xw=Fw(),qw=Fw(),Zw=Fw(),Jw=Fw(),Qw=Fw(),tC=Fw(),eC=Symbol.for("GraphicService"),iC=Symbol.for("GraphicCreator");var nC;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(nC||(nC={}));let rC=class t extends Iw{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Kw,this._childUpdateTag=bm.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 Rv),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Rv)}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===vm.GLOBAL){const i=new Fe(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&bm.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Db.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Db.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=Pv(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Db.graphicService.updateGroupAABBBounds(t,Pv(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,r=aw(n);return r&&i.expand(r),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=bm.CLEAR_BOUNDS,this._childUpdateTag&=bm.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=bm.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&bm.UPDATE_BOUNDS||(this._childUpdateTag|=bm.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(),Db.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Db.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,Db.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Db.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),Db.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&bm.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=Db.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const oC=Symbol.for("LayerHandlerContribution");class sC extends rC{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=Ob.get(oC),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 Rv,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=>{Db.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Db.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var aC=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},lC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hC=function(t,e){return function(i,n){e(i,n,t)}};let cC=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 sC(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}};cC=aC([jy(),hC(0,Ky(em)),lC("design:paramtypes",[Object])],cC);var uC=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},dC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pC=function(t,e){return function(i,n){e(i,n,t)}};const fC=Symbol.for("Window"),gC=Symbol.for("WindowHandlerContribution");let yC=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 Qy(["x","y","width","height"])},this._uid=Ev.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Ob.getNamed(gC,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};uC([Yy(),dC("design:type",Function),dC("design:paramtypes",[]),dC("design:returntype",void 0)],yC.prototype,"postInit",null),yC=uC([jy(),pC(0,Ky(em)),dC("design:paramtypes",[Object])],yC);const mC=Symbol.for("TransformUtil"),bC=Symbol.for("GraphicUtil"),vC=Symbol.for("LayerService");var wC=new Oy((t=>{t(om).toSelf().inSingletonScope(),t(em).toService(om),t(yC).to(yC),t(fC).toService(yC),t(vv).toSelf().inSingletonScope(),t(bC).toService(vv),t(xv).toSelf().inSingletonScope(),t(mC).toService(xv),t(cC).toSelf().inSingletonScope(),t(vC).toService(cC)}));function CC(t){return!!t}function xC(t,e){let i;return i=Wt(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function _C(t,e){return t*e>0}function SC(t,e,i,n){return t*e>0&&i>0&&n>0}function AC(t,e){return t*e>0}function TC(t,e,i,n){return t*e>0&&i>0&&n>0}function BC(t,e,i,n,r,o,s,a){if(!t.pathProxy)return!1;const l=Pv(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,y=_C(u,d),m=AC(u,f),b=CC(h),v=xC(c,p);if(!g)return!0;if(!b&&!v)return!0;if(!(y||m||s||a))return!0;e.beginPath();return Pm(("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):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),b&&(s?s(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function RC(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<xe?[]:(d=(c*(e-o)-u*(t-r))/d,[t+d*l,e+d*h])}function MC(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,y=(d+f)/2,m=(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,R=S-y,M=A-m,P=T-y,E=B-m;return R*R+M*M>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 PC(t,e,i,n,r,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=Be(l-a),c=l>a;let u=!1;if(r<o){const t=r;r=o,o=t}if(r<=xe)e.moveTo(i,n);else if(h>=Te-xe)e.moveTo(i+r*Me(a),n+r*He(a)),e.arc(i,n,r,a,l,!c),o>xe&&(e.moveTo(i+o*Me(l),n+o*He(l)),e.arc(i,n,o,l,a,c));else{const d=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:f,outerStartAngle:g,outerEndAngle:y,innerEndAngle:m,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*Me(g),R=r*He(g),M=o*Me(m),P=o*He(m);let E,H,L,k;if((S>xe||_>xe)&&(E=r*Me(y),H=r*He(y),L=o*Me(b),k=o*He(b),h<_e)){const t=RC(B,R,L,k,E,H,M,P);if(t){const e=B-t[0],i=R-t[1],n=E-t[0],s=H-t[1],a=1/He(Ie((e*n+i*s)/(Le(e*e+i*i)*Le(n*n+s*s)))/2),l=Le(t[0]*t[0]+t[1]*t[1]);T=Ee(S,(o-l)/(a-1)),A=Ee(_,(r-l)/(a+1))}}if(p<.001)s&&(s[3]||s[1])&&e.moveTo(i+B,n+R),u=!0;else if(A>xe){const t=Ee(v,A),o=Ee(w,A),a=MC(L,k,B,R,r,t,Number(c)),l=MC(E,H,M,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,Re(a.y01,a.x01),Re(l.y01,l.x01),!c)):e.moveTo(i+a.cx+A*Me(Re(l.y01,l.x01)),n+a.cy+A*He(Re(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,Re(a.y01,a.x01),Re(a.y11,a.x11),!c),e.arc(i,n,r,Re(a.cy+a.y11,a.cx+a.x11),Re(l.cy+l.y11,l.cx+l.x11),!c),o>0&&e.arc(i+l.cx,n+l.cy,o,Re(l.y11,l.x11),Re(l.y01,l.x01),!c)):o>0?e.moveTo(i+l.cx+o*Me(Re(l.y01,l.x01)),n+l.cy+o*He(Re(l.y01,l.x01))):e.moveTo(i+E,n+r*He(y))}else s&&!s[0]||(e.moveTo(i+B,n+R),e.arc(i,n,r,g,y,!c));if(!(o>xe)||f<.001)!s||s[1]?e.lineTo(i+M,n+P):e.moveTo(i+M,n+P),u=!0;else if(T>xe){const t=Ee(x,T),r=Ee(C,T),a=MC(M,P,E,H,o,-r,Number(c)),l=MC(B,R,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=Re(l.y01,l.x01);!s||s[2]?e.arc(i+a.cx,n+a.cy,T,Re(a.y01,a.x01),t,!c):e.moveTo(i+a.cx+Me(t),n+a.cy+He(t))}else!s||s[2]?(r>0&&e.arc(i+a.cx,n+a.cy,r,Re(a.y01,a.x01),Re(a.y11,a.x11),!c),e.arc(i,n,o,Re(a.cy+a.y11,a.cx+a.x11),Re(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Re(l.y11,l.x11),Re(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Me(Re(l.y01,l.x01)),n+l.cy+t*He(Re(l.y01,l.x01))):e.moveTo(i+L,n+k)}else!s||s[1]?e.lineTo(i+M,n+P):e.moveTo(i+M,n+P),!s||s[2]?e.arc(i,n,o,m,b,c):e.moveTo(i+o*Me(b),n+o*He(b))}return s?s[3]&&e.lineTo(i+r*Me(l),n+r*Me(l)):e.closePath(),u}class EC{static GetCanvas(){try{return EC.canvas||(EC.canvas=Db.global.createCanvas({})),EC.canvas}catch(t){return null}}static GetCtx(){if(!EC.ctx){const t=EC.GetCanvas();EC.ctx=t.getContext("2d")}return EC.ctx}}class HC{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=EC.GetCanvas(),n=EC.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=HC.dataMap.get(i);return n||(n=new HC(t,e),HC.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){HC.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return HC.dataMap.get(t)}}HC.dataMap=new Map;class LC{static GetSize(t){for(let e=0;e<LC.ImageSize.length;e++)if(LC.ImageSize[e]>=t)return LC.ImageSize[e];return t}static Get(t,e,i,n,r,o,s){const a=LC.GenKey(t,e,i,n,r),l=LC.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=LC.GenKey(t,e,i,n,r);LC.cache[l]?LC.cache[l].push({width:s,height:a,pattern:o}):LC.cache[l]=[{width:s,height:a,pattern:o}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}LC.cache={},LC.ImageSize=[20,40,80,160,320,640,1280,2560];const kC=Symbol.for("ArcRenderContribution"),IC=Symbol.for("AreaRenderContribution"),OC=Symbol.for("CircleRenderContribution"),DC=Symbol.for("GroupRenderContribution"),FC=Symbol.for("ImageRenderContribution"),WC=Symbol.for("PathRenderContribution"),zC=Symbol.for("PolygonRenderContribution"),jC=Symbol.for("RectRenderContribution"),NC=Symbol.for("SymbolRenderContribution"),GC=Symbol.for("TextRenderContribution"),KC=Symbol.for("InteractiveSubRenderContribution");var UC=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},VC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$C=function(t,e){return function(i,n){e(i,n,t)}};let YC=class{constructor(t){this.arcRenderContribitions=t,this.numberType=Ww}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=Be(u-c),p=u>c;let f=!1;if(r<o){const t=r;r=o,o=t}const g=t.getParsedCornerRadius(),{outerDeltaAngle:y,innerDeltaAngle:m,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 R=T,M=B;const P=r*Me(b),E=r*He(b),H=o*Me(w),L=o*He(w);let k,I,O,D;if((B>xe||T>xe)&&(k=r*Me(v),I=r*He(v),O=o*Me(C),D=o*He(C),d<_e)){const t=RC(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/He(Ie((e*n+i*s)/(Le(e*e+i*i)*Le(n*n+s*s)))/2),l=Le(t[0]*t[0]+t[1]*t[1]);M=Ee(B,(o-l)/(a-1)),R=Ee(T,(r-l)/(a+1))}}if(R>xe){const t=Ee(x,R),o=Ee(_,R),s=MC(O,D,P,E,r,t,Number(p)),a=MC(k,I,H,L,r,o,Number(p));if(R<T&&t===o)e.moveTo(i+s.cx+s.x01,n+s.cy+s.y01),e.arc(i+s.cx,n+s.cy,R,Re(s.y01,s.x01),Re(a.y01,a.x01),!p);else{const t=u-l-.03,s=Re(a.y11,a.x11);e.arc(i,n,r,t,s,!p),o>0&&e.arc(i+a.cx,n+a.cy,o,Re(a.y11,a.x11),Re(a.y01,a.x01),!p)}}else e.moveTo(i+P,n+E);if(!(o>xe)||m<.001)e.lineTo(i+H,n+L),f=!0;else if(M>xe){const t=Ee(A,M),r=Ee(S,M),s=MC(H,L,k,I,o,-r,Number(p)),a=MC(P,E,O,D,o,-t,Number(p));if(e.lineTo(i+s.cx+s.x01,n+s.cy+s.y01),M<B&&t===r){const t=Re(a.y01,a.x01);e.arc(i+s.cx,n+s.cy,M,Re(s.y01,s.x01),t,!p)}else{r>0&&e.arc(i+s.cx,n+s.cy,r,Re(s.y01,s.x01),Re(s.y11,s.x11),!p);const t=Re(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*Me(C),n+o*He(C));return f}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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:y=l.visible,x:m=l.x,y:b=l.y}=t.attribute,v=_C(d,p),w=AC(d,g),C=CC(h),x=xC(u,f);if(!t.valid||!y)return;if(!(C||x||c))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=!1;const{isFullStroke:R,stroke:M}=(t=>{var e;let i=!0;if(Et(t,!0)){for(let n=0;n<4;n++)ow[n]=t,i&&(i=!(null!==(e=ow[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ow[e]=!!t[e],i&&(i=!!ow[e]);else ow[0]=!1,ow[1]=!1,ow[2]=!1,ow[3]=!1;return{isFullStroke:i,stroke:ow}})(u);if(C||R||c){if(e.beginPath(),PC(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===Tm.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}B=!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,m-i,b-n,l),e.fill())),x&&R&&(a?a(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,m-i,b-n,l),e.stroke()))}if(!R&&x){if(e.beginPath(),PC(t,e,i,n,_,S,M),!B){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===Tm.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}B=!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(A&&T){const{startAngle:o,endAngle:h}=t.getParsedAngle();if(Be(h-o)>=Te-xe){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),!B){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===Tm.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}B=!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+=Te;for(;i>Te;)i-=Te;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),Sw(a.color,l.color,h,!1)}(0,0,h,r);s||_C&&(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)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;const o=Pv(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);BC(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};YC=UC([jy(),$C(0,Ky(Xy)),$C(0,Ny(kC)),VC("design:paramtypes",[Object])],YC);var XC=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},qC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZC=function(t,e){return function(i,n){e(i,n,t)}};let JC=class{constructor(t){this.circleRenderContribitions=t,this.numberType=Nw}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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:y=l.strokeOpacity,opacity:m=l.opacity,lineWidth:b=l.lineWidth,visible:v=l.visible,x:w=l.x,y:C=l.y}=t.attribute,x=_C(m,g),_=AC(m,y),S=CC(h),A=xC(u,b);t.valid&&v&&(S||A||c)&&(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===Tm.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===Tm.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=Pv(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);BC(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};JC=XC([jy(),ZC(0,Ky(Xy)),ZC(0,Ny(OC)),qC("design:paramtypes",[Object])],JC);const QC=["radius","startAngle","endAngle",...Pw];let tx=class t extends Iw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Nw}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=Pv(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Db.graphicService.updateCircleAABBBounds(i,Pv(this).circle,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=aw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).circle[t]}needUpdateTags(t){for(let e=0;e<QC.length;e++){const i=QC[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<QC.length;e++)if(t===QC[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 sb;return a.arc(0,0,r,o,s),a}clone(){return new t(Object.assign({},this.attribute))}};function ex(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 ix(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function nx(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class rx{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){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,s);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===r||("middle"===r?c[1]=h[1]/-2:"bottom"===r&&(c[1]=-h[1]));const u={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(u,l,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;t=t.map((t=>t.toString()));const s=[],a=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;i<n;i++)e=Math.min(this.textMeasure.measureTextWidth(t[i],this.textOptions),o),s.push({str:this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,e,r).str,width:e});a[0]=o}else{let e,i;o=0;for(let n=0,r=t.length;n<r;n++)i=t[n],e=this.textMeasure.measureTextWidth(i,this.textOptions),o=Math.max(o,e),s.push({str:i,width:e});a[0]=o}a[1]=s.length*n;const l={xOffset:0,yOffset:0,width:a[0],height:a[1]};return this.LayoutBBox(l,e,i),this.layoutWithBBox(l,s,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 ox=["text","maxLineWidth","fontSize","fontFamily","fontWeight","ellipsis","lineHeight",...Pw];let sx=class t extends Iw{get font(){const t=Pv(this).text;return this._font||(this._font=ex(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=Pv(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=Pv(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)}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=tC,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=Pv(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=Pv(this).text,n=Db.graphicUtil.textMeasure;let r,o;const s=2,a=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:u=i.textBaseline,fontSize:d=i.fontSize,fontWeight:p=i.fontWeight,stroke:f=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+s),lineWidth:y=i.lineWidth}=a;if(!this.shouldUpdateShape()&&this.cache){r=this.cache.clipedWidth;const t=ix(c,r),e=nx(u,g,d);return this._AABBBounds.set(t,e,t+r,e+g),f&&this._AABBBounds.expand(y/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,s=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:p},l,e);o=s.str,r=s.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:p},l);o=e.str,r=e.width}this.cache.clipedText=o,this.cache.clipedWidth=r}else r=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=r;this.clearUpdateShapeTag();const m=ix(c,r),b=nx(u,g,d);return this._AABBBounds.set(m,b,m+r,b+g),f&&this._AABBBounds.expand(y/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=Pv(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}=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 f=Db.graphicUtil.textMeasure,g=new rx(r,{fontSize:a,fontWeight:l},f).GetLayoutByLines(t,o,s,h,!0===c?i.ellipsis:c||void 0,u),{bbox:y}=g;return this.cache.layoutData=g,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}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).text[t]}needUpdateTags(t){for(let e=0;e<ox.length;e++){const i=ox[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<ox.length;e++)if(t===ox[e])return!0;return!1}clone(){return new t(Object.assign({},this.attribute))}};function ax(t,e,i,n,r){return r?t.arc(i,n,e,0,Ae,!1,r):t.arc(i,n,e,0,Ae),!1}var lx=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 ax(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,o){return ax(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 hx=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 cx(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 ux=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 cx(t,e/2,i,n,r)}drawFitDir(t,e,i,n,r){return cx(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,o){return cx(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 dx(t,e,i,n){const r=2*e;return t.rect(i-e,n-e,r,r),!1}var px=new class{constructor(){this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return dx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return dx(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 fx{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 gx=new fx;var yx=new class extends fx{constructor(){super(...arguments),this.type="triangle"}};const mx=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bx=Math.sin(Ae/10)*mx,vx=-Math.cos(Ae/10)*mx;function Cx(t,e,i,n){const r=bx*e,o=vx*e;t.moveTo(i,-e+n),t.lineTo(r+i,o+n);for(let s=1;s<5;++s){const a=Ae*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 xx=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 Cx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return Cx(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 _x=Le(3);function Sx(t,e,i,n){const r=e,o=r/_x,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 Ax=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 Sx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return Sx(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 Tx(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 Bx=new class{constructor(){this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return Tx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return Tx(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 Rx(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Mx=new class{constructor(){this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Rx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return Rx(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 Px=-.5,Ex=Le(3)/2,Hx=1/Le(12);function Lx(t,e,i,n){const r=e/2,o=e*Hx,s=r,a=e*Hx+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(Px*r-Ex*o+i,Ex*r+Px*o+n),t.lineTo(Px*s-Ex*a+i,Ex*s+Px*a+n),t.lineTo(Px*l-Ex*h+i,Ex*l+Px*h+n),t.lineTo(Px*r+Ex*o+i,Px*o-Ex*r+n),t.lineTo(Px*s+Ex*a+i,Px*a-Ex*s+n),t.lineTo(Px*l+Ex*h+i,Px*h-Ex*l+n),t.closePath(),!1}var kx=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 Lx(t,e/2,i,n)}drawOffset(t,e,i,n,r){return Lx(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 Ix=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 Ox=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 Dx=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 Fx=Le(3);function Wx(t,e,i,n){const r=e*Fx;return t.moveTo(i,n+-r/3*2),t.lineTo(e+i,n+r),t.lineTo(i-e,n+r),t.closePath(),!0}var zx=new class extends fx{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Wx(t,e/2/Fx,i,n)}drawOffset(t,e,i,n,r){return Wx(t,e/2/Fx+r,i,n)}bounds(t,e){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}};function jx(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 Nx=new class{constructor(){this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.5 0.5"}draw(t,e,i,n){return jx(t,e/4,i,n)}drawOffset(t,e,i,n,r){return jx(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 Gx(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 Kx=new class{constructor(){this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5"}draw(t,e,i,n){return Gx(t,e/4,i,n)}drawOffset(t,e,i,n,r){return Gx(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 Ux(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}var Vx=new class{constructor(){this.type="rect",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return Ux(t,Nt(e)?[e,e]:e,i,n)}drawOffset(t,e,i,n,r){return Ux(t,Nt(e)?[e+2*r,e+2*r]:[e[0]+2*r,e[1]+2*r],i,n)}bounds(t,e){const i=Nt(t)?[t,t]:t;e.x1=-i[0]/2,e.x2=i[0]/2,e.y1=-i[1]/2,e.y2=i[1]/2}};class $x{constructor(t,e){this.pathStr="",this.type=t,this.path=e}drawOffset(t,e,i,n,r){return Pm(this.path.commandList,t,i,n,e+r,e+r),!1}draw(t,e,i,n){return Pm(this.path.commandList,t,i,n,e,e),!1}bounds(t,e){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 Yx={};[lx,hx,ux,px,zx,yx,xx,Ax,Bx,Mx,kx,Ix,Ox,gx,Dx,Nx,Kx,Vx].forEach((t=>{Yx[t.type]=t}));const Xx=["symbolType","size",...Pw];let qx=class t extends Iw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Qw}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return Wt(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Pv(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=Yx[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const r=(new sb).fromString(i),o=r.bounds.width(),s=r.bounds.height(),a=1/Pe(o,s);return r.transform(0,0,a,a),this._parsedPath=new $x(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Pv(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Db.graphicService.updateSymbolAABBBounds(i,Pv(this).symbol,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=aw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).symbol[t]}needUpdateTags(t){for(let e=0;e<Xx.length;e++){const i=Xx[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Xx.length;e++)if(t===Xx[e])return!0;return!1}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=Wt(e)?e:[e,e];return t.path?(new sb).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new sb).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}};qx.userSymbolMap={};const Zx=["segments","points","curveType",...Pw];let Jx=class t extends Iw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Vw}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=dw(i,n,e))}doUpdateAABBBounds(){const t=Pv(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateLineAABBBounds(e,Pv(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).line[t]}needUpdateTags(t){for(let e=0;e<Zx.length;e++){const i=Zx[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Zx.length;e++)if(t===Zx[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=new sb,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 Qx=["width","height","cornerRadius",...Pw];let t_=class t extends Iw{constructor(t){super(t),this.type="rect",this.numberType=qw}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=Pv(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateRectAABBBounds(e,Pv(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).rect[t]}needUpdateTags(t){for(let e=0;e<Qx.length;e++){const i=Qx[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<Qx.length;e++)if(t===Qx[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new sb;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new t(Object.assign({},this.attribute))}};const e_=[[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 i_ extends t_{constructor(t){super(t),this.type="rect3d",this.numberType=Zw}findFace(){const t={polygons:[],vertices:[],edges:[]},e=Pv(this).rect3d,{width:i=e.width,height:n=e.width,length:r=Ee(e.width,e.height)}=this.attribute;for(let e=0;e<e_.length;e++){const o=e_[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}}const n_={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"}},r_=!0,o_=!1,s_=/\w|\(|\)/,a_=/[.?!,;:/,。?!、;:]/,l_=/\S/;function h_(t,e,i,n,r){if(!e||e<=0)return 0;const o=Db.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=function(t,e){let i=e;for(;s_.test(t[i-1])&&s_.test(t[i])||a_.test(t[i]);)if(i--,i<=0)return e;return i}(t,s)),s}function c_(t,e){const i=Db.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class u_{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=n_[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 d_{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}=c_(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}=c_(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=h_(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}=c_(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||o_;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||r_;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=h_(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=c_(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const p_=["width","height","image",...Pw];let f_=class t extends Iw{constructor(t){super(t),this.type="image",this.numberType=Uw,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=Pv(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateImageAABBBounds(e,Pv(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Mb[t]}needUpdateTags(t){for(let e=0;e<p_.length;e++){const i=p_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<p_.length;e++)if(t===p_[e])return!0;return!1}clone(){return new t(Object.assign({},this.attribute))}};class g_ extends f_{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=aw(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(Wt(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=aw(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=Mb.width,height:e=Mb.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 y_{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=n_[this.direction]}store(t){if(t instanceof g_){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 g_?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=s,this.directionKey=n_[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof d_){const e=l_.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 g_?(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 g_)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=c_("...",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 g_)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 g_)break;const{width:n}=c_("...",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 g_?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 g_?"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=h_(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 d_(i,t.newLine,t.character),new d_(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const m_=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Pw];class b_ extends Iw{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Jw}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rb.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:Rb.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:Rb.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:Rb.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:Rb.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:Rb.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:Rb.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:Rb.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Pv(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateRichTextAABBBounds(e,Pv(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rb[t]}needUpdateTags(t){for(let e=0;e<m_.length;e++){const i=m_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<m_.length;e++)if(t===m_[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 g_(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 d_(i[n],0!==n,e[t]))}else p.push(new d_(e[t].text,!1,e[t]));const f=new u_(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 y_(f);for(let t=0;t<p.length;t++)g.deal(p[t]);g.send(),this._frameCache=f}clone(){return new b_(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 v_=["path","customPath",...Pw];class w_ extends Iw{constructor(t){super(t),this.type="path",this.numberType=$w}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=Pv(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof sb?e.path:(Lt(this.cache)&&this.doUpdatePathShape(),this.cache instanceof sb?this.cache:t.path)}doUpdateAABBBounds(){const t=Pv(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updatePathAABBBounds(e,Pv(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;Ft(t.path,!0)?this.cache=(new sb).fromString(t.path):t.customPath&&(this.cache=new sb,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pv(this).path[t]}needUpdateTags(t){for(let e=0;e<v_.length;e++){const i=v_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<v_.length;e++)if(t===v_[e])return!0;return!1}toCustomPath(){return(new sb).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new w_(Object.assign({},this.attribute))}}const C_=["segments","points","curveType",...Pw];class x_ extends Iw{constructor(t){super(t),this.type="area",this.numberType=jw}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=Pv(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updateAreaAABBBounds(e,Pv(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){"points"===t&&(r.points=dw(i,n,e))}getDefaultAttribute(t){return Pv(this).area[t]}needUpdateTags(t){for(let e=0;e<C_.length;e++){const i=C_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<C_.length;e++)if(t===C_[e])return!0;return!1}toCustomPath(){const t=new sb,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 x_(Object.assign({},this.attribute))}}const __=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Pw];class S_ extends Iw{constructor(t){super(t),this.type="arc",this.numberType=Ww}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=Pv(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(Nt(e,!0)?e:r*parseFloat(e)/100,r/2)}getParsedAngle(){const t=Pv(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=Ke(e),i=e+o,n&&Be(o)<Te-xe){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>xe&&a>xe)return{startAngle:e-r*c*o,endAngle:i+r*c*s}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Pv(this).arc,{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius,padAngle:o=i.padAngle}=this.attribute,{padRadius:s=Le(n*n+r*r)}=this.attribute,a=Be(e-t);let l=t,h=e,c=t,u=e;const d=o/2;let p=a,f=a;if(d>xe&&s>xe){const i=e>t?1:-1;let o=Oe(Number(s)/r*He(d)),a=Oe(Number(s)/n*He(d));return(p-=2*o)>xe?(o*=i,c+=o,u-=o):(p=0,c=u=(t+e)/2),(f-=2*a)>xe?(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=Pv(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Db.graphicService.updateArcAABBBounds(i,Pv(this).arc,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,o=aw(r);return o&&n.expand(o),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;e<__.length;e++){const i=__[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<__.length;e++)if(t===__[e])return!0;return!1}getDefaultAttribute(t){return Pv(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius,r=t.outerRadius;const o=Be(i-e),s=i>e;if(r<n){const t=r;r=n,n=t}const a=new sb;if(r<=xe)a.moveTo(0,0);else if(o>=Te-xe)a.moveTo(0+r*Me(e),0+r*He(e)),a.arc(0,0,r,e,i,!s),n>xe&&(a.moveTo(0+n*Me(i),0+n*He(i)),a.arc(0,0,n,i,e,s));else{const t=r*Me(e),o=r*He(e),l=n*Me(i),h=n*He(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 S_(Object.assign({},this.attribute))}}const A_=["points","cornerRadius",...Pw];class T_ extends Iw{constructor(t){super(t),this.type="polygon",this.numberType=Yw}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Pv(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Db.graphicService.updatePolygonAABBBounds(e,Pv(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=aw(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){"points"===t&&(r.points=dw(i,n,e))}getDefaultAttribute(t){return Pv(this).polygon[t]}needUpdateTags(t){for(let e=0;e<A_.length;e++){const i=A_[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<A_.length;e++)if(t===A_[e])return!0;return!1}toCustomPath(){const t=this.attribute.points,e=new sb;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 T_(Object.assign({},this.attribute))}}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};let R_=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}};R_=B_([jy()],R_);var M_=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 P_=Symbol.for("RectBoundsContribution");let E_=class extends R_{};E_=M_([jy()],E_);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};const L_=Symbol.for("SymbolBoundsContribution");let k_=class extends R_{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;Ow(i,n+o+a/2,!0,s)}return i}};k_=H_([jy()],k_);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};const O_=Symbol.for("CircleBoundsContribution");let D_=class extends R_{};D_=I_([jy()],D_);var F_=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 W_=Symbol.for("ArcBoundsContribution");let z_=class extends R_{};z_=F_([jy()],z_);var j_=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 N_=Symbol.for("PathBoundsContribution");let G_=class extends R_{};G_=j_([jy()],G_);class K_{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 K_.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 U_=new class{constructor(){this.pools=[]}allocate(t,e,i,n,r,o){if(!this.pools.length)return new Ve(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 Ve(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=[]}},V_=new K_;var $_=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},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},X_=function(t,e){return function(i,n){e(i,n,t)}};function q_(t,e,i){const n=i[0],r=i[1],o=i[2];let s,a,l,h,c,u,d,p,f,g,y,m;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],y=e[10],m=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]=y,t[11]=m,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+y*o+e[14],t[15]=h*n+p*r+m*o+e[15]),t}function Z_(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 J_(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],y=e[13],m=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*y,t[2]=v*o+w*h+C*p+x*m,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*y,t[6]=v*o+w*h+C*p+x*m,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*y,t[10]=v*o+w*h+C*p+x*m,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*y,t[14]=v*o+w*h+C*p+x*m,t[15]=v*s+w*c+C*f+x*b,t}function Q_(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:y=e.attribute.anchor,anchor:m}=e.attribute,b=[0,0,0];if(y){if("string"==typeof y[0]){const t=parseFloat(y[0])/100,i=e.AABBBounds;b[0]=i.x1+(i.x2-i.x1)*t}else b[0]=y[0];if("string"==typeof y[1]){const t=parseFloat(y[1])/100,i=e.AABBBounds;b[1]=i.x1+(i.x2-i.x1)*t}else b[1]=y[1];b[2]=null!==(n=y[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),q_(t,t,[r+a,o+l,s+h]),q_(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),q_(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=V_.allocate(),n=[0,0];if(m){if("string"==typeof y[0]){const t=parseFloat(y[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=y[0];if("string"==typeof y[1]){const t=parseFloat(y[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=y[1]}q_(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),q_(i,i,[-n[0],-n[1],0]),J_(t,t,i)}}let tS=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 Qy(["graphic"]),onSetStage:new Qy(["graphic","stage"]),onRemove:new Qy(["graphic"]),onAddIncremental:new Qy(["graphic","group","stage"]),onClearIncremental:new Qy(["graphic","group","stage"]),beforeUpdateAABBBounds:new Qy(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Qy(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}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 am(t);return Pm(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;return o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),ze(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>Te-xe?i.set(-s,-s,s,s):cw(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){const{outerRadius:r=e.outerRadius,innerRadius:o=e.innerRadius}=t;let{endAngle:s=e.endAngle,startAngle:a=e.startAngle}=t;if(a>s){const t=a;a=s,s=t}return r<=xe?i.set(0,0,0,0):Math.abs(s-a)>Te-xe?i.set(-r,-r,r,r):(cw(a,s,r,i),cw(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(Wt(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){Ow(u,h/Math.abs(o+s),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(l){Ow(u,l/Math.abs(o+s),n,c),e.union(u)}this.combindShadowAABBBounds(e,r),ze(e,e,r.transMatrix)}};tS=$_([jy(),X_(0,Ky(iC)),X_(1,Ky(Xy)),X_(1,Ny(P_)),X_(2,Ky(Xy)),X_(2,Ny(L_)),X_(3,Ky(Xy)),X_(3,Ny(O_)),X_(4,Ky(Xy)),X_(4,Ny(W_)),X_(5,Ky(Xy)),X_(5,Ny(N_)),Y_("design:paramtypes",[Object,Object,Object,Object,Object,Object])],tS);class eS extends rC{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const iS=["heightLimit","lineClamp"];let nS=class extends sx{_isValid(){const{text:t}=this.attribute;return Wt(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=Pv(this).text,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:o=i.textBaseline,fontSize:s=i.fontSize,lineHeight:a=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:u=i.lineWidth,heightLimit:d=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}const f=Db.graphicUtil.textMeasure,g=new rx(n,{fontSize:s},f),y=t.map((t=>t.toString())),m=[],b=[0,0];let v=1/0;if(d>0&&(v=Math.max(Math.floor(d/a),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t<y.length;t++){const e=y[t];if(t===v-1){const t=g.textMeasure.clipTextWithSuffix(e,g.textOptions,h,l);m.push({str:t.str,width:t.width});break}const i=g.textMeasure.clipText(e,g.textOptions,h);if(m.push({str:i.str,width:i.width}),i.str.length===e.length);else{const n=e.substring(i.str.length);y.splice(t+1,0,n)}}let t=0;m.forEach((e=>{t=Math.max(t,e.width)})),b[0]=t}else{let t,e,i=0;for(let n=0,r=y.length;n<r;n++){if(n===v-1){const t=g.textMeasure.clipTextWithSuffix(y[n],g.textOptions,h,l);m.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=y[n],t=g.textMeasure.measureTextWidth(e,g.textOptions),i=Math.max(i,t),m.push({str:e,width:t})}b[0]=i}b[1]=m.length*(a+2);const w={xOffset:0,yOffset:0,width:b[0],height:b[1]};g.LayoutBBox(w,r,o);const C=g.layoutWithBBox(w,m,r,o,a);return this.cache.layoutData=C,this.clearUpdateShapeTag(),this._AABBBounds.set(w.xOffset,w.yOffset,w.xOffset+w.width,w.yOffset+w.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<iS.length;e++){const i=iS[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<iS.length;e++)if(t===iS[e])return!0;return super.needUpdateTag(t)}};function rS(t){return new S_(t)}function oS(t){return new tx(t)}function sS(t){return new rC(t)}function aS(t){return new Jx(t)}function lS(t){return new w_(t)}function hS(t){return new t_(t)}function cS(t){return new sx(t)}function uS(t){return new qx(t)}function dS(t){return new f_(t)}function pS(t){return new b_(t)}const fS={arc:rS,area:function(t){return new x_(t)},circle:oS,group:sS,image:dS,line:aS,path:lS,rect:hS,rect3d:function(t){return new i_(t)},symbol:uS,text:cS,richtext:pS,polygon:function(t){return new T_(t)},shadowRoot:function(t){return new eS(t)},wrapText:function(t){return new nS(t)}},gS=cS({text:""});function yS(t){return gS.setAttributes(t),gS.AABBBounds}pS({});var mS=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 bS=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},y=f&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(y){const n=V_.allocate(),r=V_.allocate();Q_(r,t,e),J_(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),V_.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(y)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,y=-(c.x*l.y+h.x*(a.y-l.y)-u.x*a.y+(u.x-c.x)*s.y)*d,m=(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,y,m,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 vS(t,e,i,n,r){const{offsetX:o=0,offsetY:s=0,offsetZ:a=0}=r||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+o,e.p0.y+s,a),wS(t,e,1,r),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=Sm.ROW:"y"===n?c=Sm.COLUMN:"auto"===n&&(c=e.direction);const u=i*e.tryUpdateLength(c);let d=0;for(let e=0,i=h.length;e<i;e++){const i=h[e],n=i.getLength(c),p=(u-d)/n;if(d+=n,p<0)break;i.defined?(l&&t.moveTo(i.p0.x+o,i.p0.y+s,a),wS(t,i,Ee(p,1),r),l=!1):l=!0}}function wS(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]=Im(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)}}bS=mS([jy()],bS);var CS=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 xS=class extends bS{constructor(){super(...arguments),this.numberType=Vw}draw(t,e,i,n){const{context:r}=i;r.highPerformanceSave();const o=Pv(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,BC(t,r,a,l)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&V_.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;t.beginPath();const y=null!==(g=this.z)&&void 0!==g?g:0;vS(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:y}),d.cache&&!Wt(d.cache)&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(d,s,a);const{x:m=0,x:b=0}=s;return!1!==i&&(p?p(t,s,a):r&&(t.setCommonStyle(d,s,m-c,b-u,a),t.fill())),!1!==n&&(f?f(t,s,a):o&&(t.setStrokeStyle(d,s,m-c,b-u,a),t.stroke())),!1}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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,y=_C(u,d),m=AC(u,p),b=CC(h),v=xC(c,f);if(!t.valid||!g)return;if(!b&&!v)return;if(!(y||m||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=ob(t.points,n,{startPoint:e}),r)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=ob(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 y=r.getLength(),m=(o-u)/y;u+=y,m>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,p,t.attribute.segments[g],[l,t.attribute],Ee(m,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 _S(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),SS(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),SS(t,l,1,n),a=!1):a=!0}t.closePath()}function SS(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]=Im(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)}}xS=CS([jy()],xS);var AS=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},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BS=function(t,e){return function(i,n){e(i,n,t)}};function RS(t,e,i){switch(e){case"linear":default:return Gm(t,i);case"basis":return Vm(t,i);case"monotoneX":return Qm(t,i);case"monotoneY":return tb(t,i);case"step":return ib(t,.5,i);case"stepBefore":return ib(t,0,i);case"stepAfter":return ib(t,1,i);case"linearClosed":return rb(t,i)}}let MS=class{constructor(t){this.areaRenderContribitions=t,this.numberType=jw}drawShape(t,e,i,n,r,o,s,a){var l,h,c,u,d,p;const f=Pv(t,null==o?void 0:o.theme).area,{fill:g=f.fill,fillOpacity:y=f.fillOpacity,opacity:m=f.opacity,visible:b=f.visible,z:v=f.z,stroke:w=t.attribute.stroke,lineWidth:C=f.lineWidth,strokeOpacity:x=f.strokeOpacity}=t.attribute,_=_C(m,y),S=CC(g),A=xC(w,C),T=AC(m,x);if(!t.valid||!b)return;if(!S&&!A)return;if(!(_||s||T||a))return;const{clipRange:B=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=RS(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=RS(r,n),a.unshift(s)}t.cacheArea=a.map(((t,e)=>({top:o[e],bottom:t})))}else{if(!e||!e.length)return t.cache=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=RS(i,n),s=RS(r,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:o,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===B){let o=!1;t.cacheArea.forEach(((l,h)=>{o||(o=this.drawSegmentItem(e,l,S,y,A,x,t.attribute.segments[h],[f,t.attribute],B,i,n,v,t,r,s,a))}))}else{const o=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=B*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,S,y,A,x,t.attribute.segments[u],[f,t.attribute],Ee(p,1),i,n,v,t,r,s,a))}))}else this.drawSegmentItem(e,t.cacheArea,S,y,A,x,t.attribute,f,B,i,n,v,t,r,s,a)}draw(t,e,i,n){const{context:r}=i,o=Pv(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);BC(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){t.beginPath(),function(t,e,i,n){var r;const{top:o,bottom:s}=e;if(i>=1){const e=[],i=[];let r=!0;for(let a=0,l=o.curves.length;a<l;a++){const h=o.curves[a];r!==h.defined?(r?(_S(t,e,i,n),e.length=0,i.length=0):(e.push(h),i.push(s.curves[l-a-1])),r=!r):r&&(e.push(h),i.push(s.curves[l-a-1]))}return void _S(t,e,i,n)}if(i<=0)return;let{direction:a}=n||{};const{curves:l}=o,h=null!==(r=l[l.length-1].p3)&&void 0!==r?r:l[l.length-1].p1,c=Be(h.x-l[0].p0.x),u=Be(h.y-l[0].p0.y);a=null!=a?a:c>u?Sm.ROW:Sm.COLUMN,Number.isFinite(c)||(a=Sm.COLUMN),Number.isFinite(u)||(a=Sm.ROW);const d=i*(a===Sm.ROW?c:u);let p=0,f=!0;const g=[],y=[];for(let e=0,i=o.curves.length;e<i;e++){const r=o.curves[e],l=r.getLength(a),h=(d-p)/l;if(h<0)break;p+=l;let c=null,u=null;f!==r.defined?(f?(_S(t,g,y,n),g.length=0,y.length=0):(c=r,u=s.curves[i-e-1]),f=!f):f&&(c=r,u=s.curves[i-e-1]),c&&u&&(h<1&&(c=c.p2&&c.p3?Im(c,h)[0]:Dm(c,h)[0],u=u.p2&&u.p3?Im(u,1-h)[1]:Dm(u,1-h)[1]),c.defined=f,u.defined=f,g.push(c),y.push(u)),c=null,u=null}_S(t,g,y,n)}(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:c,offsetZ:u}),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[],this._areaRenderContribitions.sort(((t,e)=>e.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===Tm.beforeFillStroke&&e.drawShape(d,t,h,c,!!n,!1,i,!1,a,p,f,null,{attribute:s})})),t.setShadowStyle&&t.setShadowStyle(d,s,a);const{x:y=0,x:m=0}=s;if(!1!==i&&(f?f(t,s,a):n&&(t.setCommonStyle(d,s,y-h,m-c,a),t.fill())),!1!==r)if(g)g(t,s,a);else{const{stroke:i}=s;Wt(i)&&i[0]&&!1===i[1]&&(t.beginPath(),vS(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,s,y-h,m-c,a),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===Tm.afterFillStroke&&e.drawShape(d,t,h,c,!!n,!1,i,!1,a,p,f,null,{attribute:s})})),!1}};MS=AS([jy(),BS(0,Ky(Xy)),BS(0,Ny(IC)),TS("design:paramtypes",[Object])],MS);var PS=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},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,n){e(i,n,t)}};let LS=class extends bS{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=$w}drawShape(t,e,i,n,r,o,s,a){var l,h;const c=Pv(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:y,lineWidth:m=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=_C(g,p),_=AC(g,f),S=CC(u),A=xC(d,m);if(t.valid&&b&&(S||A||y)&&(x||_||s||a||y)){if(e.beginPath(),t.pathShape)Pm(t.pathShape.commandList,e,i,n,1,1,C);else{Pm((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===Tm.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===Tm.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=Pv(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,BC(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&V_.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}};LS=PS([jy(),HS(0,Ky(Xy)),HS(0,Ny(WC)),ES("design:paramtypes",[Object])],LS);const kS=_e/2;function IS(t,e,i,n,r,o){let s;if(Nt(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]],y=[l[0],l[1]+d[1]],m=[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]),!le(g,y)){const e=g[0],i=g[1]+d[1];t.arc(e,i,d[1],-kS,0,!1)}if(t.lineTo(b[0],b[1]),!le(m,b)){const e=b[0]-d[2],i=b[1];t.arc(e,i,d[2],0,kS,!1)}if(t.lineTo(v[0],v[1]),!le(v,w)){const e=v[0],i=v[1]-d[3];t.arc(e,i,d[3],kS,_e,!1)}if(t.lineTo(f[0],f[1]),!le(p,f)){const e=p[0],i=p[1]+d[0];t.arc(e,i,d[0],_e,_e+kS,!1)}return t.closePath(),t}var OS=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},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,n){e(i,n,t)}};let WS=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=qw}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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:y=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:b=l.strokeOpacity,visible:v=l.visible,x:w=l.x,y:C=l.y}=t.attribute,x=SC(g,y,d,p),_=TC(g,b,d,p),S=CC(h),A=xC(u,m);if(!t.valid||!v)return;if(!(S||A||c))return;if(!(x||_||s||a||c))return;0===f||Wt(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(i,n,d,p)):(e.beginPath(),IS(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===Tm.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===Tm.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=Pv(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);BC(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};WS=OS([jy(),FS(0,Ky(Xy)),FS(0,Ny(jC)),DS("design:paramtypes",[Object])],WS);var zS=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},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NS=function(t,e){return function(i,n){e(i,n,t)}};let GS=class extends bS{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Qw}drawShape(t,e,i,n,r,o,s,a){var l;const h=Pv(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:y=h.lineWidth,stroke:m=h.stroke,visible:b=h.visible,x:v=h.x,y:w=h.y,scaleX:C=h.scaleX,scaleY:x=h.scaleY}=t.attribute,_=_C(g,p),S=AC(g,f),A=CC(u),T=xC(m,y);if(!t.valid||!b)return;if(!(A||T||d))return;if(!(_||S||s||a||d))return;const B=t.getParsedPath();if(!B)return;const{keepDirIn3d:R=h.keepDirIn3d}=t.attribute,M=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),R&&e.camera&&e.project){const t=e.project(i,n,M),r=e.camera;e.camera=null,!1===B.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=r}else!1===B.draw(e,c,i,n,M)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((o=>{o.time===Tm.beforeFillStroke&&o.drawShape(t,e,i,n,A,T,_,S,h,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),A&&(s?s(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,v-i,w-n,h),e.fill())),T&&(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===Tm.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=Pv(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,BC(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&V_.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}};GS=zS([jy(),NS(0,Ky(Xy)),NS(0,Ny(NC)),jS("design:paramtypes",[Object])],GS);var KS=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},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VS=function(t,e){return function(i,n){e(i,n,t)}};let $S=class extends bS{constructor(t){super(),this.textRenderContribitions=t,this.numberType=tC}drawShape(t,e,i,n,r,o,s,a){var l;const h=Pv(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:y=h.lineWidth,visible:m=h.visible,underline:b=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:w=h.keepDirIn3d,fontSize:C=h.fontSize,textBaseline:x=h.textBaseline,x:_=h.x,y:S=h.y}=t.attribute,A=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:C,T=_C(g,p),B=AC(g,f),R=CC(u),M=xC(d,y);if(!t.valid||!m)return;if(!(R||M||T||B))return;const P=!w,E=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===Tm.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,R,M,T,B,h,r,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,E,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,E);const{multilineLayout:r}=t;if(!r)return void e.highPerformanceRestore();const{xOffset:o,yOffset:l}=r.bbox;M&&(a?a(e,t.attribute,h):B&&(e.setStrokeStyle(t,t.attribute,_-i,S-n,h),r.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+o+i,(t.topOffset||0)+l+n,E)})))),R&&(s?s(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,_-i,S-n,h),r.lines.forEach((r=>{e.fillText(r.str,(r.leftOffset||0)+o+i,(r.topOffset||0)+l+n,E),this.drawMultiUnderLine(b,v,t,(r.leftOffset||0)+i,(r.topOffset||0)+l+n,E,r.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,E);const r=t.clipedText;let o=0;A!==C&&("top"===x?o=(A-C)/2:"middle"===x||"bottom"===x&&(o=-(A-C)/2)),M&&(a?a(e,t.attribute,h):B&&(e.setStrokeStyle(t,t.attribute,_-i,S-n,h),e.strokeText(r,i,n+o,E))),R&&(s?s(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,_-i,S-n,h),e.fillText(r,i,n+o,E),this.drawUnderLine(b,v,t,i,n+o,E,h,e)))}P&&this.restoreTransformUseContext2d(t,h,E,e),this._textAfterRenderContribitions.forEach((o=>{o.drawShape(t,e,i,n,R,M,T,B,h,r,s,a)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;r.highPerformanceSave();const o=Pv(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=ix(l,f),y=nx(h,c,c),m={lineWidth:0,stroke:u,opacity:d,strokeOpacity:p};if(t){m.lineWidth=t,a.setStrokeStyle(i,m,n,r,s),a.beginPath();const e=r+y+c;a.moveTo(n+g,e,o),a.lineTo(n+g+f,e,o),a.stroke()}if(e){m.lineWidth=e,a.setStrokeStyle(i,m,n,r,s),a.beginPath();const t=r+y+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=ix(h,s),g=nx("alphabetic",c,c),y={lineWidth:0,stroke:u,opacity:d,strokeOpacity:p};let m=-3;if(t){y.lineWidth=t,l.setStrokeStyle(i,y,n,r,a),l.beginPath();const e=r+g+c+m;l.moveTo(n+f,e,o),l.lineTo(n+f+s,e,o),l.stroke()}if(m=-1,e){y.lineWidth=e,l.setStrokeStyle(i,y,n,r,a),l.beginPath();const t=r+g+c/2+m;l.moveTo(n+f,t,o),l.lineTo(n+f+s,t,o),l.stroke()}}};$S=KS([jy(),VS(0,Ky(Xy)),VS(0,Ny(GC)),US("design:paramtypes",[Object])],$S);var YS=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 XS=class{};function qS(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 ZS(t,e){return Math.sqrt(t*t+e*e)}function JS(t,e,i,n,r){const o=e/i;return{x:t.x-n*o,y:t.y-r*o}}XS=YS([jy()],XS);var QS=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},tA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eA=function(t,e){return function(i,n){e(i,n,t)}};let iA=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=Yw}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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:y=l.lineWidth,opacity:m=l.opacity,visible:b=l.visible,x:v=l.x,y:w=l.y}=t.attribute,C=_C(m,p),x=AC(m,g),_=CC(c),S=xC(u,y);t.valid&&b&&(_||S||f)&&(C||x||s||a||f)&&(e.beginPath(),d<=0||Wt(d)&&d.every((t=>0===t))?qS(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,r){var o;if(e.length<3)qS(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 y=Array.isArray(r)?null!==(o=r[(s+1)%e.length])&&void 0!==o?o:0:r,m=y/g;const b=ZS(c,u),v=ZS(d,p),w=Math.min(b,v);m>w&&(m=w,y=w*g);const C=JS(l,m,b,c,u),x=JS(l,m,v,d,p),_=2*l.x-C.x-x.x,S=2*l.y-C.y-x.y,A=ZS(_,S),T=JS(l,ZS(m,y),A,_,S);let B=Math.atan2(C.y-T.y,C.x-T.x);const R=Math.atan2(x.y-T.y,x.x-T.x);let M=R-B;M<0&&(B=R,M=-M),M>Math.PI&&(M-=Math.PI),0===s?t.moveTo(C.x+i,C.y+n):t.lineTo(C.x+i,C.y+n),M&&t.arcTo(l.x+i,l.y+n,x.x+i,x.y+n,y),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===Tm.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===Tm.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=Pv(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);BC(t,r,s,a,0,n)||this.drawShape(t,r,s,a,i,n),r.highPerformanceRestore()}};iA=QS([jy(),eA(0,Ky(Xy)),eA(0,Ny(zC)),tA("design:paramtypes",[Object])],iA);var nA=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},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,n){e(i,n,t)}};const sA=["","repeat-x","repeat-y","repeat"];let aA=class{constructor(t){this.imageRenderContribitions=t,this.numberType=Uw}drawShape(t,e,i,n,r,o,s){const a=Pv(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,image:y}=t.attribute,m=_C(u,d),b=CC(l);if(t.valid&&p&&b&&(m||s)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((o=>{o.time===Tm.beforeFillStroke&&o.drawShape(t,e,i,n,b,!1,m,!1,a,r,s)})),e.setShadowStyle&&e.setShadowStyle(t,a),b)if(s)s(e,t.attribute,a);else if(m){if(!y||!t.resources)return;const r=t.resources.get(y);if("success"!==r.state)return;e.setCommonStyle(t,t.attribute,i,n,a);let o=0;if("repeat"===f&&(o|=1),"repeat"===g&&(o|=2),o){const t=e.createPattern(r.data,sA[o]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(r.data,i,n,h,c)}this._imageRenderContribitions.forEach((o=>{o.time===Tm.afterFillStroke&&o.drawShape(t,e,i,n,b,!1,m,!1,a,r,s)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const r=Pv(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()}}};aA=nA([jy(),oA(0,Ky(Xy)),oA(0,Ny(FC)),rA("design:paramtypes",[Object])],aA);const lA=Symbol.for("IncrementalDrawContribution"),hA=Symbol.for("ArcRender"),cA=Symbol.for("Arc3dRender"),uA=Symbol.for("AreaRender"),dA=Symbol.for("CircleRender"),pA=Symbol.for("GraphicRender"),fA=Symbol.for("GroupRender"),gA=Symbol.for("LineRender"),yA=Symbol.for("PathRender"),mA=Symbol.for("PolygonRender"),bA=Symbol.for("RectRender"),vA=Symbol.for("Rect3DRender"),wA=Symbol.for("SymbolRender"),CA=Symbol.for("TextRender"),xA=Symbol.for("RichTextRender"),_A=Symbol.for("Pyramid3dRender"),SA=Symbol.for("GlyphRender"),AA=Symbol.for("ImageRender"),TA=Symbol.for("RenderSelector"),BA=Symbol.for("DrawContribution");function RA(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 MA(t,e,i,n,r){if(!e||!0===e)return"black";let o,s;if(Wt(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 y=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=>{y.addColorStop(t.offset,t.color)})),y}(t,s,i,n,r)),o||"orange")}const PA=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return zb(Object.assign({nativeCanvas:Db.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 zb(Object.assign({nativeCanvas:Db.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 EA=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},HA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,n){e(i,n,t)}};let kA=class{constructor(){this.time=Tm.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=Pv(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()}};kA=EA([jy()],kA);let IA=class{constructor(t){this.subRenderContribitions=t,this.time=Tm.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)}))}};IA=EA([jy(),LA(0,Ky(Xy)),LA(0,Ny(KC)),HA("design:paramtypes",[Object])],IA);let OA=class{constructor(){this.time=Tm.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const o=(t-2*e)/2,s=PA.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 PA.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,Te),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:y=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(g,y,f,e);break;case"diamond":m=this.createDiamondPattern(g,y,f,e);break;case"rect":m=this.createRectPattern(g,y,f,e);break;case"vertical-line":m=this.createVerticalLinePattern(g,y,f,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(g,y,f,e);break;case"bias-lr":m=this.createBiasLRLinePattern(g,y,f,e);break;case"bias-rl":m=this.createBiasRLLinePattern(g,y,f,e);break;case"grid":m=this.createGridPattern(g,y,f,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};OA=EA([jy()],OA);var DA=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 FA=class{constructor(){this.time=Tm.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{innerRadius:d=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:f=l.startAngle,endAngle:g=l.endAngle,opacity:y=l.opacity,outerBorder:m,innerBorder:b}=t.attribute;if(m){const{distance:r=l.outerBorder.distance}=m,o=RA(e,r,e.dpr),s=r/p;if(t.setAttributes({outerRadius:p+o,innerRadius:d-o,startAngle:f-s,endAngle:g+s}),e.beginPath(),PC(t,e,i,n,p+o,d-o),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,m,l.outerBorder);else if(a){const r=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(b){const{distance:r=l.innerBorder.distance}=b,o=RA(e,r,e.dpr),s=r/p;if(t.setAttributes({outerRadius:p-o,innerRadius:d+o,startAngle:f+s,endAngle:g-s}),e.beginPath(),PC(t,e,i,n,p-o,d+o),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,b,l.innerBorder);else if(a){const r=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,b,i,n,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:d,startAngle:f,endAngle:g})}};FA=DA([jy()],FA);let WA=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};WA=DA([jy()],WA);let zA=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}};zA=DA([jy()],zA);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};let NA=class{constructor(){this.time=Tm.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{radius:d=l.radius,startAngle:p=l.startAngle,endAngle:f=l.endAngle,opacity:g=l.opacity,outerBorder:y,innerBorder:m}=t.attribute;if(y){const{distance:r=l.outerBorder.distance}=y,o=RA(e,r,e.dpr);if(e.beginPath(),e.arc(i,n,d+o,p,f),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,y,l.outerBorder);else if(a){const r=l.outerBorder.opacity;l.outerBorder.opacity=g,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(m){const{distance:r=l.innerBorder.distance}=m,o=RA(e,r,e.dpr);if(e.beginPath(),e.arc(i,n,d-o,p,f),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,m,l.innerBorder);else if(a){const r=l.innerBorder.opacity;l.innerBorder.opacity=g,e.setStrokeStyle(t,m,i,n,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}};NA=jA([jy()],NA);let GA=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};GA=jA([jy()],GA);let KA=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}};KA=jA([jy()],KA);var UA=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 VA=class extends kA{constructor(){super(...arguments),this.time=Tm.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()}};VA=UA([jy()],VA);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};let YA=class extends kA{constructor(){super(...arguments),this.time=Tm.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=Pv(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{e.beginPath();const r=t.AABBBounds;e.rect(i,n,r.width(),r.height()),e.fillStyle=d,e.globalAlpha=1,e.fill()}}};YA=$A([jy()],YA);var XA=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 qA=class{constructor(){this.time=Tm.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,cornerRadius:f=l.cornerRadius,opacity:g=l.opacity,outerBorder:y,innerBorder:m}=t.attribute;if(y){const{distance:r=l.outerBorder.distance}=y,o=RA(e,r,e.dpr),s=i-o,h=n-o,c=2*o;if(0===f||Wt(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(s,h,d+c,p+c)):(e.beginPath(),IS(e,s,h,d+c,p+c,f)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,y,l.outerBorder);else if(a){const r=l.outerBorder.opacity;l.outerBorder.opacity=g,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(m){const{distance:r=l.innerBorder.distance}=m,o=RA(e,r,e.dpr),s=i+o,h=n+o,c=2*o;if(0===f||Wt(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(s,h,d-c,p-c)):(e.beginPath(),IS(e,s,h,d-c,p-c,f)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,m,l.innerBorder);else if(a){const r=l.innerBorder.opacity;l.innerBorder.opacity=g,e.setStrokeStyle(t,m,i,n,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}};qA=XA([jy()],qA);let ZA=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};ZA=XA([jy()],ZA);let JA=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}};JA=XA([jy()],JA);let QA=class{constructor(){this.time=Tm.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)}};QA=XA([jy()],QA);let tT=class{constructor(){this.time=Tm.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()}}};tT=XA([jy()],tT);var eT=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 iT=class{constructor(){this.time=Tm.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,o,s,a,l,h,c,u){const{size:d=l.size,opacity:p=l.opacity,outerBorder:f,innerBorder:g}=t.attribute,y=t.getParsedPath();if(y){if(f){const{distance:r=l.outerBorder.distance}=f,o=RA(e,r,e.dpr);if(e.beginPath(),!1===y.drawOffset(e,d,i,n,o)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,f,l.outerBorder);else if(a){const r=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.outerBorder),l.outerBorder.opacity=r,e.stroke()}}if(g){const{distance:r=l.innerBorder.distance}=g,o=RA(e,r,e.dpr);if(e.beginPath(),!1===y.drawOffset(e,d,i,n,-o)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),u)u(e,g,l.innerBorder);else if(a){const r=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.innerBorder),l.innerBorder.opacity=r,e.stroke()}}}}};iT=eT([jy()],iT);class nT extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}}class rT extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}}var oT=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)}};const lT=Symbol.for("RenderService");let hT=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};hT=oT([jy(),aT(0,Ky(BA)),sT("design:paramtypes",[Object])],hT);var cT=new Oy((t=>{t(hT).toSelf(),t(lT).toService(hT)})),uT=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 dT(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 pT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return uT(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function fT(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 gT=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 yT=Symbol.for("PickItemInterceptor");let mT=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===zw,!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+=Te;for(;a<0;)a+=Te;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,o.restore(),n.in3dInterceptor=!1,s}return null}initCanvasCtx(t){t.setTransformForCurrent()}};mT=gT([jy()],mT);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)}};const CT=Symbol.for("PickerService");let xT=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 Ve(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=V_.allocate();if(Z_(i,e),s){if(i){const t=V_.allocate();o.modelMatrix=J_(t,s,i),V_.free(i)}}else Z_(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&&V_.free(o.modelMatrix),o.modelMatrix=s,r}}const a=t.transMatrix,l=U_.allocateByObj(i),h=new Fe(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&&dT(t,gb.zIndex,(i=>{if(i.isContainer){const o=new Fe(e.x,e.y),s=Pv(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 Fe(e.x,e.y);l.transformPoint(o,o);const s=Pv(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&&V_.free(o.modelMatrix),o.modelMatrix=s,r.graphic||r.group||!u||t.stage.camera||(r.group=t),U_.free(l),r}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};xT=bT([jy(),wT(0,Ky(em)),wT(1,Ky(Xy)),wT(1,Ny(yT)),vT("design:paramtypes",[Object,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)}};const TT=Symbol.for("GlobalPickerService");let BT=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 Ve(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 Fe(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 Fe(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 RT(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],y=e[13],m=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*y,t[2]=v*o+w*h+C*p+x*m,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*y,t[6]=v*o+w*h+C*p+x*m,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*y,t[10]=v*o+w*h+C*p+x*m,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*y,t[14]=v*o+w*h+C*p+x*m,t[15]=v*s+w*c+C*f+x*b,t}function MT(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}BT=_T([jy(),AT(0,Ky(em)),ST("design:paramtypes",[Object])],BT);class PT{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=V_.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=V_.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],y=e[2],m=n[0],b=n[1],v=n[2],w=i[0],C=i[1],x=i[2];Math.abs(f-w)<xe&&Math.abs(g-C)<xe&&Math.abs(y-x)<xe?K_.identity(t):(c=f-w,u=g-C,d=y-x,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,r=b*d-v*u,o=v*c-m*d,s=m*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*y),t[13]=-(a*f+l*g+h*y),t[14]=-(c*f+u*g+d*y),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=V_.allocate()),this._vp=RT(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=V_.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=V_.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=V_.allocate()),this._vp=RT(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 MT(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;MT(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 ET=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},HT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LT=[0,0,0],kT=new Ve(1,0,0,1,0,0);let IT=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({},cb),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},db),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},pb),{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(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 Ve(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 U_.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&&(U_.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(U_.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-=Te;else for(;i<e;)i+=Te;const l=_e/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),y=d*o+n,m=p*s+r,b=f*o+n,v=g*s+r,w=o*a*u,C=s*a*u;t.push([y-w*p,m+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&&(MT(LT,[t,e,s],this.modelMatrix),t=LT[0],e=LT[1],a=LT[2],MT(LT,[i,n,s],this.modelMatrix),i=LT[0],n=LT[1],l=LT[2],MT(LT,[r,o,s],this.modelMatrix),r=LT[0],o=LT[1],s=LT[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&&(MT(LT,[t,e,i],this.modelMatrix),t=LT[0],e=LT[1],i=LT[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&&(MT(LT,[t,e,i],this.modelMatrix),t=LT[0],e=LT[1],i=LT[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&&(MT(LT,[t,e,r],this.modelMatrix),t=LT[0],e=LT[1],o=LT[2],MT(LT,[i,n,r],this.modelMatrix),i=LT[0],n=LT[1],r=LT[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=EC.GetCanvas(),u=EC.GetCtx();if(!u)return null;const d=LC.GetSize(a),p=LC.GetSize(l);let f=LC.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)))),y=h+1,m=r/Math.max(1,y-1),b=HC.GetOrCreate(e,y),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=y-1;t<e&&!(o+t*m>s);t++){const e=b.getColor(t);u.beginPath(),u.rotate(m),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&&LC.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&&(MT(LT,[t,e,i],this.modelMatrix),t=LT[0],e=LT[1],i=LT[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&&(MT(LT,[t,e,i],this.modelMatrix),t=LT[0],e=LT[1],i=LT[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(MT(LT,[e,i,n],this.modelMatrix),e=LT[0],i=LT[1],n=LT[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]:Db.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Db.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:pb.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:pb.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&&(MT(LT,[e,i,n],this.modelMatrix),e=LT[0],i=LT[1],n=LT[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=MA(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=RA(this,l,this.dpr),o.strokeStyle=MA(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=ex(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=ex(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(kT,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=>U_.free(t))),this.stack.length=0}};IT.env="browser",IT=ET([jy(),HT("design:paramtypes",[Object,Number])],IT);var OT=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},DT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const FT={WIDTH:500,HEIGHT:500,DPR:1};let WT=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=FT.WIDTH,height:n=FT.HEIGHT,dpr:r=FT.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=Db.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 IT(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)}};WT.env="browser",WT=OT([jy(),DT("design:paramtypes",[Object])],WT);const zT=Symbol.for("CanvasArcPicker"),jT=Symbol.for("CanvasArc3dPicker"),NT=Symbol.for("CanvasAreaPicker"),GT=Symbol.for("CanvasCirclePicker"),KT=Symbol.for("CanvasImagePicker"),UT=Symbol.for("CanvasLinePicker"),VT=Symbol.for("CanvasPathPicker"),$T=Symbol.for("CanvasRectPicker"),YT=Symbol.for("CanvasRect3dPicker"),XT=Symbol.for("CanvasSymbolPicker"),qT=Symbol.for("CanvasTextPicker"),ZT=Symbol.for("CanvasPolygonPicker"),JT=Symbol.for("CanvasPyramid3dPicker"),QT=Symbol.for("CanvasRichTextPicker"),tB=Symbol.for("CanvasGlyphPicker"),eB=Symbol.for("CanvasPickerContribution"),iB=Symbol.for("MathArcPicker"),nB=Symbol.for("MathAreaPicker"),rB=Symbol.for("MathCirclePicker"),oB=Symbol.for("MathLinePicker"),sB=Symbol.for("MathPathPicker"),aB=Symbol.for("MathRectPicker"),lB=Symbol.for("MathSymbolPicker"),hB=Symbol.for("MathTextPicker"),cB=Symbol.for("MathPolygonPicker"),uB=Symbol.for("MathGlyphPicker"),dB=Symbol.for("MathPickerContribution");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},fB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gB=function(t,e){return function(i,n){e(i,n,t)}};let yB=class extends xT{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 WT(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}};pB([Yy(),fB("design:type",Function),fB("design:paramtypes",[]),fB("design:returntype",void 0)],yB.prototype,"init",null),yB=pB([jy(),gB(0,Ky(Xy)),gB(0,Ny(eB)),gB(1,Ky(GT)),gB(2,Ky($T)),gB(3,Ky(zT)),gB(4,Ky(NT)),gB(5,Ky(KT)),gB(6,Ky(UT)),gB(7,Ky(VT)),gB(8,Ky(XT)),gB(9,Ky(qT)),gB(10,Ky(ZT)),gB(11,Ky(QT)),gB(12,Ky(BA)),gB(13,Ky(em)),gB(14,Ky(Xy)),gB(14,Ny(yT)),fB("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object])],yB);var mB=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},bB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vB=new Ve(1,0,0,1,0,0),wB={x:0,y:0};let CB=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this.path=new sb}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 U_.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(U_.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(U_.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},wB),function(t,e,i){return gv(t,0,!1,e,i)}(this.path.commandList,wB.x,wB.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},wB);const i=RA(this,this.lineWidth,this.dpr);return function(t,e,i,n){return gv(t,e,!0,i,n)}(this.path.commandList,i,wB.x,wB.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(vB,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=>U_.free(t))),this.stack.length=0}};CB=mB([jy(),bB("design:paramtypes",[Object,Number])],CB);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},_B=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends xT{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 CB(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}};xB([Yy(),_B("design:type",Function),_B("design:paramtypes",[]),_B("design:returntype",void 0)],AB.prototype,"init",null),AB=xB([jy(),SB(0,Ky(Xy)),SB(0,Ny(dB)),SB(1,Ky(em)),SB(2,Ky(Xy)),SB(2,Ny(yT)),_B("design:paramtypes",[Object,Object,Object])],AB);var TB=new Oy((t=>{t(yB).toSelf().inSingletonScope(),t(AB).toSelf().inSingletonScope(),t(CT).toService(yB),t(BT).toSelf().inSingletonScope(),t(TT).toService(BT),t(mT).toSelf().inSingletonScope(),t(yT).toService(mT),Zy(t,yT)})),BB=new Oy((t=>{t(tS).toSelf().inSingletonScope(),t(eC).toService(tS),t(E_).toSelf().inSingletonScope(),t(P_).toService(E_),Zy(t,P_),t(k_).toSelf().inSingletonScope(),t(L_).toService(k_),Zy(t,L_),t(D_).toSelf().inSingletonScope(),t(O_).toService(D_),Zy(t,O_),t(z_).toSelf().inSingletonScope(),t(W_).toService(z_),Zy(t,W_),t(G_).toSelf().inSingletonScope(),t(N_).toService(G_),Zy(t,N_),t(iC).toConstantValue(fS)}));const RB=Symbol.for("AutoEnablePlugins"),MB=Symbol.for("PluginService");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},EB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HB=function(t,e){return function(i,n){e(i,n,t)}};let LB=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&&Ob.isBound(RB)&&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=[]}};LB=PB([jy(),HB(0,Ky(Xy)),HB(0,Ny(RB)),EB("design:paramtypes",[Object])],LB);var kB=new Oy((t=>{t(LB).toSelf(),t(MB).toService(LB),Zy(t,RB)})),IB=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 OB=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};OB=IB([jy()],OB);var DB=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},FB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function WB(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 zB=class extends OB{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)/(Gt(a)?a:1),y:(r-o.top)/(Gt(l)?a:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return WB(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return WB(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:Ev.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(){}};function jB(){Ob.rebind(CT).toService(AB)}zB=DB([jy(),FB("design:paramtypes",[])],zB);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},GB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KB=class extends OB{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),jB())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};KB=NB([jy(),GB("design:paramtypes",[])],KB);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},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $B=class extends OB{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,Ob.rebind(CT).toService(AB))}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(){}};$B=UB([jy(),VB("design:paramtypes",[])],$B);var YB=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},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qB=!1;try{qB=!!lynx.createCanvasNG}catch(t){}let ZB=class extends OB{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=qB?lynx.createCanvasNG(e):lynx.createCanvas(e);a.width=t.width*o,a.height=t.height*o,qB&&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),jB())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};ZB=YB([jy(),XB("design:paramtypes",[])],ZB);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};let QB=class extends OB{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};QB=JB([jy()],QB);var tR=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)},iR=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 nR=class extends OB{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){return iR(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o<e.length;o++){const s=e[o];yield new Promise((e=>{wx.createSelectorQuery().select(`#${s}`).fields({node:!0,size:!0}).exec((a=>{const l=a[0].node,h=a[0].width,c=a[0].height;l.width=h*t,l.height=c*t,i.set(s,l),o>=n&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{jB()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};nR=tR([jy(),eR("design:paramtypes",[])],nR);var rR=new Oy((t=>{t(zB).toSelf().inSingletonScope(),t(tm).toService(zB),t(KB).toSelf().inSingletonScope(),t(tm).toService(KB),t($B).toSelf().inSingletonScope(),t(tm).toService($B),t(ZB).toSelf().inSingletonScope(),t(tm).toService(ZB),t(nR).toSelf().inSingletonScope(),t(tm).toService(nR),t(QB).toSelf().inSingletonScope(),t(tm).toService(QB),Zy(t,tm)})),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},sR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let aR=class{constructor(){this._uid=Ev.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};aR=oR([jy(),sR("design:paramtypes",[])],aR);var lR=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},hR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cR=function(t,e){return function(i,n){e(i,n,t)}};let uR=class extends aR{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ev.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new WT(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 WT({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()}};uR.env="browser",uR=lR([jy(),cR(0,Ky(em)),hR("design:paramtypes",[Object])],uR);var dR=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 pR=class extends IT{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}};pR.env="feishu",pR=dR([jy()],pR);var fR=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)};const yR={WIDTH:500,HEIGHT:500,DPR:1};let mR=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=yR.WIDTH,height:n=yR.HEIGHT,dpr:r=yR.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 pR(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(){}};mR.env="feishu",mR=fR([jy(),gR("design:paramtypes",[Object])],mR);var bR=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},vR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wR=function(t,e){return function(i,n){e(i,n,t)}};let CR=class extends aR{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:Ev.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new mR(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 mR({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()}};CR.env="feishu",CR=bR([jy(),wR(0,Ky(em)),vR("design:paramtypes",[Object])],CR);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};let _R=class extends IT{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(MA(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(RA(this,l,this.dpr)),o.setStrokeStyle(MA(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=ex(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=ex(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}};_R.env="taro",_R=xR([jy()],_R);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)};const TR={WIDTH:500,HEIGHT:500,DPR:1};let BR=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=TR.WIDTH,height:n=TR.HEIGHT,dpr:r=TR.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 _R(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(){}};BR.env="taro",BR=SR([jy(),AR("design:paramtypes",[Object])],BR);var RR=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)},PR=function(t,e){return function(i,n){e(i,n,t)}};let ER=class extends aR{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:Ev.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BR(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 BR({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()}};ER.env="taro",ER=RR([jy(),PR(0,Ky(em)),MR("design:paramtypes",[Object])],ER);var HR=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 LR=class extends IT{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=RA(this,l,this.dpr),o.strokeStyle=MA(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)}))}))}};LR.env="lynx",LR=HR([jy()],LR);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},IR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const OR={WIDTH:500,HEIGHT:500,DPR:1};let DR=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=OR.WIDTH,height:n=OR.HEIGHT,dpr:r=OR.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 LR(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(){}};DR.env="lynx",DR=kR([jy(),IR("design:paramtypes",[Object])],DR);var FR=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)},zR=function(t,e){return function(i,n){e(i,n,t)}};let jR=class extends aR{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:Ev.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new DR(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 DR({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()}};jR.env="lynx",jR=FR([jy(),zR(0,Ky(em)),WR("design:paramtypes",[Object])],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 KR=class extends IT{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};KR.env="node",KR=NR([jy(),GR("design:paramtypes",[Object,Number])],KR);var UR=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},VR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const $R={WIDTH:500,HEIGHT:500,DPR:1};let YR=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=$R.WIDTH,height:n=$R.HEIGHT,canvasControled:r=!0,dpr:o=$R.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 KR(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&&Ht(this._nativeCanvas.release)&&this._nativeCanvas.release()}};YR.env="node",YR=UR([jy(),VR("design:paramtypes",[Object])],YR);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},qR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZR=function(t,e){return function(i,n){e(i,n,t)}};let JR=class extends aR{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:Ev.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new YR(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 YR({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){}};JR.env="node",JR=XR([jy(),ZR(0,Ky(em)),qR("design:paramtypes",[Object])],JR);var 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};let tM=class extends IT{draw(){}createPattern(t,e){return null}};tM.env="wx",tM=QR([jy()],tM);var eM=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},iM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const nM={WIDTH:500,HEIGHT:500,DPR:1};let rM=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=nM.WIDTH,height:n=nM.HEIGHT,dpr:r=nM.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 tM(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(){}};rM.env="wx",rM=eM([jy(),iM("design:paramtypes",[Object])],rM);var oM=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},sM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aM=function(t,e){return function(i,n){e(i,n,t)}};class lM{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 hM=class extends aR{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new lM}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:Ev.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new rM(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 rM({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()}};hM.env="wx",hM=oM([jy(),aM(0,Ky(em)),sM("design:paramtypes",[Object])],hM);var cM=new Oy((t=>{t(uR).toSelf(),t(gC).toDynamicValue((t=>t.container.get(uR))).whenTargetNamed(uR.env),t(CR).toSelf(),t(gC).toDynamicValue((t=>t.container.get(CR))).whenTargetNamed(CR.env),t(ER).toSelf(),t(gC).toDynamicValue((t=>t.container.get(ER))).whenTargetNamed(ER.env),t(jR).toSelf(),t(gC).toDynamicValue((t=>t.container.get(jR))).whenTargetNamed(jR.env),t(hM).toSelf(),t(gC).toDynamicValue((t=>t.container.get(hM))).whenTargetNamed(hM.env),t(JR).toSelf(),t(gC).toDynamicValue((t=>t.container.get(JR))).whenTargetNamed(JR.env)})),uM=new Oy((t=>{t(Ib).toSelf().inSingletonScope(),t(kb).toService(Ib),Zy(t,kb)})),dM=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)},fM=function(t,e){return function(i,n){e(i,n,t)}};let gM=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,r=zb({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()}};gM=dM([jy(),fM(0,Ky(em)),pM("design:paramtypes",[Object])],gM);var yM=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},mM=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)}};let vM=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=zb({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){}};vM=yM([jy(),bM(0,Ky(em)),mM("design:paramtypes",[Object])],vM);var wM=new Oy((t=>{t(gM).toSelf(),t(vM).toSelf(),t(oC).toService(gM)}));var CM=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 xM=Symbol.for("DrawItemInterceptor"),_M=new Ne;let SM=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){_M.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(_M),!0}};SM=CM([jy()],SM);let AM=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=V_.allocate();Z_(l,a);const h=o.modelMatrix;if(h){if(l){const t=V_.allocate();o.modelMatrix=J_(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===zw,!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+=Te;for(;a<0;)a+=Te;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&&V_.free(o.modelMatrix),o.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};AM=CM([jy()],AM);var TM=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},BM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RM=function(t,e){return function(i,n){e(i,n,t)}};let MM=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 je,this.backupDirtyBounds=new je}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=(h=l,c=n.dirtyBounds,u=!1,null===h?c:null===c?h:(ni=h.x1,ri=h.x2,oi=h.y1,si=h.y2,ai=c.x1,li=c.x2,hi=c.y1,ci=c.y2,u&&(ni>ri&&([ni,ri]=[ri,ni]),oi>si&&([oi,si]=[si,oi]),ai>li&&([ai,li]=[li,ai]),hi>ci&&([hi,ci]=[ci,hi])),ni>=li||ri<=ai||oi>=ci||si<=hi?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ni,ai),y1:Math.max(oi,hi),x2:Math.min(ri,li),y2:Math.min(si,ci)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,u;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const d=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(r,o,!0),d&&(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:gb.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:gb.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=fT(e,i,gb.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(!di(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))})):dT(t,gb.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||Ob.get(lA);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&&!di(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=MA(e,n,{AABBBounds:{x1:s,y1:a,x2:s+r,y2:a+o}},0,0),e.fillRect(s,a,r,o)}}};TM([Yy(),BM("design:type",Function),BM("design:paramtypes",[]),BM("design:returntype",void 0)],MM.prototype,"init",null),MM=TM([jy(),RM(0,Uy(pA)),RM(1,Ky(TA)),RM(2,Ky(vC)),RM(3,Ky(Xy)),RM(3,Ny(xM)),BM("design:paramtypes",[Array,Object,Object,Object])],MM);var PM=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 EM=class{selector(t){return null}};EM=PM([jy()],EM);var HM=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},LM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let IM=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Kw}drawShape(t,e,i,n,r,o,s,a){const l=Pv(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:y=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:b=l.cornerRadius,path:v=l.path,lineWidth:w=l.lineWidth,visible:C=l.visible}=t.attribute,x=SC(d,y,p,f),_=TC(d,m,p,f),S=CC(h),A=xC(u,w);if(!t.valid||!C)return;if(!g){if(!(S||A||c))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||Wt(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,f)):(e.beginPath(),IS(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===Tm.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===Tm.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=Pv(t,null==n?void 0:n.theme).group,a=r.modelMatrix;if(r.camera){const e=V_.allocate(),i=V_.allocate();Q_(i,t,s),J_(e,a||e,i),r.modelMatrix=e,V_.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&&V_.free(r.modelMatrix),r.modelMatrix=a,c&&c.then?c.then((()=>{o?r.restore():r.highPerformanceRestore()})):o?r.restore():r.highPerformanceRestore()}};IM=HM([jy(),kM(0,Ky(Xy)),kM(0,Ny(DC)),LM("design:paramtypes",[Object])],IM);var OM=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 DM=class extends xS{constructor(){super(...arguments),this.numberType=Vw}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=Pv(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:y=h.visible}=t.attribute,m=_C(d,p),b=AC(d,f),v=CC(c),w=xC(u,g);if(!t.valid||!y)return;if(!v&&!w)return;if(!(m||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())}};DM=OM([jy()],DM);var FM=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 WM=class extends MS{constructor(){super(...arguments),this.numberType=jw}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=Pv(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=_C(d,u),g=CC(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())}};WM=FM([jy()],WM);var zM,jM=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},NM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GM=function(t,e){return function(i,n){e(i,n,t)}},KM=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"}(zM||(zM={}));let UM=class extends MM{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=zM.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Qy([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return KM(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:gb.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:gb.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 KM(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return KM(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KM(this,void 0,void 0,(function*(){if(2!==t.count)yield pT(t,gb.zIndex,((i,n)=>{if(this.status===zM.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 KM(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return KM(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return KM(this,void 0,void 0,(function*(){this.rendering&&(this.status=zM.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=zM.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 KM(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:()=>KM(this,void 0,void 0,(function*(){yield pT(t,gb.zIndex,(t=>KM(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};jM([Ky(em),NM("design:type",Object)],UM.prototype,"global",void 0),UM=jM([jy(),GM(0,Uy(pA)),GM(1,Ky(TA)),GM(2,Ky(DM)),GM(3,Ky(WM)),GM(4,Ky(vC)),GM(5,Ky(Xy)),GM(5,Ny(xM)),NM("design:paramtypes",[Array,Object,Object,Object,Object,Object])],UM);var VM=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 $M=class extends bS{constructor(){super(...arguments),this.type="rect3d",this.numberType=Zw}drawShape(t,e,i,n,r,o,s,a){var l;const h=Pv(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:y=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:b=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,w=SC(f,g,d,p),C=TC(f,m,d,p),x=CC(c),_=xC(u,y);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=ww.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]],y={x:t+d[0],y:e+d[1],z:i+d[2]},m={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(y.x,y.y,y.z),o.lineTo(m.x,m.y,m.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=Pv(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&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};$M=VM([jy()],$M);var YM=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 XM=class{constructor(){this.numberType=Jw}drawShape(t,e,i,n,r){const o=Pv(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&&_C(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,r){var o;const s=Pv(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:y}=t.attribute,{backgroundWidth:m=a,backgroundHeight:b=l}=t.attribute;if(y&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-a)/2,r=(b-l)/2;0===g?(e.beginPath(),e.rect(i-t,n-r,m,b)):(e.beginPath(),IS(e,i-t,n-r,m,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=Pv(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()}};XM=YM([jy()],XM);var qM=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 ZM=class{constructor(){this.numberType=Gw}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=Pv(t),s=t.getSubGraphic();s.length&&s.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:o})})),r.highPerformanceRestore()}};ZM=qM([jy()],ZM);var JM=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 QM=class extends bS{constructor(){super(...arguments),this.numberType=zw}drawShape(t,e,i,n,r,o,s,a){var l;const h=Pv(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:y=h.strokeOpacity,visible:m=h.visible}=t.attribute,b=_C(p,f),v=AC(p,y),w=CC(c),C=xC(d,g),x=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!(w||C||u))return;if(!(b||v||s||a||u))return;const{outerRadius:_=h.outerRadius,innerRadius:S=h.innerRadius,height:A=10}=t.attribute,T=ww.get(c).value,{light:B}=r.stage||{},R=r.hack_pieFace,M={top:x,bottom:x+A},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===R||"top"===R?(e.beginPath(),function(t,e,i,n,r,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=Be(l-a),c=l>a;let u=!1;if(o<s){const t=o;o=s,s=t}if(o<=xe)e.moveTo(i,n,r);else if(h>=Te-xe)e.moveTo(i+o*Me(a),n+o*He(a),r),e.arc(i,n,o,a,l,!c,r),s>xe&&(e.moveTo(i+s*Me(l),n+s*He(l),r),e.arc(i,n,s,l,a,c,r));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:f,innerEndAngle:g,innerStartAngle:y}=t.getParsePadAngle(a,l),m=o*Me(p),b=o*He(p),v=s*Me(g),w=s*He(g);h<.001?u=!0:(e.moveTo(i+m,n+b,r),e.arc(i,n,o,p,f,!c,r)),!(s>xe)||d<.001?(e.lineTo(i+v,n+w,r),u=!0):(e.lineTo(i+v,n+w,r),e.arc(i,n,s,g,y,c,r))}e.closePath()}(t,e,i,n,M[R],_,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[R],T):c,e.fill())),C&&(a?a(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==R&&"inside"!==R||("inside"===R&&(e.save(),e.beginPath(),e.arc(i,n,S,0,Te,!0,M.top),e.clip()),e.beginPath(),function(t,e,i,n,r,o,s,a){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Be(h-l),u=h>l;let d=!1;if(s<=xe)e.moveTo(i,n,r);else if(c>=Te-xe)e.moveTo(i+s*Me(l),n+s*He(l),r),e.arc(i,n,s,l,h,!u,r),e.lineTo(i+s*Me(h),n+s*He(h),o),e.arc(i,n,s,h,l,u,o);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=a(l,h),f=s*Me(c),g=s*He(c),y=s*Me(p),m=s*He(p);t<.001?d=!0:(e.moveTo(i+f,n+g,r),e.arc(i,n,s,c,p,!u,r),e.lineTo(i+y,n+m,o),e.arc(i,n,s,p,c,u,o))}e.closePath()}(t,e,i,n,M.top,M.bottom,"outside"===R?_:S,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:r,outerStartAngle:o,outerEndAngle:s,innerEndAngle:a,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===R?{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[R],T):c,e.fill())),C&&(a?a(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===R&&e.restore())}draw(t,e,i,n){const{context:r}=i;if(!r)return;const o=Pv(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,BC(t,r,a,l,0,n)||(this.drawShape(t,r,a,l,i,n),this.z=0,r.modelMatrix!==c&&V_.free(r.modelMatrix),r.modelMatrix=c),r.restore()}};QM=JM([jy()],QM);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 eP=class extends bS{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Xw}drawShape(t,e,i,n,r,o,s,a){var l;const h=Pv(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:y=h.visible,points:m,face:b=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,w=_C(d,p),C=AC(d,g),x=CC(c),_=xC(u,f);if(!t.valid||!y||4!==m.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=ww.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]],y=p[r[2]],m=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+y[0],y:e+y[1],z:i+y[2]},C={x:t+m[0],y:e+m[1],z:i+m[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=Pv(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&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};eP=tP([jy()],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};let nP=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};nP=iP([jy()],nP);let rP=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}};rP=iP([jy()],rP);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};let sP=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};sP=oP([jy()],sP);let aP=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}};aP=oP([jy()],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};let hP=class extends kA{constructor(){super(...arguments),this.time=Tm.beforeFillStroke}};hP=lP([jy()],hP);let cP=class extends OA{constructor(){super(...arguments),this.time=Tm.afterFillStroke}drawShape(t,e,i,n,r,o,s,a,l,h,c,u,d){var p,f,g,y;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=d||{},{texture:b=(null!==(p=t.attribute.texture)&&void 0!==p?p:pw(l,"texture")),textureColor:v=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:pw(l,"textureColor")),textureSize:w=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:pw(l,"textureSize")),texturePadding:C=(null!==(y=t.attribute.texturePadding)&&void 0!==y?y:pw(l,"texturePadding"))}=m;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())}};cP=lP([jy()],cP);var uP=new Oy((t=>{t(MM).toSelf(),t(BA).toService(MM),t(UM).toSelf(),t(lA).toService(UM),t(EM).toSelf(),t(TA).toService(EM),t(JC).toSelf().inSingletonScope(),t(dA).to(JC),t(pA).to(JC),t(NA).toSelf().inSingletonScope(),t(GA).toSelf().inSingletonScope(),t(KA).toSelf().inSingletonScope(),t(OC).toService(NA),t(OC).toService(GA),t(OC).toService(KA),Zy(t,OC),t(WS).toSelf().inSingletonScope(),t(bA).to(WS),t(pA).to(WS),t($M).toSelf().inSingletonScope(),t(vA).toService($M),t(pA).toService(vA),t(qA).toSelf().inSingletonScope(),t(ZA).toSelf().inSingletonScope(),t(JA).toSelf().inSingletonScope(),t(QA).toSelf().inSingletonScope(),t(tT).toSelf().inSingletonScope(),t(jC).toService(qA),t(jC).toService(ZA),t(jC).toService(JA),t(jC).toService(QA),t(jC).toService(tT),Zy(t,jC),t($S).toSelf().inSingletonScope(),t(CA).to($S),t(pA).to($S),Zy(t,GC),t(LS).toSelf().inSingletonScope(),t(yA).to(LS),t(pA).to(LS),t(sP).toSelf().inSingletonScope(),t(aP).toSelf().inSingletonScope(),t(WC).toService(sP),t(WC).toService(aP),Zy(t,WC),t(GS).toSelf().inSingletonScope(),t(wA).to(GS),t(pA).to(GS),t(iT).toSelf().inSingletonScope(),t(nT).toSelf().inSingletonScope(),t(rT).toSelf().inSingletonScope(),t(NC).toService(iT),t(NC).toService(nT),t(NC).toService(rT),Zy(t,NC),t(YC).toSelf().inSingletonScope(),t(hA).to(YC),t(pA).to(YC),t(QM).toSelf().inSingletonScope(),t(cA).toService(QM),t(pA).toService(cA),t(FA).toSelf().inSingletonScope(),t(WA).toSelf().inSingletonScope(),t(zA).toSelf().inSingletonScope(),t(kC).toService(FA),t(kC).toService(WA),t(kC).toService(zA),Zy(t,kC),t(xS).toSelf().inSingletonScope(),t(gA).to(xS),t(pA).to(xS),t(DM).toSelf().inSingletonScope(),t(WM).toSelf().inSingletonScope(),t(MS).toSelf().inSingletonScope(),t(uA).to(MS),t(pA).to(MS),t(hP).toSelf().inSingletonScope(),t(cP).toSelf().inSingletonScope(),t(IC).toService(hP),t(IC).toService(cP),Zy(t,IC),t(IM).toSelf().inSingletonScope(),t(fA).to(IM),t(pA).to(IM),t(VA).toSelf().inSingletonScope(),t(DC).toService(VA),Zy(t,DC),t(iA).toSelf().inSingletonScope(),t(mA).to(iA),t(pA).to(iA),t(nP).toSelf().inSingletonScope(),t(rP).toSelf().inSingletonScope(),t(zC).toService(nP),t(zC).toService(rP),Zy(t,zC),t(ZM).toSelf().inSingletonScope(),t(SA).toService(ZM),t(pA).toService(SA),t(aA).toSelf().inSingletonScope(),t(AA).toService(aA),t(pA).toService(AA),t(YA).toSelf().inSingletonScope(),t(FC).toService(YA),Zy(t,FC),t(XM).toSelf().inSingletonScope(),t(xA).toService(XM),t(pA).toService(xA),t(eP).toSelf().inSingletonScope(),t(_A).toService(eP),t(pA).toService(_A),t(IA).toSelf().inSingletonScope(),t(GC).toService(IA),t(kC).toService(IA),t(WC).toService(IA),t(NC).toService(IA),t(jC).toService(IA),t(FC).toService(IA),t(OC).toService(IA),t(IC).toService(IA),t(zC).toService(IA),Zy(t,KC),Zy(t,pA),t(SM).toSelf().inSingletonScope(),t(xM).toService(SM),t(AM).toSelf().inSingletonScope(),t(xM).toService(AM),Zy(t,xM)}));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{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Nw}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=Pv(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=RA(n,o,n.dpr),a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};gP=dP([jy(),fP(0,Ky(dA)),pP("design:paramtypes",[Object])],gP);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},mP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bP=function(t,e){return function(i,n){e(i,n,t)}};const vP=new Ne;let wP=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=qw}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=Pv(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||Nt(o,!0)&&0!==o||Wt(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=RA(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;vP.setValue(i.x1,i.y1,i.x2,i.y2),vP.expand(-o/2),h=!vP.containsPoint(e)}}return n.highPerformanceRestore(),h}};wP=yP([jy(),bP(0,Ky(bA)),mP("design:paramtypes",[Object])],wP);var CP=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},xP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_P=function(t,e){return function(i,n){e(i,n,t)}};let SP=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Ww}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=Pv(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=RA(n,o,n.dpr),a=t.isPointInStroke(e.x,e.y),a})),n.highPerformanceRestore(),a}};SP=CP([jy(),_P(0,Ky(hA)),xP("design:paramtypes",[Object])],SP);var AP=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)},BP=function(t,e){return function(i,n){e(i,n,t)}};let RP=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jw}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=Pv(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}};RP=AP([jy(),BP(0,Ky(uA)),TP("design:paramtypes",[Object])],RP);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 PP=class{constructor(){this.type="image",this.numberType=Uw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};PP=MP([jy()],PP);var EP=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 HP=class extends bS{};HP=EP([jy()],HP);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},kP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IP=function(t,e){return function(i,n){e(i,n,t)}};let OP=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Vw}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=Pv(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=RA(n,r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};OP=LP([jy(),IP(0,Ky(gA)),kP("design:paramtypes",[Object])],OP);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},FP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WP=function(t,e){return function(i,n){e(i,n,t)}};let zP=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=$w}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=Pv(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=RA(n,r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};zP=DP([jy(),WP(0,Ky(yA)),FP("design:paramtypes",[Object])],zP);var jP=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)},GP=function(t,e){return function(i,n){e(i,n,t)}};let KP=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Qw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=Pv(t).symbol,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=RA(n,r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};KP=jP([jy(),GP(0,Ky(wA)),NP("design:paramtypes",[Object])],KP);var UP=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)},$P=function(t,e){return function(i,n){e(i,n,t)}};let YP=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=tC}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=Pv(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(),y=nx(s,d,r),m=ix(a,g);return e.rect(m+h,y+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,i)=>f)),this.canvasRenderer.z=0,n.modelMatrix!==d&&V_.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),f}};YP=UP([jy(),$P(0,Ky(CA)),VP("design:paramtypes",[Object])],YP);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},qP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZP=function(t,e){return function(i,n){e(i,n,t)}};let JP=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Yw}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=Pv(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}};JP=XP([jy(),ZP(0,Ky(mA)),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)}};new Ne;let iE=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Jw}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};iE=QP([jy(),eE(0,Ky(xA)),tE("design:paramtypes",[Object])],iE);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},rE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oE=function(t,e){return function(i,n){e(i,n,t)}};let sE=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Gw}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}};sE=nE([jy(),oE(0,Ky(SA)),rE("design:paramtypes",[Object])],sE);var aE=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},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};new Ne;let cE=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=Zw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Pv(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&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};cE=aE([jy(),hE(0,Ky(vA)),lE("design:paramtypes",[Object])],cE);var uE=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},dE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pE=function(t,e){return function(i,n){e(i,n,t)}};new Ne;let fE=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Xw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Pv(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&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};fE=uE([jy(),pE(0,Ky(_A)),dE("design:paramtypes",[Object])],fE);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},yE=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)}};new Ne;let bE=class extends HP{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=zw}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=Pv(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&&V_.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}};bE=gE([jy(),mE(0,Ky(cA)),yE("design:paramtypes",[Object])],bE);var vE=new Oy(((t,e,i,n)=>{t(gP).toSelf().inSingletonScope(),t(GT).toService(gP),t(eB).toService(GT),t(wP).toSelf().inSingletonScope(),t($T).toService(wP),t(eB).toService($T),t(cE).toSelf().inSingletonScope(),t(YT).toService(cE),t(eB).toService(YT),t(SP).toSelf().inSingletonScope(),t(zT).toService(SP),t(eB).toService(zT),t(RP).toSelf().inSingletonScope(),t(NT).toService(RP),t(eB).toService(NT),t(PP).toSelf().inSingletonScope(),t(KT).toService(PP),t(eB).toService(KT),t(OP).toSelf().inSingletonScope(),t(UT).toService(OP),t(eB).toService(UT),t(zP).toSelf().inSingletonScope(),t(VT).toService(zP),t(eB).toService(VT),t(KP).toSelf().inSingletonScope(),t(XT).toService(KP),t(eB).toService(XT),t(YP).toSelf().inSingletonScope(),t(qT).toService(YP),t(eB).toService(qT),t(JP).toSelf().inSingletonScope(),t(ZT).toService(JP),t(eB).toService(ZT),t(fE).toSelf().inSingletonScope(),t(JT).toService(fE),t(eB).toService(JT),t(bE).toSelf().inSingletonScope(),t(jT).toService(bE),t(eB).toService(jT),t(iE).toSelf().inSingletonScope(),t(QT).toService(iE),t(eB).toService(QT),t(sE).toSelf().inSingletonScope(),t(tB).toService(sE),t(eB).toService(tB),Zy(t,eB)})),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){this.canvasRenderer=t,this.type="path",this.numberType=$w}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=Pv(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}};_E=wE([jy(),xE(0,Ky(yA)),CE("design:paramtypes",[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},AE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TE=function(t,e){return function(i,n){e(i,n,t)}};let BE=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Nw}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=Pv(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}};BE=SE([jy(),TE(0,Ky(dA)),AE("design:paramtypes",[Object])],BE);var RE=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},ME=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PE=function(t,e){return function(i,n){e(i,n,t)}};const EE=new Ne;let HE=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=qw}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=Pv(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||Nt(o,!0)&&0!==o||Wt(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;EE.setValue(i.x1,i.y1,i.x2,i.y2),EE.expand(-o/2),h=!EE.containsPoint(e)}}return n.highPerformanceRestore(),h}};HE=RE([jy(),PE(0,Ky(bA)),ME("design:paramtypes",[Object])],HE);var LE=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},kE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IE=function(t,e){return function(i,n){e(i,n,t)}};let OE=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Ww}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=Pv(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}};OE=LE([jy(),IE(0,Ky(hA)),kE("design:paramtypes",[Object])],OE);var DE=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},FE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let zE=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jw}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=Pv(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}};zE=DE([jy(),WE(0,Ky(uA)),FE("design:paramtypes",[Object])],zE);var jE=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},NE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let KE=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=Vw}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=Pv(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}};KE=jE([jy(),GE(0,Ky(gA)),NE("design:paramtypes",[Object])],KE);var UE=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},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};let YE=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=Qw}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=Pv(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}};YE=UE([jy(),$E(0,Ky(wA)),VE("design:paramtypes",[Object])],YE);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 qE=class{constructor(){this.type="text",this.numberType=tC}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};qE=XE([jy()],qE);var ZE=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},JE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QE=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Yw}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=Pv(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}};tH=ZE([jy(),QE(0,Ky(mA)),JE("design:paramtypes",[Object])],tH);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},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};let rH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Gw}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}};rH=eH([jy(),nH(0,Ky(SA)),iH("design:paramtypes",[Object])],rH);var oH=new Oy((t=>{t(BE).toSelf().inSingletonScope(),t(rB).toService(BE),t(dB).toService(rB),t(HE).toSelf().inSingletonScope(),t(aB).toService(HE),t(dB).toService(aB),t(OE).toSelf().inSingletonScope(),t(iB).toService(OE),t(dB).toService(iB),t(zE).toSelf().inSingletonScope(),t(nB).toService(zE),t(dB).toService(nB),t(KE).toSelf().inSingletonScope(),t(oB).toService(KE),t(dB).toService(oB),t(_E).toSelf().inSingletonScope(),t(sB).toService(_E),t(dB).toService(sB),t(YE).toSelf().inSingletonScope(),t(lB).toService(YE),t(dB).toService(lB),t(qE).toSelf().inSingletonScope(),t(hB).toService(qE),t(dB).toService(hB),t(tH).toSelf().inSingletonScope(),t(cB).toService(tH),t(dB).toService(cB),t(rH).toSelf().inSingletonScope(),t(uB).toService(rH),t(rH).toService(uB),Zy(t,dB)}));var sH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new WT(t))).whenTargetNamed(WT.env),t(Wb).toDynamicValue((()=>(t,e)=>new IT(t,e))).whenTargetNamed(IT.env)})),aH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new BR(t))).whenTargetNamed(BR.env),t(Wb).toDynamicValue((()=>(t,e)=>new _R(t,e))).whenTargetNamed(_R.env)})),lH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new mR(t))).whenTargetNamed(mR.env),t(Wb).toDynamicValue((()=>(t,e)=>new pR(t,e))).whenTargetNamed(pR.env)})),hH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new DR(t))).whenTargetNamed(DR.env),t(Wb).toDynamicValue((()=>(t,e)=>new LR(t,e))).whenTargetNamed(LR.env)})),cH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new rM(t))).whenTargetNamed(rM.env),t(Wb).toDynamicValue((()=>(t,e)=>new tM(t,e))).whenTargetNamed(tM.env)})),uH=new Oy((t=>{t(Fb).toDynamicValue((()=>t=>new YR(t))).whenTargetNamed(YR.env),t(Wb).toDynamicValue((()=>(t,e)=>new KR(t,e))).whenTargetNamed(KR.env)}));Ob.load(wC),Ob.load(BB),Ob.load(cT),Ob.load(TB),Ob.load(kB),function(t){t.load(rR),t.load(cM),t.load(uM),t.load(wM)}(Ob),function(t){t.load(uP)}(Ob),function(t){t.load(vE),t.load(oH)}(Ob),function(t){t.load(sH),t.load(lH),t.load(aH),t.load(hH),t.load(cH),t.load(uH)}(Ob);const dH=Ob.get(em);Db.global=dH;const pH=Ob.get(bC);Db.graphicUtil=pH;const fH=Ob.get(mC);Db.transformUtil=fH;const gH=Ob.get(eC);Db.graphicService=gH,Ob.get(TT);const yH=Ob.get(vC);Db.layerService=yH;class mH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ev.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Db.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Db.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Db.graphicService.hooks.onAttributeUpdate.taps=Db.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Db.graphicService.hooks.onSetStage.taps=Db.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Ev.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 vH{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ev.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Db.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))})),Db.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){Db.graphicService.hooks.onAddIncremental.taps=Db.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Db.graphicService.hooks.onClearIncremental.taps=Db.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Db.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const wH=new Ne;class CH{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ev.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()})),Db.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&&(wH.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(wH,t.parent&&t.parent.globalTransMatrix)))})),Db.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))})),Db.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){Db.graphicService.hooks.beforeUpdateAABBBounds.taps=Db.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Db.graphicService.hooks.afterUpdateAABBBounds.taps=Db.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)),Db.graphicService.hooks.onRemove.taps=Db.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const xH=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===Yv.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=Yv.INITIAL,Db.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Db.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:$v},{mode:"timeout",cons:Vv},{mode:"manual",cons:Uv}];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 $v;break;case"timeout":t=new Vv;break;case"manual":t=new Uv;break;default:console.warn("非法的计时器模式"),t=new $v}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!==Yv.INITIAL&&(this.status=Yv.PAUSE,!0)}resume(){return this.status!==Yv.INITIAL&&(this.status=Yv.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===Yv.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Yv.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=Yv.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Yv.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};xH.addTimeline(qv),xH.setFPS(60);class _H{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ww.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Le(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=Ee(Pe((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let r;r=Ft(e)?ww.get(e).value:e;const o=this.colorRgb;return ww.to.rgb(o[0]*r[0]*n,o[1]*r[1]*n,o[2]*r[2]*n)}}const SH="white";class AH extends rC{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:SH}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new Rv,this.hooks={beforeRender:new Qy(["stage"]),afterRender:new Qy(["stage"])},this.global=Ob.get(em),this.window=Ob.get(fC),this.renderService=Ob.get(lT),this.pickerService=Ob.get(CT),this.pluginService=Ob.get(MB),this.layerService=Ob.get(vC),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 Ne,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:SH,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 Kv({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||xH,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta: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:y="white",ambient:m}=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 _H(g,y,m);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 PT(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 bH))}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 mH))}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 vH))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new CH,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,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){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Fe(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Ob.get(fC);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var TH;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(TH||(TH={}));class BH extends rC{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 RH(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}const MH=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class PH extends rC{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){Ot(this.attribute[t])?ne(this.attribute[t],e):this.attribute[t]=e,MH.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=>MH.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){Lt(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const n=e[i];Ot(this.attribute[n])?ne(this.attribute[n],t[n]):this.attribute[n]=t[n]}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class EH extends PH{constructor(t){super(ne({},EH.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=ye(t-h/2,c,u);d=t/a,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ye(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"===dH.env?(dH.addEventListener("pointermove",this._onSliderPointerMove),dH.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"===dH.env?(dH.removeEventListener("pointermove",this._onSliderPointerMove),dH.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=me(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(me(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:Ci(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]=Ci(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]=me(t,0,1),{width:r,height:o,x1:s,y1:a}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?me([s+i*r,s+n*r],s,r-l):me([a+i*o,a+n*o],a,o-l)}_onChange(t){var e;const i=new Fv("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 HH(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&HH(t,e)}))}function LH(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}EH.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const kH=-.5*Math.PI,IH=1.5*Math.PI;var OH;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(OH||(OH={}));const DH={[OH.selectedReverse]:{},[OH.selected]:{},[OH.hover]:{},[OH.hoverReverse]:{}};function FH(t,e){var i,n;if(!t)return{width:0,height:0};const r=yS({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:r.width(),height:r.height()}}var WH,zH,jH=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 NH extends PH{constructor(t){super(ne({},NH.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=Ci(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],y=0,m=0;const{visible:b}=n,v=jH(n,["visible"]);if(Et(b)){const t=(null==v?void 0:v.size)||10,e=Nt(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"),Yt(null==c?void 0:c.shape)||(p.states=c.shape),b&&(m=e+o)}f+=m,y+=m;const w=Object.assign(Object.assign({text:e,visible:kt(e)&&!1!==h,lineHeight:null==i?void 0:i.fontSize},i),{x:y,y:0});Lt(w.lineHeight)&&(w.lineHeight=w.fontSize);const C=d.createOrUpdateChild("tag-text",w,"text");Yt(null==c?void 0:c.text)||(C.states=c.text);const x=FH(w.text,i),_=x.width,S=x.height;f+=_;const A=null!==(t=n.size)&&void 0!==t?t:10,T=Nt(A)?A:Math.max(A[0],A[1]);g+=Math.max(S,(null==n?void 0:n.visible)?T:0);const{textAlign:B,textBaseline:R}=i;(kt(s)||kt(a))&&(kt(s)&&f<s&&(f=s),kt(a)&&f>a&&(f=a,C.setAttribute("maxLineWidth",a-u[1]-u[2])));let M=0,P=0;"center"===B?(M-=f/2,p&&p.setAttribute("x",(p.attribute.x||0)-_/2),d.setAttribute("x",-m/2)):"right"===B||"end"===B?(M-=f,p&&p.setAttribute("x",(p.attribute.x||0)-_),d.setAttribute("x",-u[1]-m)):"left"!==B&&"start"!==B||d.setAttribute("x",u[3]),"middle"===R?(P-=g/2,p&&p.setAttribute("y",0)):"bottom"===R?(P-=g,p&&p.setAttribute("y",-S/2),d.setAttribute("y",-u[2])):"top"===R&&(d.setAttribute("y",u[0]),p&&p.setAttribute("y",S/2));const{visible:E}=r,H=jH(r,["visible"]);if(h&&Et(E)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},H),{visible:E&&!!e,x:M,y:P,width:f,height:g}),"rect");Yt(null==c?void 0:c.panel)||(t.states=c.panel)}}}function GH(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function KH(t,e,i,n){let r="";if(!t||0===e.length)return r;const o=e[0],s=We.distancePP(t,o),a=i?0:1;return n?r+=`M${t.x},${t.y-s}A${s},${s},0,0,${a},${t.x},${t.y+s}A${s},${s},0,0,${a},${t.x},${t.y-s}Z`:e.forEach(((t,e)=>{0===e?r=`M${t.x},${t.y}`:r+=`A${s},${s},0,0,${a},${t.x},${t.y}`})),r}function UH(t,e,i){const{type:n,closed:r}=i,o=e.slice(0).reverse();let s="",a="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=o[0],l=i.center;s=GH(t,!!r),a=GH(o,!!r);const h=We.distancePP(n,l),c=We.distancePP(e,l);s+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,a+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;s=KH(e,t,!1,!!r),a=KH(e,o,!0,!!r)}else"line"!==n&&"polygon"!==n||(s=GH(t,!!r),a=GH(o,!!r));return r?s+=a:(a="L"+a.substring(1),s+=a,s+="Z"),s}NH.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class VH extends PH{constructor(t){super(ne({},VH.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:r,depth:o=0}=this.attribute;if(!Yt(e)&&(e.forEach(((e,r)=>{const{id:s,points:a}=e;let l="";if("line"===t||"polygon"===t)l=GH(a,!!n);else if("circle"===t){const{center:t}=this.attribute;l=KH(t,a,!1,!!n)}const h=lS(Object.assign({path:l,z:o},Ht(i)?ne({},VH.defaultAttributes.style,i(e,r)):i));h.name=`${this.name}-line`,h.id=this._getNodeId(`path-${s}`),this.add(h)})),o&&"line"===t&&e.forEach(((t,e)=>{const{id:r,points:s}=t,a=[];a.push(s[0]);const l=s[1].x-s[0].x,h=s[1].y-s[0].y,c=Math.sqrt(l*l+h*h),u=o/c;a.push({x:s[0].x+l*u,y:s[0].y+h*u});const d=GH(a,!!n),p=Be(a[0].x-a[1].x),f=Be(a[0].y-a[1].y),g=lS(Object.assign({path:d,z:0,alpha:p>f?(s[1].x-s[0].x>0?-1:1)*_e/2:0,beta:p<f?-_e/2:0,anchor3d:p>f?[a[0].x,0]:[0,a[0].y]},Ht(i)?ne({},VH.defaultAttributes.style,i(t,e)):i));g.name=`${this.name}-line`,g.id=this._getNodeId(`path-${r}`),this.add(g)})),e.length>1&&r)){const t=Wt(r)?r:[r,"transparent"],i=e=>t[e%t.length];for(let t=0;t<e.length-1;t++){const[n,r]=[e[t].points,e[t+1].points],o=lS({path:UH(n,r,this.attribute),fill:i(t)});o.name=`${this.name}-region`,o.id=this._getNodeId(`region-${t}`),this.add(o)}}}_getNodeId(t){return`${this.id}-${t}`}}VH.defaultAttributes={style:{lineWidth:1,stroke:"#416180"},zIndex:0};class $H extends PH{constructor(t){super(ne({},$H.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=aS(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),Yt(null==r?void 0:r.line)||(h.states=r.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,r=this._endAngle,{points:o,state:s}=this.attribute,a=o[0],l=o[o.length-1],{refX:h=0,refY:c=0,refAngle:u=0,style:d,symbolType:p,size:f=12}=t;let g,y;"start"===e?(g={x:a.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:a.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},y=n+Math.PI/2):(g={x:l.x+(r?h*Math.cos(r)+c*Math.cos(r-Math.PI/2):0),y:l.y+(r?h*Math.sin(r)+c*Math.sin(r-Math.PI/2):0)},y=r+Math.PI/2),i=uS(Object.assign(Object.assign(Object.assign({},g),{symbolType:p,size:f,angle:y+u,strokeBoundsBuffer:0}),d)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),Yt(null==s?void 0:s.symbol)||(i.states=s.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}$H.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(WH||(WH={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(zH||(zH={}));const YH={[zH.selectedReverse]:{},[zH.selected]:{},[zH.hover]:{},[zH.hoverReverse]:{}},XH={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var qH=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 ZH extends PH{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&&!Yt(e.states)&&(e.addState(OH.hover,!0),HH(this.axisContainer,(t=>{t!==e&&t.name&&!Yt(t.states)&&t.addState(OH.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(HH(this.axisContainer,(t=>{t.name&&!Yt(t.states)&&(t.removeState(OH.hoverReverse),t.removeState(OH.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(OH.selected))return this._lastSelect=null,void HH(this.axisContainer,(t=>{t.name&&!Yt(t.states)&&(t.removeState(OH.selectedReverse),t.removeState(OH.selected))}));e.name&&!Yt(e.states)&&(e.addState(OH.selected,!0),HH(this.axisContainer,(t=>{t!==e&&t.name&&!Yt(t.states)&&t.addState(OH.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=Qt(this.attribute);ne(this.attribute,t);const i=sS({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=sS({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,grid:o,items:s,panel:a}=this.attribute,l=sS({x:0,y:0,zIndex:1});if(l.name=WH.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==r?void 0:r.visible)&&this.renderLine(l),s&&s.length){if(this.data=this._transformItems(s[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=sS({x:0,y:0,pickable:!1});t.name=WH.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),s.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,s.length)}))}(null==o?void 0:o.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),a&&a.visible){const t=l.AABBBounds,e=hS(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},a.style));e.name=WH.background,e.id=this._getNodeId("background"),Yt(a.state)||(e.states=ne({},DH,a.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=sS({x:0,y:0,pickable:!1});i.name=WH.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var r;const o=aS(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(o.name=WH.tick,o.id=this._getNodeId(t.id),Yt(null===(r=this.attribute.tick)||void 0===r?void 0:r.state))o.states=null;else{const t=this.data[n],e=ne({},DH,this.attribute.tick.state);Object.keys(e).forEach((i=>{Ht(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=aS(Object.assign({},this._getTickLineAttribute("subTick",t,r,e)));if(o.name=WH.subTick,o.id=this._getNodeId(`${r}`),Yt(n.state))o.states=null;else{const i=ne({},DH,n.state);Object.keys(i).forEach((n=>{Ht(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&&Ht(n)&&(e=n(e,i));const r=this._transformItems(e),o=sS({x:0,y:0,pickable:!1});o.name=`${WH.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=cS(u);if(d.name=WH.label,d.id=this._getNodeId(`layer${i}-label-${t.id}`),Yt(null===(n=this.attribute.label)||void 0===n?void 0:n.state))d.states=null;else{const n=ne({},DH,this.attribute.label.state);Object.keys(n).forEach((o=>{Ht(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 NH(Object.assign({},e));i.name=WH.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return pe(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:r=!1,length:o,dataFilter:s}=t;let a=1;return e.length>=2&&(a=e[1].value-e[0].value),(s&&Ht(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;Be(n[0])>Be(n[1])?a=_e/2*(l.x>e.x?1:-1):h=_e/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=Xt(this.attribute,`${t}.style`);const o=this.data[i];r=Ht(r)?ne({},Xt(XH,`${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=qH(c,["space","inside","formatMethod"]);let g=u,y=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&&(y=(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&&(y=Math.max(y,(null===(h=this.attribute.subTick)||void 0===h?void 0:h.length)||2)),g+=y;const m=this.getRelativeVector(t.point);n>0&&(0===m[1]?g+=(this.axisLabelLayerSize[n-1].height+Xt(this.attribute,"label.space",4))*n:g+=(this.axisLabelLayerSize[n-1].width+Xt(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;return C=Ht(C)?ne({},XH.label.style,C(t,e,i,n)):C,C=ne({textAlign:this.getTextAlign(v),textBaseline:this.getTextBaseline(v,d)},C),Ht(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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new VH(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${WH.grid}-sub`:`${WH.grid}`,n.id=this._getNodeId(t),e.add(n)}}const JH={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&&QH(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function QH(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function tL(t,e){for(let i,n=1,r=t.length,o=t[0].AABBBounds;n<r;o=i,++n)if(QH(o,i=t[n].AABBBounds,e))return!0}function eL(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function iL(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=mi(t,i),o=mi(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=yi(t),l=yi(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:gi(t.angle);let g=i?t.angle+Se:gi(90-t.angle);const y=i?e.angle:gi(e.angle);let m=i?e.angle+Se:gi(90-e.angle);g>Te&&(g-=Te),m>Te&&(m-=Te);const b=(t,e,i,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(pi(r,i)+pi(r,n))/2>pi(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,y,c,u)&&b((e.y2-e.y1)/2,m,c,u)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function nL(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const r=e/(.5*Math.PI);let o;o=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[o],textBaseline:n[o],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let r=t.attribute.angle||0;if(r<0)for(;r<0;)r+=2*Math.PI;if(r>0)for(;r>=2*Math.PI;)r-=2*Math.PI;const o=r/(.5*Math.PI);let s;s=o===Math.floor(o)?2*Math.floor(o):2*Math.floor(o)+1,t.setAttributes({textAlign:i[s],textBaseline:n[s],angle:r})}))}(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)}var rL=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 oL extends ZH{constructor(t,e){super(ne({},oL.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}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=rL(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),p=Object.assign({points:[e,i],startSymbol:o,endSymbol:s,lineStyle:a},d);Yt(u)||(p.state={line:ne({},YH,u),symbol:ne({},YH,u)});const f=new $H(p);f.name=WH.line,f.id=this._getNodeId("line"),t.add(f)}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(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*i)}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,y=rL(l,["position","space","textStyle","autoRotate","shape","background","state"]);let m=.5;"start"===h?m=0:"end"===h&&(m=1);const{verticalFactor:b=1}=this.attribute,v=-1*b,w=this.getTickCoord(m),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=+Xt(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);let B,R,{angle:M}=y;if(B="start"===h?"start":"end"===h?"end":"center",Lt(M)&&d){M=LH(C,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else B=this.getTextAlign(T),R=this.getTextBaseline(T,!1);const P=Object.assign(Object.assign(Object.assign({},A),y),{textStyle:Object.assign({textAlign:B,textBaseline:R},u),state:Yt(g)?null:{text:g.text,shape:g.shape,panel:g.background}});return P.angle=M,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}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:r=kH,endAngle:o=IH}=this.attribute.grid;i=function(t,e,i,n,r){const o=[],s=r-n;for(let r=0;r<e;r++){const a=n+r*s/e;o.push(Ue(t,i,a))}return o}(t,n,We.distancePP(t,e),r,o)}return i}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute.grid;let n,r=1;this.data.length>=2&&(r=this.data[1].value-this.data[0].value);let o=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:o}=n;if(!i){const t=n.value-r/2;if(this.isInValidValue(t))return;o=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,o)})})),o=t}else{n=ne({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:s=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-r/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i<n.length-1;i++){const r=n[i],o=n[i+1];t.push({id:`sub-${i}-0`,points:this._getGridPoint(e,this.getTickCoord(r.value)),datum:{}});for(let n=0;n<s;n++){const a=(n+1)/(s+1),l=(1-a)*r.value+a*o.value,h=this.getTickCoord(l);t.push({id:`sub-${i}-${n+1}`,points:this._getGridPoint(e,h),datum:{}})}i===n.length-2&&t.push({id:`sub-${i}-${s+1}`,points:this._getGridPoint(e,this.getTickCoord(o.value)),datum:{}})}o=t}}return Object.assign(Object.assign({},n),{items:o})}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,r=(e?1:-1)*n;return pe(t[1],0)?i=pe(t[0],0)?1===r?"bottom":"top":"middle":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var r,o,s;if(Yt(t))return;const{verticalLimitSize:a,label:l,title:h,line:c,tick:u,orient:d}=this.attribute,p=null!==(r=l.space)&&void 0!==r?r:4;let f=a,g=0,y=0;const m=(null==c?void 0:c.visible)?null!==(o=c.style.lineWidth)&&void 0!==o?o:1:0,b=(null==u?void 0:u.visible)?null!==(s=u.length)&&void 0!==s?s:4:0;(null==h?void 0:h.visible)&&(g=FH(h.text,h.textStyle).height,y=h.space),f&&(f=(f-p-y-g-m-b)/n);const{layoutFunc:v,autoRotate:w,autoRotateAngle:C,autoLimit:x,limitEllipsis:_,autoHide:S,autoHideMethod:A,autoHideSeparation:T}=l;Ht(v)?v(t,e,i,this):(w&&function(t,e){if(Yt(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=Ge(e)})),nL(i,t),!iL(t))break}}(t,{labelRotateAngle:C,orient:d}),x&&Gt(f)&&f>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:r}=e;!Yt(t)&&Gt(i)&&t.forEach((t=>{const e=0===t.attribute.angle||Lt(t.attribute.angle)?"top"===r||"bottom"===r?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:f,ellipsis:_,orient:d}),S&&function(t,e){if(Yt(t))return;const i=t.filter(eL);if(Yt(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=Ht(r)?r:JH[r]||JH.parity;if(n.length>=3&&tL(n,o)){do{n=s(n,o)}while(n.length>=3&&tL(n,o));n.length<3&&!ae(i).attribute.opacity&&(n.length>1&&ae(n).setAttribute("opacity",0),ae(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:d,method:A,separation:T}))}}oL.defaultAttributes=XH;const sL={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class aL extends PH{getCurrent(){return this._current}constructor(t){super(ne({},aL.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 Fv("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 Fv("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=sL,total:n,defaultCurrent:r=1,textStyle:o,padding:s=0}=this.attribute;this._current=r;const a=Ci(s),l="horizontal"===e,h=sS({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 y=uS(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:f,size:u}));y.states=p,y.name="preHandler",this.preHandler=y,h.add(y);const{width:m,height:b}=FH(`${n}/${n}`,Object.assign({textAlign:"center",textBaseline:"middle"},o)),v=Nt(u)?u:u[0],w=Nt(u)?u:u[1],C=cS(Object.assign({x:l?v/2+d+m/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=uS(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:l?v+2*d+m: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?(y.addState("disable"),x.addState("disable")):1===this._current?y.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}}aL.defaultAttributes={handler:sL,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const lL=16,hL=8,cL=12;var uL,dL,pL;!function(t){t.selected="selected",t.unSelected="unSelected",t.selectedHover="selectedHover",t.unSelectedHover="unSelectedHover",t.focus="focus"}(uL||(uL={})),function(t){t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.legendItemClick="legendItemClick"}(dL||(dL={})),function(t){t.innerView="innerView",t.title="legendTitle",t.item="legendItem",t.itemShape="legendItemShape",t.itemLabel="legendItemLabel",t.itemValue="legendItemValue",t.focus="legendItemFocus"}(pL||(pL={}));class fL extends PH{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:t=!0,title:e,padding:i=0}=this.attribute,n=Ci(i),r=sS({x:n[3],y:n[0],pickable:t,childrenPickable:t});r.name=pL.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:Ci(n),minWidth:o,maxWidth:s};a&&a.visible&&(l.shape=Object.assign({visible:!0},a.style),kt(a.space)&&(l.space=a.space)),r&&r.visible&&(l.panel=Object.assign({visible:!0},r.style));const h=new NH(l);h.name=pL.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 gL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var 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 yL={[uL.focus]:{},[uL.selected]:{},[uL.selectedHover]:{},[uL.unSelected]:{},[uL.unSelectedHover]:{}};class mL extends fL{constructor(t){super(ne({},mL.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(pL.item)){const t=i.delegate;t.hasState(uL.selected)?this._setLegendItemState(t,uL.selectedHover):this._setLegendItemState(t,uL.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===pL.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(dL.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(pL.item)){const t=i.delegate;t.removeState(uL.unSelectedHover),t.removeState(uL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(uL.unSelectedHover),t.removeState(uL.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===pL.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(dL.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(pL.item)){const t=s.delegate;if(s.name===pL.focus){const e=t.hasState(uL.focus);t.toggleState(uL.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[uL.unSelected,uL.unSelectedHover,uL.focus]),this._setLegendItemState(t,uL.selected)})):(this._setLegendItemState(t,uL.selected),this._removeLegendItemState(t,[uL.unSelected,uL.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[uL.selected,uL.selectedHover,uL.focus]),this._setLegendItemState(e,uL.unSelected))})))}else{null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((t=>{t.removeState(uL.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(uL.selected),s=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===s.length)return void this._dispatchEvent(dL.legendItemClick,t);n?(this._removeLegendItemState(t,[uL.selected,uL.selectedHover]),this._setLegendItemState(t,uL.unSelected)):(this._setLegendItemState(t,uL.selected),this._removeLegendItemState(t,[uL.unSelected,uL.unSelectedHover]))}else this._setLegendItemState(t,uL.selected),this._removeLegendItemState(t,[uL.unSelected,uL.unSelectedHover]),null===(o=this._itemsContainer)||void 0===o||o.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[uL.selected,uL.selectedHover]),this._setLegendItemState(e,uL.unSelected))}))}this._dispatchEvent(dL.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,uL.selected),this._removeLegendItemState(e,[uL.unSelected,uL.unSelectedHover])):(this._removeLegendItemState(e,[uL.selected,uL.selectedHover]),this._setLegendItemState(e,uL.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:r=2}=this.attribute;if(!1===t.visible||Yt(e))return;let o=e;i&&(o=null==e?void 0:e.reverse());const s=sS({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=lL,spaceRow:f=hL,maxWidth:g,width:y,height:m}=t;kt(g)?kt(y)?this._itemWidthByUser=Math.min(g,y):this._itemWidthByUser=g:kt(y)&&(this._itemWidthByUser=y),kt(m)&&(this._itemHeightByUser=m);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,!!Yt(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,kt(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,kt(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()+Xt(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=Ci(l);let y;!1===f.visible?(y=sS({x:0,y:0,cursor:(null==f?void 0:f.style).cursor}),this._appendDataToShape(y,pL.item,t,y)):(y=sS(Object.assign({x:0,y:0},null==f?void 0:f.style)),this._appendDataToShape(y,pL.item,t,y,null==f?void 0:f.state)),y.addState(e?uL.selected:uL.unSelected);const m=sS({x:0,y:0,pickable:!1});y.add(m);let b=0;const v=Xt(u,"style.size",10),w=Xt(u,"space",8),C=uS(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&&Lt(u.state[t].fill)&&e&&(u.state[t].fill=e),a.stroke&&Lt(u.state[t].stroke)&&e&&(u.state[t].stroke=e)})),this._appendDataToShape(C,pL.itemShape,t,y,null==u?void 0:u.state),C.addState(e?uL.selected:uL.unSelected),m.add(C);let _=0;if(h){const e=Xt(c,"size",10);x=uS(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},c),{visible:!1,pickMode:"imprecise",boundsPadding:g})),this._appendDataToShape(x,pL.focus,t,y),_=e}const S=cS(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,pL.itemLabel,t,y,null==d?void 0:d.state),S.addState(e?uL.selected:uL.unSelected),m.add(S);const A=Xt(d,"space",8);if(b+=v/2+w+S.AABBBounds.width()+A,kt(s)){const n=Xt(p,"space",h?8:0),r=cS(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}));this._appendDataToShape(r,pL.itemValue,t,y,null==p?void 0:p.state),r.addState(e?uL.selected:uL.unSelected),this._itemWidthByUser&&(r.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-v-w-S.AABBBounds.width()-A-_-n),p.alignRight&&r.setAttributes({textAlign:"right",x:this._itemWidthByUser-v/2-g[1]-g[3]-_-n})),b=r.AABBBounds.x2+n,m.add(r)}else this._itemWidthByUser&&S.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-v-w-_);x&&(x.setAttribute("x",b),m.add(x));const T=m.AABBBounds,B=T.width(),R=T.height(),M=this._itemWidthByUser||B+g[1]+g[3],P=this._itemHeightByUser||R+g[0]+g[2];return y.attribute.width=M,y.attribute.height=P,m.translateTo(-T.x1+g[3],-T.y1+g[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+Xt(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:r=1,maxRow:o=2,item:s={},pager:a={}}=this.attribute,{spaceCol:l=lL,spaceRow:h=hL}=s,c=this._itemsContainer,{animation:u=!0,animationDuration:d=450,animationEasing:p="quadIn",space:f=cL}=a,g=gL(a,["animation","animationDuration","animationEasing","space"]);let y,m=0,b=0,v=0,w=0,C=1;if(t){if(y=new aL(Object.assign({layout:1===o?"horizontal":"vertical",total:99},ne({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},g))),this._pager=y,this._innerView.add(y),m=(o-1)*h+this._itemHeight*o,b=i-y.AABBBounds.width()-f,b<=0)return this._innerView.removeChild(y),!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})),y.setAttributes({total:Math.ceil(C/o),x:b,y:e+m/2-y.AABBBounds.height()/2})}else{if(y=new aL(Object.assign({layout:"horizontal",total:99},g)),this._pager=y,this._innerView.add(y),b=this._itemMaxWidth*r+(r-1)*l,m=n-y.AABBBounds.height()-f-e,m<=0)return this._innerView.removeChild(y),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m<w+i&&(w=0,v+=this._itemMaxWidth+l,C+=1),e>0&&t.setAttributes({x:v,y:w}),w+=h+i})),y.setAttributes({total:Math.ceil(C/r),x:(b-y.AABBBounds.width())/2,y:n-y.AABBBounds.height()})}a.defaultCurrent>1&&(t?c.setAttribute("y",-(a.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(a.defaultCurrent-1)*(b+l)));const x=sS({x:0,y:e,width:b,height:m,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)*(m+h)}:{x:-(i-1)*(b+l)},d,p):t?c.setAttribute("y",-(i-1)*(m+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];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==pL.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==pL.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(uL.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=ne({},yL,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 Fv(t,{item:e,data:e.data,selected:e.hasState(uL.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=ne({},t);return t.style&&Ht(t.style)&&(o.style=t.style(e,i,n,r)),t.state&&Object.keys(t.state).forEach((s=>{t.state[s]&&Ht(t.state[s])&&(o.state[s]=t.state[s](e,i,n,r))})),o}}var bL;function vL(t){switch(t){case bL.Linear:case bL.Log:case bL.Pow:case bL.Sqrt:case bL.Symlog:case bL.Time:return!0;default:return!1}}mL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:lL,spaceRow:hL,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:cL,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bL||(bL={}));class wL{_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}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const CL=Symbol("implicit");class xL extends wL{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=bL.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=CL}clone(){return(new xL).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!Lt(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==CL)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;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 _L(t){return t}function SL(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 AL(t,e,i){const n=t[0],r=t[1],o=e[0],s=e[1];let a,l;return r<n?(a=SL(r,n),l=i(s,o)):(a=SL(n,r),l=i(o,s)),t=>l(a(t))}function TL(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]=SL(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(Lt(n)&&(n=t.length);i<n;){const r=i+n>>>1;he(t[r],e)>0?n=r:i=r+1}return i}(t,e,1,n)-1;return o[i](r[i](e))}}function BL(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=be(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 RL extends xL{constructor(t){super(),this.type=bL.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=function(t,e,i){kt(e)||(e=t,t=0),kt(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}(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=[ce(t[0]),ce(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[ce(t[0]),ce(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:BL(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 BL(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=be(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&&!fe(t,o+i)||s&&!ge(t,o-i)))break;if(e===r-1)break;if(!ge(t,o-i)&&!fe(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 RL(!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:ML}=ii;function PL(t,e){const i=typeof e;let n;if(Lt(e)||"boolean"===i)return()=>e;if("number"===i)return we(t,e);if("string"===i){if(n=ti.parseColorString(e)){const e=ML(ti.parseColorString(t),n);return t=>e(t).formatRgb()}return we(Number(t),Number(e))}return e instanceof ei?ML(t,e):e instanceof ti?ML(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):we(Number(t),Number(e))}class EL extends wL{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_L,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_L;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=_L,this._piecewise=AL,this._interpolate=PL}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),we)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,ce);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ce,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e<i&&this._forceAlign){const t=i-e+1,r=this._domain[e-1],o=e>=2?(r-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=r-o*(t-i);n=i}return void 0===this._clamp&&(this._clamp=be(this._domain[0],this._domain[n-1])),this._piecewise=n>2?TL:AL,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:_L),this.rescale(i)):this._clamp!==_L}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 HL=Math.sqrt(50),LL=Math.sqrt(10),kL=Math.sqrt(2);function IL(t,e,i){const n=(e-t)/Math.max(0,i),r=Math.floor(Math.log(n)/Math.LN10),o=n/10**r;let s=1;return o>=HL?s=10:o>=LL?s=5:o>=kL&&(s=2),r>=0?s*10**r:-(10**-r)/s}function OL(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 DL(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=IL(s,a,n),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 FL extends EL{constructor(){super(...arguments),this.type=bL.Linear}clone(){return(new FL).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,r,o,s,a=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e<t)&&(r=t,t=e,e=r),s=IL(t,e,i),!isFinite(s))return[];if(s>0){let i=Math.round(t/s),n=Math.round(e/s);for(i*s<t&&++i,n*s>e&&--n,o=new Array(r=n-i+1);++a<r;)o[a]=(i+a)*s}else{s=-s;let i=Math.round(t*s),n=Math.round(e*s);for(i/s<t&&++i,n/s>e&&--n,o=new Array(r=n-i+1);++a<r;)o[a]=(i+a)/s}return n&&o.reverse(),o}(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return OL(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;const e=DL(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=DL(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=DL(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}let WL=class t extends PH{constructor(e){super(ne({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,y,m,b,v,w,C,x,_,S,A,T,B,R,M,P,E,H,L,k,I,O,D,F,W,z,j,N,G,K,U,V,$,Y,X,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:yt,maxHeight:mt,align:bt,verticalAlign:vt,padding:wt=0}=this.attribute,Ct=Ci(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&&kt(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 kt(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&&kt(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!==(m=null!==(y=ut.width)&&void 0!==y?y:dt)&&void 0!==m?m: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 kt(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),Rt=_t+(null!==(T=null==ut?void 0:ut.height)&&void 0!==T?T:At);if(kt(dt)&&(Bt=dt,null===(B=this._mainTitle)||void 0===B||B.setAttribute("maxLineWidth",dt),null===(R=this._subTitle)||void 0===R||R.setAttribute("maxLineWidth",dt)),kt(pt)&&(Rt=pt),kt(ft)&&Bt<ft&&(Bt=ft),kt(gt)&&(null===(M=this._mainTitle)||void 0===M||M.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)),kt(yt)&&Rt<yt&&(Rt=yt),kt(mt)&&(null===(L=this._mainTitle)||void 0===L||L.setAttribute("maxHeight",mt),null===(k=this._subTitle)||void 0===k||k.setAttribute("maxHeight",mt-_t),Rt>mt&&(Rt=mt)),xt.attribute.width=Bt+Ct[1]+Ct[3],xt.attribute.height=Rt+Ct[0]+Ct[2],kt(bt)||kt(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===(W=this._mainTitle)||void 0===W||W.setAttribute("textAlign","center")):"right"===t&&(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","right"))}if(kt(vt)||kt(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===(K=this._mainTitle)||void 0===K||K.setAttribute("y",e/2),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(V=this._mainTitle)||void 0===V||V.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(kt(bt)||kt(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:bt,e=null!==(Y=null==ut?void 0:ut.width)&&void 0!==Y?Y:Tt;"left"===t?(null===(X=this._subTitle)||void 0===X||X.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(kt(vt)||kt(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 zL(t){return Yt(t)||t.angle&&(t.angle=Ge(t.angle)),t}function jL(t={}){return Yt(t.style)||(t.style=zL(t.style)),Yt(t.state)||Object.keys(t.state).forEach((e=>{Yt(t.state[e])||(t.state[e]=zL(t.state[e]))})),t}function NL(t){return Yt(t)?null:(Object.keys(t).forEach((e=>{Yt(t[e])||(t[e]=zL(t[e]))})),t)}WL.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 GL={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}},KL=14,UL=4,VL={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:UL,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,tickSize:UL/2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},label:{visible:!0,space:0,style:{fontSize:KL,fill:"#89909D",fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:KL,fill:"#333333",fontWeight:"normal",fillOpacity:1}}};function $L(t){return"bottom"===t||"top"===t}class YL{_scale;_scales;bandPadding;paddingInner;paddingOuter;constructor(){this._scale=new RL,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=Wt(i),s=Wt(n),a=Wt(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 XL(){return new qL}function qL(){this.reset()}qL.prototype={constructor:qL,reset:function(){this.s=this.t=0},add:function(t){JL(ZL,t,this.t),JL(this,ZL.s,this.s),this.s?this.t+=ZL.t:this.s=ZL.t},valueOf:function(){return this.s}};var ZL=new qL;function JL(t,e,i){var n=t.s=e+i,r=n-e,o=n-r;t.t=e-o+(i-r)}var QL=1e-6,tk=Math.PI,ek=tk/2,ik=tk/4,nk=2*tk,rk=180/tk,ok=tk/180,sk=Math.abs,ak=Math.atan,lk=Math.atan2,hk=Math.cos,ck=Math.exp,uk=Math.log,dk=Math.sin,pk=Math.sign||function(t){return t>0?1:t<0?-1:0},fk=Math.sqrt,gk=Math.tan;function yk(t){return t>1?ek:t<-1?-ek:Math.asin(t)}function mk(){}function bk(t,e){t&&wk.hasOwnProperty(t.type)&&wk[t.type](t,e)}var vk={Feature:function(t,e){bk(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,r=i.length;++n<r;)bk(i[n].geometry,e)}},wk={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){Ck(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)Ck(i[n],e,0)},Polygon:function(t,e){xk(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)xk(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,r=i.length;++n<r;)bk(i[n],e)}};function Ck(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 xk(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)Ck(t[i],e,1);e.polygonEnd()}function _k(t,e){t&&vk.hasOwnProperty(t.type)?vk[t.type](t,e):bk(t,e)}function Sk(t){return[lk(t[1],t[0]),yk(t[2])]}function Ak(t){var e=t[0],i=t[1],n=hk(i);return[n*hk(e),n*dk(e),dk(i)]}function Tk(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Bk(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 Rk(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Mk(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Pk(t){var e=fk(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Ek(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 Hk(t,e){return[sk(t)>tk?t+Math.round(-t/nk)*nk:t,e]}function Lk(t,e,i){return(t%=nk)?e||i?Ek(Ik(t),Ok(e,i)):Ik(t):e||i?Ok(e,i):Hk}function kk(t){return function(e,i){return[(e+=t)>tk?e-nk:e<-tk?e+nk:e,i]}}function Ik(t){var e=kk(t);return e.invert=kk(-t),e}function Ok(t,e){var i=hk(t),n=dk(t),r=hk(e),o=dk(e);function s(t,e){var s=hk(e),a=hk(t)*s,l=dk(t)*s,h=dk(e),c=h*i+a*n;return[lk(l*r-c*o,a*i-h*n),yk(c*r+l*o)]}return s.invert=function(t,e){var s=hk(e),a=hk(t)*s,l=dk(t)*s,h=dk(e),c=h*r-l*o;return[lk(l*r+h*o,a*i+c*n),yk(c*i-a*n)]},s}function Dk(t,e){(e=Ak(e))[0]-=t,Pk(e);var i,n=(i=-e[1])>1?0:i<-1?tk:Math.acos(i);return((-e[2]<0?-n:n)+nk-QL)%nk}function Fk(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:mk,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Wk(t,e){return sk(t[0]-e[0])<QL&&sk(t[1]-e[1])<QL}function zk(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 jk(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(Wk(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*QL}a.push(i=new zk(n,t,null,!0)),l.push(i.o=new zk(n,null,i,!1)),a.push(i=new zk(s,t,null,!1)),l.push(i.o=new zk(s,null,i,!0))}})),a.length){for(l.sort(e),Nk(a),Nk(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 Nk(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}}Hk.invert=Hk;var Gk,Kk,Uk=XL();function Vk(t){return sk(t[0])<=tk?t[0]:pk(t[0])*((sk(t[0])+tk)%nk-tk)}function $k(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Yk(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 Xk(t,e,i,n){return function(r){var o,s,a,l=e(r),h=Fk(),c=e(h),u=!1,d={point:p,lineStart:g,lineEnd:y,polygonStart:function(){d.point=m,d.lineStart=b,d.lineEnd=v,s=[],o=[]},polygonEnd:function(){d.point=p,d.lineStart=g,d.lineEnd=y,s=Yk(s);var t=function(t,e){var i=Vk(e),n=e[1],r=dk(n),o=[dk(i),-hk(i),0],s=0,a=0;Uk.reset(),1===r?n=ek+QL:-1===r&&(n=-ek-QL);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=Vk(d),f=d[1]/2+ik,g=dk(f),y=hk(f),m=0;m<u;++m,p=v,g=C,y=x,d=b){var b=c[m],v=Vk(b),w=b[1]/2+ik,C=dk(w),x=hk(w),_=v-p,S=_>=0?1:-1,A=S*_,T=A>tk,B=g*C;if(Uk.add(lk(B*S*dk(A),y*x+B*hk(A))),s+=T?_+S*nk:_,T^p>=i^v>=i){var R=Bk(Ak(d),Ak(b));Pk(R);var M=Bk(o,R);Pk(M);var P=(T^_>=0?-1:1)*yk(M[2]);(n>P||n===P&&(R[0]||R[1]))&&(a+=T^_>=0?1:-1)}}return(s<-QL||s<QL&&Uk<-QL)^1&a}(o,n);s.length?(u||(r.polygonStart(),u=!0),jk(s,Zk,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 y(){d.point=p,l.lineEnd()}function m(t,e){a.push([t,e]),c.point(t,e)}function b(){c.lineStart(),a=[]}function v(){m(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(qk))}return d}}function qk(t){return t.length>1}function Zk(t,e){return((t=t.x)[0]<0?t[1]-ek-QL:ek-t[1])-((e=e.x)[0]<0?e[1]-ek-QL:ek-e[1])}1===(Gk=$k).length&&(Kk=Gk,Gk=function(t,e){return $k(Kk(t),e)});var Jk=Xk((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?tk:-tk,l=sk(o-i);sk(l-tk)<QL?(t.point(i,n=(n+s)/2>0?ek:-ek),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):r!==a&&l>=tk&&(sk(i-r)<QL&&(i-=r*QL),sk(o-a)<QL&&(o-=a*QL),n=function(t,e,i,n){var r,o,s=dk(t-i);return sk(s)>QL?ak((dk(e)*(o=hk(n))*dk(i)-dk(n)*(r=hk(e))*dk(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*ek,n.point(-tk,r),n.point(0,r),n.point(tk,r),n.point(tk,0),n.point(tk,-r),n.point(0,-r),n.point(-tk,-r),n.point(-tk,0),n.point(-tk,r);else if(sk(t[0]-e[0])>QL){var o=t[0]<e[0]?tk:-tk;r=i*o/2,n.point(-o,r),n.point(0,r),n.point(o,r)}else n.point(e[0],e[1])}),[-tk,-ek]);function Qk(t){var e=hk(t),i=6*ok,n=e>0,r=sk(e)>QL;function o(t,i){return hk(t)*hk(i)>e}function s(t,i,n){var r=[1,0,0],o=Bk(Ak(t),Ak(i)),s=Tk(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var h=e*s/l,c=-e*a/l,u=Bk(r,o),d=Mk(r,h);Rk(d,Mk(o,c));var p=u,f=Tk(d,p),g=Tk(p,p),y=f*f-g*(Tk(d,d)-1);if(!(y<0)){var m=fk(y),b=Mk(p,(-f-m)/g);if(Rk(b,d),b=Sk(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=sk(S-tk)<QL;if(!A&&_<x&&(v=x,x=_,_=v),A||S<QL?A?x+_>0^b[1]<(sk(b[0]-w)<QL?x:_):x<=b[1]&&b[1]<=_:S>tk^(w<=b[0]&&b[0]<=C)){var T=Mk(p,(-f+m)/g);return Rk(T,d),[b,Sk(T)]}}}function a(e,i){var r=n?t:tk-t,o=0;return e<-r?o|=1:e>r&&(o|=2),i<-r?o|=4:i>r&&(o|=8),o}return Xk(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),y=n?g?0:a(u,d):g?a(u+(u<0?tk:-tk),d):0;if(!e&&(h=l=g)&&t.lineStart(),g!==l&&(!(p=s(e,f))||Wk(e,p)||Wk(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 m;y&i||!(m=s(f,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!g||e&&Wk(e,f)||t.point(f[0],f[1]),e=f,l=g,i=y},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=hk(e),a=dk(e),l=n*i;null==r?(r=e+n*nk,o=e-l/2):(r=Dk(s,r),o=Dk(s,o),(n>0?r<o:r>o)&&(r+=n*nk));for(var h,c=r;n>0?c>o:c<o;c-=l)h=Sk([s,-a*hk(c),-a*dk(c)]),t.point(h[0],h[1])}}(o,t,i,r,e,n)}),n?[0,-t]:[-tk,t-tk])}var tI=1e9,eI=-tI;function iI(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 sk(n[0]-t)<QL?r>0?0:3:sk(n[0]-i)<QL?r>0?2:1:sk(n[1]-e)<QL?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,y,m,b,v=s,w=Fk(),C={point:x,lineStart:function(){C.point=_,h&&h.push(c=[]);m=!0,y=!1,f=g=NaN},lineEnd:function(){l&&(_(u,d),p&&y&&w.rejoin(),l.push(w.result()));C.point=x,y&&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=Yk(l)).length;(i||r)&&(s.polygonStart(),i&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),r&&jk(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]),m)u=o,d=s,p=a,m=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&y)v.point(o,s);else{var l=[f=Math.max(eI,Math.min(tI,f)),g=Math.max(eI,Math.min(tI,g))],w=[o=Math.max(eI,Math.min(tI,o)),s=Math.max(eI,Math.min(tI,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):(y||(v.lineStart(),v.point(l[0],l[1])),v.point(w[0],w[1]),a||v.lineEnd(),b=!1)}f=o,g=s,y=a}return C}}function nI(t){return t}var rI,oI,sI,aI,lI=XL(),hI=XL(),cI={point:mk,lineStart:mk,lineEnd:mk,polygonStart:function(){cI.lineStart=uI,cI.lineEnd=fI},polygonEnd:function(){cI.lineStart=cI.lineEnd=cI.point=mk,lI.add(sk(hI)),hI.reset()},result:function(){var t=lI/2;return lI.reset(),t}};function uI(){cI.point=dI}function dI(t,e){cI.point=pI,rI=sI=t,oI=aI=e}function pI(t,e){hI.add(aI*t-sI*e),sI=t,aI=e}function fI(){pI(rI,oI)}var gI=cI,yI=1/0,mI=yI,bI=-yI,vI=bI,wI={point:function(t,e){t<yI&&(yI=t);t>bI&&(bI=t);e<mI&&(mI=e);e>vI&&(vI=e)},lineStart:mk,lineEnd:mk,polygonStart:mk,polygonEnd:mk,result:function(){var t=[[yI,mI],[bI,vI]];return bI=vI=-(mI=yI=1/0),t}};var CI,xI,_I,SI,AI=wI,TI=0,BI=0,RI=0,MI=0,PI=0,EI=0,HI=0,LI=0,kI=0,II={point:OI,lineStart:DI,lineEnd:zI,polygonStart:function(){II.lineStart=jI,II.lineEnd=NI},polygonEnd:function(){II.point=OI,II.lineStart=DI,II.lineEnd=zI},result:function(){var t=kI?[HI/kI,LI/kI]:EI?[MI/EI,PI/EI]:RI?[TI/RI,BI/RI]:[NaN,NaN];return TI=BI=RI=MI=PI=EI=HI=LI=kI=0,t}};function OI(t,e){TI+=t,BI+=e,++RI}function DI(){II.point=FI}function FI(t,e){II.point=WI,OI(_I=t,SI=e)}function WI(t,e){var i=t-_I,n=e-SI,r=fk(i*i+n*n);MI+=r*(_I+t)/2,PI+=r*(SI+e)/2,EI+=r,OI(_I=t,SI=e)}function zI(){II.point=OI}function jI(){II.point=GI}function NI(){KI(CI,xI)}function GI(t,e){II.point=KI,OI(CI=_I=t,xI=SI=e)}function KI(t,e){var i=t-_I,n=e-SI,r=fk(i*i+n*n);MI+=r*(_I+t)/2,PI+=r*(SI+e)/2,EI+=r,HI+=(r=SI*t-_I*e)*(_I+t),LI+=r*(SI+e),kI+=3*r,OI(_I=t,SI=e)}var UI=II;function VI(t){this._context=t}VI.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,nk)}},result:mk};var $I,YI,XI,qI,ZI,JI=XL(),QI={point:mk,lineStart:function(){QI.point=tO},lineEnd:function(){$I&&eO(YI,XI),QI.point=mk},polygonStart:function(){$I=!0},polygonEnd:function(){$I=null},result:function(){var t=+JI;return JI.reset(),t}};function tO(t,e){QI.point=eO,YI=qI=t,XI=ZI=e}function eO(t,e){qI-=t,ZI-=e,JI.add(fk(qI*qI+ZI*ZI)),qI=t,ZI=e}var iO=QI;function nO(){this._string=[]}function rO(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function oO(t){return function(e){var i=new sO;for(var n in t)i[n]=t[n];return i.stream=e,i}}function sO(){}function aO(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),_k(i,t.stream(AI)),e(AI.result()),null!=n&&t.clipExtent(n),t}function lO(t,e,i){return aO(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)}nO.prototype={_radius:4.5,_circle:rO(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=rO(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}},sO.prototype={constructor:sO,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 hO=16,cO=hk(30*ok);function uO(t,e){return+e?function(t,e){function i(n,r,o,s,a,l,h,c,u,d,p,f,g,y){var m=h-n,b=c-r,v=m*m+b*b;if(v>4*e&&g--){var w=s+d,C=a+p,x=l+f,_=fk(w*w+C*C+x*x),S=yk(x/=_),A=sk(sk(x)-1)<QL||sk(o-u)<QL?(o+u)/2:lk(C,w),T=t(A,S),B=T[0],R=T[1],M=B-n,P=R-r,E=b*M-m*P;(E*E/v>e||sk((m*M+b*P)/v-.5)>.3||s*d+a*p+l*f<cO)&&(i(n,r,o,s,a,l,B,R,A,w/=_,C/=_,x,g,y),y.point(B,R),i(B,R,A,w,C,x,h,c,u,d,p,f,g,y))}}return function(e){var n,r,o,s,a,l,h,c,u,d,p,f,g={point:y,lineStart:m,lineEnd:v,polygonStart:function(){e.polygonStart(),g.lineStart=w},polygonEnd:function(){e.polygonEnd(),g.lineStart=m}};function y(i,n){i=t(i,n),e.point(i[0],i[1])}function m(){c=NaN,g.point=b,e.lineStart()}function b(n,r){var o=Ak([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],hO,e),e.point(c,u)}function v(){g.point=y,e.lineEnd()}function w(){m(),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,hO,e),g.lineEnd=v,v()}return g}}(t,e):function(t){return oO({point:function(e,i){e=t(e,i),this.stream.point(e[0],e[1])}})}(t)}var dO=oO({point:function(t,e){this.stream.point(t*ok,e*ok)}});function pO(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 fO(t,e,i,n,r,o){var s=hk(o),a=dk(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 gO(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,y=0,m=0,b=0,v=0,w=1,C=1,x=null,_=Jk,S=null,A=nI,T=.5;function B(t){return l(t[0]*ok,t[1]*ok)}function R(t){return(t=l.invert(t[0],t[1]))&&[t[0]*rk,t[1]*rk]}function M(){var t=fO(u,0,0,w,C,v).apply(null,e(f,g)),n=(v?fO:pO)(u,d-t[0],p-t[1],w,C,v);return i=Lk(y,m,b),a=Ek(e,n),l=Ek(i,a),s=uO(a,T),P()}function P(){return h=c=null,B}return B.stream=function(t){return h&&c===t?h:h=dO(function(t){return oO({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?Qk(x=t*ok):(x=null,Jk),P()):x*rk},B.clipExtent=function(t){return arguments.length?(A=null==t?(S=n=r=o=null,nI):iI(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,M()):u},B.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],M()):[d,p]},B.center=function(t){return arguments.length?(f=t[0]%360*ok,g=t[1]%360*ok,M()):[f*rk,g*rk]},B.rotate=function(t){return arguments.length?(y=t[0]%360*ok,m=t[1]%360*ok,b=t.length>2?t[2]%360*ok:0,M()):[y*rk,m*rk,b*rk]},B.angle=function(t){return arguments.length?(v=t%360*ok,M()):v*rk},B.reflectX=function(t){return arguments.length?(w=t?-1:1,M()):w<0},B.reflectY=function(t){return arguments.length?(C=t?-1:1,M()):C<0},B.precision=function(t){return arguments.length?(s=uO(a,T=t*t),P()):fk(T)},B.fitExtent=function(t,e){return lO(B,t,e)},B.fitSize=function(t,e){return function(t,e,i){return lO(t,[[0,0],e],i)}(B,t,e)},B.fitWidth=function(t,e){return function(t,e,i){return aO(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 aO(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&&R,M()}}((function(){return t}))()}function yO(t,e){return[t,uk(gk((ek+e)/2))]}yO.invert=function(t,e){return[t,2*ak(ck(e))-ek]},function(t){var e,i,n,r=gO(t),o=r.center,s=r.scale,a=r.translate,l=r.clipExtent,h=null;function c(){var o=tk*s(),a=r(function(t){function e(e){return(e=t(e[0]*ok,e[1]*ok))[0]*=rk,e[1]*=rk,e}return t=Lk(t[0]*ok,t[1]*ok,t.length>2?t[2]*ok:0),e.invert=function(e){return(e=t.invert(e[0]*ok,e[1]*ok))[0]*=rk,e[1]*=rk,e},e}(r.rotate()).invert([0,0]));return l(null==h?[[a[0]-o,a[1]-o],[a[0]+o,a[1]+o]]:t===yO?[[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()}(yO).scale(961/nk).translate([0,0]).center([0,0]).scale(63781);var mO=Object.prototype.hasOwnProperty;function bO(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 vO(t,e){return t[0]===e[0]&&t[1]===e[1]}var wO=new ArrayBuffer(16),CO=new Float64Array(wO),xO=new Uint32Array(wO);function _O(t){CO[0]=t[0],CO[1]=t[1];var e=xO[0]^xO[1];return 2147483647&(e=e<<5^e>>7^xO[2]^xO[3])}function SO(t){var e,i,n,r,o=t.coordinates,s=t.lines,a=t.rings,l=function(){for(var t=bO(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],y=f[1];for(n=l[g],r=l[++g],++p,d[n]=1;++g<=y;)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 m=a[e],b=m[0]+1,v=m[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 _O(o[t])}function x(t,e){return vO(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,_O,vO);for(e=0,i=o.length;e<i;++e)d[_=l[e]]&&S.add(o[_]);return S}function AO(t,e,i,n){TO(t,e,i),TO(t,e,e+n),TO(t,e+n,i)}function TO(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 BO(t){var e,i,n={};for(e in t)n[e]=null==(i=t[e])?{type:null}:("FeatureCollection"===i.type?RO:"Feature"===i.type?MO:PO)(i);return n}function RO(t){var e={type:"GeometryCollection",geometries:t.features.map(MO)};return null!=t.bbox&&(e.bbox=t.bbox),e}function MO(t){var e,i=PO(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 PO(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(PO)}:"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 EO(t){var e,i=t[0],n=t[1];return n<i&&(e=i,i=n,n=e),i+31*n}function HO(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 LO=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&&mO.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=BO(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&&mO.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 y in t)f(t[y]);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=bO(2*l*1.4,_O,vO),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(y(n,t))return t[0]=n[1],void(t[1]=n[0])}if(i=h.get(e=o[t[0]+m(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(y(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(!vO(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(!vO(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=m(t),a=m(e),l=0;l<r;++l)if(!vO(o[i+(l+s)%r],o[n+(l+a)%r]))return!1;return!0}function y(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=m(t),h=a-m(e),c=0;c<a;++c)if(!vO(o[i+(c+l)%a],o[s-(c+h)%a]))return!1;return!0}function m(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=SO(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):(AO(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&&mO.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=bO(1.4*r.arcs.length,EO,HO);function a(t){t&&mO.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}}),kO=Bt(LO);function IO(t){return t}function OO(t){if(null==t)return IO;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 DO(t){var e,i=OO(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 FO(t,e){var i=e.id,n=e.bbox,r=null==e.properties?{}:e.properties,o=WO(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 WO(t,e){var i=OO(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 zO(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 jO(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:zO(t,n)}}function NO(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)}(WO(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=zO(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 GO(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 KO(t){if(null==t)return IO;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 UO=Object.freeze({__proto__:null,bbox:DO,feature:function(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return FO(t,e)}))}:FO(t,e)},merge:function(t){return WO(t,NO.apply(this,arguments))},mergeArcs:NO,mesh:function(t){return WO(t,jO.apply(this,arguments))},meshArcs:jO,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=GO(u,p)]!==p&&u.splice(s,0,p),(u=i[p])[s=GO(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||DO(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=KO(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:OO,untransform:KO}),VO=Bt(UO);kO.topology,VO.merge;var $O=function(t,e){this.p1=t,this.p2=e};$O.prototype.rise=function(){return this.p2[1]-this.p1[1]},$O.prototype.run=function(){return this.p2[0]-this.p1[0]},$O.prototype.slope=function(){return this.rise()/this.run()},$O.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},$O.prototype.isVertical=function(){return!isFinite(this.slope())},$O.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},$O.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},$O.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},$O.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)},$O.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var YO,XO=$O,qO=function(t,e){for(var i=0,n=0,r=1;r<=t.length-2;r++){var o=new XO(t[0],t[t.length-1]).perpendicularDistance(t[r]);o>i&&(n=r,i=o)}if(i>e)var s=qO(t.slice(0,n),e),a=qO(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},ZO=qO;!function(t){var e=ZO;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"}(YO||(YO={}));const JO=(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[t[r.key]]&&(r.sortIndex[t[r.key]]=r.sortIndexCount++),void 0===r.sortIndex[e[r.key]]&&(r.sortIndex[e[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 QO={
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}},tD=QO;function eD(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}eD.Varint=0,eD.Fixed64=1,eD.Bytes=2,eD.Fixed32=5;var iD=4294967296,nD=1/iD,rD="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function oD(t){return t.type===eD.Bytes?t.readVarint()+t.pos:t.pos+1}function sD(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function aD(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 lD(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function hD(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function cD(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function uD(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function dD(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function pD(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function fD(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function gD(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function yD(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function mD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function bD(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function vD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}eD.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=mD(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=vD(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=mD(this.buf,this.pos)+mD(this.buf,this.pos+4)*iD;return this.pos+=8,t},readSFixed64:function(){var t=mD(this.buf,this.pos)+vD(this.buf,this.pos+4)*iD;return this.pos+=8,t},readFloat:function(){var t=tD.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=tD.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 sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return sD(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&&rD?function(t,e,i){return rD.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!==eD.Bytes)return t.push(this.readVarint(e));var i=oD(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==eD.Bytes)return t.push(this.readSVarint());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==eD.Bytes)return t.push(this.readBoolean());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==eD.Bytes)return t.push(this.readFloat());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==eD.Bytes)return t.push(this.readDouble());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==eD.Bytes)return t.push(this.readFixed32());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==eD.Bytes)return t.push(this.readSFixed32());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==eD.Bytes)return t.push(this.readFixed64());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==eD.Bytes)return t.push(this.readSFixed64());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===eD.Varint)for(;this.buf[this.pos++]>127;);else if(e===eD.Bytes)this.pos=this.readVarint()+this.pos;else if(e===eD.Fixed32)this.pos+=4;else{if(e!==eD.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),bD(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bD(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bD(this.buf,-1&t,this.pos),bD(this.buf,Math.floor(t*nD),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bD(this.buf,-1&t,this.pos),bD(this.buf,Math.floor(t*nD),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&&aD(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),tD.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),tD.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&&aD(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,eD.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,lD,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,hD,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,dD,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,cD,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,uD,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,pD,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,fD,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,gD,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,yD,e)},writeBytesField:function(t,e){this.writeTag(t,eD.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,eD.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,eD.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,eD.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,eD.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,eD.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,eD.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,eD.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,eD.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,eD.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)),_k(t,i(n))),n.result()}o.area=function(t){return _k(t,i(gI)),gI.result()},o.measure=function(t){return _k(t,i(iO)),iO.result()},o.bounds=function(t){return _k(t,i(AI)),AI.result()},o.centroid=function(t){return _k(t,i(UI)),UI.result()},o.projection=function(e){return arguments.length?(i=null==e?(t=null,nI):(t=e).stream,o):t},o.context=function(t){return arguments.length?(n=null==t?(e=null,new nO):new VI(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 wD=0;function CD(){return wD>1e8&&(wD=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+wD++}class xD{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Mt,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:CD("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 _D="_data-view-diff-rank";class SD{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Mt,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:CD("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",JO),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=Qt(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=Qt(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[_D]=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[_D]=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[_D]<e&&(this.latestDataAUD.del.push(t),this._diffMap.delete(i))}))}this._diffRank=e}cloneParseData(t,e){let i=!0;return(t instanceof SD||!1===(null==e?void 0:e.clone))&&(i=!1),i?t:Qt(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}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const AD=(t,e,i)=>new vi({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:yS,specialCharSet:"-/: .,@%'\"~"+vi.ALPHABET_CHAR_SET+vi.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),TD=(t,e)=>{const i=t.map(((t,i)=>({index:i,value:t,label:e.labelFormatter?e.labelFormatter(t):`${t}`})));return i},BD=(t,e,i=0)=>{const n=new Ne(t).expand(i/2),r=new Ne(e).expand(i/2);return n.intersects(r)},RD=(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 MD(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function PD(t,e){for(let i,n=1,r=t.length,o=t[0];n<r;o=i,++n)if(i=t[n],MD(o.AABBBounds,i.AABBBounds,e))return!0;return!1}const ED=(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=>Gt(t)?Ge(t):null)(-90));const d=AD(n),p=e.map(((i,r)=>{const a=s?s(i):`${i}`,{width:p,height:f}=d.quickMeasure(a),g=Math.max(p,12),y=Math.max(f,12),m=t.scale(i);let b,v,w=Math.cos(u)*m,C=-Math.sin(u)*m;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-=y:"middle"===v&&(C-=y/2);return(new Ne).set(w,C,w+g,C+y).rotate(l,w+g/2,C+y/2)}));return p},HD=(t,e,i)=>{const{labelStyle:n,getRadius:r,axisSpec:o,labelFormatter:s}=i,a=r?.(),l=n.angle??0,h=LD(o),c=AD(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:y,y:m}=Ue({x:0,y:0},a+h,d);p=y+("right"===g.align?-o:"center"===g.align?-o/2:0),f=m+("bottom"===g.baseline?-u:"middle"===g.baseline?-u/2:0);return(new Ne).set(p,f,p+o,f+u).rotate(l,p+o/2,f+u/2)}));return u};function LD(t){let e=0;return Xt(t,"tick.visible")&&(e+=Xt(t,"tick.tickSize")),Xt(t,"label.visible")&&(e+=Xt(t,"label.space")),e}const kD={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!MD(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},ID=(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&&BD(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&&!BD(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=RD(e[d],e[n])[t],p=d-s>=0?RD(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}},OD=(t,e,i,n)=>{let r=n;do{let n=!0;r++;let o=0;do{o+r<t.length&&BD(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&&BD(e[0],e[i]);)o++,i-=r}return{step:r,delCount:o}},DD=(t,e)=>{if(vL(t.type))return((t,e)=>{if(!vL(t.type))return TD(t.domain(),e);const{tickCount:i,forceTickCount:n,tickStep:r}=e;let o;if(o=kt(r)?t.stepTicks(r):kt(n)?t.forceTicks(n):t.ticks(i??5),"cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType){const{labelGap:i=4,labelFlush:n}=e;let r=ED(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;r.length>=3&&PD(r,i);)r=kD.parity(r);const s=r.map((t=>t.value));s.length<3&&n&&(s.length>1&&s.pop(),ae(s)!==ae(o)&&s.push(ae(o))),o=s}return TD(o,e)})(t,e);if(function(t){switch(t){case bL.Ordinal:case bL.Point:case bL.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:r,labelGap:o=4,axisOrientType:s}=e,a=["bottom","top"].includes(s);let l;if(kt(r))l=t.stepTicks(r);else if(kt(n))l=t.forceTicks(n);else if(kt(i))l=t.ticks(i);else{const i=t.domain(),n=t.range(),r=ED(t,i,e),s=r.map((t=>a?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,u=ID(i,r,o,e.labelLastVisible,a,Math.floor(Math.min(...s)/c));l=t.stepTicks(u.step),e.labelLastVisible&&(l=l.slice(0,l.length-u.delCount),l.push(i[i.length-1]))}return TD(l,e)})(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 TD(t.domain(),e);let h;if(kt(r))h=t.stepTicks(r);else if(kt(n))h=t.forceTicks(n);else if(kt(i))h=t.ticks(i);else{const i=t.domain(),n=t.range(),r=LD(s),o=HD(t,i,e),c=Math.min(...n),u=Math.max(...n),d=Math.abs(u-c)*(l+r)/i.length,{step:p,delCount:f}=OD(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)}return TD(h,e)})(t,e)}return TD(t.domain(),e)},FD=Math.sqrt(50),WD=Math.sqrt(10),zD=Math.sqrt(2);class jD{_extend={};_scale;_scales;nice;zero;domain;expand;forceTickCount;tickCount;niceType;constructor(){this._scale=new FL,this._scales=[this._scale]}setExtraAttrFromSpec(t,e,i,n){this.nice=t,this.zero=e,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)),Lt(this.domain?.min)&&Lt(this.domain?.max)?this.nice&&this._scale.nice(t):kt(this.domain?.min)&&Lt(this.domain?.max)?this.nice&&this._scale.niceMax(t):Lt(this.domain?.min)&&kt(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];kt(this.expand.min)&&(t[0]=e-(i-e)*this.expand.min),kt(this.expand.max)&&(t[t.length-1]=i+(i-e)*this.expand.max)}niceDomain(t){if(Math.abs(function(t){if(t&&Wt(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)}(t)-function(t){if(t&&Wt(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>=FD?10:r>=WD?5:r>=zD?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)),Lt(this.domain?.min)&&Lt(this.domain?.max)?this._scale.nice(t):kt(this.domain?.min)&&Lt(this.domain?.max)?this._scale.niceMax(t):Lt(this.domain?.min)&&kt(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;kt(e)&&(t[0]=e),kt(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 ND(t,e){const i=e.option;Yt(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),r=$L(e.orient),o=t[0],s=ae(t);if(r){const t=0,e=i,n=o.AABBBounds.x1,r=s.AABBBounds.x2;n<t&&o.setAttributes({x:t,textAlign:"left"}),r>e&&s.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=o.AABBBounds.y2,r=s.AABBBounds.y1;i>t&&o.setAttributes({y:t,textBaseline:"bottom"}),r<e&&s.setAttributes({y:e,textBaseline:"top"})}}(t,e)}const GD=t=>t;class KD{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=ne({},t,VL),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.data),this.initScale(),this.initData(),this.createComponent(),this.initEvent()}initScale(){const t=this.option;"band"===this.type?(this.scale=new YL,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 jD,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.dataSet,"scale",GD),function(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}(this.table.dataSet,"ticks",DD);const t=this.option.label||{},e=this.option.tick||{},i=new SD(this.table.dataSet).parse(this.scale._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this.orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this.tickData=i,this.computeData()}computeData(){this.tickData.reRunAllTransform()}initEvent(){}createComponent(){const t=function(t){const e=t;let i,n=e.title?.angle??0;return"left"!==e.orient&&"right"!==e.orient||e.title?.autoRotate&&Lt(e.title.angle)&&(n="left"===e.orient?-90:90,i=GL[e.orient]),{select:e.select,hover:e.hover,line:(r=e.domainLine,jL(r),jL(r.startSymbol),jL(r.endSymbol),r),label:{visible:e.label.visible,space:e.label.space,inside:e.label.inside,style:zL(e.label.style),formatMethod:e.label.formatMethod?(t,i,n)=>e.label.formatMethod(i.rawValue,i):null,state:NL(e.label.state)},tick:{visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,style:zL(e.tick.style),state:NL(e.tick.state)},subTick:{visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount,style:zL(e.subTick.style),state:NL(e.subTick.state)},grid:{type:"line",visible:e.grid.visible,alternateColor:e.grid.alternateColor,alignWithLabel:e.grid.alignWithLabel,style:zL(e.grid.style)},subGrid:{type:"line",visible:e.subGrid.visible,alternateColor:e.subGrid.alternateColor,style:zL(e.subGrid.style)},title:{visible:e.title.visible,position:e.title.position,space:e.title.space,autoRotate:!1,angle:n?Ge(n):null,textStyle:ne({},i,zL(e.title.style)),padding:e.title.padding,shape:{visible:e.title.shape?.visible,space:e.title.shape?.space,style:zL(e.title.shape?.style)},background:{visible:e.title.background?.visible,style:zL(e.title.background?.style)},state:{text:NL(e.title.state),shape:NL(e.title.shape?.state),background:NL(e.title.background?.state)}},panel:{visible:e.background?.visible,style:zL(e.background?.style),state:NL(e.background?.state)}};var r}(this.option),e=this.getUpdateAttribute();e.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component=new oL(ne({},t,e)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0}))}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);ND(i?i.getChildren():[],e),ND(n?n.getChildren():[],e)}(this.component,this)}getLayoutRect(){return{width:this.width,height:this.height}}getUpdateAttribute(){const t=this.table.tableNoFrameHeight,e=this.table.tableNoFrameWidth,{width:i,height:n}=this.getLayoutRect(),r=$L(this.orient),o="left"===(s=this.orient)||"right"===s;var s;let a={x:0,y:0},l=0,h=0;r?(a={x:i,y:0},l=t,h=i):o&&(a={x:0,y:n},l=e,h=n);return{start:{x:0,y:0},end:a,grid:{type:"line",length:l,visible:this.option.grid.visible},title:{text:this.option.title.text,maxWidth:this._getTitleLimit(r)},items:this.getLabelItems(h)}}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();let i=[0,0];$L(this.orient)?Gt(t)&&(i=[0,t]):Gt(e)&&(i=[e,0]),this.scale.updateRange(i)}setLayoutStartPosition(t){let{x:e,y:i}=t;return Gt(e)&&(e+=Number("left"===this.orient)*this.getLayoutRect().width),Gt(i)&&(i+=Number("top"===this.orient)*this.getLayoutRect().height),{x:e,y:i}}_getTitleLimit(t){if(this.option.title.visible&&Lt(this.option.title.style?.maxLineWidth)){const e=this.option.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}getScale(){return this.scale._scale}getDomainSpec(){return this.scale.domain}}function UD(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 VD(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 $D={SOURCE_LENGTH_UPDATE:"source_length_update",CHANGE_ORDER:"change_order"};function YD(t,e){const i=ot(t);if(st(i)){const t=i.then((t=>(e(t),t)));return e(t),t}return i}function XD(t,e,i){if(null===t)return;if(st(t))return t.then((t=>XD(t,e,i)));const n=function(t){if(ut.isObject(t)){const e=t;if(A(e.get)&&A(e.set))return!0}return!1}(e)?e.get:e;if(n in t){return YD(t[n],i)}if("function"==typeof n){return YD(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 YD(e,i)}const r=`${n}`.split(".");if(r.length<=1){return YD(t[n],i)}return YD(nt(t,((t,e)=>XD(t,e,gt)),...r),i)}function qD(t,e){if(!t)return e;const i=t[e];return A(i)?i:e}class ZD extends E{_get;_sourceLength;_source;sortedIndexMap;lastOrder;lastOrderFn;lastOrderField;currentIndexedData=[];pagerConf;_currentPagerIndexedData;enableHierarchyState=!1;static get EVENT_TYPE(){return $D}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.pagerConf=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,r.collapse)}if(i>1){let t=this._sourceLength;for(let e=0;e<t;e++){const n=this.currentIndexedData[e],o=this.getOriginalRecord(n);if(o.children?.length>0){this.treeDataHierarchyState.set(Array.isArray(n)?n.join(","):n,r.expand);const s=this.initChildrenNodeHierarchy(n,i,2,o);e+=s,t+=s}}}this.updatePagerData()}initChildrenNodeHierarchy(t,e,i,n){if(i>e)return 0;let o=0;const s=n.children?.length??0;for(let a=0;a<s;a++){o+=1;const s=n.children[a],l=Array.isArray(t)?t.concat(a):[t,a];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+o,0,l),s.children?.length>0&&(i<e?this.treeDataHierarchyState.set(Array.isArray(l)?l.join(","):l,r.expand):this.treeDataHierarchyState.set(Array.isArray(l)?l.join(","):l,r.collapse)),o+=this.initChildrenNodeHierarchy(l,e,i+1,s)}return o}updatePager(t){this.pagerConf=t||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},this.updatePagerData()}updatePagerData(){const{currentIndexedData:t}=this,{perPageCount:e,currentPage:i}=this.pagerConf,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(qD(this.currentPagerIndexedData,t))}getIndexKey(t){return qD(this.currentPagerIndexedData,t)}getField(t,e){return this.getOriginalField(qD(this.currentPagerIndexedData,t),e)}hasField(t,e){return this.hasOriginalField(qD(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),o=this.getOriginalRecord(i);if(this.clearSortedIndexMap(),n===r.collapse)this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,r.expand),this.pushChildrenNode(i,r.expand,o);else if(n===r.expand){let t=0;const e=(i,n,o)=>{if(n&&n!==r.collapse&&n!==r.none&&o.children)for(let n=0;n<o.children.length;n++){t+=1;const r=Array.isArray(i)?i.concat([n]):[i,n];e(r,this.treeDataHierarchyState.get(r.join(",")),o.children[n])}};e(i,n,o),this.currentIndexedData.splice(this.currentIndexedData.indexOf(i)+1,t),this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,r.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(VD(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(VD(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===r.collapse||e===r.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&&UD((t=>A(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 o=0;o<e.length;o++){n+=1;const s=Array.isArray(t)?t.concat([e[o]]):[t,e[o]];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+n,0,s);const a=this.treeDataHierarchyState.get(s.join(",")),l=this.getOriginalRecord(s);!a&&l.children&&this.treeDataHierarchyState.set(s.join(","),r.collapse),n+=this.pushChildrenNode(s,this.treeDataHierarchyState.get(s.join(",")),i.children[e[o]])}}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($D.CHANGE_ORDER,null);const o=[];if("normal"===e)for(let t=0;t<this._sourceLength;t++)o[t]=t;else UD((t=>A(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($D.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($D.SOURCE_LENGTH_UPDATE,this._sourceLength))}get length(){return this.currentPagerIndexedData.length}get dataSource(){return this}get currentPagerIndexedData(){return this._currentPagerIndexedData.length>0?this._currentPagerIndexedData:[]}dispose(){super.dispose?.()}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 YD(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getOriginalField(t,e){if(null===e)return;return XD(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 ZD({get(){},length:0})}class JD extends ZD{_recordCache;_fieldCache;static get EVENT_TYPE(){return ZD.EVENT_TYPE}static ofArray(t,e,i){return new JD({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}dispose(){super.dispose?.()}}var QD=Object.freeze({__proto__:null,CachedDataSource:JD,DataSource:ZD}),tF={exports:{}},eF={},iF=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"),nF=["style","variant","weight","size","lineHeight","family"],rF=/([\.0-9]+)(.*)/,oF=function(t,e,i){var n=t.match(rF);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)}}},sF={size:oF,lineHeight:oF},aF={serif:1,"sans-serif":1,cursive:1,fantasy:1,monospace:1},lF=tF.exports=function(t,e,i){var n=t+"-"+(e||"null")+"@"+i;if(i=i||96,void 0!==eF[n])return eF[n];if(e&&(e=lF(e,null,i)),"inherit"===t)return e;var r=iF.exec(t);if(r){r.shift();for(var o={},s=0;s<r.length;s++){var a=nF[s],l=r[s];if(sF[a]&&l){var h=e&&e[a]||null,c=sF[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),eF[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(),aF[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}eF[n]=null};tF.exports.generics=aF;var hF=Tt(tF.exports);function cF(t){let e=aw(t);return"number"==typeof e||"string"==typeof e?e=[e,e,e,e]:Array.isArray(e)&&(e=e.slice(0)),e}const uF=0,dF=1,pF=2,fF=3,gF=10,yF=11,mF=12,bF=9,vF=13,wF=10,CF=12,xF=32,_F=37,SF=46,AF=48,TF=57,BF=65,RF=90,MF=97,PF=122;function EF(t){return function(t){return t>=MF&&t<=PF}(t)||function(t){return t>=BF&&t<=RF}(t)}function HF(t){return t===bF||t===wF||t===CF||t===vF||t===xF}function LF(t){return t>=AF&&t<=TF}function kF(t){return t===SF}function IF(t){return EF(t)||t===_F}function OF(t){return new Error(`calc parse error: ${t}`)}const DF={"*":3,"/":3,"+":2,"-":2};function FF(t,e){function i(t){const i=t.pop(),n=t.pop(),r=t.pop();if(!(r&&r.nodeType&&n&&n.type===pF&&i&&i.nodeType))throw OF(e);return{nodeType:yF,left:r,op:n,right:i}}const n=[];for(;t.length;){const r=t.shift();if(r.type===uF&&"("===r.value){let i=0;const r=X.findIndex(t,(t=>{if(t.type===uF&&"("===t.value)i++;else if(t.type===uF&&")"===t.value){if(!i)return!0;i--}return!1}));if(-1===r)throw OF(e);n.push(FF(t.splice(0,r),e)),t.shift()}else if(r.type===pF){if(n.length>=3){const t=n[n.length-2].value;DF[r.value]<=DF[t]&&n.push(i(n))}n.push(r)}else if(r.type===dF){const{value:t,unit:e}=r;n.push({nodeType:gF,value:t,unit:e})}else r.type===fF&&n.push({nodeType:mF,value:r.value})}for(;n.length>1;)n.push(i(n));return n[0]}function WF(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:uF});else if("*"===n||"/"===n)i.push({value:n,type:pF});else if("+"===n||"-"===n)s=r(n,s+1)-1;else if(LF(a)||kF(a))s=o(n,s+1)-1;else if(!HF(a))throw OF(t)}function r(t,r){if(r<n){const i=e[r],n=i.charCodeAt(0);if(LF(n)||kF(n))return o(t+i,r+1)}return i.push({value:t,type:pF}),r}function o(r,o){let a=o;for(;a<n;a++){const i=e[a],n=i.charCodeAt(0);if(LF(n))r+=i;else{if("."!==i){if(IF(n))return s(r,i,a+1);break}if(r.indexOf(".")>=0)throw OF(t);r+=i}}if("."===r)throw OF(t);return i.push({value:parseFloat(r),type:fF}),a}function s(t,r,o){let s=o;for(;s<n;s++){const t=e[s];if(!IF(t.charCodeAt(0)))break;r+=t}return i.push({value:parseFloat(t),unit:r,type:dF}),s}return i}(t);return FF(e,t)}function zF(t,e){if(t.nodeType===yF){const i=zF(t.left,e),n=zF(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===gF)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===mF)return t.value;throw new Error("calc error.")}function jF(t,e){return zF(WF(t),e)}function NF(t,e){return"string"==typeof t?jF(t.trim(),e):t-0}function GF(t){return!!Ft(t)&&(!!t.endsWith("%")&&function(t){return!(Lt(t)||!Nt(t)&&+t!=+t)}(t.substring(0,t.length-1)))}function KF(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,ZD.EVENT_TYPE.CHANGE_ORDER,(()=>{t.dataSource.enableHierarchyState&&t.refreshRowColCount(),t.invalidate()}))]}function UF(t,e=[]){KF(t,(()=>{const i=e;t.internalProps.records=e;const n=t.internalProps.dataSource=JD.ofArray(i,t.pagerConf,t.options.hierarchyExpandLevel??(t.hasHierarchyTreeHeader?.()?1:void 0));t.addDisposable(n)}))}function VF(t,e){KF(t,(()=>{if(e)if(e instanceof ZD)t.internalProps.dataSource=e;else{const i=t.internalProps.dataSource=new JD(e);t.addDisposable(i)}else t.internalProps.dataSource=ZD.EMPTY;t.internalProps.records=null}))}function $F(t,e){return Math.round(NF(e,t.internalProps.calcWidthContext))}function YF(t,e){return t?t.min&&t.min>e?t.min:t.max&&t.max<e?t.max:e:e}function XF(t){return Boolean(t&&"string"==typeof t&&"auto"===t.toLowerCase())}function qF(t,e,i,n,r,o=!0){const s=cF(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 hF(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),y=r("underline",t,i,n,e),m=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 y&&"boolean"==typeof m&&"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:y?b:void 0,lineThrough:m?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=cF(C)),Array.isArray(w)){const t=cF(w);T.group.stroke=!t.every((t=>!t))&&t,T.group.strokeArrayColor=cF(w)}return{theme:T,hasFunctionPros:A}}const ZF={};class JF{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 QF={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:l.sort,name:"sort_downward",positionType:a.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:l.sort,positionType:a.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:l.sort,positionType:a.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:l.frozen,positionType:a.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:l.frozen,positionType:a.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:l.frozen,positionType:a.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:l.dropDown,positionType:a.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:l.play,positionType:a.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:l.damagePic,positionType:a.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:l.expand,name:"expand",positionType:a.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:l.collapse,name:"collapse",positionType:a.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:a.absolute,funcType:l.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:a.absolute,funcType:l.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 tW(){return it(QF,ZF)}function eW(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 iW(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 y=e+l[0]+u;return"bottom"===a||"alphabetic"===a||"ideographic"===a?y=f-o-l[2]-d:"middle"===a&&(y=e+(n-o+u-d)/2),{x:g,y:y}}function nW(t,e,i,n,r){const o=e&&A(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 rW(t,e,i,n,r){const o=e&&A(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)})}}const oW=tW();function sW(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 aW(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=nW("textAlign",s,e,i,n)??"left",l=nW("textBaseline",s,e,i,n)??"middle",h=cF(nW("padding",s,e,i,n))??[0,0,0,0];if(r.keepAspectRatio){const{width:e,height:i}=eW(o.width||o.videoWidth,o.height||o.videoHeight,t.attribute.width-(h[1]+h[3]),t.attribute.height-(h[0]+h[2])),n=iW(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 lW(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 BH({x:0,y:0,width:c,height:u});d.name="progress-bar";const{showBar:p,barColor:f,barBgColor:g,barPositiveColor:y,barNegativeColor:m,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&&dt.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 R=c,M=u,P=cF(nW("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&&dt.endsWith(A,"%")?(A=Number(A.substr(0,A.length-1)),A=u*A/100):A=Number(A),"string"==typeof T&&dt.endsWith(T,"%")?(T=Number(T.substr(0,T.length-1)),T=u*T/100):T=Number(T);if(ot(p,{col:o,row:s,table:l,context:null,value:n,dataValue:r})){let e=`${r}`;dt.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,y=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e});if(y){const t=hS({x:p,y:h,width:i,height:A,fill:y});d.addChild(t)}const m=hS({x:p,y:h,width:Math.min(i*e,i),height:A,fill:ot(f,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e})||"#20a8d8"});d.addChild(m)}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,R=a<0?-a/e:0,M=c,P=E+u-A-T,H=0+k,L=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B});if(L){const t=hS({x:H,y:P,width:M,height:A,fill:L});d.addChild(t)}const I=v?f*M:p*M,O=Math.min(M*p*R,M),D=v?{left:H+I,top:P,width:O,height:A}:{left:H+I-O,top:P,width:O,height:A},F=ot(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:R})||"#20a8d8",W=hS({x:D.left,y:D.top,width:D.width,height:D.height,fill:F});d.addChild(W);const z=Math.min(M*f*B,M),j=v?{left:H+I-z,top:P,width:z,height:A}:{left:H+I,top:P,width:z,height:A},N=ot(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8",G=hS({x:j.left,y:j.top,width:j.width,height:j.height,fill:N});d.addChild(G);const K=v?D.left:j.left,U=aS({x:0,y:0,stroke:ot(b),lineWidth:1,lineDash:[2,2],points:[{x:K,y:0},{x:K,y:h}]});if(d.addChild(U),w&&(B||R)){const t=_,e=[];let i;if(B>0)if(i=ot(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(R>0)if(i=ot(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:R})||"#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=aS({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=M-L-A-T-1,B=v?R-H-f:0+k,P=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u});if(P){const t=hS({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?ot(y,{col:o,row:s,table:l,context:null,value:n,percentile:u,dataValue:r})||"#20a8d8":ot(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8";const O=hS({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?ot(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8":ot(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=aS({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(h)}}}return d}const hW=new class extends RL{constructor(t){super(!1),this.type=bL.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},cW=new FL;function uW(t,e,i,n,r,o,s,a,l,h,c){t||((t=new BH({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=dW(s,c,u,i,n)}else s=l,a=dW(l,c,u,i,n);const f=[],g=[];let y,m;if("object"==typeof s.xField)hW.domain(s.xField.domain),y=s.xField.field;else if("string"==typeof s.xField){const t=h.map((t=>t[s.xField]));hW.domain(t),y=s.xField}else Array.isArray(h)&&(hW.domain(Array.from({length:h.length},((t,e)=>e))),y=s.xField);if(hW.range([0,i]),"object"==typeof s.yField)cW.domain(s.yField.domain),m=s.yField.field;else if("string"==typeof s.yField){const t=h.map((t=>t[s.yField]));cW.domain([Math.min(...t),Math.max(...t)]),m=s.yField}else Array.isArray(h)&&h.every((t=>"number"==typeof t))&&(cW.domain([Math.min(...h),Math.max(...h)]),m=s.yField);if(cW.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(!A(t[y])||!A(t[m]))break;f.push({x:d+hW.scale(t[y]),y:p-cW.scale(t[m]),defined:A(t[m])}),g.push(t),n=!0;break}n||(f.push({x:d+hW.scale(e[i]),y:0,defined:!1}),g.push({[y]:e[i],[m]:null}))}}else for(let t=0;t<h.length;t++){const e=h[t];f.push({x:d+hW.scale(y?e[y]:t),y:p-cW.scale(m?e[m]:e),defined:A(m?e[m]:e),rawData:e}),g.push(e)}const b=a.getChildByName("sparkline-line");b&&b.setAttribute("points",f);b.bandwidth=hW.step(),b.min=cW.range()[0],b.max=cW.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=uS({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=uS({x:e,y:i});v.appendChild(t)}}}return a}(r,o,s,a,l,h);return u&&t.appendChild(u),t}function dW(t,e,i,n,r){let o;o="function"==typeof t?t(null):t;const s=new BH({x:e,y:i,width:n,height:r,stroke:!1,fill:!1});if(s.name="sparkline","line"===o.type){const t=aS({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 BH({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 pW=class extends f_{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}};const fW=new Map;function gW(t,e){const i=`${t}-${e}`,n=fW.get(i);if(n)return n;const r=(o={fontSize:t,fontFamily:e},new vi({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:a?void 0:yS,specialCharSet:`-/: .,@%'"~${vi.ALPHABET_CHAR_SET}${vi.ALPHABET_CHAR_SET.toUpperCase()}`,...s??{}},o));var o,s,a;return fW.set(i,r),r}const yW=new class{measureText(t,e){const{fontSize:i,fontFamily:n}=e;return gW(i,n).measure(t)}measureTextWidth(t,e){const{fontSize:i,fontFamily:n="sans-serif"}=e;return gW(i,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}},mW=["heightLimit","lineClamp","autoWrapText"];class bW extends sx{constructor(t){super(t)}updateSingallineAABBBounds(t){const e=Pv(this).text;let i,n;const r=this.attribute,{maxLineWidth:o=e.maxLineWidth,ellipsis:s=e.ellipsis,textAlign:a=e.textAlign,textBaseline:l=e.textBaseline,fontSize:h=e.fontSize,fontFamily:c=e.fontFamily,stroke:u=e.stroke,lineHeight:d=r.lineHeight??r.fontSize??e.fontSize,lineWidth:p=e.lineWidth}=r;if(!this.shouldUpdateShape()&&this.cache){i=this.cache.clipedWidth;const t=ix(a,i),e=nx(l,d,h);return this._AABBBounds.set(t,e,t+i,e+d),u&&this._AABBBounds.expand(p/2),this._AABBBounds}if(Number.isFinite(o)){if(s){const r=!0===s?e.ellipsis:s,a=yW.clipTextWithSuffix(t.toString(),{fontSize:h,fontFamily:c},o,r);n=a.str,i=a.width}else{const e=yW.clipText(t.toString(),{fontSize:h,fontFamily:c},o);n=e.str,i=e.width}this.cache.clipedText=n,this.cache.clipedWidth=i}else i=yW.measureTextWidth(t.toString(),{fontSize:h,fontFamily:c}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=i;this.clearUpdateShapeTag();const f=ix(a,i),g=nx(l,d,h);return this._AABBBounds.set(f,g,f+i,g+d),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateMultilineAABBBounds(t){const e=Pv(this).text,{fontFamily:i=e.fontFamily,textAlign:n=e.textAlign,textBaseline:r=e.textBaseline,fontSize:o=e.fontSize,lineHeight:s=this.attribute.lineHeight??this.attribute.fontSize??e.fontSize,ellipsis:a=e.ellipsis,maxLineWidth:l,stroke:h=e.stroke,lineWidth:c=e.lineWidth,heightLimit:u=-1,lineClamp:d=e.lineClamp,autoWrapText:p=e.autoWrapText}=this.attribute;if(!this.shouldUpdateShape()&&this.cache?.layoutData){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),h&&this._AABBBounds.expand(c/2),this._AABBBounds}const f=new rx(i,{fontSize:o,fontFamily:i},yW),g=t.map((t=>t.toString())),y=[],m=[0,0];let b=1/0;if(u>0&&(b=Math.max(Math.floor(u/s),1)),d&&(b=Math.min(b,d)),p)if("number"==typeof l&&l!==1/0){if(l>0)for(let t=0;t<g.length;t++){const e=g[t];if(t===b-1){const t=f.textMeasure.clipTextWithSuffix(e,f.textOptions,l,a);y.push({str:t.str,width:t.width});break}const n=f.textMeasure.clipText(e,f.textOptions,l);if(""!==e&&""===n.str&&(n.str=e.substring(0,1),n.width=yW.measureTextWidth(n.str,{fontSize:o,fontFamily:i})),y.push({str:n.str,width:n.width}),n.str.length===e.length);else{const i=e.substring(n.str.length);g.splice(t+1,0,i)}}let t=0;y.forEach((e=>{t=Math.max(t,e.width)})),m[0]=t}else{let t,e,i=0;for(let n=0,r=g.length;n<r;n++){if(n===b-1){const t=f.textMeasure.clipTextWithSuffix(g[n],f.textOptions,l,a);y.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=g[n],t=f.textMeasure.measureTextWidth(e,f.textOptions),i=Math.max(i,t),y.push({str:e,width:t})}m[0]=i}else{let t=0;for(let e=0,i=g.length;e<i;e++)if(e<b){const i=f.textMeasure.clipTextWithSuffix(g[e],f.textOptions,l,a);y.push({str:i.str,width:i.width}),t=Math.max(t,i.width)}m[0]=t}m[1]=y.length*s;const v={xOffset:0,yOffset:0,width:m[0],height:m[1]};f.LayoutBBox(v,n,r);const w=f.layoutWithBBox(v,y,n,r,s);return this.cache.layoutData=w,this.clearUpdateShapeTag(),this._AABBBounds.set(v.xOffset,v.yOffset,v.xOffset+v.width,v.yOffset+v.height),h&&this._AABBBounds.expand(c/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<mW.length;e++){const i=mW[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<mW.length;e++){if(t===mW[e])return!0}return super.needUpdateTag(t)}}class vW extends BH{_leftGroup;_rightGroup;_centerGroup;_autoWidth=!1;_autoHeight=!1;_cellWidth;_cellHeight;_align;_baseline;constructor(t){super(t),this._leftGroup=new BH({pickable:!1,fill:!1,stroke:!1}),this._leftGroup.role="content-left",this._rightGroup=new BH({pickable:!1,fill:!1,stroke:!1}),this._rightGroup.role="content-right",this._centerGroup=new BH({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 bW&&(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 pW&&(e-=t.AABBBounds.width())}));const i=this._centerGroup.getChildByName("text");i instanceof b_?i.setAttribute("width",e):i instanceof bW&&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 wW(t,e,i){let n=0;const o=i.internalProps.layoutMap;if(o.isHeader(t,e)){const i=o.getHeader(t,e);i?.hierarchyLevel&&(n=(i.hierarchyLevel??0)*(o.rowHierarchyIndent??0))}else{const s=i.getBodyColumnDefine(t,e);if(s?.tree){const s=i.dataSource.getIndexKey(i.getRecordIndexByRow(t,e));n=Array.isArray(s)&&i.getHierarchyState(t,e)!==r.none?(s.length-1)*(o.hierarchyIndent??0):0}}return n}function CW(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;let s=0;if(Nt(i)&&Nt(n)&&r&&(t.funcType===l.collapse||t.funcType===l.expand)&&(s=wW(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 pW(o);return a.tooltip=t.tooltip,a}function xW(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 _W(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 bW?(l=p.AABBBounds.height(),p.setAttribute("maxLineWidth",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):p instanceof b_?(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 y=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=RH(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],y))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 SW(t,e,i,n,r,o,s,a,l){let h,c,u,d,g=!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),g=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,g=t.renderDefault,h=t.expectedWidth,c=t.expectedHeight)}else e&&(h=e.expectedWidth,c=e.expectedHeight,u=e.elements,g=e.renderDefault);if(u){d=function(t,e,i,n){const r=new BH({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)&&p(c[t])&&(c[t]=c[t](n));const u=c;A(u.x)&&(u.x=f(u.x)?AW(u.x,e-a[1]):Number(u.x),u.y=f(u.y)?AW(u.y,i-a[2]):Number(u.y)),"width"in c&&(c.width=f(c.width)?AW(c.width,e-a[1]):Number(c.width)),"height"in c&&(c.height=f(c.height)?AW(c.height,i-a[2]):Number(c.height)),"radius"in c&&(c.radius=f(c.radius)?AW(c.radius,Math.min(e-a[1],i-a[2])):Number(c.radius)),"hover"in c&&(c.hover.x=f(c.hover.x)?AW(c.hover.x,e-a[1]):Number(c.hover.x),c.hover.y=f(c.hover.y)?AW(c.hover.y,i-a[2]):Number(c.hover.y),c.hover.width=f(c.hover.width)?AW(c.hover.width,e-a[1]):Number(c.hover.width),c.hover.height=f(c.hover.height)?AW(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=rS({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=hS({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 bW(Object.assign({pickable:!!t.clickable,fill:t.color??t.fill},t));r.appendChild(i);break;case"rect":const n=hS({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=oS({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 pW({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 pW({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=aS({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:g}}function AW(t,e){return t.endsWith("px")?parseInt(t,10):t.endsWith("%")&&e?parseInt(t,10)/100*e:parseInt(t,10)}function TW(t,e,i,n,r,o,s){let a,l;const h=RH(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=(cF(nW("padding",o,i,n,t.table)),lW(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=cF(nW("padding",r,i,n,t.table));uW(e,e.parent,e.attribute.x,e.attribute.y,i,n,e.attribute.width,e.attribute.height,o,t.table,qF(r,t.table,i,n,nW).theme)}else if("image"===a||"video"===a)aW(e,i,n,t.table);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 bW&&!n?l.setAttribute("heightLimit",a):l instanceof b_&&!n?l.setAttribute("height",a):t.getChildByName("content")&&t.getChildByName("content").updateHeight(a);t.forEachChildren((t=>{"rect"===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,cF(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.getCellType(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=SW(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 BW(t,e,i,n,r,o,s,a){let l,h;const c=RH(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=(cF(nW("padding",r,i,n,t.table)),lW(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=cF(nW("padding",e,i,n,t.table));uW(l,l.parent,l.attribute.x,l.attribute.y,i,n,l.attribute.width,l.attribute.height,r,t.table,qF(e,t.table,i,n,nW).theme)}else if("image"===u||"video"===u)aW(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 KD(e,l.attribute.width,l.attribute.height,t.table);l.clear(),l.appendChild(i.component),i.overlap()}}else{const e=t.table._getCellStyle(i,n);d=_W(l,h,o,a,cF(e.padding),e.textAlign,e.textBaseline,t)}return d}function RW(t,e){let i=0;for(let n=0;n<t.table.colCount;n++){let r=MW(t.highPerformanceGetCell(n,e),t);const o=RH(t.table,n,e);o&&o.end.row-o.start.row&&(r/=o.end.row-o.start.row+1),i=Math.max(i,r)}for(let n=0;n<t.table.colCount;n++){let r=i;const o=t.highPerformanceGetCell(n,e),s=RH(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));TW(t,o,n,e,r,0,t.table.isHeader(n,e))}t.table.setRowHeight(e,i,!0)}function MW(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=cF(e.table._getCellStyle(t.col,t.row).padding);return i+n[0]+n[2]}var PW;!function(t){t.dropDown="dropDown",t.contextmenu="contextmenu",t.custom="custom"}(PW||(PW={}));const EW={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 HW=tW();class LW{icon;constructor(){const t=HW.drillDown;this.icon=new pW({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=HW.drillDown,a=HW.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 kW{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=uS({visible:!1,pickable:!1,x:0,y:0,symbolType:"triangle",fill:i}),this.columnMoverLine=aS({visible:!1,pickable:!1,stroke:i,lineWidth:e,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnMoverBack=hS({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.getCellType(t,e),r=RH(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 IW(t,e){let i=e.getColsWidth(0,t);return t>=e.frozenColCount&&(i-=e.scrollLeft),i}class OW{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=aS({visible:!1,pickable:!1,stroke:i,lineWidth:n,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnResizeBgLine=aS({visible:!1,pickable:!1,stroke:r,lineWidth:o,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]});const s=cS({visible:!1,pickable:!1,x:0,y:0,fontSize:10,fill:"#FFF",text:"",textBaseline:"top",dx:16,dy:-6}),a=hS({visible:!1,pickable:!1,fill:"#3073F2",x:0,y:0,width:38,height:16,cornerRadius:5,dx:12,dy:-8});this.columnResizeLabel=sS({visible:!1,pickable:!1,x:0,y:0}),this.columnResizeLabel.appendChild(a),this.columnResizeLabel.appendChild(s),this.cellMover=new kW(this.table);const l=e.frozenColumnLine?.shadow?.width,h=e.frozenColumnLine?.shadow?.startColor,c=e.frozenColumnLine?.shadow?.endColor;this.frozenShadowLine=hS({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 BH({x:0,y:0,fill:EW.bgColor,stroke:EW.borderColor,cornerRadius:EW.cornerRadius,lineWidth:EW.borderWidth}),this._menuInfo={x:-1,y:-1,col:-1,row:-1,type:PW.dropDown,menuInfo:[],highlightIndex:-1}}bindTableComponent(t){t.appendChild(this._menuInstance),this.bindEvent()}dispose(){}attach(t,e,i,n,r,o){if(r===PW.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===PW.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!==PW.dropDown||t!==n||e!==r}checkContextMenuChange(t,e){const{type:i,menuInfo:n}=this._menuInfo;return i!==PW.contextmenu||n!==this._table.internalProps.menu?.contextMenuItems}updateMenuInstance(t,e){this._menuInstance.removeAllChild();let i=EW.menuPadding;const n=EW.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 BH({y:i,x:n,height:EW.lineHeight,fill:EW.bgColor});h.role="menu-item",this._menuInstance.appendChild(h),h.stateProxy=t=>"hover"===t?{fill:EW.hoverBgColor}:{fill:EW.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 sx({x:EW.menuItemPadding,y:EW.menuItemPadding,fill:s?EW.highlightColor:EW.color,text:l,textBaseline:"top",fontSize:EW.fontSize,pickable:!1,maxLineWidth:EW.maxLineWidth,ellipsis:"…"});if(h.addChild(c),a){c.AABBBounds.height();const t=a.width??16,e=a.height??16,i=new pW({x:EW.menuItemPadding,y:(EW.lineHeight-e)/2,width:t,height:e,image:a.svg,pickable:!1});i.role="menu-icon",h.insertBefore(i,c),c.setAttribute("x",t+EW.menuItemPadding)}r=Math.max(h.AABBBounds.width(),r),i+=EW.lineHeight})),this._menuInstance.setAttributes({width:r+2*EW.menuItemPadding+2*EW.menuPadding,height:i+EW.menuPadding}),this._menuInstance.forEachChildren((t=>{t.setAttribute("width",r+2*EW.menuItemPadding)}))}updatePosition(t,e){this._menuInstance.setAttributes({x:this._menuInfo.type===PW.dropDown?t-this._menuInstance.attribute.width:t,y:e}),this._menuInfo.x=PW.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===PW.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===PW.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(yt.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 LW}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 EH({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 EH({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){const i=IW(t,this.table);this.columnResizeLine.setAttributes({visible:!0,x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({visible:!0,x:i,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:i,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${this.table.getColWidth(t)}px`)}updateResizeCol(t,e){const i=IW(t,this.table);this.columnResizeLine.setAttributes({x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.setAttributes({x:i,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){if(t<0)this.frozenShadowLine.setAttributes({visible:!1});else{const e=this.table.getColsWidth(0,t);this.frozenShadowLine.setAttributes({visible:!0,x:e,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 DW(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=WW(u,n),g.lineWidth=d,p&&(g.lineDash=p),g.lineCap="square"),Array.isArray(u)&&(g.strokeArrayColor=cF(u)),Array.isArray(d)&&(g.strokeArrayWidth=cF(d),g.lineWidth=1),c&&(g.cornerRadius=c,f.cornerRadius=c);const y=g.strokeArrayWidth?g.strokeArrayWidth[0]:g.lineWidth??0,m=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=y/2,g.pickable=!1,o){g.x=t.attribute.x-v/2,g.y=t.attribute.y-y/2,g.width=t.attribute.width+v/2+m/2,g.height=t.attribute.height+y/2+b/2;const e=hS(g);e.name="table-border-rect",t.parent.insertBefore(e,t),t.border=e}else{g.width=t.attribute.width-v/2-m/2,g.height=t.attribute.height-y/2-b/2;const e=hS(g);e.name="border-rect",t.addChild(e),t.border=e}}function FW(t,e,i){const{borderColor:n}=e;t.border?.setAttribute("stroke",WW(n,i))}function WW(t,e){let i=!0;return e&&!Wt(t)?i=e.map((e=>!!e&&t)):e?i=e:e||Wt(t)?Wt(t)&&(i=!0):i=t,i}function zW(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}},tD=QO;function eD(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}eD.Varint=0,eD.Fixed64=1,eD.Bytes=2,eD.Fixed32=5;var iD=4294967296,nD=1/iD,rD="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function oD(t){return t.type===eD.Bytes?t.readVarint()+t.pos:t.pos+1}function sD(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function aD(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 lD(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function hD(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function cD(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function uD(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function dD(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function pD(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function fD(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function gD(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function yD(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function mD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function bD(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function vD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}eD.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=mD(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=vD(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=mD(this.buf,this.pos)+mD(this.buf,this.pos+4)*iD;return this.pos+=8,t},readSFixed64:function(){var t=mD(this.buf,this.pos)+vD(this.buf,this.pos+4)*iD;return this.pos+=8,t},readFloat:function(){var t=tD.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=tD.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 sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return sD(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return sD(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&&rD?function(t,e,i){return rD.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!==eD.Bytes)return t.push(this.readVarint(e));var i=oD(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==eD.Bytes)return t.push(this.readSVarint());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==eD.Bytes)return t.push(this.readBoolean());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==eD.Bytes)return t.push(this.readFloat());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==eD.Bytes)return t.push(this.readDouble());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==eD.Bytes)return t.push(this.readFixed32());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==eD.Bytes)return t.push(this.readSFixed32());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==eD.Bytes)return t.push(this.readFixed64());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==eD.Bytes)return t.push(this.readSFixed64());var e=oD(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===eD.Varint)for(;this.buf[this.pos++]>127;);else if(e===eD.Bytes)this.pos=this.readVarint()+this.pos;else if(e===eD.Fixed32)this.pos+=4;else{if(e!==eD.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),bD(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bD(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bD(this.buf,-1&t,this.pos),bD(this.buf,Math.floor(t*nD),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bD(this.buf,-1&t,this.pos),bD(this.buf,Math.floor(t*nD),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&&aD(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),tD.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),tD.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&&aD(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,eD.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,lD,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,hD,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,dD,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,cD,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,uD,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,pD,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,fD,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,gD,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,yD,e)},writeBytesField:function(t,e){this.writeTag(t,eD.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,eD.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,eD.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,eD.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,eD.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,eD.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,eD.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,eD.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,eD.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,eD.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)),_k(t,i(n))),n.result()}o.area=function(t){return _k(t,i(gI)),gI.result()},o.measure=function(t){return _k(t,i(iO)),iO.result()},o.bounds=function(t){return _k(t,i(AI)),AI.result()},o.centroid=function(t){return _k(t,i(UI)),UI.result()},o.projection=function(e){return arguments.length?(i=null==e?(t=null,nI):(t=e).stream,o):t},o.context=function(t){return arguments.length?(n=null==t?(e=null,new nO):new VI(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 wD=0;function CD(){return wD>1e8&&(wD=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+wD++}class xD{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Mt,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:CD("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 _D="_data-view-diff-rank";class SD{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Mt,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:CD("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",JO),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=Qt(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=Qt(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[_D]=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[_D]=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[_D]<e&&(this.latestDataAUD.del.push(t),this._diffMap.delete(i))}))}this._diffRank=e}cloneParseData(t,e){let i=!0;return(t instanceof SD||!1===(null==e?void 0:e.clone))&&(i=!1),i?t:Qt(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}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const AD=(t,e,i)=>new vi({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:yS,specialCharSet:"-/: .,@%'\"~"+vi.ALPHABET_CHAR_SET+vi.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),TD=(t,e)=>{const i=t.map(((t,i)=>({index:i,value:t,label:e.labelFormatter?e.labelFormatter(t):`${t}`})));return i},BD=(t,e,i=0)=>{const n=new Ne(t).expand(i/2),r=new Ne(e).expand(i/2);return n.intersects(r)},RD=(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 MD(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function PD(t,e){for(let i,n=1,r=t.length,o=t[0];n<r;o=i,++n)if(i=t[n],MD(o.AABBBounds,i.AABBBounds,e))return!0;return!1}const ED=(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=>Gt(t)?Ge(t):null)(-90));const d=AD(n),p=e.map(((i,r)=>{const a=s?s(i):`${i}`,{width:p,height:f}=d.quickMeasure(a),g=Math.max(p,12),y=Math.max(f,12),m=t.scale(i);let b,v,w=Math.cos(u)*m,C=-Math.sin(u)*m;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-=y:"middle"===v&&(C-=y/2);return(new Ne).set(w,C,w+g,C+y).rotate(l,w+g/2,C+y/2)}));return p},HD=(t,e,i)=>{const{labelStyle:n,getRadius:r,axisSpec:o,labelFormatter:s}=i,a=r?.(),l=n.angle??0,h=LD(o),c=AD(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:y,y:m}=Ue({x:0,y:0},a+h,d);p=y+("right"===g.align?-o:"center"===g.align?-o/2:0),f=m+("bottom"===g.baseline?-u:"middle"===g.baseline?-u/2:0);return(new Ne).set(p,f,p+o,f+u).rotate(l,p+o/2,f+u/2)}));return u};function LD(t){let e=0;return Xt(t,"tick.visible")&&(e+=Xt(t,"tick.tickSize")),Xt(t,"label.visible")&&(e+=Xt(t,"label.space")),e}const kD={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!MD(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},ID=(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&&BD(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&&!BD(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=RD(e[d],e[n])[t],p=d-s>=0?RD(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}},OD=(t,e,i,n)=>{let r=n;do{let n=!0;r++;let o=0;do{o+r<t.length&&BD(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&&BD(e[0],e[i]);)o++,i-=r}return{step:r,delCount:o}},DD=(t,e)=>{if(vL(t.type))return((t,e)=>{if(!vL(t.type))return TD(t.domain(),e);const{tickCount:i,forceTickCount:n,tickStep:r}=e;let o;if(o=kt(r)?t.stepTicks(r):kt(n)?t.forceTicks(n):t.ticks(i??5),"cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType){const{labelGap:i=4,labelFlush:n}=e;let r=ED(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;r.length>=3&&PD(r,i);)r=kD.parity(r);const s=r.map((t=>t.value));s.length<3&&n&&(s.length>1&&s.pop(),ae(s)!==ae(o)&&s.push(ae(o))),o=s}return TD(o,e)})(t,e);if(function(t){switch(t){case bL.Ordinal:case bL.Point:case bL.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:r,labelGap:o=4,axisOrientType:s}=e,a=["bottom","top"].includes(s);let l;if(kt(r))l=t.stepTicks(r);else if(kt(n))l=t.forceTicks(n);else if(kt(i))l=t.ticks(i);else{const i=t.domain(),n=t.range(),r=ED(t,i,e),s=r.map((t=>a?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,u=ID(i,r,o,e.labelLastVisible,a,Math.floor(Math.min(...s)/c));l=t.stepTicks(u.step),e.labelLastVisible&&(l=l.slice(0,l.length-u.delCount),l.push(i[i.length-1]))}return TD(l,e)})(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 TD(t.domain(),e);let h;if(kt(r))h=t.stepTicks(r);else if(kt(n))h=t.forceTicks(n);else if(kt(i))h=t.ticks(i);else{const i=t.domain(),n=t.range(),r=LD(s),o=HD(t,i,e),c=Math.min(...n),u=Math.max(...n),d=Math.abs(u-c)*(l+r)/i.length,{step:p,delCount:f}=OD(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)}return TD(h,e)})(t,e)}return TD(t.domain(),e)},FD=Math.sqrt(50),WD=Math.sqrt(10),zD=Math.sqrt(2);class jD{_extend={};_scale;_scales;nice;zero;domain;expand;forceTickCount;tickCount;niceType;constructor(){this._scale=new FL,this._scales=[this._scale]}setExtraAttrFromSpec(t,e,i,n){this.nice=t,this.zero=e,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)),Lt(this.domain?.min)&&Lt(this.domain?.max)?this.nice&&this._scale.nice(t):kt(this.domain?.min)&&Lt(this.domain?.max)?this.nice&&this._scale.niceMax(t):Lt(this.domain?.min)&&kt(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];kt(this.expand.min)&&(t[0]=e-(i-e)*this.expand.min),kt(this.expand.max)&&(t[t.length-1]=i+(i-e)*this.expand.max)}niceDomain(t){if(Math.abs(function(t){if(t&&Wt(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)}(t)-function(t){if(t&&Wt(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>=FD?10:r>=WD?5:r>=zD?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)),Lt(this.domain?.min)&&Lt(this.domain?.max)?this._scale.nice(t):kt(this.domain?.min)&&Lt(this.domain?.max)?this._scale.niceMax(t):Lt(this.domain?.min)&&kt(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;kt(e)&&(t[0]=e),kt(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 ND(t,e){const i=e.option;Yt(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),r=$L(e.orient),o=t[0],s=ae(t);if(r){const t=0,e=i,n=o.AABBBounds.x1,r=s.AABBBounds.x2;n<t&&o.setAttributes({x:t,textAlign:"left"}),r>e&&s.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=o.AABBBounds.y2,r=s.AABBBounds.y1;i>t&&o.setAttributes({y:t,textBaseline:"bottom"}),r<e&&s.setAttributes({y:e,textBaseline:"top"})}}(t,e)}const GD=t=>t;class KD{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=ne({},VL,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.data),this.initScale(),this.initData(),this.createComponent(),this.initEvent()}initScale(){const t=this.option;"band"===this.type?(this.scale=new YL,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 jD,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.dataSet,"scale",GD),function(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}(this.table.dataSet,"ticks",DD);const t=this.option.label||{},e=this.option.tick||{},i=new SD(this.table.dataSet).parse(this.scale._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this.orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this.tickData=i,this.computeData()}computeData(){this.tickData.reRunAllTransform()}initEvent(){}createComponent(){const t=function(t){const e=t;let i,n=e.title?.angle??0;return"left"!==e.orient&&"right"!==e.orient||e.title?.autoRotate&&Lt(e.title.angle)&&(n="left"===e.orient?-90:90,i=GL[e.orient]),{select:e.select,hover:e.hover,line:(r=e.domainLine,jL(r),jL(r.startSymbol),jL(r.endSymbol),r),label:{visible:e.label.visible,space:e.label.space,inside:e.label.inside,style:zL(e.label.style),formatMethod:e.label.formatMethod?(t,i,n)=>e.label.formatMethod(i.rawValue,i):null,state:NL(e.label.state)},tick:{visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,style:zL(e.tick.style),state:NL(e.tick.state)},subTick:{visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount,style:zL(e.subTick.style),state:NL(e.subTick.state)},grid:{type:"line",visible:e.grid.visible,alternateColor:e.grid.alternateColor,alignWithLabel:e.grid.alignWithLabel,style:zL(e.grid.style)},subGrid:{type:"line",visible:e.subGrid.visible,alternateColor:e.subGrid.alternateColor,style:zL(e.subGrid.style)},title:{visible:e.title.visible,position:e.title.position,space:e.title.space,autoRotate:!1,angle:n?Ge(n):null,textStyle:ne({},i,zL(e.title.style)),padding:e.title.padding,shape:{visible:e.title.shape?.visible,space:e.title.shape?.space,style:zL(e.title.shape?.style)},background:{visible:e.title.background?.visible,style:zL(e.title.background?.style)},state:{text:NL(e.title.state),shape:NL(e.title.shape?.state),background:NL(e.title.background?.state)}},panel:{visible:e.background?.visible,style:zL(e.background?.style),state:NL(e.background?.state)}};var r}(this.option),e=this.getUpdateAttribute();e.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component=new oL(ne({},t,e)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0}))}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);ND(i?i.getChildren():[],e),ND(n?n.getChildren():[],e)}(this.component,this)}getLayoutRect(){return{width:this.width,height:this.height}}getUpdateAttribute(){const t=this.table.tableNoFrameHeight,e=this.table.tableNoFrameWidth,{width:i,height:n}=this.getLayoutRect(),r=$L(this.orient),o="left"===(s=this.orient)||"right"===s;var s;let a={x:0,y:0},l=0,h=0;r?(a={x:i,y:0},l=t,h=i):o&&(a={x:0,y:n},l=e,h=n);return{start:{x:0,y:0},end:a,grid:{type:"line",length:l,visible:this.option.grid.visible},title:{text:this.option.title.text,maxWidth:this._getTitleLimit(r)},items:this.getLabelItems(h)}}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();let i=[0,0];$L(this.orient)?Gt(t)&&(i=[0,t]):Gt(e)&&(i=[e,0]),this.scale.updateRange(i)}setLayoutStartPosition(t){let{x:e,y:i}=t;return Gt(e)&&(e+=Number("left"===this.orient)*this.getLayoutRect().width),Gt(i)&&(i+=Number("top"===this.orient)*this.getLayoutRect().height),{x:e,y:i}}_getTitleLimit(t){if(this.option.title.visible&&Lt(this.option.title.style?.maxLineWidth)){const e=this.option.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}getScale(){return this.scale._scale}getDomainSpec(){return this.scale.domain}}function UD(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 VD(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 $D={SOURCE_LENGTH_UPDATE:"source_length_update",CHANGE_ORDER:"change_order"};function YD(t,e){const i=ot(t);if(st(i)){const t=i.then((t=>(e(t),t)));return e(t),t}return i}function XD(t,e,i){if(null===t)return;if(st(t))return t.then((t=>XD(t,e,i)));const n=function(t){if(ut.isObject(t)){const e=t;if(A(e.get)&&A(e.set))return!0}return!1}(e)?e.get:e;if(n in t){return YD(t[n],i)}if("function"==typeof n){return YD(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 YD(e,i)}const r=`${n}`.split(".");if(r.length<=1){return YD(t[n],i)}return YD(nt(t,((t,e)=>XD(t,e,gt)),...r),i)}function qD(t,e){if(!t)return e;const i=t[e];return A(i)?i:e}class ZD extends E{_get;_sourceLength;_source;sortedIndexMap;lastOrder;lastOrderFn;lastOrderField;currentIndexedData=[];pagerConf;_currentPagerIndexedData;enableHierarchyState=!1;static get EVENT_TYPE(){return $D}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.pagerConf=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,r.collapse)}if(i>1){let t=this._sourceLength;for(let e=0;e<t;e++){const n=this.currentIndexedData[e],o=this.getOriginalRecord(n);if(o.children?.length>0){this.treeDataHierarchyState.set(Array.isArray(n)?n.join(","):n,r.expand);const s=this.initChildrenNodeHierarchy(n,i,2,o);e+=s,t+=s}}}this.updatePagerData()}initChildrenNodeHierarchy(t,e,i,n){if(i>e)return 0;let o=0;const s=n.children?.length??0;for(let a=0;a<s;a++){o+=1;const s=n.children[a],l=Array.isArray(t)?t.concat(a):[t,a];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+o,0,l),s.children?.length>0&&(i<e?this.treeDataHierarchyState.set(Array.isArray(l)?l.join(","):l,r.expand):this.treeDataHierarchyState.set(Array.isArray(l)?l.join(","):l,r.collapse)),o+=this.initChildrenNodeHierarchy(l,e,i+1,s)}return o}updatePager(t){this.pagerConf=t||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},this.updatePagerData()}updatePagerData(){const{currentIndexedData:t}=this,{perPageCount:e,currentPage:i}=this.pagerConf,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(qD(this.currentPagerIndexedData,t))}getIndexKey(t){return qD(this.currentPagerIndexedData,t)}getField(t,e){return this.getOriginalField(qD(this.currentPagerIndexedData,t),e)}hasField(t,e){return this.hasOriginalField(qD(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),o=this.getOriginalRecord(i);if(this.clearSortedIndexMap(),n===r.collapse)this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,r.expand),this.pushChildrenNode(i,r.expand,o);else if(n===r.expand){let t=0;const e=(i,n,o)=>{if(n&&n!==r.collapse&&n!==r.none&&o.children)for(let n=0;n<o.children.length;n++){t+=1;const r=Array.isArray(i)?i.concat([n]):[i,n];e(r,this.treeDataHierarchyState.get(r.join(",")),o.children[n])}};e(i,n,o),this.currentIndexedData.splice(this.currentIndexedData.indexOf(i)+1,t),this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,r.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(VD(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(VD(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===r.collapse||e===r.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&&UD((t=>A(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 o=0;o<e.length;o++){n+=1;const s=Array.isArray(t)?t.concat([e[o]]):[t,e[o]];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+n,0,s);const a=this.treeDataHierarchyState.get(s.join(",")),l=this.getOriginalRecord(s);!a&&l.children&&this.treeDataHierarchyState.set(s.join(","),r.collapse),n+=this.pushChildrenNode(s,this.treeDataHierarchyState.get(s.join(",")),i.children[e[o]])}}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($D.CHANGE_ORDER,null);const o=[];if("normal"===e)for(let t=0;t<this._sourceLength;t++)o[t]=t;else UD((t=>A(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($D.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($D.SOURCE_LENGTH_UPDATE,this._sourceLength))}get length(){return this.currentPagerIndexedData.length}get dataSource(){return this}get currentPagerIndexedData(){return this._currentPagerIndexedData.length>0?this._currentPagerIndexedData:[]}dispose(){super.dispose?.()}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 YD(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getOriginalField(t,e){if(null===e)return;return XD(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 ZD({get(){},length:0})}class JD extends ZD{_recordCache;_fieldCache;static get EVENT_TYPE(){return ZD.EVENT_TYPE}static ofArray(t,e,i){return new JD({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}dispose(){super.dispose?.()}}var QD=Object.freeze({__proto__:null,CachedDataSource:JD,DataSource:ZD}),tF={exports:{}},eF={},iF=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"),nF=["style","variant","weight","size","lineHeight","family"],rF=/([\.0-9]+)(.*)/,oF=function(t,e,i){var n=t.match(rF);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)}}},sF={size:oF,lineHeight:oF},aF={serif:1,"sans-serif":1,cursive:1,fantasy:1,monospace:1},lF=tF.exports=function(t,e,i){var n=t+"-"+(e||"null")+"@"+i;if(i=i||96,void 0!==eF[n])return eF[n];if(e&&(e=lF(e,null,i)),"inherit"===t)return e;var r=iF.exec(t);if(r){r.shift();for(var o={},s=0;s<r.length;s++){var a=nF[s],l=r[s];if(sF[a]&&l){var h=e&&e[a]||null,c=sF[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),eF[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(),aF[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}eF[n]=null};tF.exports.generics=aF;var hF=Tt(tF.exports);function cF(t){let e=aw(t);return"number"==typeof e||"string"==typeof e?e=[e,e,e,e]:Array.isArray(e)&&(e=e.slice(0)),e}const uF=0,dF=1,pF=2,fF=3,gF=10,yF=11,mF=12,bF=9,vF=13,wF=10,CF=12,xF=32,_F=37,SF=46,AF=48,TF=57,BF=65,RF=90,MF=97,PF=122;function EF(t){return function(t){return t>=MF&&t<=PF}(t)||function(t){return t>=BF&&t<=RF}(t)}function HF(t){return t===bF||t===wF||t===CF||t===vF||t===xF}function LF(t){return t>=AF&&t<=TF}function kF(t){return t===SF}function IF(t){return EF(t)||t===_F}function OF(t){return new Error(`calc parse error: ${t}`)}const DF={"*":3,"/":3,"+":2,"-":2};function FF(t,e){function i(t){const i=t.pop(),n=t.pop(),r=t.pop();if(!(r&&r.nodeType&&n&&n.type===pF&&i&&i.nodeType))throw OF(e);return{nodeType:yF,left:r,op:n,right:i}}const n=[];for(;t.length;){const r=t.shift();if(r.type===uF&&"("===r.value){let i=0;const r=X.findIndex(t,(t=>{if(t.type===uF&&"("===t.value)i++;else if(t.type===uF&&")"===t.value){if(!i)return!0;i--}return!1}));if(-1===r)throw OF(e);n.push(FF(t.splice(0,r),e)),t.shift()}else if(r.type===pF){if(n.length>=3){const t=n[n.length-2].value;DF[r.value]<=DF[t]&&n.push(i(n))}n.push(r)}else if(r.type===dF){const{value:t,unit:e}=r;n.push({nodeType:gF,value:t,unit:e})}else r.type===fF&&n.push({nodeType:mF,value:r.value})}for(;n.length>1;)n.push(i(n));return n[0]}function WF(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:uF});else if("*"===n||"/"===n)i.push({value:n,type:pF});else if("+"===n||"-"===n)s=r(n,s+1)-1;else if(LF(a)||kF(a))s=o(n,s+1)-1;else if(!HF(a))throw OF(t)}function r(t,r){if(r<n){const i=e[r],n=i.charCodeAt(0);if(LF(n)||kF(n))return o(t+i,r+1)}return i.push({value:t,type:pF}),r}function o(r,o){let a=o;for(;a<n;a++){const i=e[a],n=i.charCodeAt(0);if(LF(n))r+=i;else{if("."!==i){if(IF(n))return s(r,i,a+1);break}if(r.indexOf(".")>=0)throw OF(t);r+=i}}if("."===r)throw OF(t);return i.push({value:parseFloat(r),type:fF}),a}function s(t,r,o){let s=o;for(;s<n;s++){const t=e[s];if(!IF(t.charCodeAt(0)))break;r+=t}return i.push({value:parseFloat(t),unit:r,type:dF}),s}return i}(t);return FF(e,t)}function zF(t,e){if(t.nodeType===yF){const i=zF(t.left,e),n=zF(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===gF)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===mF)return t.value;throw new Error("calc error.")}function jF(t,e){return zF(WF(t),e)}function NF(t,e){return"string"==typeof t?jF(t.trim(),e):t-0}function GF(t){return!!Ft(t)&&(!!t.endsWith("%")&&function(t){return!(Lt(t)||!Nt(t)&&+t!=+t)}(t.substring(0,t.length-1)))}function KF(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,ZD.EVENT_TYPE.CHANGE_ORDER,(()=>{t.dataSource.enableHierarchyState&&t.refreshRowColCount(),t.invalidate()}))]}function UF(t,e=[]){KF(t,(()=>{const i=e;t.internalProps.records=e;const n=t.internalProps.dataSource=JD.ofArray(i,t.pagerConf,t.options.hierarchyExpandLevel??(t.hasHierarchyTreeHeader?.()?1:void 0));t.addDisposable(n)}))}function VF(t,e){KF(t,(()=>{if(e)if(e instanceof ZD)t.internalProps.dataSource=e;else{const i=t.internalProps.dataSource=new JD(e);t.addDisposable(i)}else t.internalProps.dataSource=ZD.EMPTY;t.internalProps.records=null}))}function $F(t,e){return Math.round(NF(e,t.internalProps.calcWidthContext))}function YF(t,e){return t?t.min&&t.min>e?t.min:t.max&&t.max<e?t.max:e:e}function XF(t){return Boolean(t&&"string"==typeof t&&"auto"===t.toLowerCase())}function qF(t,e,i,n,r,o=!0){const s=cF(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 hF(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),y=r("underline",t,i,n,e),m=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 y&&"boolean"==typeof m&&"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:y?b:void 0,lineThrough:m?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=cF(C)),Array.isArray(w)){const t=cF(w);T.group.stroke=!t.every((t=>!t))&&t,T.group.strokeArrayColor=cF(w)}return{theme:T,hasFunctionPros:A}}const ZF={};class JF{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 QF={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:l.sort,name:"sort_downward",positionType:a.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:l.sort,positionType:a.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:l.sort,positionType:a.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:l.frozen,positionType:a.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:l.frozen,positionType:a.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:l.frozen,positionType:a.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:l.dropDown,positionType:a.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:l.play,positionType:a.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:l.damagePic,positionType:a.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:l.expand,name:"expand",positionType:a.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:l.collapse,name:"collapse",positionType:a.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:a.absolute,funcType:l.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:a.absolute,funcType:l.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 tW(){return it(QF,ZF)}function eW(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 iW(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 y=e+l[0]+u;return"bottom"===a||"alphabetic"===a||"ideographic"===a?y=f-o-l[2]-d:"middle"===a&&(y=e+(n-o+u-d)/2),{x:g,y:y}}function nW(t,e,i,n,r){const o=e&&A(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 rW(t,e,i,n,r){const o=e&&A(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)})}}const oW=tW();function sW(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 aW(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=nW("textAlign",s,e,i,n)??"left",l=nW("textBaseline",s,e,i,n)??"middle",h=cF(nW("padding",s,e,i,n))??[0,0,0,0];if(r.keepAspectRatio){const{width:e,height:i}=eW(o.width||o.videoWidth,o.height||o.videoHeight,t.attribute.width-(h[1]+h[3]),t.attribute.height-(h[0]+h[2])),n=iW(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 lW(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 BH({x:0,y:0,width:c,height:u});d.name="progress-bar";const{showBar:p,barColor:f,barBgColor:g,barPositiveColor:y,barNegativeColor:m,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&&dt.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 R=c,M=u,P=cF(nW("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&&dt.endsWith(A,"%")?(A=Number(A.substr(0,A.length-1)),A=u*A/100):A=Number(A),"string"==typeof T&&dt.endsWith(T,"%")?(T=Number(T.substr(0,T.length-1)),T=u*T/100):T=Number(T);if(ot(p,{col:o,row:s,table:l,context:null,value:n,dataValue:r})){let e=`${r}`;dt.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,y=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e});if(y){const t=hS({x:p,y:h,width:i,height:A,fill:y});d.addChild(t)}const m=hS({x:p,y:h,width:Math.min(i*e,i),height:A,fill:ot(f,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:e})||"#20a8d8"});d.addChild(m)}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,R=a<0?-a/e:0,M=c,P=E+u-A-T,H=0+k,L=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B});if(L){const t=hS({x:H,y:P,width:M,height:A,fill:L});d.addChild(t)}const I=v?f*M:p*M,O=Math.min(M*p*R,M),D=v?{left:H+I,top:P,width:O,height:A}:{left:H+I-O,top:P,width:O,height:A},F=ot(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:R})||"#20a8d8",W=hS({x:D.left,y:D.top,width:D.width,height:D.height,fill:F});d.addChild(W);const z=Math.min(M*f*B,M),j=v?{left:H+I-z,top:P,width:z,height:A}:{left:H+I,top:P,width:z,height:A},N=ot(y,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:B})||"#20a8d8",G=hS({x:j.left,y:j.top,width:j.width,height:j.height,fill:N});d.addChild(G);const K=v?D.left:j.left,U=aS({x:0,y:0,stroke:ot(b),lineWidth:1,lineDash:[2,2],points:[{x:K,y:0},{x:K,y:h}]});if(d.addChild(U),w&&(B||R)){const t=_,e=[];let i;if(B>0)if(i=ot(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(R>0)if(i=ot(x,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:R})||"#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=aS({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=M-L-A-T-1,B=v?R-H-f:0+k,P=ot(g,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u});if(P){const t=hS({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?ot(y,{col:o,row:s,table:l,context:null,value:n,percentile:u,dataValue:r})||"#20a8d8":ot(m,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8";const O=hS({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?ot(C,{col:o,row:s,table:l,context:null,value:n,dataValue:r,percentile:u})||"#20a8d8":ot(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=aS({x:0,y:0,stroke:i,lineWidth:t,points:e});d.addChild(h)}}}return d}const hW=new class extends RL{constructor(t){super(!1),this.type=bL.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},cW=new FL;function uW(t,e,i,n,r,o,s,a,l,h,c){t||((t=new BH({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=dW(s,c,u,i,n)}else s=l,a=dW(l,c,u,i,n);const f=[],g=[];let y,m;if("object"==typeof s.xField)hW.domain(s.xField.domain),y=s.xField.field;else if("string"==typeof s.xField){const t=h.map((t=>t[s.xField]));hW.domain(t),y=s.xField}else Array.isArray(h)&&(hW.domain(Array.from({length:h.length},((t,e)=>e))),y=s.xField);if(hW.range([0,i]),"object"==typeof s.yField)cW.domain(s.yField.domain),m=s.yField.field;else if("string"==typeof s.yField){const t=h.map((t=>t[s.yField]));cW.domain([Math.min(...t),Math.max(...t)]),m=s.yField}else Array.isArray(h)&&h.every((t=>"number"==typeof t))&&(cW.domain([Math.min(...h),Math.max(...h)]),m=s.yField);if(cW.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(!A(t[y])||!A(t[m]))break;f.push({x:d+hW.scale(t[y]),y:p-cW.scale(t[m]),defined:A(t[m])}),g.push(t),n=!0;break}n||(f.push({x:d+hW.scale(e[i]),y:0,defined:!1}),g.push({[y]:e[i],[m]:null}))}}else for(let t=0;t<h.length;t++){const e=h[t];f.push({x:d+hW.scale(y?e[y]:t),y:p-cW.scale(m?e[m]:e),defined:A(m?e[m]:e),rawData:e}),g.push(e)}const b=a.getChildByName("sparkline-line");b&&b.setAttribute("points",f);b.bandwidth=hW.step(),b.min=cW.range()[0],b.max=cW.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=uS({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=uS({x:e,y:i});v.appendChild(t)}}}return a}(r,o,s,a,l,h);return u&&t.appendChild(u),t}function dW(t,e,i,n,r){let o;o="function"==typeof t?t(null):t;const s=new BH({x:e,y:i,width:n,height:r,stroke:!1,fill:!1});if(s.name="sparkline","line"===o.type){const t=aS({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 BH({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 pW=class extends f_{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}};const fW=new Map;function gW(t,e){const i=`${t}-${e}`,n=fW.get(i);if(n)return n;const r=(o={fontSize:t,fontFamily:e},new vi({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:a?void 0:yS,specialCharSet:`-/: .,@%'"~${vi.ALPHABET_CHAR_SET}${vi.ALPHABET_CHAR_SET.toUpperCase()}`,...s??{}},o));var o,s,a;return fW.set(i,r),r}const yW=new class{measureText(t,e){const{fontSize:i,fontFamily:n}=e;return gW(i,n).measure(t)}measureTextWidth(t,e){const{fontSize:i,fontFamily:n="sans-serif"}=e;return gW(i,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}},mW=["heightLimit","lineClamp","autoWrapText"];class bW extends sx{constructor(t){super(t)}updateSingallineAABBBounds(t){const e=Pv(this).text;let i,n;const r=this.attribute,{maxLineWidth:o=e.maxLineWidth,ellipsis:s=e.ellipsis,textAlign:a=e.textAlign,textBaseline:l=e.textBaseline,fontSize:h=e.fontSize,fontFamily:c=e.fontFamily,stroke:u=e.stroke,lineHeight:d=r.lineHeight??r.fontSize??e.fontSize,lineWidth:p=e.lineWidth}=r;if(!this.shouldUpdateShape()&&this.cache){i=this.cache.clipedWidth;const t=ix(a,i),e=nx(l,d,h);return this._AABBBounds.set(t,e,t+i,e+d),u&&this._AABBBounds.expand(p/2),this._AABBBounds}if(Number.isFinite(o)){if(s){const r=!0===s?e.ellipsis:s,a=yW.clipTextWithSuffix(t.toString(),{fontSize:h,fontFamily:c},o,r);n=a.str,i=a.width}else{const e=yW.clipText(t.toString(),{fontSize:h,fontFamily:c},o);n=e.str,i=e.width}this.cache.clipedText=n,this.cache.clipedWidth=i}else i=yW.measureTextWidth(t.toString(),{fontSize:h,fontFamily:c}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=i;this.clearUpdateShapeTag();const f=ix(a,i),g=nx(l,d,h);return this._AABBBounds.set(f,g,f+i,g+d),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateMultilineAABBBounds(t){const e=Pv(this).text,{fontFamily:i=e.fontFamily,textAlign:n=e.textAlign,textBaseline:r=e.textBaseline,fontSize:o=e.fontSize,lineHeight:s=this.attribute.lineHeight??this.attribute.fontSize??e.fontSize,ellipsis:a=e.ellipsis,maxLineWidth:l,stroke:h=e.stroke,lineWidth:c=e.lineWidth,heightLimit:u=-1,lineClamp:d=e.lineClamp,autoWrapText:p=e.autoWrapText}=this.attribute;if(!this.shouldUpdateShape()&&this.cache?.layoutData){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),h&&this._AABBBounds.expand(c/2),this._AABBBounds}const f=new rx(i,{fontSize:o,fontFamily:i},yW),g=t.map((t=>t.toString())),y=[],m=[0,0];let b=1/0;if(u>0&&(b=Math.max(Math.floor(u/s),1)),d&&(b=Math.min(b,d)),p)if("number"==typeof l&&l!==1/0){if(l>0)for(let t=0;t<g.length;t++){const e=g[t];if(t===b-1){const t=f.textMeasure.clipTextWithSuffix(e,f.textOptions,l,a);y.push({str:t.str,width:t.width});break}const n=f.textMeasure.clipText(e,f.textOptions,l);if(""!==e&&""===n.str&&(n.str=e.substring(0,1),n.width=yW.measureTextWidth(n.str,{fontSize:o,fontFamily:i})),y.push({str:n.str,width:n.width}),n.str.length===e.length);else{const i=e.substring(n.str.length);g.splice(t+1,0,i)}}let t=0;y.forEach((e=>{t=Math.max(t,e.width)})),m[0]=t}else{let t,e,i=0;for(let n=0,r=g.length;n<r;n++){if(n===b-1){const t=f.textMeasure.clipTextWithSuffix(g[n],f.textOptions,l,a);y.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=g[n],t=f.textMeasure.measureTextWidth(e,f.textOptions),i=Math.max(i,t),y.push({str:e,width:t})}m[0]=i}else{let t=0;for(let e=0,i=g.length;e<i;e++)if(e<b){const i=f.textMeasure.clipTextWithSuffix(g[e],f.textOptions,l,a);y.push({str:i.str,width:i.width}),t=Math.max(t,i.width)}m[0]=t}m[1]=y.length*s;const v={xOffset:0,yOffset:0,width:m[0],height:m[1]};f.LayoutBBox(v,n,r);const w=f.layoutWithBBox(v,y,n,r,s);return this.cache.layoutData=w,this.clearUpdateShapeTag(),this._AABBBounds.set(v.xOffset,v.yOffset,v.xOffset+v.width,v.yOffset+v.height),h&&this._AABBBounds.expand(c/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<mW.length;e++){const i=mW[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<mW.length;e++){if(t===mW[e])return!0}return super.needUpdateTag(t)}}class vW extends BH{_leftGroup;_rightGroup;_centerGroup;_autoWidth=!1;_autoHeight=!1;_cellWidth;_cellHeight;_align;_baseline;constructor(t){super(t),this._leftGroup=new BH({pickable:!1,fill:!1,stroke:!1}),this._leftGroup.role="content-left",this._rightGroup=new BH({pickable:!1,fill:!1,stroke:!1}),this._rightGroup.role="content-right",this._centerGroup=new BH({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 bW&&(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 pW&&(e-=t.AABBBounds.width())}));const i=this._centerGroup.getChildByName("text");i instanceof b_?i.setAttribute("width",e):i instanceof bW&&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 wW(t,e,i){let n=0;const o=i.internalProps.layoutMap;if(o.isHeader(t,e)){const i=o.getHeader(t,e);i?.hierarchyLevel&&(n=(i.hierarchyLevel??0)*(o.rowHierarchyIndent??0))}else{const s=i.getBodyColumnDefine(t,e);if(s?.tree){const s=i.dataSource.getIndexKey(i.getRecordIndexByRow(t,e));n=Array.isArray(s)&&i.getHierarchyState(t,e)!==r.none?(s.length-1)*(o.hierarchyIndent??0):0}}return n}function CW(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;let s=0;if(Nt(i)&&Nt(n)&&r&&(t.funcType===l.collapse||t.funcType===l.expand)&&(s=wW(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 pW(o);return a.tooltip=t.tooltip,a}function xW(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 _W(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 bW?(l=p.AABBBounds.height(),p.setAttribute("maxLineWidth",e-h-d-(r[1]+r[3])),g=p.AABBBounds.height()):p instanceof b_?(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 y=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=RH(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],y))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 SW(t,e,i,n,r,o,s,a,l){let h,c,u,d,g=!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),g=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,g=t.renderDefault,h=t.expectedWidth,c=t.expectedHeight)}else e&&(h=e.expectedWidth,c=e.expectedHeight,u=e.elements,g=e.renderDefault);if(u){d=function(t,e,i,n){const r=new BH({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)&&p(c[t])&&(c[t]=c[t](n));const u=c;A(u.x)&&(u.x=f(u.x)?AW(u.x,e-a[1]):Number(u.x),u.y=f(u.y)?AW(u.y,i-a[2]):Number(u.y)),"width"in c&&(c.width=f(c.width)?AW(c.width,e-a[1]):Number(c.width)),"height"in c&&(c.height=f(c.height)?AW(c.height,i-a[2]):Number(c.height)),"radius"in c&&(c.radius=f(c.radius)?AW(c.radius,Math.min(e-a[1],i-a[2])):Number(c.radius)),"hover"in c&&(c.hover.x=f(c.hover.x)?AW(c.hover.x,e-a[1]):Number(c.hover.x),c.hover.y=f(c.hover.y)?AW(c.hover.y,i-a[2]):Number(c.hover.y),c.hover.width=f(c.hover.width)?AW(c.hover.width,e-a[1]):Number(c.hover.width),c.hover.height=f(c.hover.height)?AW(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=rS({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=hS({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 bW(Object.assign({pickable:!!t.clickable,fill:t.color??t.fill},t));r.appendChild(i);break;case"rect":const n=hS({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=oS({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 pW({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 pW({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=aS({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:g}}function AW(t,e){return t.endsWith("px")?parseInt(t,10):t.endsWith("%")&&e?parseInt(t,10)/100*e:parseInt(t,10)}function TW(t,e,i,n,r,o,s){let a,l;const h=RH(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=(cF(nW("padding",o,i,n,t.table)),lW(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=cF(nW("padding",r,i,n,t.table));uW(e,e.parent,e.attribute.x,e.attribute.y,i,n,e.attribute.width,e.attribute.height,o,t.table,qF(r,t.table,i,n,nW).theme)}else if("image"===a||"video"===a)aW(e,i,n,t.table);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 bW&&!n?l.setAttribute("heightLimit",a):l instanceof b_&&!n?l.setAttribute("height",a):t.getChildByName("content")&&t.getChildByName("content").updateHeight(a);t.forEachChildren((t=>{"rect"===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,cF(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.getCellType(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=SW(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 BW(t,e,i,n,r,o,s,a){let l,h;const c=RH(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=(cF(nW("padding",r,i,n,t.table)),lW(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=cF(nW("padding",e,i,n,t.table));uW(l,l.parent,l.attribute.x,l.attribute.y,i,n,l.attribute.width,l.attribute.height,r,t.table,qF(e,t.table,i,n,nW).theme)}else if("image"===u||"video"===u)aW(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 KD(e,l.attribute.width,l.attribute.height,t.table);l.clear(),l.appendChild(i.component),i.overlap()}}else{const e=t.table._getCellStyle(i,n);d=_W(l,h,o,a,cF(e.padding),e.textAlign,e.textBaseline,t)}return d}function RW(t,e){let i=0;for(let n=0;n<t.table.colCount;n++){let r=MW(t.highPerformanceGetCell(n,e),t);const o=RH(t.table,n,e);o&&o.end.row-o.start.row&&(r/=o.end.row-o.start.row+1),i=Math.max(i,r)}for(let n=0;n<t.table.colCount;n++){let r=i;const o=t.highPerformanceGetCell(n,e),s=RH(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));TW(t,o,n,e,r,0,t.table.isHeader(n,e))}t.table.setRowHeight(e,i,!0)}function MW(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=cF(e.table._getCellStyle(t.col,t.row).padding);return i+n[0]+n[2]}var PW;!function(t){t.dropDown="dropDown",t.contextmenu="contextmenu",t.custom="custom"}(PW||(PW={}));const EW={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 HW=tW();class LW{icon;constructor(){const t=HW.drillDown;this.icon=new pW({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=HW.drillDown,a=HW.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 kW{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=uS({visible:!1,pickable:!1,x:0,y:0,symbolType:"triangle",fill:i}),this.columnMoverLine=aS({visible:!1,pickable:!1,stroke:i,lineWidth:e,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnMoverBack=hS({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.getCellType(t,e),r=RH(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 IW(t,e){let i=e.getColsWidth(0,t);return t>=e.frozenColCount&&(i-=e.scrollLeft),i}class OW{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=aS({visible:!1,pickable:!1,stroke:i,lineWidth:n,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnResizeBgLine=aS({visible:!1,pickable:!1,stroke:r,lineWidth:o,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]});const s=cS({visible:!1,pickable:!1,x:0,y:0,fontSize:10,fill:"#FFF",text:"",textBaseline:"top",dx:16,dy:-6}),a=hS({visible:!1,pickable:!1,fill:"#3073F2",x:0,y:0,width:38,height:16,cornerRadius:5,dx:12,dy:-8});this.columnResizeLabel=sS({visible:!1,pickable:!1,x:0,y:0}),this.columnResizeLabel.appendChild(a),this.columnResizeLabel.appendChild(s),this.cellMover=new kW(this.table);const l=e.frozenColumnLine?.shadow?.width,h=e.frozenColumnLine?.shadow?.startColor,c=e.frozenColumnLine?.shadow?.endColor;this.frozenShadowLine=hS({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 BH({x:0,y:0,fill:EW.bgColor,stroke:EW.borderColor,cornerRadius:EW.cornerRadius,lineWidth:EW.borderWidth}),this._menuInfo={x:-1,y:-1,col:-1,row:-1,type:PW.dropDown,menuInfo:[],highlightIndex:-1}}bindTableComponent(t){t.appendChild(this._menuInstance),this.bindEvent()}dispose(){}attach(t,e,i,n,r,o){if(r===PW.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===PW.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!==PW.dropDown||t!==n||e!==r}checkContextMenuChange(t,e){const{type:i,menuInfo:n}=this._menuInfo;return i!==PW.contextmenu||n!==this._table.internalProps.menu?.contextMenuItems}updateMenuInstance(t,e){this._menuInstance.removeAllChild();let i=EW.menuPadding;const n=EW.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 BH({y:i,x:n,height:EW.lineHeight,fill:EW.bgColor});h.role="menu-item",this._menuInstance.appendChild(h),h.stateProxy=t=>"hover"===t?{fill:EW.hoverBgColor}:{fill:EW.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 sx({x:EW.menuItemPadding,y:EW.menuItemPadding,fill:s?EW.highlightColor:EW.color,text:l,textBaseline:"top",fontSize:EW.fontSize,pickable:!1,maxLineWidth:EW.maxLineWidth,ellipsis:"…"});if(h.addChild(c),a){c.AABBBounds.height();const t=a.width??16,e=a.height??16,i=new pW({x:EW.menuItemPadding,y:(EW.lineHeight-e)/2,width:t,height:e,image:a.svg,pickable:!1});i.role="menu-icon",h.insertBefore(i,c),c.setAttribute("x",t+EW.menuItemPadding)}r=Math.max(h.AABBBounds.width(),r),i+=EW.lineHeight})),this._menuInstance.setAttributes({width:r+2*EW.menuItemPadding+2*EW.menuPadding,height:i+EW.menuPadding}),this._menuInstance.forEachChildren((t=>{t.setAttribute("width",r+2*EW.menuItemPadding)}))}updatePosition(t,e){this._menuInstance.setAttributes({x:this._menuInfo.type===PW.dropDown?t-this._menuInstance.attribute.width:t,y:e}),this._menuInfo.x=PW.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===PW.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===PW.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(yt.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 LW}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 EH({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 EH({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){const i=IW(t,this.table);this.columnResizeLine.setAttributes({visible:!0,x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({visible:!0,x:i,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:i,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${this.table.getColWidth(t)}px`)}updateResizeCol(t,e){const i=IW(t,this.table);this.columnResizeLine.setAttributes({x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({x:i,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.setAttributes({x:i,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){if(t<0)this.frozenShadowLine.setAttributes({visible:!1});else{const e=this.table.getColsWidth(0,t);this.frozenShadowLine.setAttributes({visible:!0,x:e,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 DW(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=WW(u,n),g.lineWidth=d,p&&(g.lineDash=p),g.lineCap="square"),Array.isArray(u)&&(g.strokeArrayColor=cF(u)),Array.isArray(d)&&(g.strokeArrayWidth=cF(d),g.lineWidth=1),c&&(g.cornerRadius=c,f.cornerRadius=c);const y=g.strokeArrayWidth?g.strokeArrayWidth[0]:g.lineWidth??0,m=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=y/2,g.pickable=!1,o){g.x=t.attribute.x-v/2,g.y=t.attribute.y-y/2,g.width=t.attribute.width+v/2+m/2,g.height=t.attribute.height+y/2+b/2;const e=hS(g);e.name="table-border-rect",t.parent.insertBefore(e,t),t.border=e}else{g.width=t.attribute.width-v/2-m/2,g.height=t.attribute.height-y/2-b/2;const e=hS(g);e.name="border-rect",t.addChild(e),t.border=e}}function FW(t,e,i){const{borderColor:n}=e;t.border?.setAttribute("stroke",WW(n,i))}function WW(t,e){let i=!0;return e&&!Wt(t)?i=e.map((e=>!!e&&t)):e?i=e:e||Wt(t)?Wt(t)&&(i=!0):i=t,i}function zW(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 jW(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 NW=Fw();class GW extends rC{type="chart";chartInstance;activeChartInstance;active;cacheCanvas;constructor(t){super(t),this.numberType=NW,t.chartInstance?this.chartInstance=t.chartInstance:(t.chartInstance=this.chartInstance=new t.ClassType(t.spec,{renderCanvas:t.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:t.viewBox,interactive:!1,animation:!1}),this.chartInstance.renderSync())}activate(t){this.active=!0;const{x1:e,y1:i,x2:n,y2:r}=this.attribute.viewBox,o=t.scenegraph.tableGroup.globalAABBBounds,s=new je;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,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),GW.temp&&t.scenegraph.updateChartState(e?.datum)})),this.activeChartInstance.on("brushEnd",(e=>{console.log("brushEnd captured",e),t.scenegraph.updateChartState(e?.value?.inBrushData),GW.temp=0,setTimeout((()=>{GW.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}}const KW=Symbol.for("ChartRender");let UW=class{type;numberType=NW;drawShape(t,e,i,n,r,o,s,a){const l=Pv(t,o?.theme).group,{dataId:h,data:c,viewBox:u}=t.attribute,{width:d=l.width,height:p=l.height}=t.attribute,{chartInstance:f,active:g,cacheCanvas:y,activeChartInstance:m}=t;if(!g&&y)e.drawImage(y,i,n,d,p);else if(m)if("string"==typeof h)m.updateDataSync(h,c??[]);else for(const t in h){const e=h[t];m.updateDataSync(t,e?c?.filter((t=>t.hasOwnProperty(e)))??[]:c??[])}else{const{axes:e}=t.attribute;if(e.forEach(((t,e)=>{if("linear"===t.type){f._chart._components[e]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const i=f._chart._components[e];i._spec.domain=t.domain.slice(0),i.updateScaleDomain()}})),f.updateViewBox({x1:u.x1-t.getRootNode().table.scrollLeft,x2:u.x2-t.getRootNode().table.scrollLeft,y1:u.y1-t.getRootNode().table.scrollTop,y2:u.y2-t.getRootNode().table.scrollTop}),"string"==typeof h)f.updateDataSync(h,c??[]);else for(const t in h){const e=h[t];f.updateDataSync(t,e?c?.filter((t=>t.hasOwnProperty(e)))??[]:c??[])}const i=f.getStage();t.cacheCanvas=i.toCanvas()}}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);const s=Pv(t,n?.theme).group,{scrollX:a=s.scrollX,scrollY:l=s.scrollY}=t.attribute;let h;(a||l)&&r.translate(a,l),n&&n.drawingCb&&(h=n.drawingCb()),h&&h.then?h.then((()=>{o?r.restore():r.highPerformanceRestore()})):o?r.restore():r.highPerformanceRestore()}};UW=jW([jy()],UW);let VW=class{time=Tm.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()}}};VW=jW([jy()],VW);let $W=class{time=Tm.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 YW(t,e,n){const{highlightScope:r,disableHeader:o,cellPos:s}=t.hover;if(!t.table.isHeader(e,n)||!o){if(r===i.single&&s.col===e&&s.row===n)return"cellBgColor";if(r===i.column&&s.col===e)return"inlineColumnBgColor";if(r===i.row&&s.row===n)return"inlineRowBgColor";if(r===i.cross){if(s.col===e&&s.row===n)return"cellBgColor";if(s.col===e)return"inlineColumnBgColor";if(s.row===n)return"inlineRowBgColor"}}}$W=jW([jy()],$W);let XW=class{time=Tm.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)}};XW=jW([jy()],XW);let qW=class{time=Tm.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:y=l.strokeArrayWidth,lineWidth:m=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;if(!f||!Array.isArray(y)&&0===m)return;let v,w;if(Array.isArray(g)||Array.isArray(y)){if("number"==typeof m&&1&m||Array.isArray(y)&&y.some((t=>1&t))){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=rz(t,Math.ceil(d),Math.ceil(p));v=e,w=r}else v=Math.ceil(d),w=Math.ceil(p);ZW(t,e,i,n,l,f,y||m,g||b,v,w)}}};function ZW(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),y=Array.isArray(a)||d.isSplitDraw;e.setStrokeStyle(t,t.attribute,i,n,r);let m=!1;e.getLineDash().length&&(m=!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)),!y&&!m||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)),!y&&!m||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)),!y&&!m||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)),!y&&!m||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),y||m||(!p&&d.width&&(e.lineWidth=d.width),e.stroke())}qW=jW([jy()],qW);let JW=class{time=Tm.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:y=l.strokeArrayWidth}=t.attribute;f&&Array.isArray(p)&&p.length&&!Array.isArray(g)&&!Array.isArray(y)&&(d.doStroke=!1)}};JW=jW([jy()],JW);let QW=class{time=Tm.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:y=l.lineWidth}=t.attribute;if(!p||!Array.isArray(d)||!d.length||Array.isArray(f)||Array.isArray(g))return;let m,b,{width:v=l.width,height:w=l.height}=t.attribute;if(v=Math.ceil(v),w=Math.ceil(w),1&y){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=rz(t,Math.ceil(v),Math.ceil(w));m=e,b=r}else m=Math.ceil(v),b=Math.ceil(w);e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),e.lineTo(i+m,n),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+m,n),e.lineTo(i+m,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n+b),e.lineTo(i+m,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()}};QW=jW([jy()],QW);let tz=class{time=Tm.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:y=l.strokeArrayWidth,strokeArrayColor:m=l.strokeArrayColor}=t.attribute;f&&Array.isArray(g)&&!g.length&&!Array.isArray(m)&&!Array.isArray(y)&&1&p&&(d.doStroke=!1)}};tz=jW([jy()],tz);let ez=class{time=Tm.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:y=l.strokeArrayColor}=t.attribute,{width:m=l.width,height:b=l.height}=t.attribute;if(p&&Array.isArray(f)&&!f.length&&!Array.isArray(y)&&!Array.isArray(g)&&1&d){const{width:r,height:o}=rz(t,Math.ceil(m),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()}}};ez=jW([jy()],ez);let iz=class{time=Tm.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=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=YW(e.stateManeger,n,r);!t||i&&"cellBgColor"!==t||(i=t)}else"cell"===t.role&&(i=YW(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),nW(i,n,t.col,t.row,e)}(t,t.stage.table);e&&(t.oldColor=t.attribute.fill,t.attribute.fill=e)}}};iz=jW([jy()],iz);let nz=class{time=Tm.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 rz(t,e,i){const n=t.stage.table;if("cell"===t.role){let r=t.col,o=t.row;const s=RH(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}}nz=jW([jy()],nz);let oz=class{time=Tm.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)}};oz=jW([jy()],oz);let sz=class{time=Tm.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:y=l.strokeArrayWidth,lineWidth:m=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;f&&(Array.isArray(y)||0!==m)&&(Array.isArray(f)||Array.isArray(g)||Array.isArray(y))&&(("number"==typeof m&&1&m||Array.isArray(y)&&y.some((t=>1&t)))&&(i=Math.floor(i)+.5,n=Math.floor(n)+.5),ZW(t,e,i,n,l,f,y||m,g||b,Math.ceil(d),Math.ceil(p)))}};sz=jW([jy()],sz);var az=new Oy(((t,e,i,n)=>{i(QA)?n(QA).to(oz).inSingletonScope():(t(oz).toSelf().inSingletonScope(),t(jC).toService(oz)),i(tT)?n(tT).to(sz).inSingletonScope():(t(sz).toSelf().inSingletonScope(),t(jC).toService(sz)),t(qW).toSelf().inSingletonScope(),t(DC).toService(qW),t(XW).toSelf().inSingletonScope(),t(DC).toService(XW),t(UW).toSelf().inSingletonScope(),t(KW).to(UW),t(pA).to(UW),t(VW).toSelf().inSingletonScope(),t(FC).toService(VW),t($W).toSelf().inSingletonScope(),t(FC).toService($W),t(JW).toSelf().inSingletonScope(),t(DC).toService(JW),t(QW).toSelf().inSingletonScope(),t(DC).toService(QW),t(tz).toSelf().inSingletonScope(),t(DC).toService(tz),t(ez).toSelf().inSingletonScope(),t(DC).toService(ez),t(iz).toSelf().inSingletonScope(),t(DC).toService(iz),t(nz).toSelf().inSingletonScope(),t(DC).toService(nz)}));function lz(t,e,i,n){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=hz(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?hz(n,0,t.rowCount-1,t,!1):hz(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 hz(t,e,i,n,o){const{layoutMap:s,transpose:a}=n.internalProps,{width:l}=s?.getColumnWidthDefined(t)??{};if(a){if("standard"===n.widthMode){if(n.isRowHeader(t,0)||n.isCornerHeader(t,0))return Array.isArray(n.defaultHeaderColWidth)?n.defaultHeaderColWidth[t]??n.defaultColWidth:n.defaultHeaderColWidth;if("auto"!==l)return"string"==typeof l?NF(l,n.internalProps.calcWidthContext):l||n.defaultColWidth}else if("adaptive"===n.widthMode&&0===t&&"auto"!==l&&s?.showHeader){if("string"==typeof l)return NF(l,n.internalProps.calcWidthContext);if(l)return l}}else if("auto"!==l&&"autoWidth"!==n.widthMode&&!o)return"string"==typeof l?NF(l,n.internalProps.calcWidthContext):l||n.getColWidth(t);return function(t,e,i,n,o,s){let a=0,l=1;n-i>5e3&&(l=Math.ceil((n-i)/5e3));if(s.isPivotChart()&&e>=s.rowHeaderLevelCount){if(s.internalProps.layoutMap.indicatorsAsCol)return s.defaultColWidth;{const t=s.internalProps.layoutMap.getOptimunWidthForChart(e);if(t>0)return t}}for(let o=i;o<=n;o+=l){const i=cz(e,o,s);if("number"==typeof i){a=Math.max(i,a);continue}const n=t;if("number"==typeof n&&"standard"===s.widthMode){a=Math.max(n,a);continue}const l=s.isHeader(e,o)?s._getHeaderLayoutMap(e,o)?.headerType:s.getBodyColumnType(e,o);if("text"!==l&&"link"!==l&&"progressbar"!==l){a=Math.max(a,s.getColWidth(e)||0);continue}let h=0;const c=s.internalProps.layoutMap;if(c.isHeader(e,o)){const t=c.getHeader(e,o);if("only-body"===t?.define?.columnWidthComputeMode)continue;t?.hierarchyLevel&&(h=(t.hierarchyLevel??0)*(c.rowHierarchyIndent??0))}else{const t=s.getBodyColumnDefine(e,o);if(t?.tree){const t=s.dataSource.getIndexKey(s.getRecordIndexByRow(e,o));h=Array.isArray(t)&&s.getHierarchyState(e,o)!==r.none?(t.length-1)*(c.hierarchyIndent??0):0}}const u=uz(e,o,s);a=Math.max(u+h,a)}const h=s.getMinColWidth(e),c=s.getMaxColWidth(e);if(a<h)return h;if(a>c)return c;return a}(l,t,e,i,0,n)}function cz(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:dz(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 uz(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0;const l=i.getBodyColumnDefine(t,e);if("body"!==i.getCellType(t,e)||(!!l?.icon||!!l?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==a.absoluteRight&&(s+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0))}))}let h=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);h=n.end.col-n.start.col+1}const c=cF(nW("padding",o,t,e,i)),u=c[1]+c[3],d=nW("fontSize",o,t,e,i),p=nW("fontFamily",o,t,e,i),f=T(r).split("\n")||[];return f.length>=1?f.forEach((t=>{const e=i.measureText(t.slice(0,i.options.maxCharactersNumber||200),{fontSize:d,fontFamily:p}).width;n=Math.max((e+u+4+s)/h,n)})):n=Math.max((u+4+s)/h,n),!1!==i.internalProps.limitMaxAutoWidth&&(n=Math.min("number"==typeof i.internalProps.limitMaxAutoWidth?i.internalProps.limitMaxAutoWidth:450,n)),n}function dz(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 pz=new bW({autoWrapText:!0}),fz=new b_({width:0,height:0,textConfig:[]});function gz(t,e,i){const n="undefined"!=typeof window?window.performance.now():0;if("autoHeight"===t.heightMode){if(e=e??0,i=i??t.rowCount-1,0===e&&i===t.rowCount-1)t._clearRowRangeHeightsMap();else for(let n=e;n<=i;n++)t._clearRowRangeHeightsMap(n);for(let i=e;i<t.columnHeaderLevelCount;i++){const e=yz(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||!mz(t))if((t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol)&&mz(t))for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){t._clearRowRangeHeightsMap(n);const e=yz(n,0,t.rowHeaderLevelCount,t);t.setRowHeight(n,e)}else for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){t._clearRowRangeHeightsMap(n);const e=yz(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)}(yz(t.columnHeaderLevelCount,0,t.colCount-1,t),t.columnHeaderLevelCount,t.rowCount-1,t)}}else 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)}}console.log("computeRowsHeight time:",("undefined"!=typeof window?window.performance.now():0)-n)}function yz(t,e,i,n){let r=0;for(let o=e;o<=i;o++){const e=bz(o,t,n);if("number"==typeof e){r=Math.max(e,r);continue}const i=vz(o,t,n);r=Math.max(i,r)}return r}function mz(t){const{layoutMap:e}=t.internalProps,i=t.columnHeaderLevelCount;for(let n=0;n<t.colCount;n++){const r=e.isHeader(n,i),o=r?e.getHeader(n,i):e.getBody(n,i);if("function"==typeof o.style||"function"==typeof o.icon||"function"==typeof o.headerIcon||(r?o.define?.headerCustomRender:o.define?.customRender)||(r?"function"==typeof o.define?.headerIcon:"function"==typeof o.define?.icon))return!1;const s=t._getCellStyle(n,i);if("function"==typeof s.padding||"function"==typeof s.fontSize||"function"==typeof s.lineHeight||!0===s.autoWrapText)return!1}return!0}function bz(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:dz(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 vz(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0,l=0;const h=[];let c=0;const u=[];let d=0;const p=i.getBodyColumnDefine(t,e);if("body"!==i.getCellType(t,e)||(!!p?.icon||!!p?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==a.absoluteRight&&t.positionType!==a.inlineFront&&t.positionType!==a.inlineEnd?(l+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0),s=Math.max(s,t.height??0)):t.positionType===a.inlineFront?(h.push(t),c=Math.max(c,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0))):t.positionType===a.inlineEnd&&(u.push(t),d=Math.max(d,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0)))}))}let f=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);f=n.end.row-n.start.row+1}const g=cF(nW("padding",o,t,e,i)),y=nW("fontSize",o,t,e,i),m=nW("fontStyle",o,t,e,i),b=nW("fontWeight",o,t,e,i),v=nW("lineHeight",o,t,e,i)??y,w=nW("fontFamily",o,t,e,i),C=nW("autoWrapText",o,t,e,i),x=T(r).split("\n")||[];if(h.length||u.length){const e=Object.assign({text:r?.toString(),fontFamily:w,fontSize:y,fontStyle:m,fontWeight:b,lineHeight:v});e.textBaseline="middle";const o=[...h.map((t=>xW(t))),e,...u.map((t=>xW(t)))];fz.setAttributes({width:i.getColWidth(t)-(g[1]+g[3])-l,height:0,textConfig:o}),n=fz.AABBBounds.height()}else if(C){const e=i.getColWidth(t)-(g[1]+g[3])-l;pz.setAttributes({maxLineWidth:e,text:x,fontSize:y,fontStyle:m,fontWeight:b,fontFamily:w}),n=pz.AABBBounds.height()}else n=x.length*v;return(Math.max(n,s)+g[0]+g[2])/f}const wz=new BH({});wz.role="empty";const Cz={},xz={};function _z(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const y=it(xz,Cz)[c],m=rW("padding",f._getCellStyle(r,o),r,o,f);A(m)&&(l=m),t||((t=new BH({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 GW({stroke:!1,x:l[3],y:l[0],canvas:f.canvas,spec:u,ClassType:y,width:s-l[3]-l[1],height:a-l[2]-l[0],chartInstance:d,dataId:p,data:f.getCellValue(r,o),cellPadding:l,viewBox:{x1:Math.ceil(t.globalAABBBounds.x1+l[3]+f.scrollLeft),x2:Math.ceil(t.globalAABBBounds.x1+s-l[1]+f.scrollLeft),y1:Math.ceil(t.globalAABBBounds.y1+l[0]+f.scrollTop),y2:Math.ceil(t.globalAABBBounds.y1+a-l[2]+f.scrollTop)},axes:f.internalProps.layoutMap.getChartAxes(r,o)});return t.appendChild(b),f.internalProps.layoutMap.setChartInstance(r,o,b.chartInstance),t}function Sz(t,e,i,n,r,o,s,l,h,c,u,d,p,f,g,y){const m=t._getCellStyle(r,o),b=rW("padding",m,r,o,t);A(b)&&(c=b),y?.text?.textAlign&&(u=y?.text?.textAlign),y?.text?.textBaseline&&(d=y?.text?.textBaseline);const v="autoHeight"===t.heightMode,C="auto"===s,x=m.autoWrapText??t.internalProps.autoWrapText,_=m.lineClamp,S=new BH({x:i,y:n,width:l,height:h,lineWidth:y?.group?.lineWidth??void 0,fill:y?.group?.fill??void 0,stroke:y?.group?.stroke??void 0,strokeArrayWidth:y?.group?.strokeArrayWidth??void 0,strokeArrayColor:y?.group?.strokeArrayColor??void 0,cursor:y?.group?.cursor??void 0,lineCap:"square",clip:!0});if(S.role="cell",S.col=r,S.row=o,e.addChild(S),f&&S.appendChild(f),g){const e=t.getCellValue(r,o);let i;if(p&&(i=t.getCellIcons(r,o)),function(t,e,i,n,r,o,s,l,h,c,u,d,p,f){const g=[],y=[],m=[],b=[],v=[],C=[],x=[],_=[];let S,A=0,T=0,B=0,R=0,M=0,P=0;if(Array.isArray(e)&&0!==e.length){let E;if(e.forEach((t=>{switch(t.positionType){case a.left:g.push(t);break;case a.right:y.push(t);break;case a.contentLeft:m.push(t);break;case a.contentRight:b.push(t);break;case a.absoluteRight:_.push(t);break;case a.inlineFront:v.push(t);break;case a.inlineEnd:C.push(t)}})),g.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-left",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)})),y.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-right",i.name=e.name,i.setAttribute("x",B+(i.attribute.marginLeft??0)),B+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),R=Math.max(R,i.AABBBounds.height()),t.appendChild(i)})),x.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-absolute-left",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)})),_.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-absolute-right",i.name=e.name,i.setAttribute("x",P+(i.attribute.marginLeft??0)),P+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),0===v.length&&0===C.length){const t=w(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:h-(n[1]+n[3])-A-B,textBaseline:"top",heightLimit:o?-1:c-(n[0]+n[2]),pickable:!1,autoWrapText:s,lineClamp:l},a=new bW(f.text?Object.assign({},f.text,e):e);a.name="text",E=a}else{const e=Object.assign({text:i?.toString()},t.parent?.theme?.userTheme?.text||{});f.text&&Object.assign(e,f.text),e.textBaseline="middle";const s=[...v.map((t=>xW(t))),e,...C.map((t=>xW(t)))];s[0].textAlign=u;const a=new b_({width:r?0:h-(n[1]+n[3])-A-B,height:o?0:c-(n[0]+n[2]),textConfig:s,verticalDirection:o?"top":d});a.name="text",E=a,a.bindIconEvent()}if(0!==m.length||0!==b.length){const e=new vW({x:0,y:0,fill:!1,stroke:!1});e.name="content",e.setCellContentOption({autoWidth:r,autoHeight:o,cellWidth:h-(n[1]+n[3])-A-B,cellHeight:c-(n[0]+n[2]),align:u,baseline:d}),m.forEach((i=>{const n=CW(i,void 0,t.col,t.row,p);n.role="icon-content-left",n.name=i.name,e.addLeftOccupyingIcon(n)})),b.forEach((i=>{const n=CW(i,void 0,t.col,t.row,p);n.role="icon-content-right",n.name=i.name,e.addRightOccupyingIcon(n)})),e.addContent(E),t.appendChild(e),e.layout(),S=e.AABBBounds.width(),e.AABBBounds.height()}else t.firstChild?t.insertBefore(E,t.firstChild):t.appendChild(E),S=E.AABBBounds.width(),E.AABBBounds.height()}else if(i){const e=w(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),a=wW(t.col,t.row,p),u={text:1!==e.length||s?e:e[0],maxLineWidth:r?1/0:h-(n[1]+n[3]+a),textBaseline:"top",autoWrapText:s,lineClamp:l,heightLimit:o?-1:c-(n[0]+n[2]),pickable:!1,dx:a},d=new bW(f.text?Object.assign({},f.text,u):u);d.name="text",t.appendChild(d),S=d.AABBBounds.width(),d.AABBBounds.height()}const E=r?A+S+B:h-(n[1]+n[3]),H=c-(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+E-B+n[3]):"icon-absolute-right"===t.role?t.setAttribute("x",t.attribute.x+E-P+n[3]+n[1]):"content"!==t.name&&"text"!==t.name||("center"===u&&"richtext"!==t.type?t.setAttribute("x",n[3]+A+(E-A-B)/2):"right"===u&&"richtext"!==t.type?t.setAttribute("x",n[3]+E-B):t.setAttribute("x",n[3]+A))})),t.forEachChildren((t=>{"middle"===d?t.setAttribute("y",n[0]+(H-t.AABBBounds.height())/2):"bottom"===d?t.setAttribute("y",n[0]+H-t.AABBBounds.height()):t.setAttribute("y",n[0])})),t.setAttributes({width:E+n[1]+n[3],height:H+n[0]+n[2]})}(S,i,e,c,C,v,x,"number"==typeof _?_:void 0,l,h,u,d,t,y),y?._vtable?.marked){const t=rS({x:S.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});t.name="mark",S.appendChild(t)}}return f&&S.setAttributes({width:Math.max(S.attribute.width,f.attribute.width),height:Math.max(S.attribute.height,f.attribute.height)}),S}const Az=tW();function Tz(t,e,i){t.then((()=>{i(),e.scenegraph.updateNextFrame()})).catch((t=>{console.error(t)}))}function Bz(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,y,m){let b;if("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||Pi.test(o))&&(m?(m.text.fill=nW("linkColor",s,n,r,i),m.group.cursor="pointer"):m={text:{fill:nW("linkColor",s,n,r,i)},group:{cursor:"pointer"}})}if(s){const t=i.getCellOriginValue(n,r),e=s(i,t);e&&(m?m.group.fill=e:m={group:{fill:e}})}let v,w,C,x=!0;if("body"!==i.getCellType(n,r)?(w=e?.headerCustomRender,C=e?.headerCustomLayout):(w=e?.customRender||i.customRender,C=e?.customLayout),C||w){const t=SW(C,w,n,r,i.getColWidth(n),i.getRowHeight(r),!1,"autoHeight"===i.heightMode,i);v=t.elementsGroup,x=t.renderDefault}b=Sz(i,h,0,c,n,r,o,a,l,u,d,p,f,v,x,m),g&&(b.mergeCol=y.end.col,b.mergeRow=y.end.row);const _=i.internalProps.layoutMap.getAxisConfigInPivotChart(n,r);if(_){const t=new KD(_,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=rW("padding",d._getCellStyle(n,r),n,r,d);A(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new BH({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 y=d.getCellValue(n,r),m=dS({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[0]-h[2],image:y??oW.damage_pic.svg,cursor:"pointer"});return m.name="image",m.keepAspectRatio=a,m.successCallback=a||l?()=>{const t=m.resources.get(m.attribute.image).data;if(l&&sW(n,r,t.width,t.height,d.scenegraph,h),a){const{width:e,height:i}=eW(t.width,t.height,g.attribute.width-h[1]-h[3],g.attribute.height-h[0]-h[2]),n=iW(0,0,g.attribute.width,g.attribute.height,e,i,c,u,h);m.setAttributes({x:n.x,y:n.y,width:e,height:i})}d.scenegraph.updateNextFrame()}:()=>{aW(g,n,r,d)},m.failCallback=()=>{const t=tW();m.image=t.damage_pic.svg},g.appendChild(m),g}(h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,u,d,p,i,m);else if("video"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=rW("padding",d._getCellStyle(n,r),n,r,d);A(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new BH({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 y=d.getCellValue(n,r),m=document.createElement("video");m.addEventListener("loadeddata",(()=>{l&&sW(n,r,m.videoWidth,m.videoHeight,d.scenegraph,h);const t=g.attribute.width,e=g.attribute.height;if(a){const{width:i,height:n}=eW(m.videoWidth,m.videoHeight,t-h[1]-h[3],e-h[0]-h[2]),r=iW(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 pW({x:o-i/2,y:s-i/2,width:i,height:i,image:Az.play.svg,cursor:Az.play.cursor});p.name="play-icon",g.appendChild(p),d.scenegraph.updateNextFrame()})),m.onerror=()=>{b.image=Az.damage_pic.svg},m.src=y,m.setAttribute("preload","auto");const b=dS({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[2]-h[0],image:m,cursor:"pointer"});return b.name="image",g.appendChild(b),g}(h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,u,d,p,i,m);else if("chart"===t){const t=i.internalProps.layoutMap.getChartInstance(n,r);b=_z(null,h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),u,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),s=i.getCellValue(n,r),f=i.getCellOriginValue(n,r);b=Sz(i,h,0,c,n,r,o,a,l,u,d,p,!1,null,!0,m);const g=lW(e,t,o,s,f,n,r,0,i);b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g)}else"sparkline"===t&&(b=uW(null,h,0,c,n,r,a,l,u,i,m));return b}function Rz(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.getCellType(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=qF(i._getCellStyle(t,e),i,t,e,nW).theme,p=d._vtable.padding,f=d._vtable.textAlign,g=d._vtable.textBaseline;let y,m,b;i.internalProps?.dataConfig?.mappingRules&&"body"===s&&i.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&(y=t.bgColor.mapping)})),"body"!==s?(a?.headerCustomRender,a?.headerCustomLayout):(a?.customRender||i.customRender,a?.customLayout),h?(m=i.getColsWidth(h.start.col,h.end.col),b=i.getRowsHeight(h.start.row,h.end.row)):(m=i.getColWidth(t),b=i.getRowHeight(e));const v=i.getCellValue(t,e);st(v)?(r.removeAllChild(),Tz(v,i,Mz.bind(null,o,a,i,t,e,y,m,b,r,p,f,g,u,l,h,n,d))):c=Mz(o,a,i,t,e,y,m,b,r,p,f,g,u,l,h,n,d)}else c=new BH({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));return c}function Mz(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,y){const m=Bz(t,e,i,n,r,i.getColWidth(n),o,s,a,g?i.scenegraph.getColGroup(n):l.parent,g?0:l.attribute.y,h,c,u,d,p,f,y);return g||(l.parent.insertAfter(m,l),l.parent.removeChild(l),i.scenegraph?.proxy.cellCache.get(n)&&i.scenegraph?.proxy.cellCache.set(n,m)),m}function Pz(t,e,i,n,r,o,s,a,l,h){let c,u,d,p,f=0;a.internalProps?.dataConfig?.mappingRules&&"body"===l&&a.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&(p=t.bgColor.mapping)}));let g=0;t.colHeight&&(g=t.colHeight);for(let y=n;y<=r;y++){const n=y,r="body"!==l?a.getHeaderDefine(e,n):a.getBodyColumnDefine(e,n),m="body"!==l||(!!r?.icon||!!r?.tree),b=qF(a._getCellStyle(e,n),a,e,n,nW).theme;b.group.width=i,b.group.height=Array.isArray(s)?s[n]:s,b._vtable.padding&&(c=b._vtable.padding),b.text.textAlign&&(u=b.text.textAlign),b.text.textBaseline&&(d=b.text.textBaseline),"body"===l||b.group.fill||(b.group.fill="#fff");let v=i,w=a.getRowHeight(n);const C=(a.isHeader(e,n)?a._getHeaderLayoutMap(e,n).headerType:a.getBodyColumnType(e,n))||"text";let x,_,S;if(("body"!==l||r?.mergeCell)&&(_=a.getCellRange(e,n),S=_.start.col!==_.end.col||_.start.row!==_.end.row,S&&(v=0,w=0,x=o.get(`${_.start.col},${_.start.row};${_.end.col},${_.end.row}`),!x))){for(let t=_.start.col;t<=_.end.col;t++)v+=a.getColWidth(t);for(let t=_.start.row;t<=_.end.row;t++)w+=a.getRowHeight(t);o.set(`${_.start.col},${_.start.row};${_.end.col},${_.end.row}`,{x:0,y:g,cellWidth:v,cellHeight:w})}if(x){const i=x.cellHeight/(_.end.row-_.start.row+1),r=new BH({x:0,y:g,width:0,height:i,visible:!1,pickable:!1});r.role="shadow-cell",r.col=e,r.row=n,r.mergeCol=_.start.col,r.mergeRow=_.start.row,t.addChild(r),t.updateColumnRowNumber(n),t.updateColumnHeight(i),_=a.getCellRange(e,n),g+=i,f=Math.max(f,x.cellWidth)}else{const o=a.getCellValue(e,n);if(st(o)){Tz(o,a,Bz.bind(null,C,r,a,e,n,i,p,v,w,t,g,c,u,d,m,S,_,b)),t.updateColumnRowNumber(n);const s=S?a.getRowHeight(n)/(_.end.row-_.start.row+1):a.getRowHeight(n);t.updateColumnHeight(s),g+=s}else{const o=Bz(C,r,a,e,n,i,p,v,w,t,g,c,u,d,m,S,_,b);t.updateColumnRowNumber(n);const s=S?o.attribute.height/(_.end.row-_.start.row+1):o.attribute.height;t.updateColumnHeight(s),g+=s}}if(h&&n>h)break}return t.setAttribute("width",i),{width:i,height:g}}function Ez(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 BH({x:e+f,y:i,width:r,height:0,clip:!1,pickable:!1});p.role="column",p.col=c,t.addChild(p);const{width:y,height:m}=Pz(p,n,r,o,s,l.scenegraph.mergeMap,"columnHeader"===a?d??u:u,l,a,h);f+=y,g=Math.max(g,m)}t.setAttribute("width",f),t.setAttribute("height",g)}async function Hz(t,e,i,n){if("left"===e&&n.colEnd+t>n.bodyRightCol?t=n.bodyRightCol-n.colEnd:"right"===e&&n.colStart-t<n.bodyLeftCol&&(t=n.colStart-n.bodyLeftCol),n.table.scenegraph.bodyGroup,t<n.colEnd-n.colStart){const r="left"===e?n.colStart:n.colEnd-t+1,o="left"===e?n.colStart+t-1:n.colEnd,s="left"===e?n.colEnd+1:n.colStart-t,a="left"===e?n.colEnd+t:n.colStart-1;lz(n.table,s,a),function(t,e,i,n){for(let r=t;r<=e;r++)n.table.scenegraph.bodyGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.colHeaderGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.bottomFrozenGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n)}(r,o,e,n);const l=Math.max(n.bodyLeftCol,i-1*n.screenColCount),h=Math.min(n.bodyRightCol,i+2*n.screenColCount);n.colStart="left"===e?n.colStart+t:n.colStart-t,n.colEnd="left"===e?n.colEnd+t:n.colEnd-t,Dz(s,n),Oz(l,h,n),n.currentCol="left"===e?n.currentCol+t:n.currentCol-t,n.totalCol="left"===e?n.totalCol+t:n.totalCol-t,n.referenceCol=n.colStart+Math.floor((n.colEnd-n.colStart)/2),n.colUpdatePos=s,n.colUpdateDirection=e,n.table.scenegraph.stage.render(),await n.progress()}else{const r="left"===e?n.colStart+t:n.colStart-t,o="left"===e?n.colEnd+t:n.colEnd-t;lz(n.table,r,o);const s=n.table.getColsWidth(n.bodyLeftCol,r-1);console.log("distStartColY",n.bodyLeftCol,r-1,s),function(t,e,i,n){n.table.scenegraph.colHeaderGroup.forEachChildren(((r,o)=>{"group"===r.type&&Lz(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&&Lz(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&&Lz(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))}))}(s,t,e,n);const a=Math.max(n.bodyLeftCol,i-1*n.screenRowCount),l=Math.min(n.bodyRightCol,i+2*n.screenRowCount);n.colStart=r,n.colEnd=o,Dz(r,n),Oz(a,l,n),n.currentCol="left"===e?n.currentCol+t:n.currentCol-t,n.totalCol="left"===e?n.totalCol+t:n.totalCol-t,n.referenceCol=n.colStart+Math.floor((n.colEnd-n.colStart)/2),n.colUpdatePos=n.colStart,n.colUpdateDirection=o>n.bodyRightCol-(n.colEnd-n.colStart+1)?"right":"left",await n.progress()}}function Lz(t,e,i){t.col=e,t.forEachChildren((t=>{t.col=e,t.needUpdate=!0})),t.setAttribute("x",i),t.needUpdate=!0}function kz(t,e){let i=t.firstChild;for(;i;){i=e.updateCellGroupContent(i)._next}t.needUpdate=!1}function Iz(t,e,i){if("left"===e){const e=t.firstChild;Lz(e,t.lastChild.col+1,t.lastChild.attribute.x+t.lastChild.attribute.width),t.appendChild(e)}else{const e=t.lastChild;Lz(e,t.firstChild.col-1,t.firstChild.attribute.x-i.table.getColWidth(t.firstChild.col-1)),t.insertBefore(e,t.firstChild)}}function Oz(t,e,i){for(let n=t;n<=e;n++){kz(i.table.scenegraph.getColGroup(n),i);kz(i.table.scenegraph.getColGroup(n,!0),i);kz(i.table.scenegraph.getColGroupInBottom(n),i)}}function Dz(t,e){for(let i=0;i<e.table.rowCount;i++){if(i>=e.table.columnHeaderLevelCount&&i<e.rowStart||i>e.rowEnd&&i<e.table.rowCount-e.table.bottomFrozenRowCount)continue;const n=RH(e.table,t,i);if(n&&n.start.row!==i){const r=e.highPerformanceGetCell(t,i,!0),o=Rz(n.start.col,n.start.row,e.table,!0);o.col=t,o.row=i,o.setAttribute("x",e.table.getColsWidth(e.table.rowHeaderLevelCount,n.start.col-1)),r.parent.insertAfter(o,r),r.parent.removeChild(r),r.needUpdate=!1,o.needUpdate=!1,e.cellCache.get(t)&&e.cellCache.set(t,o)}}}function Fz(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.getCell(o,t);if(!e.row)continue;let i;i=e._prev?(e._prev?.attribute.y??0)+(e._prev?.attribute.height??0):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.getCell(o,t);if(!e.row)continue;let i;e._next?i=(e._next?.attribute.y??0)-(e.attribute.height??0):(i=r.getRowsHeight(r.columnHeaderLevelCount,e.row)-(e.attribute.height??0),console.log("估计位置",r.getRowsHeight(r.columnHeaderLevelCount,e.row))),e.setAttribute("y",i)}}async function Wz(t,e,i,n){if("up"===e&&n.rowEnd+t>n.bodyBottomRow?t=n.bodyBottomRow-n.rowEnd:"down"===e&&n.rowStart-t<n.bodyTopRow&&(t=n.rowStart-n.bodyTopRow),t<n.rowEnd-n.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++)zz(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++)zz(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++)zz(o,i,n)}}("up"===e?n.rowStart:n.rowEnd-t+1,"up"===e?n.rowStart+t-1:n.rowEnd,e,n);const r="up"===e?n.rowEnd+1:n.rowStart-t;"up"===e?n.rowEnd:n.rowStart;const o=Math.max(n.bodyTopRow,i-1*n.screenRowCount),s=Math.min(n.bodyBottomRow,i+2*n.screenRowCount);"autoHeight"===n.table.heightMode&&gz(n.table,o,s),n.rowStart="up"===e?n.rowStart+t:n.rowStart-t,n.rowEnd="up"===e?n.rowEnd+t:n.rowEnd-t,Nz(r,n),jz(o,s,n),"autoHeight"===n.table.heightMode&&Fz(n.bodyLeftCol,n.bodyRightCol,o,s,n.table,e),n.currentRow="up"===e?n.currentRow+t:n.currentRow-t,n.totalRow="up"===e?n.totalRow+t:n.totalRow-t,n.referenceRow=n.rowStart+Math.floor((n.rowEnd-n.rowStart)/2),n.rowUpdatePos=r,n.rowUpdateDirection=e,console.log("move end proxy",n.rowStart,n.rowEnd),console.log("move end cell",n.table.scenegraph.bodyGroup.firstChild.firstChild.row,n.table.scenegraph.bodyGroup.firstChild.lastChild.row),n.table.scenegraph.updateNextFrame(),await n.progress()}else{const r="up"===e?n.rowStart+t:n.rowStart-t,o="up"===e?n.rowEnd+t:n.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))}))}}(n.table.getRowsHeight(n.bodyTopRow,r-1),t,e,n),"autoHeight"===n.table.heightMode?(s=r,a=o):(s=Math.max(n.bodyTopRow,i-1*n.screenRowCount),a=Math.min(n.bodyBottomRow,i+2*n.screenRowCount)),console.log("更新同步范围",s,a),"autoHeight"===n.table.heightMode&&gz(n.table,s,a),n.rowStart=r,n.rowEnd=o,Nz(r,n),jz(s,a,n),console.log("updateAutoRow",o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up"),"autoHeight"===n.table.heightMode&&Fz(n.bodyLeftCol,n.bodyRightCol,s,a,n.table,o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up"),n.currentRow="up"===e?n.currentRow+t:n.currentRow-t,n.totalRow="up"===e?n.totalRow+t:n.totalRow-t,n.referenceRow=n.rowStart+Math.floor((n.rowEnd-n.rowStart)/2),n.rowUpdatePos=n.rowStart,n.rowUpdateDirection=o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up",console.log("move total end proxy",n.rowStart,n.rowEnd),console.log("move total end cell",n.table.scenegraph.bodyGroup.firstChild.firstChild.row,n.table.scenegraph.bodyGroup.firstChild.lastChild.row),n.table.scenegraph.updateNextFrame(),"autoHeight"!==n.table.heightMode&&await n.progress()}}function zz(t,e,i){if("up"===e){const e=t.firstChild;i.updateCellGroupPosition(e,t.lastChild.row+1,t.lastChild.attribute.y+t.lastChild.attribute.height),t.appendChild(e)}else{const e=t.lastChild;i.updateCellGroupPosition(e,t.firstChild.row-1,t.firstChild.attribute.y-e.attribute.height),t.insertBefore(e,t.firstChild)}}function jz(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)}}function Nz(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=RH(e.table,i,t);if(n&&n.start.row!==t){const r=e.highPerformanceGetCell(i,t,!0),o=Rz(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)}}}class Gz{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;colLimit=1e3;bodyLeftCol;bodyRightCol;totalCol;colStart;colEnd;taskColCount;xLimitLeft;xLimitRight;screenColCount;firstScreenColLimit;colUpdatePos;currentCol;referenceCol;screenLeftCol=0;colUpdateDirection;cellCache=new Map;constructor(t){this.table=t,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){l.setParamsForRow(),l.setParamsForColumn(),l.table.internalProps._colWidthsMap.clear(),l.table._clearColRangeWidthsMap(),lz(l.table,0,Math.min(l.firstScreenColLimit,l.table.colCount-1)),l.table.internalProps._rowHeightsMap.clear(),l.table._clearRowRangeHeightsMap(),gz(l.table,0,Math.min(l.firstScreenRowLimit,l.table.rowCount-1)),l.table.rightFrozenColCount>0&&l.table.colCount-1>l.firstScreenColLimit&&lz(l.table,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1),l.table.bottomFrozenRowCount>0&&l.table.rowCount-1>l.firstScreenRowLimit&&lz(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()}),Ez(t,s,a,0,l.table.rowHeaderLevelCount-1,0,l.table.columnHeaderLevelCount-1,"cornerHeader",l.table),Ez(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),Ez(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&&Ez(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&&Ez(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),Ez(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 createColGroupForFirstScreen(t,e,i,n,r){this.setParamsForRow(),this.setParamsForColumn(),gz(r,this.table.columnHeaderLevelCount,Math.min(this.firstScreenRowLimit,r.rowCount-1)),Ez(t,i,n,0,r.rowHeaderLevelCount-1,r.columnHeaderLevelCount,r.rowCount-1,"rowHeader",r,this.firstScreenRowLimit),Ez(e,i,n,r.rowHeaderLevelCount,r.colCount-1,r.columnHeaderLevelCount,r.rowCount-1,"body",r,this.firstScreenRowLimit),e.firstChild?(this.currentRow=e.firstChild?.rowNumber??this.totalRow,this.rowEnd=this.currentRow,this.rowUpdatePos=this.rowEnd,this.referenceRow=Math.floor((this.rowEnd-this.rowStart)/2),await this.progress()):(this.currentRow=this.totalRow,this.rowEnd=this.currentRow,this.rowUpdatePos=this.rowEnd,this.referenceRow=Math.floor((this.rowEnd-this.rowStart)/2))}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(gz(this.table,this.currentRow+1,e),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}=Pz(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}=Pz(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}=Pz(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);if(lz(this.table,this.currentCol+1,e),this.table.columnHeaderLevelCount){const t=this.table.scenegraph.colHeaderGroup.lastChild instanceof BH?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;Ez(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 BH?this.table.scenegraph.bottomFrozenGroup.lastChild:this.table.scenegraph.bottomFrozenGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;Ez(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 BH?this.table.scenegraph.bodyGroup.lastChild:this.table.scenegraph.bodyGroup.lastChild._prev,n=i.attribute.x+i.attribute.width,r=i.attribute.y;Ez(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;e.screenTopRow=n;const r=n-e.referenceRow;r>0?(Wz(r,"up",n,e),e.updateBody(t)):r<0?(Wz(-r,"down",n,e),e.updateBody(t)):e.updateBody(t),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;e.screenLeftCol=i.col;const n=e.screenLeftCol-e.referenceCol;n>0?(e.table.scenegraph.setBodyAndColHeaderX(-t),await Hz(n,"left",e.screenLeftCol,e)):n<0?(e.table.scenegraph.setBodyAndColHeaderX(-t),await Hz(-n,"right",e.screenLeftCol,e)):e.table.scenegraph.setBodyAndColHeaderX(-t),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&&gz(this.table,this.rowUpdatePos,e),jz(this.rowUpdatePos,e,this),"autoHeight"===this.table.heightMode&&Fz(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);lz(this.table,this.colUpdatePos,e),Oz(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 sortCell(){for(let t=this.bodyLeftCol;t<=this.bodyRightCol;t++)for(let e=this.rowStart;e<=this.rowEnd;e++){this.highPerformanceGetCell(t,e).needUpdate=!0}let t,e;"autoHeight"===this.table.heightMode?(t=this.rowStart,e=this.rowEnd):(t=Math.max(this.bodyTopRow,this.screenTopRow-2*this.screenRowCount),e=Math.min(this.bodyBottomRow,this.screenTopRow+3*this.screenRowCount)),console.log("sort更新同步范围",t,e),"autoHeight"===this.table.heightMode&&gz(this.table,t,e);for(let i=this.bodyLeftCol;i<=this.bodyRightCol;i++)for(let n=t;n<=e;n++){const t=this.highPerformanceGetCell(i,n);this.updateCellGroupContent(t)}if(console.log("updateAutoRow",this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up"),"autoHeight"===this.table.heightMode&&Fz(this.bodyLeftCol,this.bodyRightCol,t,e,this.table,this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up"),this.rowUpdatePos=this.rowStart,this.rowUpdateDirection=this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up",this.rowEnd===this.table.scenegraph.proxy.bodyBottomRow&&this.rowStart===this.table.scenegraph.proxy.bodyTopRow);else if(this.rowEnd===this.table.scenegraph.proxy.bodyBottomRow){const t=this.table.getAllRowsHeight()-this.table.scenegraph.height;this.updateBody(t)}else this.rowStart===this.table.scenegraph.proxy.bodyTopRow&&this.updateBody(0);"autoHeight"!==this.table.heightMode&&await this.progress()}highPerformanceGetCell(t,e,i){if(e>=this.table.columnHeaderLevelCount&&e<this.table.rowCount-this.table.bottomFrozenRowCount&&(e<this.rowStart||e>this.rowEnd))return wz;if(t>=this.table.rowHeaderLevelCount&&t<this.table.colCount-this.table.rightFrozenColCount&&(t<this.colStart||t>this.colEnd))return wz;if(this.cellCache.get(t)){const n=this.cellCache.get(t);if((n._next||n._prev)&&Math.abs(n.row-e)<e){let r=Kz(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.row&&this.cellCache.set(t,r),r}const n=this.table.scenegraph.getCell(t,e,i);return n.row&&this.cellCache.set(t,n),n}}function Kz(t,e){return t?t.row===e?t:t.row>e?Kz(t._prev,e):Kz(t._next,e):null}function Uz(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 Vz(t,e,i){const n=i.scenegraph,r=$z(t.map((t=>t.row))).sort(((t,e)=>t-e)),o=$z(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=Rz(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 $z(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}new rC({});const Yz=[];function Xz(t){Yz.forEach((e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((t=>{t.setAttributes({dy:0,dx:0})}))})),Yz.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){Zz(t.scenegraph.getCell(i,e),s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),Yz.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){qz(t.scenegraph.getCell(i,e),o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),Yz.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);qz(n,o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),Zz(n,s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),Yz.push({col:i,row:e})}}}function qz(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 Zz(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 Jz(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,t.addUpdateBoundTag())}))}))}}function Qz(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 KD(i,t.attribute.width,t.attribute.height,e);t.clear(),t.appendChild(n.component),n.overlap()}}}))}))}function tj(t){const e=t.bodyGroup.firstChild instanceof BH?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 ej(t){const e=t.colHeaderGroup.firstChild instanceof BH?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 ij(t){const e=t.rowHeaderGroup.lastChild instanceof BH?t.rowHeaderGroup.lastChild:t.rowHeaderGroup.lastChild?._prev;e&&(t.bodyGroup.firstChild?t.bodyGroup.insertBefore(e,t.bodyGroup.firstChild):t.bodyGroup.appendChild(e),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width+e.attribute.width),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width-e.attribute.width))}function nj(t){const e=t.cornerHeaderGroup.lastChild instanceof BH?t.cornerHeaderGroup.lastChild:t.cornerHeaderGroup.lastChild?._prev;e&&(t.colHeaderGroup.firstChild?t.colHeaderGroup.insertBefore(e,t.colHeaderGroup.firstChild):t.bodyGroup.appendChild(e),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width+e.attribute.width),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width-e.attribute.width))}function rj(t){const{bgColor:e,borderColor:i,borderLineWidth:n,borderLineDash:r}=t,o={x:0,y:0,width:0,height:0,visible:!1,pickable:!0,fill:e};o.stroke=WW(i,void 0),o.lineWidth=n,r&&(o.lineDash=r),o.lineCap="square",Array.isArray(i)&&(o.strokeArrayColor=cF(i)),Array.isArray(n)&&(o.strokeArrayWidth=cF(n),o.lineWidth=1);const s=new BH(o);return s.role="corner-frozen",s}Ob.load(az);class oj{proxy;tableGroup;colHeaderGroup;cornerHeaderGroup;rowHeaderGroup;bodyGroup;rightFrozenGroup;bottomFrozenGroup;rightTopCellGroup;leftBottomCellGroup;rightBottomCellGroup;componentGroup;selectedRangeComponents;selectingRangeComponents;lastSelectId;component;stage;table;isPivot;transpose;hasFrozen;frozenColCount;frozenRowCount;clear;mergeMap;constructor(t){this.table=t,this.hasFrozen=!1,this.clear=!0,this.mergeMap=new Map,this.stage=function(t){return new AH(t)}({canvas:t.canvas,width:t.canvas.width,height:t.canvas.height,disableDirtyBounds:!1,background:t.theme.underlayBackgroundColor,dpr:t.internalProps.pixelRatio}),this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"}}),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;const t=this.table.tableNoFrameWidth,e=this.table.tableNoFrameHeight;this.tableGroup=new BH({x:0,y:0,width:t,height:e,clip:!0,pickable:!1}),this.tableGroup.role="table";const i=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});i.role="col-header",this.colHeaderGroup=i;const n=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});n.role="corner-header",this.cornerHeaderGroup=n;const r=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});r.role="row-header",this.rowHeaderGroup=r;const o=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});o.role="body",this.bodyGroup=o;const s=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});s.role="right-frozen",this.rightFrozenGroup=s;const a=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});a.role="bottom-frozen",this.bottomFrozenGroup=a;const l=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1,childrenPickable:!0});l.role="component",this.componentGroup=l,this.rightTopCellGroup=rj(this.table.theme.cornerRightTopCellStyle||this.table.theme.cornerHeaderStyle),this.leftBottomCellGroup=rj(this.table.theme.cornerLeftBottomCellStyle||this.table.theme.cornerHeaderStyle),this.rightBottomCellGroup=rj(this.table.theme.cornerRightBottomCellStyle||this.table.theme.cornerHeaderStyle),this.tableGroup.addChild(o),this.tableGroup.addChild(s),this.tableGroup.addChild(a),this.tableGroup.addChild(r),this.tableGroup.addChild(i),this.tableGroup.addChild(this.rightBottomCellGroup),this.tableGroup.addChild(this.rightTopCellGroup),this.tableGroup.addChild(this.leftBottomCellGroup),this.tableGroup.addChild(n),this.tableGroup.addChild(l)}clearCells(){this.clear=!0,this.hasFrozen=!1,this.mergeMap.clear(),this.colHeaderGroup.clear(),this.rowHeaderGroup.clear(),this.cornerHeaderGroup.clear(),this.bodyGroup.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.rightTopCellGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.leftBottomCellGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.rightTopCellGroup.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 OW(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 Gz(this.table),DW(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-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);n=this.getCell(i.start.col,i.start.row)}return n||wz}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)}getCellSize(t,e){const i=this.getCell(t,e),n=RH(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)=>{Uz(e,i,t)})),t.selectedRangeComponents.forEach(((e,i)=>{Uz(e,i,t)}))}hideHoverIcon(t,e){if(-1===t||-1===e)return;aj(this,this.getCell(t,e),"mouseenter_cell")}showHoverIcon(t,e){if(-1===t||-1===e)return;sj(this,this.getCell(t,e),"mouseenter_cell")}hideClickIcon(t,e){if(-1===t||-1===e)return;aj(this,this.getCell(t,e),"click_cell")}showClickIcon(t,e){if(-1===t||-1===e)return;sj(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,y=hS({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:y,role:o}),t.tableGroup.insertAfter(y,"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=RH(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=RH(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=RH(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=RH(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,vm.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=hS({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;let r=!1;const o=t.getColGroup(e,!0),s=o?.attribute.width;if(o?.setAttribute("width",s+i),o?.forEachChildren(((o,a)=>{if(BW(t,o,e,o.row,s,i,t.table.columnHeaderLevelCount,n)){const e=RH(t.table,o.col,o.row);if(e&&e.end.row-e.start.row)for(let i=e.start.row;i<=e.end.row;i++)RW(t,i);else RW(t,o.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!0);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(0,e-t.colHeaderGroup.attribute.height)}r=!1;const a=t.getColGroup(e),l=a.attribute.width;if(a?.setAttribute("width",l+i),a?.forEachChildren(((e,o)=>{if(BW(t,e,e.col,e.row,l,i,t.table.rowHeaderLevelCount,n)){const i=RH(t.table,e.col,e.row);if(i&&i.end.row-i.start.row)for(let e=i.start.row;e<=i.end.row;e++)RW(t,e);else RW(t,e.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!1);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}const h=t.getColGroupInBottom(e);if(h){const e=h.attribute.width;if(h?.setAttribute("width",e+i),h?.forEachChildren(((o,s)=>{if(BW(t,o,o.col,o.row,e,i,t.table.rowHeaderLevelCount,n)){const e=RH(t.table,o.col,o.row);if(e&&e.end.row-e.start.row)for(let i=e.start.row;i<=e.end.row;i++)RW(t,i);else RW(t,o.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!1);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}}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)})),h&&t.bottomFrozenGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))),t.table.setColWidth(e,a.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((r=>{"chart"===r.type&&(r.cacheCanvas=null,r.setAttribute("width",Math.ceil(i-r.attribute.cellPadding[3]-r.attribute.cellPadding[1])),r.setAttribute("height",Math.ceil(n-r.attribute.cellPadding[0]-r.attribute.cellPadding[2])),r.setAttribute("viewBox",{x1:Math.ceil(e.globalAABBBounds.x1+r.attribute.cellPadding[3]+t.table.scrollLeft),x2:Math.ceil(e.globalAABBBounds.x1+i-r.attribute.cellPadding[1]+t.table.scrollLeft),y1:Math.ceil(e.globalAABBBounds.y1+r.attribute.cellPadding[0]+t.table.scrollTop),y2:Math.ceil(e.globalAABBBounds.y1+n-r.attribute.cellPadding[2]+t.table.scrollTop)}))}))}))}(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;if(i._selectedDataItemsInChart=[],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]);i._selectedDataItemsInChart.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]);i._selectedDataItemsInChart.push(t)}if(0===i._selectedDataItemsInChart.length&&0===n)return;i.internalProps.layoutMap.updateDataStateToChartInstance(),Jz(t)}}(this,t)}updateAutoColWidth(t){const e=this.table.getColWidth(t),i=hz(t,0,this.table.rowCount-1,this.table,!0);i!==e&&this.updateColWidth(t,i-e)}recalculateColWidths(){lz(this.table,0,this.table.colCount-1,!0)}recalculateRowHeights(){gz(this.table,0,this.table.rowCount-1)}resize(){this.recalculateColWidths(),"autoHeight"===this.table.heightMode&&this.recalculateRowHeights(),this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.updateTableSize(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),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.rightBottomCellGroup.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.leftBottomCellGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height,width:this.table.getFrozenColsWidth()}),this.rightBottomCellGroup.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.rightTopCellGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width,height:this.table.getFrozenRowsHeight()}),this.rightBottomCellGroup.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=RH(t.table,n,e);o&&o.start.col!==n||(TW(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);for(let e=n;e<=r;e++)for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=RH(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.frozenRowCount?(this.colHeaderGroup.setDeltaHeight(e),this.cornerHeaderGroup.setDeltaHeight(e),this.rowHeaderGroup.setDeltaY(e),this.bodyGroup.setDeltaY(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(),Xz(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++)tj(t),ej(t)}else if(t.table.frozenColCount<t.table.rowHeaderLevelCount)for(let e=0;e<t.table.rowHeaderLevelCount-t.table.frozenColCount;e++)ij(t),nj(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++)ij(t),nj(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++)tj(t),ej(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=RH(this.table,i,o);s?t=this.getCell(s.start.col,s.start.row):t.setAttribute("width",n);const a=cF(nW("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.getCellType(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=RH(r,t,e),s=RH(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=RH(r,t,e),s=RH(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 y=Math.min(l,d),m=Math.max(c,f),b=Math.min(h,p),v=Math.max(u,g);for(let t=y;t<=m;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=y;t<=m;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(){let t=0;this.cornerHeaderGroup.forEachChildrenSkipChild(((e,i)=>{e.setAttribute("x",t),t+=e.attribute.width}));let e=0;this.rowHeaderGroup.forEachChildrenSkipChild(((t,i)=>{t.setAttribute("x",e),e+=t.attribute.width}));let i=0;this.colHeaderGroup.forEachChildrenSkipChild(((t,e)=>{t.setAttribute("x",i),i+=t.attribute.width}));let n=0;this.bodyGroup.forEachChildrenSkipChild(((t,e)=>{t.setAttribute("x",n),n+=t.attribute.width})),this.cornerHeaderGroup.setDeltaWidth(t-this.cornerHeaderGroup.attribute.width),this.colHeaderGroup.setDeltaWidth(i-this.colHeaderGroup.attribute.width),this.rowHeaderGroup.setDeltaWidth(e-this.rowHeaderGroup.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 r=this.table.stateManeger.scroll.horizontalBarPos,o=this.table.stateManeger.scroll.verticalBarPos;this.component.updateScrollBar(),this.table.stateManeger.setScrollLeft(r),this.table.stateManeger.setScrollTop(o),this.updateNextFrame()}updateCellContentWhileResize(t,e){const i=this.table.getBodyColumnType(t,e),n=this.getCell(t,e);"image"!==i&&"video"!==i||aW(n,t,e,this.table)}createFrameBorder(){this.updateTableSize();const t=!this.isPivot;DW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,this.bodyGroup.role,t?[!0,!0,!0,!1]:void 0),DW(this.rowHeaderGroup,this.isPivot?this.table.theme.rowHeaderStyle.frameStyle:this.table.theme.bodyStyle.frameStyle,this.rowHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),DW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,this.colHeaderGroup.role,t?[!0,!0,!0,!1]:void 0),DW(this.cornerHeaderGroup,this.isPivot?this.table.theme.cornerHeaderStyle.frameStyle:this.table.theme.headerStyle.frameStyle,this.cornerHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),DW(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0)}getResizeColAt(t,e,i,n=8){if(i){if(t<i.globalAABBBounds.x1+n)return{col:i.col-1,row:i.row,x:i.globalAABBBounds.x1};if(i.globalAABBBounds.x2-n<t)return{col:i.col,row:i.row,x:i.globalAABBBounds.x2}}else;return{col:-1,row:-1}}updateIcon(t,e){CW(e,t),t.name=e.name,this.updateNextFrame()}updateFrozen(){this.clear||(this.resetFrozen(),this.dealFrozen(),this.component.updateScrollBar())}updateBorderSizeAndPosition(){this.bodyGroup.border&&(this.bodyGroup.appendChild(this.bodyGroup.border),zW(this.bodyGroup),0===this.rowHeaderGroup.attribute.width?FW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!0]):FW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!1])),this.colHeaderGroup.border&&(this.colHeaderGroup.appendChild(this.colHeaderGroup.border),zW(this.colHeaderGroup),0===this.cornerHeaderGroup.attribute.width?FW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!0]):FW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!1])),this.rowHeaderGroup.border&&(this.rowHeaderGroup.appendChild(this.rowHeaderGroup.border),zW(this.rowHeaderGroup)),this.cornerHeaderGroup.border&&(this.cornerHeaderGroup.appendChild(this.cornerHeaderGroup.border),zW(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?setTimeout((()=>{this.clearCells(),this.createSceneGraph()}),10):this.proxy.sortCell())}getCellOverflowText(t,e){const i=this.getCell(t,e).getChildByName("text",!0);if(i){const t=Wt(i.attribute.text)?i.attribute.text.join(""):i.attribute.text;let e="";if(Ft(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 Rz(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,[l.collapse,l.expand],n)}updateRow(t,e){Vz(t,e,this.table),this.recalculateColWidths(),"autoHeight"===this.table.heightMode&&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 sj(t,e,i){e.forEachChildren((e=>{"group"===e.type?sj(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!0,t.updateNextFrame())}))}function aj(t,e,i){e.forEachChildren((e=>{"group"===e.type?aj(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!1,t.updateNextFrame())}))}function lj(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 hj(t,e,i,n,r){const o=t.table;for(let i=0;i<o.columnHeaderLevelCount;i++)lj(t,e,i);const s=t.getColGroup(e);return s?.addUpdateBoundTag(),!0}function cj(t,e,i,n,r,o){const s=t.table;for(let i=0;i<s.columnHeaderLevelCount;i++)lj(t,e,i);const a=t.getColGroup(e);return a?.addUpdateBoundTag(),!0}function uj(t,e,i,n,r){const o=t.table;for(let e=0;e<o.colCount;e++)lj(t,e,i);return!0}function dj(t,e,i,n,r,o){const s=t.table;for(let e=0;e<s.colCount;e++)lj(t,e,i);return!0}function pj(t,e,n){const{table:r}=t,{scenegraph:o}=r,{highlightScope:s,singleStyle:a,disableHeader:l,cellPos:h,cellPosContainHeader:c}=t.hover,u=h.col,d=h.row;if(s===i.none||l&&(c.col!==e||c.row!==n)){const t=c.col,i=c.row;o.hideHoverIcon(t,i),o.showHoverIcon(e,n),c.col=e,c.row=n}if((l&&r.isHeader(e,n)||s===i.none)&&(e=-1,n=-1),u===e&&d===n)return;o.deactivateChart(u,d),o.activateChart(e,n);let p=!1;const{ranges:f,highlightScope:g}=t.select;if(-1!==u&&-1!==d&&(p=function(t,e,n,r,o,s,a){let l=!1;s===i.single?l=!!function(t,e,i,n,r){return lj(t,e,i),!0}(t,e,n)||l:s===i.row?l=!!uj(t,0,n)||l:s===i.column?l=!!hj(t,e)||l:s===i.cross&&(l=!!uj(t,0,n)||l,l=!!hj(t,e)||l);return l}(o,u,d,0,0,s),l||o.hideHoverIcon(u,d)),-1===e||-1===n)return h.col=-1,h.row=-1,void(p&&t.table.scenegraph.updateNextFrame());s===i.single?p=!!function(t,e,i,n,r){return lj(t,e,i),!0}(o,e,n)||p:s===i.row?p=!!dj(o,0,n)||p:s===i.column?p=!!cj(o,e)||p:s===i.cross&&(p=!!dj(o,0,n)||p,p=!!cj(o,e)||p),s===i.none||l||o.showHoverIcon(e,n),h.col=e,h.row=n,p&&t.table.scenegraph.updateNextFrame()}function fj(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=gj(t,e,r.col,r.row,i)),!o);s++);else n=i.sortState,n&&(r=i._getHeaderCellBySortState(n)),r&&(o=gj(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.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",R)}(n,i,s),i.scenegraph.sortCell(),i.stateManeger.updateSelectPos(-1,-1),i.fireListeners(yt.SORT_CLICK,n)}function gj(t,e,i,n,r){return r._getLayoutCellId(t,e)===r._getLayoutCellId(i,n)}const yj=it(yt,{PIVOT_SORT_CLICK:"pivot_sort_click",DRILLMENU_CLICK:"drillmenu_click"}),mj=it(yt,{VCHART_EVENT_TYPE:"vchart_event_type"});function bj(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 vj(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}class wj{table;interactionState;select;hover;hoverIcon;residentHoverIcon;columnResize;columnMove;menu;sort;frozen;scroll;tablePosition;drill;sparkLine;_clearVerticalScrollBar;_clearHorizontalScrollBar;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=e.default,this.select={highlightScope:i.single,ranges:[],cellPos:{col:-1,row:-1},selecting:!1},this.hover={highlightScope:i.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 je,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:n}=this.table.options.hover??{highlightMode:"cell"};e?this.hover.highlightScope=i.none:"cross"===t?this.hover.highlightScope=i.cross:"row"===t?this.hover.highlightScope=i.row:"column"===t?this.hover.highlightScope=i.column:"cell"===t&&(this.hover.highlightScope=i.single),this.hover.singleStyle=!e,this.hover.disableHeader=n,(this.hover.highlightScope===i.none||n)&&(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?i.none:i.single,this.select.singleStyle=!t,this.select.disableHeader=e}isSelected(t,e){let i=!1;return this.select.ranges.forEach((n=>{at(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){pj(this,t,e)}updateSelectPos(t,i,n=!1,r=!1,o=!1){-1!==i&&-1!==i&&(this.select.selecting=!0),function(t,i,n,r,o,s){const{table:a,interactionState:l}=t,{scenegraph:h}=a,{highlightScope:c,disableHeader:u,cellPos:d}=t.select;if((u&&a.isHeader(i,n)||"none"===c)&&(i=-1,n=-1),d.col!==i||d.row!==n){if(-1!==i&&-1!==n&&t.select.ranges.length>0)if(l===e.grabing){const e=t.select.ranges[t.select.ranges.length-1];i>e.start.col&&i>e.end.col&&a._makeVisibleCell(i+1,n),n>e.start.row&&n>e.end.row&&a._makeVisibleCell(i,n+1),i<e.start.col&&i<e.end.col&&a._makeVisibleCell(i-1,n),n<e.start.row&&n<e.end.row&&a._makeVisibleCell(i,n-1)}else a._makeVisibleCell(i,n);if(s){t.select.ranges=[],h.deleteAllSelectBorder(),t.select.ranges.push({start:{col:0,row:0},end:{col:a.colCount-1,row:a.rowCount-1}});const e=t.select.ranges[t.select.ranges.length-1];h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else if(-1===d.col||-1===d.row||-1!==i&&-1!==n){if(l===e.default){const e=t.select.ranges[t.select.ranges.length-1];if(r&&e){if(a.isColumnHeader(i,n)){const t=Math.min(e.start.col,e.end.col,i),r=Math.max(e.start.col,e.end.col,i),o=Math.min(e.start.row,e.end.row,n),s=a.rowCount-1;e.start={col:t,row:o},e.end={col:r,row:s}}else if(a.isRowHeader(i,n)){const t=Math.min(e.start.col,e.end.col,i),r=a.colCount-1,o=Math.min(e.start.row,e.end.row,n),s=Math.max(e.start.row,e.end.row,n);e.start={col:t,row:o},e.end={col:r,row:s}}else e.end={col:i,row:n};h.deleteLastSelectedRangeComponents(),h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else{-1===d.col||-1===d.row||o||(t.select.ranges=[],h.deleteAllSelectBorder()),a.isColumnHeader(i,n)?t.select.ranges.push({start:{col:i,row:n},end:{col:i,row:a.rowCount-1}}):a.isRowHeader(i,n)?t.select.ranges.push({start:{col:i,row:n},end:{col:a.colCount-1,row:n}}):t.select.ranges.push({start:{col:i,row:n},end:{col:i,row:n}}),d.col=i,d.row=n;const e=t.select.ranges[t.select.ranges.length-1];h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}}else if(l===e.grabing){-1===d.col&&(d.col=i),-1===d.row&&(d.row=n);const e=t.select.ranges[t.select.ranges.length-1];e.end={col:i,row:n},d.col=i,d.row=n,h.updateCellSelectBorder(e.start.col,e.start.row,i,n)}}else d.col=-1,d.row=-1,t.select.ranges=[],h.deleteAllSelectBorder();h.updateNextFrame()}}(this,t,i,n,r,o)}checkCellRangeInSelect(t,e){return function(t,e,i,n){for(let n=0;n<i.length;n++)if(ht(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=vj(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(yt.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){this.columnResize.resizing=!0,this.columnResize.col=t,this.columnResize.x=e,this.table.scenegraph.component.showResizeCol(t,i),this.table.stateManeger.updateSelectPos(-1,-1),this.table.scenegraph.updateNextFrame()}updateResizeCol(t,e){t=Math.ceil(t),e=Math.ceil(e);let i=t-this.columnResize.x;if(Math.abs(i)<1)return;let n=this.table.colWidthsMap.get(this.columnResize.col);"number"==typeof n||(n=this.table.getColWidth(this.columnResize.col));let r=n;r+=i;const o=this.table.getMinColWidth(this.columnResize.col),s=this.table.getMaxColWidth(this.columnResize.col);if(r<o||r>s){if(n===o||n===s)return;i=n-o>s-n?s-n:o-n}i=Math.ceil(i),this.table.scenegraph.updateColWidth(this.columnResize.col,i),"adaptive"===this.table.widthMode&&this.columnResize.col<this.table.colCount-1&&this.table.scenegraph.updateColWidth(this.columnResize.col+1,-i),this.columnResize.x=t,this.table.scenegraph.component.updateResizeCol(this.columnResize.col,e),this.columnResize.col<this.table.frozenColCount&&!this.table.isPivotTable()&&!this.table.transpose&&this.table.scenegraph.component.setFrozenColumnShadow(this.table.frozenColCount-1),this.table.scenegraph.updateNextFrame()}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.getCellType(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.getCellType(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(){bj(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(yt.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(yt.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(yt.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(yt.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,PW.contextmenu)),this.table.fireListeners(yt.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"contextmenu"}))}triggerDropDownMenu(t,e,i,n){this.table.fireListeners(yt.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,PW.dropDown),this.menu.bounds=this.table.scenegraph.component.menu.bounds),this.table.fireListeners(yt.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===l.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(yt.DROPDOWN_MENU_CLEAR,null),this.table.fireListeners(yt.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(A(s)&&A(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(d(e)&&(e.menuKey||e.text)===(h||"")&&t===i)return!0;if(f(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(yj.PIVOT_SORT_CLICK,{col:t,row:e,order:i||"normal",dimensionInfo:this.table.internalProps.layoutMap.getPivotDimensionInfo(t,e),cellType:this.table.getCellType(t,e)})}const n=this.sort.col,r=this.sort.row;fj(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.dimensionTitle=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.getCellType(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=aS({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=uS({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),caption:r.getBodyColumnDefine(t,e).caption,cellRange:r.getCellRelativeRect(t,e),sparkline:{pointData:d.pointData},scaleRatio:r.canvas.getBoundingClientRect().width/r.canvas.offsetWidth};r.fireListeners(yt.MOUSEOVER_CHART_SYMBOL,i)}}(t,e,i,0,this.table),this.sparkLine.col=t,this.sparkLine.row=e}}function Cj(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}function xj(t){if(t.stateManeger.endResizeCol(),t.hasListeners(yt.RESIZE_COLUMN_END)){const e=[];for(let i=0;i<t.colCount;i++)e.push(t.getColWidth(i));t.fireListeners(yt.RESIZE_COLUMN_END,{col:t.stateManeger.columnResize.col,columns:e})}}function _j(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&&(e.setScrollLeft(e.scroll.horizontalBarPos+r),e.showHorizontalScrollBar(!0)),o&&(e.setScrollTop(e.scroll.verticalBarPos+o),e.showVerticalScrollBar(!0)),t.cancelable&&(0!==n&&Sj(n,e)||0!==i&&Aj(i,e))&&t.preventDefault()}function Sj(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 Aj(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 Tj(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||!Bj(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;_j({deltaX:n,deltaY:r},i),e.cancelable&&(0!==r&&Sj(r,i)||0!==n&&Aj(n,i))&&e.preventDefault()}),{passive:!1}),window.addEventListener("touchend",(e=>{if(t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&Bj(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),_j({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 Bj(t){return!!t.changedTouches}function Rj(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 Mj{table;isTouchdown;touchMovePoints;touchSetTimeout;touchEnd;touchMove;constructor(t){this.table=t,this.bindOuterEvent(),setTimeout((()=>{this.bindSelfEvent()}),0)}bindOuterEvent(){!function(t){const i=t.table,n=i.stateManeger;document.body.addEventListener("pointermove",(r=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const{x:o,y:s}=i._getMouseAbstractPoint(r,!1);n.interactionState!==e.scrolling&&n.interactionState===e.grabing&&n.isResizeCol()&&(t.dealColumnResize(o,s),i.hasListeners(yt.RESIZE_COLUMN)&&i.fireListeners(yt.RESIZE_COLUMN,{col:i.stateManeger.columnResize.col,colWidth:i.getColWidth(i.stateManeger.columnResize.col)}))})),i.scenegraph.tableGroup.addEventListener("pointermove",(r=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const o=Cj(r);if(n.interactionState!==e.scrolling)if(n.interactionState!==e.grabing){if(n.isResizeCol()||t.checkColumnResize(o)?n.updateCursor("col-resize"):n.updateCursor(),i.hasListeners(yt.MOUSELEAVE_CELL)){const t=o?.eventArgs?.target;"cell"!==t?.role||-1===i.stateManeger.hover.cellPos.col||-1===i.stateManeger.hover.cellPos.row||t.col===i.stateManeger.hover.cellPos.col&&t.row===i.stateManeger.hover.cellPos.row||i.fireListeners(yt.MOUSELEAVE_CELL,{col:i.stateManeger.hover.cellPos.col,row:i.stateManeger.hover.cellPos.row,cellRange:i.getCellRangeRelativeRect({col:i.stateManeger.hover.cellPos.col,row:i.stateManeger.hover.cellPos.row}),scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth,event:r.nativeEvent})}if(i.hasListeners(yt.MOUSEENTER_CELL)){const t=o?.eventArgs?.target;"cell"===t?.role&&kt(t.col)&&kt(t.row)&&(t.col!==i.stateManeger.hover.cellPos.col||t.row!==i.stateManeger.hover.cellPos.row)&&i.fireListeners(yt.MOUSEENTER_CELL,{col:t.col,row:t.row,cellRange:i.getCellRangeRelativeRect({col:t.col,row:t.row}),scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth,event:r.nativeEvent})}if(t.dealIconHover(o),t.dealTableHover(o),o.eventArgs&&i.hasListeners(yt.MOUSEMOVE_CELL)){let t,e;if(o.eventArgs?.target){const i=vj(o.eventArgs?.target);i&&(t=i.icon,e=i.position)}i.fireListeners(yt.MOUSEMOVE_CELL,{col:o.eventArgs.col,row:o.eventArgs.row,x:o.abstractPos.x,y:o.abstractPos.y,event:r.nativeEvent,targetIcon:t?{name:t.name,position:e,funcType:t.attribute.funcType}:void 0})}}else n.isResizeCol()||(n.isMoveCol()?t.dealColumnMover(o):t.dealTableSelect(o))})),i.scenegraph.tableGroup.addEventListener("pointerout",(e=>{const i=Cj(e),n=i?.eventArgs?.target;"table"===n?.role&&t.dealTableHover()})),i.scenegraph.tableGroup.addEventListener("pointerover",(t=>{const e=Cj(t),n=e?.eventArgs?.target;if(i.hasListeners(yt.MOUSEOVER_CHART_SYMBOL)&&"symbol"===n.type){const e=t.composedPath().find((t=>"cell"===t.roll));if(e){const{col:n,row:r}=e,o={col:n,row:r,field:i.getHeaderField(n,r),value:i.getCellValue(n,r),dataValue:i.getCellOriginValue(n,r),cellHeaderPaths:i.internalProps.layoutMap.getCellHeaderPaths(n,r),caption:i.getBodyColumnDefine(n,r).caption,cellRange:i.getCellRelativeRect(n,r),event:t.nativeEvent,sparkline:{pointData:void 0},scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth};i.fireListeners(yt.MOUSEOVER_CHART_SYMBOL,o)}}})),i.scenegraph.tableGroup.addEventListener("pointerleave",(r=>{n.isResizeCol()||(n.updateInteractionState(e.default),n.updateCursor()),t.dealTableHover();const o=r.target;o&&!o.isDescendantsOf(i.scenegraph.tableGroup)&&i.fireListeners(yt.MOUSELEAVE_TABLE,{col:-1,row:-1,event:r.nativeEvent})})),i.scenegraph.tableGroup.addEventListener("pointerupoutside",(r=>{console.log("pointerupoutside"),n.isResizeCol()&&xj(i),n.updateInteractionState(e.default),t.dealTableHover(),t.dealTableSelect()})),i.scenegraph.tableGroup.addEventListener("pointerdown",(r=>{if(0!==r.button)return;const o=Cj(r);if(n.interactionState===e.default){if(i.isPivotChart()&&"chart"!==o?.eventArgs?.target.type&&i.scenegraph.updateChartState(null),n.menu.isShow&&o.eventArgs&&o.eventArgs.target!==n.residentHoverIcon?.icon&&n.hideMenu(),!(o?.eventArgs?.target?.role?.startsWith("icon")?o.eventArgs.target:void 0))if("touch"===r.pointerType)t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.touchMove=!0,(!t.touchEnd&&t.checkColumnResize(o,!0)||!t.touchEnd&&t.chechColumnMover(o)||t.dealTableSelect(o)&&!t.touchEnd)&&n.updateInteractionState(e.grabing)}),500);else{if(t.checkColumnResize(o,!0))return i.scenegraph.updateChartState(null),void n.updateInteractionState(e.grabing);if(t.chechColumnMover(o))return void n.updateInteractionState(e.grabing);t.dealTableSelect(o)&&n.updateInteractionState(e.grabing)}if(i.hasListeners(yt.MOUSEDOWN_CELL)){const t=Cj(r);t.eventArgs&&i.fireListeners(yt.MOUSEDOWN_CELL,{col:t.eventArgs.col,row:t.eventArgs.row,event:r.nativeEvent})}}})),i.scenegraph.tableGroup.addEventListener("pointerup",(t=>{if(0===t.button){if("grabing"===n.interactionState){if(n.updateInteractionState(e.default),n.isResizeCol())xj(i);else if(n.isMoveCol()){i.stateManeger.endMoveCol();const e=Cj(t);e.eventArgs&&i.hasListeners(yt.CHANGE_HEADER_POSITION)&&i.fireListeners(yt.CHANGE_HEADER_POSITION,{target:{col:e.eventArgs.col,row:e.eventArgs.row},source:{col:i.stateManeger.columnMove.colSource,row:i.stateManeger.columnMove.colSource}})}else if(n.isSelecting()){i.stateManeger.endSelectCells();const e=Cj(t);if(e.eventArgs&&i.hasListeners(yt.DRAG_SELECT_END)){const n={event:t.nativeEvent,cells:[],col:e.eventArgs.target.col,row:e.eventArgs.target.row,scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth};n.cells=i.getSelectedCellInfos(),i.fireListeners(yt.DRAG_SELECT_END,n)}}}else n.interactionState===e.scrolling&&n.updateInteractionState(e.default);if(i.hasListeners(yt.MOUSEUP_CELL)){const e=Cj(t);e.eventArgs&&i.fireListeners(yt.MOUSEUP_CELL,{col:e.eventArgs.col,row:e.eventArgs.row,event:t.nativeEvent})}}})),i.scenegraph.tableGroup.addEventListener("rightdown",(t=>{const e=Cj(t);if(e.eventArgs){n.triggerContextMenu(e.eventArgs.col,e.eventArgs.row,e.abstractPos.x,e.abstractPos.y);const{col:r,row:o}=e.eventArgs;if(i.hasListeners(yt.CONTEXTMENU_CELL)){const n=i.getCellInfo(r,o);let s,a;if(e.eventArgs?.target){const t=vj(e.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,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}(i.stateManeger.select.ranges,r,o)?l.cells=[[n]]:l.cells=i.getSelectedCellInfos(),i.fireListeners(yt.CONTEXTMENU_CELL,l)}}})),i.scenegraph.tableGroup.addEventListener("click",(e=>{if(console.log("click",e.clone()),i.stateManeger.columnResize.resizing||i.stateManeger.columnMove.moving)return;const n=Cj(e);if(t.dealIconClick(e,n),!n?.eventArgs)return;const{col:r,row:o}=n.eventArgs;if(i.hasListeners(yt.CLICK_CELL)){const t=i.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=vj(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...t,event:e.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};i.fireListeners(yt.CLICK_CELL,l)}})),i.scenegraph.stage.addEventListener("click",(r=>{console.log("stage click");const o=r.target;o&&!o.isDescendantsOf(i.scenegraph.tableGroup)&&o!==i.scenegraph.tableGroup&&(console.log("pointerup outside table"),n.updateInteractionState(e.default),t.dealTableHover(),t.dealTableSelect(),n.updateCursor(),i.scenegraph.updateChartState(null))})),i.scenegraph.tableGroup.addEventListener("dblclick",(t=>{const e=Cj(t),n=e.eventArgs.targetCell.globalAABBBounds,{col:r,row:o}=e.eventArgs,s=i.getCellValue(r,o);if(i.internalProps.focusControl.setFocusRect(new xi(n.x1+i.scrollLeft,n.y1+i.scrollTop,n.x2-n.x1,n.y2-n.y1),s),i.hasListeners(yt.DBLCLICK_CELL)){const n=i.getCellInfo(r,o);let s,a;if(e.eventArgs?.target){const t=vj(e.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,event:t.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};i.fireListeners(yt.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=>{_j(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(yt.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(yt.KEYDOWN,t)}})),n.on(e.getElement(),"copy",(t=>{if(e.keyboardOptions?.copySelected){const i=e.getCopyValue();kt(i)&&(t.preventDefault(),ct?window.clipboardData.setData("Text",i):t.clipboardData.setData("text/plain",i))}})),n.on(e.getElement(),"contextmenu",(t=>{t.preventDefault()})),n.on(e.getParentElement(),"resize",(()=>{e.resize()}))}(this),function(t){const i=t.table,n=i.stateManeger,r=i.scenegraph;r.component.vScrollBar.addEventListener("pointerover",(t=>{n.showVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerover",(t=>{n.showHorizontalScrollBar()})),r.component.vScrollBar.addEventListener("pointerout",(t=>{n.interactionState!==e.scrolling&&n.hideVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerout",(t=>{n.interactionState!==e.scrolling&&n.hideHorizontalScrollBar()})),r.component.vScrollBar._slider.addEventListener("pointerdown",(()=>{n.interactionState!==e.scrolling&&n.updateInteractionState(e.scrolling)})),r.component.vScrollBar.addEventListener("pointerup",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.vScrollBar.addEventListener("pointerupoutside",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.hScrollBar._slider.addEventListener("pointerdown",(()=>{n.interactionState!==e.scrolling&&n.updateInteractionState(e.scrolling)})),r.component.hScrollBar.addEventListener("pointerup",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.hScrollBar.addEventListener("pointerupoutside",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)}));const o=x(n.updateVerticalScrollBar,20),s=x(n.updateHorizontalScrollBar,20);r.component.vScrollBar.addEventListener("scroll",(t=>{const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);o(e,t)})),r.component.hScrollBar.addEventListener("scroll",(t=>{const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(e)}))}(this),Tj(this)}bindSelfEvent(){const t=this.table.stateManeger;var e;this.table.listen(yt.ICON_CLICK,(e=>{const{col:i,row:n,x:r,y:o,funcType:s,icon:a}=e;var h;s===l.dropDown?t.triggerDropDownMenu(i,n,r,o):s===l.sort?t.triggerSort(i,n,a):s===l.frozen?t.triggerFreeze(i,n,a):s===l.drillDown?(h=this.table).fireListeners(yj.DRILLMENU_CLICK,h.stateManeger.drill):s!==l.collapse&&s!==l.expand||this.table.toggleHierarchyState(i,n)})),this.table.listen(yt.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.listen(yt.SCROLL,(t=>{Xz(this.table)})),e=this.table,"browser"===vt.mode&&e.listen(yt.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.columnType){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(!Pi.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.listen(yt.DBLCLICK_CELL,(t=>{this.table._canResizeColumn(t.col,t.row)&&this.table.scenegraph.updateAutoColWidth(t.col)})),this.table.isPivotTable()&&function(t){t.listen(yt.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.dimensionTitle,r.drillDown,r.drillUp,i,n):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.columnType)):t.internalProps.layoutMap.columnObjects.some((t=>"sparkline"===t.columnType));e&&(t.listen(yt.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.listen(yt.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateSparklineHoverPose(-1,-1,0,0)})))}(this.table),function(t){t.isPivotChart()&&t.scenegraph.tableGroup.addEventListener("click",(e=>{if("axis-label"===e.target.name){const i=Cj(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(),Jz(t.scenegraph),t.scenegraph.updateNextFrame()}else t._selectedDimensionInChart&&(t._selectedDimensionInChart.length=0,t.internalProps.layoutMap.updateDataStateToChartInstance(),Jz(t.scenegraph),t.scenegraph.updateNextFrame())}))}(this.table),function(t){t.isPivotChart()&&(t.listen(yt.MOUSEENTER_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=Rj(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(yt.MOUSEENTER_AXIS,e)}}))})),t.listen(yt.MOUSELEAVE_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=Rj(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(yt.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),!0}return!1}dealColumnResize(t,e){this.table.stateManeger.updateResizeCol(t,t)}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(at(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(yt.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 b_){const t=n.pickIcon(r.global);if(t)return this.table.fireListeners(yt.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}}let Pj;const Ej=t=>{const e=t.value;return Number(e)>80?"#20a8d8":Number(e)>50?"#4dbd74":Number(e)>20?"#ffc107":"#f86c6b"};class Hj extends O{_showBar;_barColor;_barBgColor;_barPositiveColor;_barNegativeColor;_barAxisColor;_barHeight;_barBottom;_barPadding;_showBarMark;_barMarkPositiveColor;_barMarkNegativeColor;_barMarkWidth;_barMarkPosition;_barRightToLeft;static get DEFAULT(){return Pj||(Pj=new Hj)}constructor(t={},e={}){super(t,e),this._showBar=t.showBar??!0,this._barColor=t.barColor??Ej,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 Hj(this,null)}}const Lj=["type","content","font","color","width","height","marginRight","marginLeft","src","svg","name","path","positionType","tooltip","hover","cursor","shape","interactive"];class kj{expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=tW();this.expandIcon=e[h.expandIconName],this.collapseIcon=e[h.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=tW(),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 F;case"image":case"video":return D;case"chart":case"sparkline":return O;case"progressbar":return Hj}}getCellIconFromRecordValue(t,e,i){if(Array.isArray(t))return t.map((t=>this.getCellIconFromRecordValue(t,e,i)));if(!ut.isObject(t)||"function"==typeof t)return this._table.getFieldData(t,e,i);const n={},r=t;return Lj.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===r.expand?this.expandIcon:i===r.collapse?this.collapseIcon:void 0}}function Ij(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 Oj="vtable__menu-element",Dj=`${Oj}__item`,Fj=`${Oj}__content`,Wj=`${Oj}--hidden`,zj=`${Oj}--shown`,jj=`${Oj}--normal`,Nj=`${Oj}--select`,Gj=`${Oj}__icon`,Kj=`${Oj}__split`,Uj=`${Oj}__title`,Vj=`${Oj}__arrow`,$j=`${Oj}__no-event`,Yj=`${Oj}__item-text`;function Xj(){return Ij("div",[Oj,Wj])}function qj(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(A(o)&&A(a)&&at(s,o,a)&&i===h)return!0}return!1}class Zj{_handler;_rootElement;_secondElement;_menuInstanceInfo;_showChildrenIndex;_mouseEnterSecondElement;constructor(t){this._handler=new xt,this._rootElement=Xj(),this._secondElement=Xj(),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(Wj))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(Wj))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(e=>{if(this._rootElement.classList.contains(Wj))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(Wj),i?.classList.add(zj),i.innerHTML="";const s=this._menuInstanceInfo.content[n]?.children;for(let e=0;e<s.length;e++){const n=s[e],a=Jj(n,!!t.stateManeger.menu.dropDownMenuHighlight&&qj(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(Wj),t?.classList.add(zj)}else!s&&this._secondElement?.classList.contains(zj)&&setTimeout((()=>{if(!0!==this._mouseEnterSecondElement){this._showChildrenIndex=-1;const t=this._secondElement;t?.classList.remove(zj),t?.classList.add(Wj)}}),300)})),this._secondElement?.addEventListener("wheel",(t=>{t.stopPropagation()})),this._secondElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(Wj)||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(Wj))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(qj(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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,cellHeaderPaths:t.isPivotTable()?t.getCellHeaderPaths(i,n):void 0,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()}))}get rootElement(){return this._rootElement}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.dispose(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement,o=this._secondElement;if(this._menuInstanceInfo=n,r?.classList.remove(zj),r?.classList.add(Wj),o?.classList.remove(zj),o?.classList.add(Wj),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&&qj(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(qj(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof r?r?.menuKey||r?.text:r,e,i)){a=!0;break}}const l=Jj(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(zj),r?.classList.remove(Wj),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement,e=this._secondElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(zj),t.classList.add(Wj)),e?.parentElement&&(e.classList.remove(zj),e.classList.add(Wj))}_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 Jj(t,e){const i=Ij("div",[Dj,e?Nj:jj]);if("string"==typeof t){const e=Ij("span",[Fj,$j,Yj]);e.innerHTML=t,i.appendChild(e)}else if("object"==typeof t){const n=t.type??"item";if("split"===n)return i?.classList.add(Kj),i;if(t?.icon?.svg)if(Pi.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=Ij("span",[Gj,$j]);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=Ij("span",[Fj,$j,Yj]);if(r.innerHTML=t.text,i.appendChild(r),"title"===n)i?.classList.add($j,Uj);else if(t?.children?.length){const t=Ij("span",[Fj,$j,Vj]);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 Qj;class tN extends j{static get DEFAULT(){return Qj||(Qj=new tN)}constructor(t={},e={}){super(t,e),this.textAlign=(t.textAlign??e?.textAlign)||"center"}clone(){return new tN(this)}}class eN{normalIcon;upIcon;downIcon;freezeIcon;frozenIcon;frozenCurrentIcon;dropDownAbsoluteIcon;expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=tW();this.freezeIcon=e[h.freezeIconName],this.frozenIcon=e[h.frozenIconName],this.frozenCurrentIcon=e[h.frozenCurrentIconName],this.normalIcon=e[h.normalIconName],this.upIcon=e[h.upwardIconName],this.downIcon=e[h.downwardIconName],this.dropDownAbsoluteIcon=e[h.dropdownIconName],this.expandIcon=e[h.expandIconName],this.collapseIcon=e[h.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&&at(o,i.col,i.row)){({order:r}=e);break}}else{const t=this._table._getHeaderCellBySortState(n);t&&at(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{captionIcon:r,headerIcon:o}=this._table._getHeaderLayoutMap(t,e);r&&i.push(r);const s=this.getHierarchyIcon(t,e);if(s&&i.push(s),o){let n;if("function"==typeof o){n=o({col:t,row:e,value:this._table.getCellValue(t,e),dataValue:this._table.getCellOriginValue(t,e),table:this._table})}else n=o;const r=tW(),s=t=>{let e;e="string"==typeof t?r[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,h=-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 a=s.children[n];if(t.stateManeger.menu?.dropDownMenuHighlight&&qj(t,t.stateManeger.menu?.dropDownMenuHighlight,"object"==typeof a?a?.menuKey:a,e,i)){r=o,h=n;break}}if(t._dropDownMenuIsHighlight(e,i,o)){r=o;break}}if(-1!==r){let e;e=-1!==h?(o||t.globalDropDownMenu)[r].children[h]:(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:a.right,marginRight:0,funcType:l.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:a.right,marginRight:0,funcType:l.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===r.expand)return this.expandIcon;if(i===r.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 G;case"image":case"video":return tN}}}class iN{_table;_tooltipElement;constructor(t){this._table=t}dispose(){this.unbindTooltipElement(),this._tooltipElement&&this._tooltipElement.dispose?.(),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 nN="vtable__bubble-tooltip-element",rN=`${nN}__content`,oN=`${nN}__triangle`,sN=`${nN}--hidden`,aN=`${nN}--shown`;class lN{_handler;_rootElement;_messageElement;_triangleElement;constructor(){this._handler=new xt;const t=this._rootElement=Ij("div",[nN,sN]),e=Ij("span",[rN]),i=Ij("span",[oN]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${rN}`)||void 0,this._triangleElement=t.querySelector(`.${oN}`)||void 0}bindToCell(t,e,i,n,r){const o=this._rootElement,s=this._messageElement,a=this._triangleElement;if(o?.classList.remove(aN),o?.classList.add(sN),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(aN),o?.classList.remove(sN),!0}else this.unbindFromCell();return!1}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler?.dispose?.(),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(aN),o?.classList.remove(sN)):this.unbindFromCell()}unbindFromCell(){const t=this._rootElement;t?.parentElement&&(t.classList.remove(aN),t.classList.add(sN))}_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`,B()&&(a.style.fontSize="11px");const{x1:y,x2:m,y1:b,y2:v}=t.stateManeger.menu.bounds,w=d,C=w+f,x=l,_=w+g;return!(t.stateManeger.menu.isShow&&y<C&&m>w&&v>x&&b<_)}return!1}getComputedPosition(t,e,i,r,o,s,a){const l=this._rootElement,h=t.getCellRangeRelativeRect({col:e,row:i}),{width:c,height:u}=t.internalProps.element.getBoundingClientRect(),{width:d}=h;let p,f;const g=Math.min(.8*c,4*d);l.style.maxWidth=`${g}px`;const y=l.clientWidth,m=l.clientHeight,b=a?6:0;if(r)f=r.x,p=r.y+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(o){let e=o.placement??n.bottom;const i=o.rect.left+o.rect.width/2+t.tableX,r=o.rect.top+o.rect.height/2+t.tableY,a=o.rect.top+t.tableY,l=o.rect.bottom+t.tableY,h=o.rect.left+t.tableX,d=o.rect.right+t.tableX;let g=0;const v=()=>{g++,g>=4||(this.removeStyleFromTriangle(),e===n.top?(f=i-y/2,p=a-m-b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",s&&p<0&&(e=n.right,v())):e===n.bottom?(f=i-y/2,p=l+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",s&&p+m>u&&(e=n.left,v())):e===n.left?(p=r-m/2,f=h-y-b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",s&&f<0&&(e=n.top,v())):e===n.right&&(p=r-m/2,f=d+b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",s&&f+y>c&&(e=n.bottom,v())))};v()}return s&&(f<0?f=0:f+l.offsetWidth>c&&(f=c-l.offsetWidth)),{x:f,y:p}}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 hN extends iN{createTooltipElementInternal(){return new lN}}const cN={"bubble-tooltip":function(t){return new hN(t)}};class uN{_table;_tooltipInstances;_attachInfo;confine;constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}dispose(){const t=this._tooltipInstances;for(const e in t)t[e]?.dispose?.();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||!at(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||!at(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&&at(i.range,t,e)}_bindTableEvent(t){t.listen(yt.MOUSEENTER_CELL,(e=>{if(B())return;const{x1:i,x2:r,y1:o,y2:s}=t.stateManeger.menu.bounds;if(t.stateManeger.menu.isShow&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>i&&e.x<r&&e.y>o&&e.y<s)return;const{col:a,row:l}=e;if((!e.related||!this._isBindCell(a,l))&&t.internalProps.tooltip?.isShowOverflowTextTooltip){const i=t.getCellOverflowText(a,l),r=t.getHeaderDescription(a,l),o=t.getCellRangeRelativeRect({col:a,row:l});let s;i&&(s={content:r?`${r}\n ${i}`:i,referencePosition:{placement:n.bottom,rect:o},style:{arrowMark:!1}}),r&&(s={content:r,referencePosition:{placement:n.bottom,rect:o},style:{arrowMark:!1}}),s&&this._bindToCell(e.col,e.row,s)}})),t.listen(yt.MOUSEMOVE_CELL,(e=>{if(!B()){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.listen(yt.MOUSELEAVE_CELL,(t=>{t.related&&this._isBindCell(t.related.col,t.related.row)||this._unbindFromCell()})),t.listen(yt.SELECTED_CELL,(t=>{this._isBindCell(t.col,t.row)&&this._unbindFromCell()})),t.listen(yt.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]=cN[r](i))}isBinded(t){return JSON.stringify(t)===JSON.stringify(this._attachInfo?.tooltipOptions)}}class dN{_table;_menuElement;constructor(t){this._table=t}dispose(){this.unbindMenuElement(),this._menuElement&&this._menuElement.dispose(),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 pN="vtable__menu-element",fN=`${pN}--hidden`,gN=`${pN}--shown`;class yN{_handler;_rootElement;_menuInstanceInfo;constructor(t){this._handler=new xt,this._rootElement=Ij("div",[pN,fN]),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(fN))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(fN)||t.stopPropagation()}))}get rootElement(){return this._rootElement}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.dispose(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement;if(this._menuInstanceInfo=n,r?.classList.remove(gN),r?.classList.add(fN),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(gN),r?.classList.remove(fN),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(gN),t.classList.add(fN))}_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 mN extends dN{createMenuElementInternal(){return new Zj(this._table)}}let bN=class extends dN{createMenuElementInternal(){return new yN(this._table)}};const vN={"dropdown-menu":function(t){return new mN(t)},"context-menu":function(t){return new mN(t)},container:t=>new bN(t)};class wN{_table;_menuInstances;_attachInfo;constructor(t){this._table=t,this._menuInstances={},this._bindTableEvent(t)}dispose(){const t=this._menuInstances;for(const e in t)t[e].dispose();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&&at(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.listen(yt.DROPDOWN_ICON_CLICK,(t=>{this._attachInfo&&this._isBindToCell(t.col,t.row)?this._unbindFromCell():this._bindToCell(t.col,t.row,"dropdown-menu")})),t.listen(yt.DROPDOWN_MENU_CLEAR,(t=>{this._unbindFromCell()})),t.listen(yt.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]=vN[i](r)),type:i,info:s}}}class CN extends EventTarget{_table;_input;constructor(t,e){if(super(),this._table=t,"node"===vt.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}dispose(){}}let xN=1;V?xN=1:(xN=Math.ceil(window.devicePixelRatio||1),xN>1&&xN%2!=0&&(xN+=1));const _N={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:!1,visible:!0};function SN(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:y,padding:m,...b}=ne({},_N,t),v=b;return i.visible&&(v.title=function(t){const e={...t};return Yt(t.style)||(e.textStyle=zL(t.style)),Yt(t.textStyle)||ne(e.textStyle,zL(t.textStyle)),t.shape?.style&&zL(e.shape.style),t.background?.style&&zL(e.background.style),e}(i)),Yt(n.focusIconStyle)||zL(n.focusIconStyle),jL(n.shape),jL(n.label),jL(n.value),jL(n.background),GF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),GF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),GF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,Yt(r.textStyle)||zL(r.textStyle),jL(r.handler),v.pager=r,o.visible&&!Yt(o.style)&&(ne(v,o.style),kt(o.padding)&&(v.padding=o.padding)),v}class AN{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=Qt(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 mL(ne({},t,{defaultSelected:this.selectedData}));e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e);let i=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,n=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const r=this.table.tableNoFrameWidth,o=this.table.tableNoFrameHeight,s=cF(t.padding??this.option.padding??10);let a=0,l=0;"left"===this.orient?(a=s[3],l=0,i+=s[1]+s[3]):"top"===this.orient?(a=0,l=s[0],n+=s[0]+s[2]):"right"===this.orient?(a=r-i-s[1],l=0,i+=s[1]+s[3]):"bottom"===this.orient&&(a=0,l=o-n-s[2],n+=s[0]+s[2]);const h="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",c=this.position;let u=0,d=0;"horizontal"===h?u="middle"===c?(r-i)/2:"end"===c?r-i-s[1]:s[3]:d="middle"===c?(o-n)/2:"end"===c?o-n-s[2]:s[0],this.legendComponent.setAttributes({dx:u,dy:d,x:a,y:l}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(i),this.table.tableX=Math.ceil(i)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(n),this.table.tableY=Math.ceil(n)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(i):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(n))}getLegendAttributes(t){return{layout:"bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",items:this.getLegendItems(),maxWidth:t.width,maxHeight:t.height,...SN(this.option,t)}}getLegendItems(){return this.option.data}initEvent(){this.legendComponent&&(this.legendComponent.addEventListener(dL.legendItemClick,(t=>{const e=Xt(t,"detail.currentSelected");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_CLICK,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(dL.legendItemHover,(t=>{const e=Xt(t,"detail");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_HOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(dL.legendItemUnHover,(t=>{const e=Xt(t,"detail");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_UNHOVER,{model:this,value:e,event:t})})))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}dispose(){this.legendComponent=null}}class TN{table;_titleOption;_titleComponent;_cacheAttrs;constructor(t,e){this.table=e,this._titleOption=t,this._titleComponent=this._createOrUpdateTitleComponent(this._getTitleAttrs())}_createOrUpdateTitleComponent(t){if(this._titleComponent)se(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=new WL(t);e.name="title",this.table.scenegraph.stage.defaultLayer.appendChild(e),this._titleComponent=e}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,cF(t.padding??this._titleOption.padding??10));return"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}),this._titleComponent}dispose(){this._titleComponent=null}_getTitleAttrs(){const t=cF(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:BN}=ft,{isTouchEvent:RN}=pt,MN=/^\$(\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 PN={};class EN extends E{internalProps;showFrozenIcon=!0;showSort=!0;padding;globalDropDownMenu;tableNoFrameWidth;tableNoFrameHeight;tableX;tableY;_widthMode;_heightMode;_autoFillWidth;customRender;canvasWidth;canvasHeight;dataSet;scenegraph;stateManeger;eventManeger;_pixelRatio;bottomFrozenRowCount=0;rightFrozenColCount=0;static get EVENT_TYPE(){return yt}options;version="0.9.3-alpha.3";pagerConf;id=`VTable${Date.now()}`;headerStyleCache;bodyStyleCache;constructor(t={}){super();const{frozenColCount:e=0,defaultRowHeight:i=40,defaultHeaderRowHeight:n,defaultColWidth:r=80,defaultHeaderColWidth:o,widthMode:s="standard",heightMode:a="standard",autoFillWidth:l=!1,keyboardOptions:h,parentElement:c,columnResizeMode:u,dragHeaderMode:d,showFrozenIcon:p,allowFrozenColCount:f,padding:g,hover:y,menu:m,select:b,customRender:v,pixelRatio:w=xN}=t;this.options=t,this._widthMode=s,this._heightMode=a,this._autoFillWidth=l,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 C=this.internalProps={};void 0!==p&&(this.showFrozenIcon=p),"number"==typeof f&&f<=0&&(this.showFrozenIcon=!1),C.handler=new xt,C.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),C.focusControl=new CN(this,C.element),C.pixelRatio=w,C.canvas=document.createElement("canvas"),C.element.appendChild(C.canvas),C.context=C.canvas.getContext("2d"),C.frozenColCount=e,C.defaultRowHeight=i,C.defaultHeaderRowHeight=n??i,C.defaultColWidth=r,C.defaultHeaderColWidth=o??r,C.keyboardOptions=h,C.columnResizeMode=u,C.dragHeaderMode=d,C._rowHeightsMap=new St,C._rowRangeHeightsMap=new Map,C._colRangeWidthsMap=new Map,this.colWidthsMap=new St,this.colContentWidthsMap=new St,this.colWidthsLimit={},C.calcWidthContext={_:C,get full(){return this._.canvas.width/(this._.context.pixelRatio??window.devicePixelRatio)}},C.cellTextOverflows={},C.focusedTable=!1,C.theme=Ui.of(t.theme??Ui.DEFAULT),c?(c.innerHTML="",c.appendChild(C.element),this._updateSize()):this._updateSize(),this.options=t,C.theme=Ui.of(t.theme??Ui.DEFAULT),C.bodyHelper=new kj(this),C.headerHelper=new eN(this),C.autoWrapText=t.autoWrapText,C.allowFrozenColCount=t.allowFrozenColCount??C.colCount,C.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this.dataSet=new xD,this.scenegraph=new oj(this),this.stateManeger=new wj(this),this.eventManeger=new Mj(this),t.legends&&(C.legends=new AN(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(C.title=new TN(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),C.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"===C.tooltip.renderMode&&(C.tooltipHandler=new uN(this,C.tooltip.confine)),C.menu=Object.assign({renderMode:"html"},t.menu),Array.isArray(t.menu?.dropDownMenuHighlight)&&this.setDropDownMenuHighlight(t.menu?.dropDownMenuHighlight),Array.isArray(t.menu?.defaultHeaderMenuItems)&&(this.globalDropDownMenu=t.menu.defaultHeaderMenuItems),"html"===C.menu.renderMode&&(C.menuHandler=new wN(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.invalidate.bind(this),200);getParentElement(){return this.options.parentElement}getElement(){return this.internalProps.element}get canvas(){return this.internalProps.canvas}resize(){this._updateSize(),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 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)}get heightMode(){return this._heightMode}set heightMode(t){t!==this._heightMode&&(this._heightMode=t)}get autoFillWidth(){return this._autoFillWidth}set autoFillWidth(t){t!==this._autoFillWidth&&(this._autoFillWidth=t)}_colWidthDefineToPxWidth(t){return XF(t)?$F(this,this._calculateAutoColWidthExpr()):$F(this,t)}_calculateAutoColWidthExpr(){const t=this.internalProps.calcWidthContext.full;let e=0;const i=[];let n=0;const r=[];for(let o=0;o<this.internalProps.colCount;o++){const s=this.getColWidthDefine(o),a=this._getColWidthLimits(o);if(XF(s))a&&(r.push(a),a.min&&(e+=a.min)),n++;else{let t=s;if(a){const i=$F(this,t),n=YF(a,i);i!==n&&(t=`${n}px`),e+=n}i.push(t)}if(e>t)return"0px"}if(r.length&&i.length){const e=(t-$F(this,`calc(${i.map((t=>"number"==typeof t?`${t}px`:t)).join(" + ")})`))/n;if(r.forEach((t=>{t.min&&e<t.min?(i.push(t.minDef),n--):t.max&&t.max<e&&(i.push(t.maxDef),n--)})),n<=0)return`${e}px`}if(i.length){const t=[];let e=0;return i.forEach((i=>{"number"==typeof i?e+=i:t.push(i)})),t.push(`${e}px`),`calc((100% - (${t.join(" + ")})) / ${n})`}return 100/n+"%"}_getColWidthLimits(t){const e=this.colWidthsLimit[t];if(!e)return null;const i={};return e.min&&(i.min=$F(this,e.min),i.minDef=e.min),e.max&&(i.max=$F(this,e.max),i.maxDef=e.max),i}_adjustColWidth(t,e){const i=this._getColWidthLimits(t);return Math.max(YF(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"===vt.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"===vt.mode&&(e=this.canvasWidth-1,i=this.canvasHeight-1);const n=Math.floor(e-U(this.getTheme().scrollStyle)),r=Math.floor(i-U(this.getTheme().scrollStyle));if(this.internalProps.theme?.frameStyle){const t=BN(this.internalProps.theme.frameStyle?.borderLineWidth??[null]),e=BN(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=this.colWidthsMap.get(e);let r;r=i?"adaptive"===this.widthMode||this.transpose?Number(i):this._adjustColWidth(e,this._colWidthDefineToPxWidth(i)):this.isRowHeader(e,0)||this.isCornerHeader(e,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[e]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth;const o=n+r;return t>=0&&e>=0&&!Number.isNaN(o)&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(o)),Math.round(o)}let r=0;for(let i=t;i<=e;i++)r+=this.isRowHeader(i,0)||this.isCornerHeader(i,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[i]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth;this.colWidthsMap.each(t,e,((t,e)=>{r+=("adaptive"===this.widthMode||this.transpose?Number(t):this._adjustColWidth(e,this._colWidthDefineToPxWidth(t)))-(this.isRowHeader(e,0)||this.isCornerHeader(e,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[e]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth)}));for(let i=t;i<=e;i++){if(this.colWidthsMap.has(i))continue;const t=this._adjustColWidth(i,this.internalProps.defaultColWidth);t!==this.internalProps.defaultColWidth&&(r+=t-this.internalProps.defaultColWidth)}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)}fillRowsHeight(t,e,i){for(let n=t;n<=e;n++)this.rowHeightsMap.put(n,Math.round(i)),this._rowRangeHeightsMap.set(`$0$${n}`,Math.round((this._rowRangeHeightsMap.get("$0$"+(n-1))??0)+i))}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)}getColWidthDefine(t){const e=this.colWidthsMap.get(t);return"number"==typeof e&&e<=0?0:e||(this.isRowHeader(t,0)||this.isCornerHeader(t,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.isRightFrozenColumn(t,this.columnHeaderLevelCount)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[this.rowHeaderLevelCount-this.rightFrozenColCount]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth)}getColWidth(t){const e=this.getColWidthDefine(t);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=MN.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=MN.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=$F(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=$F(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 xi(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 xi(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 xi(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 xi(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))}}invalidate(){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 xi(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)}addDisposable(t){if(!t||!t.dispose||"function"!=typeof t.dispose)throw new Error("not disposable!");(this.internalProps.disposables=this.internalProps.disposables||[]).push(t)}dispose(){const t=this.internalProps;t.tooltipHandler?.dispose?.(),t.menuHandler?.dispose?.(),JF.clearAll(),super.dispose?.(),t.handler?.dispose?.(),t.focusControl?.dispose?.(),t.disposables&&(t.disposables.forEach((t=>t?.dispose?.())),t.disposables=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:y,heightMode:m,autoFillWidth:b,customRender:v}=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=y??"standard",this.heightMode=m??"standard",this.autoFillWidth=b??!1,this.customRender=v;const w=this.internalProps;"node"!==vt.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"}(w.element,this.padding),w.frozenColCount=e,w.defaultRowHeight=i,w.defaultHeaderRowHeight=n??i,w.defaultColWidth=r,w.defaultHeaderColWidth=o??r,w.keyboardOptions=s,w.columnResizeMode=a,w.dragHeaderMode=l,w.cellTextOverflows={},w._rowHeightsMap=new St,w._rowRangeHeightsMap=new Map,w._colRangeWidthsMap=new Map,this.colWidthsMap=new St,this.colContentWidthsMap=new St,this.colWidthsLimit={},w.theme=Ui.of(t.theme??Ui.DEFAULT),w.autoWrapText=t.autoWrapText,w.allowFrozenColCount=t.allowFrozenColCount??w.colCount,w.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this.dataSet=new xD,this.scenegraph.clearCells(),this.stateManeger.initState(),t.legends&&(w.legends=new AN(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(w.title=new TN(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),w.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"!==w.tooltip.renderMode||w.tooltipHandler||(w.tooltipHandler=new uN(this,w.tooltip.confine)),w.menu=Object.assign({renderMode:"html"},t.menu),"html"!==w.menu.renderMode||w.menuHandler||(w.menuHandler=new wN(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map}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 xi(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=RN(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()}updatePager(t){this.pagerConf&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagerConf.currentPage=t.currentPage),t.perPageCount&&(this.pagerConf.perPageCount=t.perPageCount||this.pagerConf.perPageCount),this.scenegraph.clearCells(),this.dataSource.updatePager(this.pagerConf),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.invalidate())}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||null}get dataSource(){return this.internalProps.dataSource}set dataSource(t){this.scenegraph.clearCells(),VF(this,t),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.invalidate()}get autoWrapText(){return this.internalProps.autoWrapText}set autoWrapText(t){this.internalProps.autoWrapText!==t&&(this.internalProps.autoWrapText=t,this.options.autoWrapText=t,this.internalProps.layoutMap&&(this.refreshHeader(),this.invalidate()))}get theme(){return this.internalProps.theme}set theme(t){const e=Ui.of(t);this.internalProps.theme=e||Ui.DEFAULT,this.options.theme=t,this.resize()}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).columnType}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}getCellType(t,e){return this.internalProps.layoutMap.getCellType(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.sortState=e,this.stateManeger.setSortState(this.sortState)),t){if(UF(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??R)}}this.refreshRowColCount()}else UF(this,t);this.scenegraph.createSceneGraph(),this.invalidate(),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),caption:i.caption,columnType:i.columnType?"string"==typeof i.columnType?i.columnType:"progressbar":"text",originData:this.getCellOriginRecord(t,e),cellRange:this.getCellRangeRelativeRect({col:t,row:e}),value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellType:this.getCellType(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 PN;const o=this.internalProps.headerHelper.getStyleClass(r.headerType);if(i.isBottomFrozenRow(t,e)&&this.theme.bottomFrozenStyle)n=K({},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=K({},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=K(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.columnType),a=o?.style;return r=W(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),this.bodyStyleCache.set(n,r),r}clearCellStyleCache(){this.headerStyleCache.clear()}_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=qF(i,this,t,e,nW).theme,{autoWrapText:r,lineClamp:o,textOverflow:s}=i;return{textAlign:n.text.textAlign,textBaseline:n.text.textBaseline,bgColor:Et(n.group.fill)?nW("bgColor",i,t,e,this):n.group.fill,color:Et(n.text.fill)?nW("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:Et(n.group.stroke)?nW("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(A(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(A(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.invalidate()}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 yW.measureText(t,e)}measureTextBounds(t){const e=new bW(t);return{width:e.AABBBounds.width(),height:e.AABBBounds.height()}}getCustomRender(t,e){let i;if("body"!==this.getCellType(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.getCellType(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.columnType||!t.define.imageAutoSizing)))}}var HN=Object.freeze({__proto__:null,BaseTable:EN});function LN(t,e,i){const n=t[e];return t[e]=i,n}function kN(t){for(const e in t)delete t[e]}function IN(){kN(Ri),kN(ZF),kN(Cz)}var ON=Object.freeze({__proto__:null,chartModule:function(t,e){return null!=e?LN(Cz,t,e):Cz[t]},clearAll:IN,icon:function(t,e){return null!=e?LN(ZF,t,e):ZF[t]},theme:function(t,e){return null!=e?LN(Ri,t,e):Ri[t]}});var DN=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}`}}});function FN(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 WN(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 zN=0;class jN{_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}getCellType(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}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 t,e,i,n=0;return this.columnObjects.forEach(((r,o)=>{"number"==typeof r.width?n=Math.max(r.width,n):"auto"===r.width&&(i=!0),"number"==typeof r.minWidth&&(e=Math.max(r.minWidth,e)),"number"==typeof r.maxWidth&&(t=Math.max(r.maxWidth,t))})),n=n>0?n:i?"auto":void 0,{width:n,minWidth:e,maxWidth:t}}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=zN++,{captionIcon:l}=e,h={id:a,caption:e.caption,captionIcon:l,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]=h;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:zN++,field:i.field,fieldKey:i.fieldKey,fieldFormat:i.fieldFormat,width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth,icon:i.icon,columnType:i.columnType??"text",chartModule:"chartModule"in i?i.chartModule:null,chartSpec:"chartSpec"in i?i.chartSpec:null,sparklineSpec:"sparklineSpec"in i?i.sparklineSpec:Hi,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 WN(t,e,this)}}class NN{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 St;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 St,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?Ei:t.dimensionKey)&&this.dimensionKeys.put(t.level,t.indicatorKey?Ei:t.dimensionKey),t.id||(t.id=++GN));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===r.expand&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):t.hierarchyState===r.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=r.expand,t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)}))):t.children?(t.hierarchyState=r.collapse,t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)}))):(t.hierarchyState=r.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 GN=0,KN=0;class UN{_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=Ei;_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 NN(this.columnTree??[]),this.rowDimensionTree=new NN(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=++GN,e=Array(this.colCount-this.rowHeaderLevelCount).fill(t);this._columnHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{id:t}};this.columnHeaderObjs.push(i),this._headerObjects[t]=i}if(KN=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=++GN,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{id:t}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}KN=0,this.indicatorsAsCol=!A(this.rowDimensionKeys.find((t=>t===this.indicatorDimensionKey))),this._rowHeaderCellIds=C(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===KN)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.caption===i.value))),l={id:o,caption:i.value??a.caption,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),A(this._indicators.find((t=>t.indicatorKey===a.indicatorKey)))||this._indicators.push({id:++GN,indicatorKey:a.indicatorKey,field:a.indicatorKey,fieldFormat:a?.format,columnType: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&&(A(this._indicators.find((t=>t.indicatorKey===i.indicatorKey)))||this._indicators.push({id:++GN,indicatorKey:i.indicatorKey,field:i.indicatorKey,columnType:"text",define:Object.assign({},i)})),r[o]=l,this._headerObjects[o]=l,t[e][KN]=o;for(let i=e-1;i>=0;i--)t[i][KN]=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][KN]=o;KN++}})),r}_addHeadersForTreeMode(t,e,i,n,o,s){const a=[];return t[e]||function(e){const i=t[e]=[];if(0===KN)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const l=i.id,h=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),c={id:l,caption:i.value,field:i.dimensionKey,style:i.level+1===o||"function"==typeof h?.headerStyle?h?.headerStyle:Object.assign({},h?.headerStyle,{textAlign:"left"}),headerType:h?.headerType??"text",headerIcon:h?.headerIcon,define:Object.assign(i,{linkJump:h?.linkJump,linkDetect:h?.linkDetect,templateLink:h?.templateLink,keepAspectRatio:h?.keepAspectRatio??!1,imageAutoSizing:h?.imageAutoSizing,headerCustomRender:h?.headerCustomRender,headerCustomLayout:h?.headerCustomLayout,dragHeader:h?.dragHeader}),fieldFormat:h?.headerFormat,dropDownMenu:h?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},hierarchyLevel:i.level,dimensionTotalLevel:o,hierarchyState:i.level+1===o?void 0:i.hierarchyState,width:h?.width,minWidth:h?.minWidth,maxWidth:h?.maxWidth};a[l]=c,this._headerObjects[l]=c,t[e][KN]=l;for(let i=e-1;i>=0;i--)t[i][KN]=n[i];if(i.hierarchyState===r.expand&&i.children)s&&KN++,this._addHeadersForTreeMode(t,e,i.children??[],[...n,l],o,s&&i.hierarchyState===r.expand).forEach((t=>a.push(t)));else{s&&KN++;for(let i=e+1;i<t.length;i++)t[i][KN]=l}})),a}_addCornerHeaders(t){const e=[];if(t)t.forEach(((t,i)=>{const n=++GN,r=this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)),o={id:n,caption:t===this.indicatorDimensionKey?this.indicatorTitle:r?.dimensionTitle??"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:n,value:t},dropDownMenu:r?.cornerDropDownMenu,pivotInfo:{value:r?.dimensionTitle??"",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=++GN,i={id:t,caption:"",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){}getCellType(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}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:this.getDimension(this.colDimensionKeys[this.colDimensionKeys.length-1],"column")?.multiDimension?1:0:0}get rightFrozenColCount(){return this.showHeader&&this.showColumnHeader?this.indicatorsAsCol||this.hideIndicatorName?this.getDimension(this.rowDimensionKeys[this.rowDimensionKeys.length-1],"row")?.multiDimension?1:0:this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0: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,columnType: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,columnType: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)?.caption??"",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)?.caption??"",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]))),o=this.getHeader(t,e);if(o.define.hierarchyState=o.define.hierarchyState===r.collapse?r.expand:r.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=++GN,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{field:"",headerType:"text",columnType:"text"}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}return KN=0,this._rowHeaderCellIds=C(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((A(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||A(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((A(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||A(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=v(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths),n=v(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(!A(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value||A(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((!A(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value||A(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 A(n)||A(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 FN(t,e,this)}getChartDataId(t,e){return WN(t,e,this)}}const VN={isEmpty:!0,id:void 0,field:void 0,headerType:void 0,define:void 0};class $N{_headerObjects=[];_headerObjectMap={};_indicatorObjects=[];_columnWidths=[];rowTree;columnTree;rowsDefine;columnsDefine;indicatorsDefine;indicatorKeys;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;_indicatorShowType="column";indicatorsAsCol=!0;hideIndicatorName=!1;indicatorDimensionKey=Ei;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=C(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.dimensionTitle}`:`${e.dimensionTitle}`)),"");this._headerObjectMap[e]={id:e,caption:e,field:t,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,caption:"",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.dimensionTitle}`:`${e.dimensionTitle}`)),"");this._headerObjectMap[e]={id:e,caption:e,field:t,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,caption:"",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,caption:"",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.caption===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],caption:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.rows[i.length-1],headerType:n?.headerType??"text",columnType:"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],caption:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.columns[i.length-1],headerType:n?.headerType??"text",columnType:"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,caption:i.caption??e,style:i?.headerStyle,define:{field:this.indicatorDimensionKey,headerType:i?.headerType??"text",columnType:"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,caption:t===this.indicatorDimensionKey?this.indicatorTitle:e?.dimensionTitle??t,style:this.cornerSetting?.headerStyle,define:{field:t,headerType:this.cornerSetting?.headerType??"text",columnType:"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",columnType:e?.columnType??"text"},e),fieldFormat:e?.format,columnType:e?.columnType??"text",chartModule:e&&("chartModule"in e?e.chartModule:null),chartSpec:e&&("chartSpec"in e?e.chartSpec:null),sparklineSpec:"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}getCellType(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}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]??VN}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,columnType: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,columnType: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.caption: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.caption: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(!A(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(!A(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,A(r)||A(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=C(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)}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 function(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 e=i.getIndicatorKeyInChartSpec(t,i.columnHeaderLevelCount-1)[1];if(Wt(e)&&(e=e[0]),!e)return;const n=i.dataset.collectedValues[e+"_align"]?i.dataset.collectedValues[e+"_align"]:i.dataset.collectedValues[e],r=i.getRecordIndexByCol(t),o=n[i.getColKeysPath()[r][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]],s=i._table.pivotChartAxes.find((t=>"top"===t.orient));if(!1===s?.visible)return;return ne({},s,{orient:"top",type:"linear",range:o,label:{flush:!0},title:{visible:!1}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];Wt(r)&&(r=r[0]);const o=i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r],s=i.getRecordIndexByCol(t),a=o[i.getColKeysPath()[s][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]];let l=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(l=e)}));const h=i._table.pivotChartAxes.find((t=>"bottom"===t.orient));if(!1===h?.visible)return;return ne({},h,{orient:"bottom",type:"linear",range:a,label:{flush:!0},title:{text:l?.caption,autoRotate:!0}})}if(t===i.rowHeaderLevelCount-1&&e>=i.rowHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let t=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)[0];Wt(t)&&(t=t[0]);const n=i.dataset.collectedValues[t],r=i.getRecordIndexByRow(e),o=i.getRowKeysPath()[r],s=n[o[o.length-1]],a=i._table.pivotChartAxes.find((t=>"left"===t.orient));if(!1===a?.visible)return;return ne({},a,{orient:"left",type:"band",data:Array.from(s).reverse(),title:{visible:!1}})}}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];Wt(r)&&(r=r[0]);const o=i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r],s=i.getRecordIndexByRow(e),a=o[i.getRowKeysPath()[s][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]];let l=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(l=e)}));const h=i._table.pivotChartAxes.find((t=>"left"===t.orient));if(!1===h?.visible)return;return ne({},h,{orient:"left",type:"linear",range:a,label:{flush:!0},title:{text:l?.caption,autoRotate:!0}})}if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let t=i.getIndicatorKeyInChartSpec(i.rowHeaderLevelCount-1,e)[1];if(Wt(t)&&(t=t[0]),!t)return;const n=i.dataset.collectedValues[t+"_align"]?i.dataset.collectedValues[t+"_align"]:i.dataset.collectedValues[t],r=i.getRecordIndexByRow(e),o=n[i.getRowKeysPath()[r][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]],s=i._table.pivotChartAxes.find((t=>"right"===t.orient));if(!1===s?.visible)return;return ne({},s,{orient:"right",type:"linear",range:o,label:{flush:!0},title:{visible:!1}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let e=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];Wt(e)&&(e=e[0]);const n=i.dataset.collectedValues[e],r=i.getRecordIndexByCol(t),o=i.getColKeysPath()[r],s=n[o[o.length-1]],a=i._table.pivotChartAxes.find((t=>"bottom"===t.orient));if(!1===a?.visible)return;return ne({},a,{orient:"bottom",type:"band",data:Array.from(s),title:{visible:!1}})}}}(t,e,this)}getRawChartSpec(t,e){return FN(t,e,this)}getChartSpec(t,e){return function(t,e,i){let n=i.getRawChartSpec(t,e);return n?(n=Qt(n),n.axes=i.getChartAxes(t,e),n.padding=0,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(((t,e)=>{Wt(t)&&(t=t[0]);const r=(i.dataset.collectedValues[t+"_align"]?i.dataset.collectedValues[t+"_align"]:i.dataset.collectedValues[t])[i.getColKeysPath()[o][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]],s=i._table.pivotChartAxes.find((t=>t.orient===(0===e?"bottom":"top")));n.push(ne({},s,{type:"linear",orient:0===e?"bottom":"top",label:{visible:!1},title:{visible:!1},range:r,seriesIndex:e}))}));let s=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,t)[0];Wt(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=i._table.pivotChartAxes.find((t=>"left"===t.orient));n.push(ne({},u,{type:"band",orient:"left",label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},width:-1,domain:Array.from(c)}))}else{const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByRow(e);r.forEach(((t,e)=>{Wt(t)&&(t=t[0]);const r=(i.dataset.collectedValues[t+"_align"]?i.dataset.collectedValues[t+"_align"]:i.dataset.collectedValues[t])[i.getRowKeysPath()[o][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]],s=i._table.pivotChartAxes.find((t=>t.orient===(0===e?"left":"right")));n.push(ne({},s,{type:"linear",orient:0===e?"left":"right",label:{visible:!1},title:{visible:!1},range:r,seriesIndex:e}))}));let s=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];Wt(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=i._table.pivotChartAxes.find((t=>"bottom"===t.orient));n.push(ne({},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,domain:Array.from(c)}))}return n}(t,e,this)}getChartDataId(t,e){return WN(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))}}class YN{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 XN{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 qN extends XN{type=o.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 ZN extends XN{type=o.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 JN extends XN{type=o.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 QN extends XN{type=o.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===o.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 tG extends XN{type=o.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 eG extends XN{type=o.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 iG(t,e){return t&&e?t.toString().localeCompare(e.toString(),"zh"):t?1:-1}function nG(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 rG(t){return 2===t.length&&Gt(t[0])&&Gt(t[1])&&t[1]>=t[0]}function oG(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 sG(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 aG(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 lG(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 hG(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 cG(t,e){const i=[t.min,t.max],n=[e.min,e.max];if(!rG(i)||!rG(n))return;const r=oG(i),o=oG(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(!aG(r,o))return}else if(0===u&&0===d){if(!aG(o,r))return}else if(c||g)if(c&&!g){if(!sG(r,o))return}else if(g&&!c){if(!sG(o,r))return}else{if(a===d)return;if(a>d){if(!lG(r,o))return}else if(!lG(o,r))return}else{if(0===a&&0===u){if(!hG(r,o))return}else if(0===d&&0===s&&!hG(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 uG{dataConfig;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;constructor(t,e,i,n,r,o,s){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=e,this.columns=i,this.indicatorKeys=n,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??{230417170554008:{by:["230417171050031","230417171050028"]}},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(r){this.records=r;const t="undefined"!=typeof window?window.performance.now():0;this.setRecords(r),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 a="undefined"!=typeof window?window.performance.now():0;this.sortKeys();const l="undefined"!=typeof window?window.performance.now():0;console.log("sortKeys:",l-a);const h="undefined"!=typeof window?window.performance.now():0;this.rowKeysPath=s?this.TreeToArr2(s):this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=o?this.TreeToArr2(o):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())}}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(o.RECORD,qN),this.registerAggregator(o.SUM,ZN),this.registerAggregator(o.COUNT,JN),this.registerAggregator(o.MAX,tG),this.registerAggregator(o.MIN,eG),this.registerAggregator(o.AVG,QN)}setRecords(t){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;this.dataConfig?.filterRules?.length>=1&&(t=!0);for(let e=0,i=this.records.length;e<i;e++){const i=this.records[e];t&&!this.filterRecord(i)||this.processRecord(i)}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){this.derivedFieldRules?.forEach(((e,i)=>{t[e.fieldName]=e.derivedFunc(t)}));const e=[],i=[];for(let e=0,n=this.rows.length;e<n;e++){const n=this.rows[e];i.push(t[n])}for(let i=0,n=this.columns.length;i<n;i++){const n=this.columns[i];e.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[o.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 n=i.join(this.stringJoinChar),r=e.join(this.stringJoinChar);0!==i.length&&(this.rowFlatKeys[n]||(this.rowKeys.push(i),this.rowFlatKeys[n]=1)),0!==e.length&&(this.colFlatKeys[r]||(this.colKeys.push(e),this.colFlatKeys[r]=1)),this.tree[n]||(this.tree[n]={}),this.tree[n]?.[r]||(this.tree[n][r]=[]);for(let e=0;e<this.indicatorKeys.length;e++){const i=this.getAggregatorRule(this.indicatorKeys[e]);if(this.tree[n]?.[r]?.[e]||(this.tree[n][r][e]=new this.aggregators[i?.aggregationType??o.SUM](i?.field??this.indicatorKeys[e],i?.formatFun)),i?.field)if("string"==typeof i?.field)A(t[i?.field])&&this.tree[n]?.[r]?.[e].push(t);else{const o=i?.field.find((e=>t[e]));o&&this.tree[n]?.[r]?.[e].push(t)}else A(t[this.indicatorKeys[e]])&&this.tree[n]?.[r]?.[e].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[o.MAX](this.indicatorKeys[e]),min:new this.aggregators[o.MIN](this.indicatorKeys[e]),total:new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}}this.indicatorStatistics[e].max.push(this.tree[n]?.[r]?.[e].value()),this.indicatorStatistics[e].min.push(this.tree[n]?.[r]?.[e].value()),this.indicatorStatistics[e].total.push(t)}}updateSortRules(t){this.sorted=!1,this.sortRules=t,this.sortKeys(),this.rowKeysPath=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.dataConfig.isPivotChart&&this.dealWithZeroAlign()}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 nG(e(t,[]),e(i,[]))}));break;case"value_z_to_a":this.rowKeys.sort((function(t,i){return-nG(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 nG(e([],t),e([],i))}));break;case"value_z_to_a":this.colKeys.sort((function(t,i){return-nG(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:nG})}return o}.call(this);return function(i,o){let a,l;for(let h=0;h<r.length;h++){if(l=r[h],l.sortRule?.sortByIndicator){let r=i,s=o;l.fieldIndex<t.length-1&&(r=i.slice(0,l.fieldIndex+1),r.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel),s=o.slice(0,l.fieldIndex+1),s.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel)),a=l.func(r,s)}else a=l.func(i[l.fieldIndex],o[l.fieldIndex]);if(0!==a)return a*(l.sortRule?.sortType===s.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?nG(o(n,t.query),o(r,t.query)):nG(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:nG(t,e)}}(t.sortBy):t.sortType?iG:t.sortFunc?t.sortFunc:nG}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,s=t.totals?.column?.subTotalsDimensions?.length;r<s;r++){const s=t.totals.column.subTotalsDimensions[r],a=t.columns.indexOf(s);if(a>=0){const r=n.slice(0,a+1);r.push(t.totals?.column?.subTotalLabel??"小计");const s=r.join(this.stringJoinChar);this.tree[e][s]||(this.tree[e][s]=[]);for(let n=0;n<this.indicatorKeys.length;n++){if(!this.tree[e][s][n]){const t=this.getAggregatorRule(this.indicatorKeys[n]);this.tree[e][s][n]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[n],t?.formatFun)}this.tree[e][s][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??o.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((s=>{for(let i=0,a=t.totals?.row?.subTotalsDimensions?.length;i<a;i++){const a=t.totals.row.subTotalsDimensions[i],l=t.rows.indexOf(a);if(l>=0){const i=r.slice(0,l+1);i.push(t.totals?.row?.subTotalLabel??"小计");const a=i.join(this.stringJoinChar);if(this.tree[a]||(this.tree[a]={},e.push(a)),!this.tree[a][s]){this.tree[a][s]=[];for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[a][s][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[a][s][e]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[a][s][e].push(t.tree[n]?.[s]?.[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][s]||(this.tree[i][s]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[i][s][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[i][s][e]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[i][s][e].push(t.tree[n]?.[s]?.[e])}}i(n,s)}))})),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];Wt(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"]={};for(const t in n){const o=n[t],s=r[t],a=cG(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]=dG(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}}function dG(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 pG{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 fG={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 gG{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=fG[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 yG extends pG{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 mG=Object.freeze({__proto__:null,Circle:class extends pG{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 pG{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",g(t.width)?this.width=t.width:(this._widthObj=t.width,this.needCalcSize=!0),g(t.height)?this.height=t.height:(this._heightObj=t.height,this.needCalcSize=!0),this.directionKey=fG[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 gG(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 yG({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 yG({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 pG{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=fG[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 pG{type="icon";svg;iconName;cursor;cache;constructor(t){if(super(t),this.iconName=t.iconName,f(this.iconName)){const t=tW()[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 pG{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:yG,Sector:class extends pG{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 pG{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,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=mG,t.DataStatistics=DN,t.ListTable=class extends EN{showHeader=!0;constructor(t={}){super(t);const e=this.internalProps;this.pagerConf=t.pagerConf,e.sortState=t.sortState,e.columns=t.columns?v(t.columns):t.header?v(t.header):[],this.showHeader=t.showHeader??!0,this.transpose=t.transpose??!1,this.refreshHeader(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,e.sortState):this.setRecords([])}isListTable(){return!0}isPivotTable(){return!1}isPivotChart(){return!1}get sortState(){return this.internalProps.sortState}set sortState(t){this.internalProps.sortState=t}get columns(){return this.internalProps.columns}set columns(t){this.internalProps.columns=t,this.options.columns=t,this.refreshHeader(),setTimeout((()=>{this.invalidate()}),0)}get header(){return this.internalProps.columns}set header(t){this.internalProps.columns=t,this.options.header=t,this.refreshHeader(),setTimeout((()=>{this.invalidate()}),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.invalidate()))}getCellValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.pagerConf=t.pagerConf,this.showHeader=t.showHeader??!0,i.columns=t.columns?v(t.columns):t.header?v(t.header):[],this.transpose=t.transpose??!1,this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),this._updateSize(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,t.sortState):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this,e=t.internalProps,i=t.transpose,n=t.showHeader;e.headerEvents&&e.headerEvents.forEach((e=>t.unlisten(e)));const r=e.layoutMap=new jN(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.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))}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.records.length;e++){const n=this.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(A(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 A(e)&&(r=i.getRecordStartRowByRecordIndex(e)),this.transpose?{start:{row:t.start.row,col:A(r)?r+t.start.col:void 0},end:{row:t.end.row,col:A(r)?r+t.end.col:void 0}}:{start:{col:t.start.col,row:A(r)?r+t.start.row:void 0},end:{col:t.end.col,row:A(r)?r+t.end.row:void 0}}}return null}getHierarchyState(t,e){if(!this.getBodyColumnDefine(t,e).tree)return r.none;const i=this.getRecordIndexByRow(t,e);return this.dataSource.getHierarchyState(i)}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===r.expand?this.fireListeners(yt.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(yt.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.expand,originData:this.getCellOriginRecord(t,e)});const n=this.getRecordIndexByRow(t,e),o=this.dataSource.toggleHierarchyState(n),s=this.internalProps.layoutMap.toggleHierarchyState(o);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(s.removeCellPositions,s.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),cellType:this.getCellType(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){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 e,i,n;if(Array.isArray(this.internalProps.sortState)?({order:e,field:i,fieldKey:n}=this.internalProps.sortState?.[0]):({order:e,field:i,fieldKey:n}=this.internalProps.sortState),i){const t=this._getSortFuncFromHeaderOption(this.internalProps.columns,i,n);let r;r=n?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===n)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===i)),r?.define?.sort&&(this.dataSource.sort(r.field,e,t),this.scenegraph.sortCell())}this.stateManeger.updateSortState(t)}},t.PivotChart=class extends EN{pivotSortState;dataset;_selectedDataItemsInChart=[];_selectedDimensionInChart=[];_chartEventMap={};_axes;constructor(t){if(super(t),t.layout&&Object.assign(t,t.layout),this.setCustomStateNameToSpec(),this.internalProps.dataConfig={isPivotChart:!0},this.internalProps.enableDataAnalysis=!0,this._axes=Wt(t.axes)?t.axes:[],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)),[]),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.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new uG(this.internalProps.dataConfig,e,i,n,t.records,t.columnTree,t.rowTree)}this.refreshHeader(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return mj}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.dataConfig={},this.internalProps.enableDataAnalysis=!0,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)),[]),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 uG(this.internalProps.dataConfig,e,i,n,t.records??this.internalProps.records,t.columnTree,t.rowTree)}return this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),this._updateSize(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.unlisten(t))),this.internalProps.enableDataAnalysis&&(t.layoutMap=new $N(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 XD({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,gt)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.invalidate()}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(at(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.records.length;t++){const e=this.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.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.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.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===r.expand?this.fireListeners(mj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(mj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.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),cellType:this.getCellType(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:o.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:o.RECORD})}else t.push({indicatorKey:e.indicatorKey,field:e.indicatorKey,aggregationType:o.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)}}))}_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}listenChart(t,e){this._chartEventMap[t]=e}unlistenChart(t){delete this._chartEventMap[t]}_bindChartEvent(t){if(t)for(const e in this._chartEventMap)t.on(e,this._chartEventMap[e])}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),Jz(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),t.addUpdateBoundTag()}}))}));Qz(t.rowHeaderGroup,t.table),Qz(t.colHeaderGroup,t.table),Qz(t.rightFrozenGroup,t.table),Qz(t.bottomFrozenGroup,t.table)}(this.scenegraph),this.invalidate()}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,viewBox:r,axes:a}=s.attribute;a.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:r.x1-s.getRootNode().table.scrollLeft,x2:r.x2-s.getRootNode().table.scrollLeft,y1:r.y1-s.getRootNode().table.scrollTop,y2:r.y2-s.getRootNode().table.scrollTop}),e.updateDataSync(i,n),o=e.convertDatumToPosition(t),this.invalidate()}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&&Wt(e.domain))return e.domain}}},t.PivotTable=class extends EN{pivotSortState;dataset;flatDataToObjects;constructor(t){if(super(t),t.layout&&Object.assign(t,t.layout),this.internalProps.dataConfig=t.dataConfig,this.internalProps.enableDataAnalysis=t.enableDataAnalysis,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)),[]),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.dataset=new uG(this.internalProps.dataConfig,e,i,n,t.records)}this.refreshHeader(),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return yj}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),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 uG(i.dataConfig,e,n,r,t.records)}return this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),this._updateSize(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.unlisten(t)));const e=this.options.records??this.internalProps.records;this.options.enableDataAnalysis?t.layoutMap=new $N(this,this.dataset):(Array.isArray(this.options.columnTree)||Array.isArray(this.options.rowTree))&&(t.layoutMap=new UN(this),e?.[0]?.constructor!==Array&&(this.flatDataToObjects=new YN({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=e?.bottomFrozenRowCount??0,t.rightFrozenColCount=e?.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 XD({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,gt)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.invalidate()}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(at(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.records.length;t++){const e=this.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.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.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.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===r.expand?this.fireListeners(yj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(yj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.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),cellType:this.getCellType(t,e),isPivotCorner:this.isCornerHeader(t,e)}}},t.TYPES=c,t.clearGlobal=function(){IN()},t.core=HN,t.data=QD,t.getIcons=function(){return tW()},t.register=ON,t.themes=Vi,t.version="0.9.3-alpha.3"}));
17
+ ***************************************************************************** */function jW(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 NW=Fw();class GW extends rC{type="chart";chartInstance;activeChartInstance;active;cacheCanvas;constructor(t){super(t),this.numberType=NW,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}),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 je;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,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),GW.temp&&t.scenegraph.updateChartState(e?.datum)})),this.activeChartInstance.on("brushEnd",(e=>{console.log("brushEnd captured",e),t.scenegraph.updateChartState(e?.value?.inBrushData),GW.temp=0,setTimeout((()=>{GW.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 KW=Symbol.for("ChartRender");let UW=class{type;numberType=NW;drawShape(t,e,i,n,r,o,s,a){const l=Pv(t,o?.theme).group,{dataId:h,data:c}=t.attribute,u=t.getViewBox(),{width:d=l.width,height:p=l.height}=t.attribute,{chartInstance:f,active:g,cacheCanvas:y,activeChartInstance:m}=t;if(!g&&y)e.drawImage(y,i,n,d,p);else if(m)if("string"==typeof h)m.updateDataSync(h,c??[]);else for(const t in h){const e=h[t];m.updateDataSync(t,e?c?.filter((t=>t.hasOwnProperty(e)))??[]:c??[])}else{const{axes:e}=t.attribute;if(e.forEach(((t,e)=>{if("linear"===t.type){f._chart._components[e]._domain={min:t.range?.min??0,max:t.range?.max??0}}else if("band"===t.type){const i=f._chart._components[e];i._spec.domain=t.domain.slice(0),i.updateScaleDomain()}})),f.updateViewBox({x1:u.x1-t.getRootNode().table.scrollLeft,x2:u.x2-t.getRootNode().table.scrollLeft,y1:u.y1-t.getRootNode().table.scrollTop,y2:u.y2-t.getRootNode().table.scrollTop}),"string"==typeof h)f.updateDataSync(h,c??[]);else for(const t in h){const e=h[t];f.updateDataSync(t,e?c?.filter((t=>t.hasOwnProperty(e)))??[]:c??[])}const i=f.getStage();t.cacheCanvas=i.toCanvas()}}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);const s=Pv(t,n?.theme).group,{scrollX:a=s.scrollX,scrollY:l=s.scrollY}=t.attribute;let h;(a||l)&&r.translate(a,l),n&&n.drawingCb&&(h=n.drawingCb()),h&&h.then?h.then((()=>{o?r.restore():r.highPerformanceRestore()})):o?r.restore():r.highPerformanceRestore()}};UW=jW([jy()],UW);let VW=class{time=Tm.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()}}};VW=jW([jy()],VW);let $W=class{time=Tm.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 YW(t,e,n){const{highlightScope:r,disableHeader:o,cellPos:s}=t.hover;if(!t.table.isHeader(e,n)||!o){if(r===i.single&&s.col===e&&s.row===n)return"cellBgColor";if(r===i.column&&s.col===e)return"inlineColumnBgColor";if(r===i.row&&s.row===n)return"inlineRowBgColor";if(r===i.cross){if(s.col===e&&s.row===n)return"cellBgColor";if(s.col===e)return"inlineColumnBgColor";if(s.row===n)return"inlineRowBgColor"}}}$W=jW([jy()],$W);let XW=class{time=Tm.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)}};XW=jW([jy()],XW);let qW=class{time=Tm.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:y=l.strokeArrayWidth,lineWidth:m=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;if(!f||!Array.isArray(y)&&0===m)return;let v,w;if(Array.isArray(g)||Array.isArray(y)){if("number"==typeof m&&1&m||Array.isArray(y)&&y.some((t=>1&t))){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=rz(t,Math.ceil(d),Math.ceil(p));v=e,w=r}else v=Math.ceil(d),w=Math.ceil(p);ZW(t,e,i,n,l,f,y||m,g||b,v,w)}}};function ZW(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),y=Array.isArray(a)||d.isSplitDraw;e.setStrokeStyle(t,t.attribute,i,n,r);let m=!1;e.getLineDash().length&&(m=!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)),!y&&!m||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)),!y&&!m||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)),!y&&!m||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)),!y&&!m||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),y||m||(!p&&d.width&&(e.lineWidth=d.width),e.stroke())}qW=jW([jy()],qW);let JW=class{time=Tm.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:y=l.strokeArrayWidth}=t.attribute;f&&Array.isArray(p)&&p.length&&!Array.isArray(g)&&!Array.isArray(y)&&(d.doStroke=!1)}};JW=jW([jy()],JW);let QW=class{time=Tm.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:y=l.lineWidth}=t.attribute;if(!p||!Array.isArray(d)||!d.length||Array.isArray(f)||Array.isArray(g))return;let m,b,{width:v=l.width,height:w=l.height}=t.attribute;if(v=Math.ceil(v),w=Math.ceil(w),1&y){i=Math.floor(i)+.5,n=Math.floor(n)+.5;const{width:e,height:r}=rz(t,Math.ceil(v),Math.ceil(w));m=e,b=r}else m=Math.ceil(v),b=Math.ceil(w);e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),e.lineTo(i+m,n),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+m,n),e.lineTo(i+m,n+b),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,n+b),e.lineTo(i+m,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()}};QW=jW([jy()],QW);let tz=class{time=Tm.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:y=l.strokeArrayWidth,strokeArrayColor:m=l.strokeArrayColor}=t.attribute;f&&Array.isArray(g)&&!g.length&&!Array.isArray(m)&&!Array.isArray(y)&&1&p&&(d.doStroke=!1)}};tz=jW([jy()],tz);let ez=class{time=Tm.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:y=l.strokeArrayColor}=t.attribute,{width:m=l.width,height:b=l.height}=t.attribute;if(p&&Array.isArray(f)&&!f.length&&!Array.isArray(y)&&!Array.isArray(g)&&1&d){const{width:r,height:o}=rz(t,Math.ceil(m),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()}}};ez=jW([jy()],ez);let iz=class{time=Tm.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=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=YW(e.stateManeger,n,r);!t||i&&"cellBgColor"!==t||(i=t)}else"cell"===t.role&&(i=YW(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),nW(i,n,t.col,t.row,e)}(t,t.stage.table);e&&(t.oldColor=t.attribute.fill,t.attribute.fill=e)}}};iz=jW([jy()],iz);let nz=class{time=Tm.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 rz(t,e,i){const n=t.stage.table;if("cell"===t.role){let r=t.col,o=t.row;const s=RH(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}}nz=jW([jy()],nz);let oz=class{time=Tm.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)}};oz=jW([jy()],oz);let sz=class{time=Tm.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:y=l.strokeArrayWidth,lineWidth:m=l.lineWidth,strokeColor:b=l.stroke}=t.attribute;f&&(Array.isArray(y)||0!==m)&&(Array.isArray(f)||Array.isArray(g)||Array.isArray(y))&&(("number"==typeof m&&1&m||Array.isArray(y)&&y.some((t=>1&t)))&&(i=Math.floor(i)+.5,n=Math.floor(n)+.5),ZW(t,e,i,n,l,f,y||m,g||b,Math.ceil(d),Math.ceil(p)))}};sz=jW([jy()],sz);var az=new Oy(((t,e,i,n)=>{i(QA)?n(QA).to(oz).inSingletonScope():(t(oz).toSelf().inSingletonScope(),t(jC).toService(oz)),i(tT)?n(tT).to(sz).inSingletonScope():(t(sz).toSelf().inSingletonScope(),t(jC).toService(sz)),t(qW).toSelf().inSingletonScope(),t(DC).toService(qW),t(XW).toSelf().inSingletonScope(),t(DC).toService(XW),t(UW).toSelf().inSingletonScope(),t(KW).to(UW),t(pA).to(UW),t(VW).toSelf().inSingletonScope(),t(FC).toService(VW),t($W).toSelf().inSingletonScope(),t(FC).toService($W),t(JW).toSelf().inSingletonScope(),t(DC).toService(JW),t(QW).toSelf().inSingletonScope(),t(DC).toService(QW),t(tz).toSelf().inSingletonScope(),t(DC).toService(tz),t(ez).toSelf().inSingletonScope(),t(DC).toService(ez),t(iz).toSelf().inSingletonScope(),t(DC).toService(iz),t(nz).toSelf().inSingletonScope(),t(DC).toService(nz)}));function lz(t,e,i,n){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=hz(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?hz(n,0,t.rowCount-1,t,!1):hz(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 hz(t,e,i,n,o){const{layoutMap:s,transpose:a}=n.internalProps,{width:l}=s?.getColumnWidthDefined(t)??{};if(a){if("standard"===n.widthMode){if(n.isRowHeader(t,0)||n.isCornerHeader(t,0))return Array.isArray(n.defaultHeaderColWidth)?n.defaultHeaderColWidth[t]??n.defaultColWidth:n.defaultHeaderColWidth;if("auto"!==l)return"string"==typeof l?NF(l,n.internalProps.calcWidthContext):l||n.defaultColWidth}else if("adaptive"===n.widthMode&&0===t&&"auto"!==l&&s?.showHeader){if("string"==typeof l)return NF(l,n.internalProps.calcWidthContext);if(l)return l}}else if("auto"!==l&&"autoWidth"!==n.widthMode&&!o)return"string"==typeof l?NF(l,n.internalProps.calcWidthContext):l||n.getColWidth(t);return function(t,e,i,n,o,s){let a=0,l=1;n-i>5e3&&(l=Math.ceil((n-i)/5e3));if(s.isPivotChart()&&e>=s.rowHeaderLevelCount){if(s.internalProps.layoutMap.indicatorsAsCol)return s.defaultColWidth;{const t=s.internalProps.layoutMap.getOptimunWidthForChart(e);if(t>0)return t}}for(let o=i;o<=n;o+=l){const i=cz(e,o,s);if("number"==typeof i){a=Math.max(i,a);continue}const n=t;if("number"==typeof n&&"standard"===s.widthMode){a=Math.max(n,a);continue}const l=s.isHeader(e,o)?s._getHeaderLayoutMap(e,o)?.headerType:s.getBodyColumnType(e,o);if("text"!==l&&"link"!==l&&"progressbar"!==l){a=Math.max(a,s.getColWidth(e)||0);continue}let h=0;const c=s.internalProps.layoutMap;if(c.isHeader(e,o)){const t=c.getHeader(e,o);if("only-body"===t?.define?.columnWidthComputeMode)continue;t?.hierarchyLevel&&(h=(t.hierarchyLevel??0)*(c.rowHierarchyIndent??0))}else{const t=s.getBodyColumnDefine(e,o);if(t?.tree){const t=s.dataSource.getIndexKey(s.getRecordIndexByRow(e,o));h=Array.isArray(t)&&s.getHierarchyState(e,o)!==r.none?(t.length-1)*(c.hierarchyIndent??0):0}}const u=uz(e,o,s);a=Math.max(u+h,a)}const h=s.getMinColWidth(e),c=s.getMaxColWidth(e);if(a<h)return h;if(a>c)return c;return a}(l,t,e,i,0,n)}function cz(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:dz(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 uz(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0;const l=i.getBodyColumnDefine(t,e);if("body"!==i.getCellType(t,e)||(!!l?.icon||!!l?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==a.absoluteRight&&(s+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0))}))}let h=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);h=n.end.col-n.start.col+1}const c=cF(nW("padding",o,t,e,i)),u=c[1]+c[3],d=nW("fontSize",o,t,e,i),p=nW("fontFamily",o,t,e,i),f=T(r).split("\n")||[];return f.length>=1?f.forEach((t=>{const e=i.measureText(t.slice(0,i.options.maxCharactersNumber||200),{fontSize:d,fontFamily:p}).width;n=Math.max((e+u+4+s)/h,n)})):n=Math.max((u+4+s)/h,n),!1!==i.internalProps.limitMaxAutoWidth&&(n=Math.min("number"==typeof i.internalProps.limitMaxAutoWidth?i.internalProps.limitMaxAutoWidth:450,n)),n}function dz(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 pz=new bW({autoWrapText:!0}),fz=new b_({width:0,height:0,textConfig:[]});function gz(t,e,i){const n="undefined"!=typeof window?window.performance.now():0;if("autoHeight"===t.heightMode||"adaptive"===t.heightMode){if(e=e??0,i=i??t.rowCount-1,0===e&&i===t.rowCount-1)t._clearRowRangeHeightsMap();else for(let n=e;n<=i;n++)t._clearRowRangeHeightsMap(n);for(let i=e;i<t.columnHeaderLevelCount;i++){const e=yz(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||!mz(t))if((t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol)&&mz(t))for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){t._clearRowRangeHeightsMap(n);const e=yz(n,0,t.rowHeaderLevelCount,t);t.setRowHeight(n,e)}else for(let n=Math.max(e,t.columnHeaderLevelCount);n<=i;n++){t._clearRowRangeHeightsMap(n);const e=yz(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)}(yz(t.columnHeaderLevelCount,0,t.colCount-1,t),t.columnHeaderLevelCount,t.rowCount-1,t)}}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)}}console.log("computeRowsHeight time:",("undefined"!=typeof window?window.performance.now():0)-n)}function yz(t,e,i,n){let r=0;if(n.isPivotChart()&&t>=n.columnHeaderLevelCount){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=bz(o,t,n);if("number"==typeof e){r=Math.max(e,r);continue}const i=vz(o,t,n);r=Math.max(i,r)}return r}function mz(t){const{layoutMap:e}=t.internalProps,i=t.columnHeaderLevelCount;for(let n=0;n<t.colCount;n++){const r=e.isHeader(n,i),o=r?e.getHeader(n,i):e.getBody(n,i);if("function"==typeof o.style||"function"==typeof o.icon||"function"==typeof o.headerIcon||(r?o.define?.headerCustomRender:o.define?.customRender)||(r?"function"==typeof o.define?.headerIcon:"function"==typeof o.define?.icon))return!1;const s=t._getCellStyle(n,i);if("function"==typeof s.padding||"function"==typeof s.fontSize||"function"==typeof s.lineHeight||!0===s.autoWrapText)return!1}return!0}function bz(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:dz(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 vz(t,e,i){let n=0;const r=i.getCellValue(t,e),o=i._getCellStyle(t,e);let s=0,l=0;const h=[];let c=0;const u=[];let d=0;const p=i.getBodyColumnDefine(t,e);if("body"!==i.getCellType(t,e)||(!!p?.icon||!!p?.tree)){const n=i.getCellIcons(t,e);n?.forEach((t=>{t.positionType!==a.absoluteRight&&t.positionType!==a.inlineFront&&t.positionType!==a.inlineEnd?(l+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0),s=Math.max(s,t.height??0)):t.positionType===a.inlineFront?(h.push(t),c=Math.max(c,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0))):t.positionType===a.inlineEnd&&(u.push(t),d=Math.max(d,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0)))}))}let f=1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e).mergeCell){const n=i.getCellRange(t,e);f=n.end.row-n.start.row+1}const g=cF(nW("padding",o,t,e,i)),y=nW("fontSize",o,t,e,i),m=nW("fontStyle",o,t,e,i),b=nW("fontWeight",o,t,e,i),v=nW("lineHeight",o,t,e,i)??y,w=nW("fontFamily",o,t,e,i),C=nW("autoWrapText",o,t,e,i),x=T(r).split("\n")||[];if(h.length||u.length){const e=Object.assign({text:r?.toString(),fontFamily:w,fontSize:y,fontStyle:m,fontWeight:b,lineHeight:v});e.textBaseline="middle";const o=[...h.map((t=>xW(t))),e,...u.map((t=>xW(t)))];fz.setAttributes({width:i.getColWidth(t)-(g[1]+g[3])-l,height:0,textConfig:o}),n=fz.AABBBounds.height()}else if(C){const e=i.getColWidth(t)-(g[1]+g[3])-l;pz.setAttributes({maxLineWidth:e,text:x,fontSize:y,fontStyle:m,fontWeight:b,fontFamily:w}),n=pz.AABBBounds.height()}else n=x.length*v;return(Math.max(n,s)+g[0]+g[2])/f}const wz=new BH({});wz.role="empty";const Cz={},xz={};function _z(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g){const y=it(xz,Cz)[c],m=rW("padding",f._getCellStyle(r,o),r,o,f);A(m)&&(l=m),t||((t=new BH({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 GW({stroke:!1,x:l[3],y:l[0],canvas:f.canvas,spec:u,ClassType:y,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 Sz(t,e,i,n,r,o,s,l,h,c,u,d,p,f,g,y){const m=t._getCellStyle(r,o),b=rW("padding",m,r,o,t);A(b)&&(c=b),y?.text?.textAlign&&(u=y?.text?.textAlign),y?.text?.textBaseline&&(d=y?.text?.textBaseline);const v="autoHeight"===t.heightMode,C="auto"===s,x=m.autoWrapText??t.internalProps.autoWrapText,_=m.lineClamp,S=new BH({x:i,y:n,width:l,height:h,lineWidth:y?.group?.lineWidth??void 0,fill:y?.group?.fill??void 0,stroke:y?.group?.stroke??void 0,strokeArrayWidth:y?.group?.strokeArrayWidth??void 0,strokeArrayColor:y?.group?.strokeArrayColor??void 0,cursor:y?.group?.cursor??void 0,lineCap:"square",clip:!0});if(S.role="cell",S.col=r,S.row=o,e.addChild(S),f&&S.appendChild(f),g){const e=t.getCellValue(r,o);let i;if(p&&(i=t.getCellIcons(r,o)),function(t,e,i,n,r,o,s,l,h,c,u,d,p,f){const g=[],y=[],m=[],b=[],v=[],C=[],x=[],_=[];let S,A=0,T=0,B=0,R=0,M=0,P=0;if(Array.isArray(e)&&0!==e.length){let E;if(e.forEach((t=>{switch(t.positionType){case a.left:g.push(t);break;case a.right:y.push(t);break;case a.contentLeft:m.push(t);break;case a.contentRight:b.push(t);break;case a.absoluteRight:_.push(t);break;case a.inlineFront:v.push(t);break;case a.inlineEnd:C.push(t)}})),g.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-left",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)})),y.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-right",i.name=e.name,i.setAttribute("x",B+(i.attribute.marginLeft??0)),B+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),R=Math.max(R,i.AABBBounds.height()),t.appendChild(i)})),x.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-absolute-left",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)})),_.forEach((e=>{const i=CW(e,void 0,t.col,t.row,p);i.role="icon-absolute-right",i.name=e.name,i.setAttribute("x",P+(i.attribute.marginLeft??0)),P+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),0===v.length&&0===C.length){const t=w(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:h-(n[1]+n[3])-A-B,textBaseline:"top",heightLimit:o?-1:c-(n[0]+n[2]),pickable:!1,autoWrapText:s,lineClamp:l},a=new bW(f.text?Object.assign({},f.text,e):e);a.name="text",E=a}else{const e=Object.assign({text:i?.toString()},t.parent?.theme?.userTheme?.text||{});f.text&&Object.assign(e,f.text),e.textBaseline="middle";const s=[...v.map((t=>xW(t))),e,...C.map((t=>xW(t)))];s[0].textAlign=u;const a=new b_({width:r?0:h-(n[1]+n[3])-A-B,height:o?0:c-(n[0]+n[2]),textConfig:s,verticalDirection:o?"top":d});a.name="text",E=a,a.bindIconEvent()}if(0!==m.length||0!==b.length){const e=new vW({x:0,y:0,fill:!1,stroke:!1});e.name="content",e.setCellContentOption({autoWidth:r,autoHeight:o,cellWidth:h-(n[1]+n[3])-A-B,cellHeight:c-(n[0]+n[2]),align:u,baseline:d}),m.forEach((i=>{const n=CW(i,void 0,t.col,t.row,p);n.role="icon-content-left",n.name=i.name,e.addLeftOccupyingIcon(n)})),b.forEach((i=>{const n=CW(i,void 0,t.col,t.row,p);n.role="icon-content-right",n.name=i.name,e.addRightOccupyingIcon(n)})),e.addContent(E),t.appendChild(e),e.layout(),S=e.AABBBounds.width(),e.AABBBounds.height()}else t.firstChild?t.insertBefore(E,t.firstChild):t.appendChild(E),S=E.AABBBounds.width(),E.AABBBounds.height()}else if(i){const e=w(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),a=wW(t.col,t.row,p),u={text:1!==e.length||s?e:e[0],maxLineWidth:r?1/0:h-(n[1]+n[3]+a),textBaseline:"top",autoWrapText:s,lineClamp:l,heightLimit:o?-1:c-(n[0]+n[2]),pickable:!1,dx:a},d=new bW(f.text?Object.assign({},f.text,u):u);d.name="text",t.appendChild(d),S=d.AABBBounds.width(),d.AABBBounds.height()}const E=r?A+S+B:h-(n[1]+n[3]),H=c-(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+E-B+n[3]):"icon-absolute-right"===t.role?t.setAttribute("x",t.attribute.x+E-P+n[3]+n[1]):"content"!==t.name&&"text"!==t.name||("center"===u&&"richtext"!==t.type?t.setAttribute("x",n[3]+A+(E-A-B)/2):"right"===u&&"richtext"!==t.type?t.setAttribute("x",n[3]+E-B):t.setAttribute("x",n[3]+A))})),t.forEachChildren((t=>{"middle"===d?t.setAttribute("y",n[0]+(H-t.AABBBounds.height())/2):"bottom"===d?t.setAttribute("y",n[0]+H-t.AABBBounds.height()):t.setAttribute("y",n[0])})),t.setAttributes({width:E+n[1]+n[3],height:H+n[0]+n[2]})}(S,i,e,c,C,v,x,"number"==typeof _?_:void 0,l,h,u,d,t,y),y?._vtable?.marked){const t=rS({x:S.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});t.name="mark",S.appendChild(t)}}return f&&S.setAttributes({width:Math.max(S.attribute.width,f.attribute.width),height:Math.max(S.attribute.height,f.attribute.height)}),S}const Az=tW();function Tz(t,e,i){t.then((()=>{i(),e.scenegraph.updateNextFrame()})).catch((t=>{console.error(t)}))}function Bz(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,y,m){let b;if("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||Pi.test(o))&&(m?(m.text.fill=nW("linkColor",s,n,r,i),m.group.cursor="pointer"):m={text:{fill:nW("linkColor",s,n,r,i)},group:{cursor:"pointer"}})}if(s){const t=i.getCellOriginValue(n,r),e=s(i,t);e&&(m?m.group.fill=e:m={group:{fill:e}})}let v,w,C,x=!0;if("body"!==i.getCellType(n,r)?(w=e?.headerCustomRender,C=e?.headerCustomLayout):(w=e?.customRender||i.customRender,C=e?.customLayout),C||w){const t=SW(C,w,n,r,i.getColWidth(n),i.getRowHeight(r),!1,"autoHeight"===i.heightMode,i);v=t.elementsGroup,x=t.renderDefault}b=Sz(i,h,0,c,n,r,o,a,l,u,d,p,f,v,x,m),g&&(b.mergeCol=y.end.col,b.mergeRow=y.end.row);const _=i.internalProps.layoutMap.getAxisConfigInPivotChart(n,r);if(_){const t=new KD(_,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=rW("padding",d._getCellStyle(n,r),n,r,d);A(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new BH({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 y=d.getCellValue(n,r),m=dS({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[0]-h[2],image:y??oW.damage_pic.svg,cursor:"pointer"});return m.name="image",m.keepAspectRatio=a,m.successCallback=a||l?()=>{const t=m.resources.get(m.attribute.image).data;if(l&&sW(n,r,t.width,t.height,d.scenegraph,h),a){const{width:e,height:i}=eW(t.width,t.height,g.attribute.width-h[1]-h[3],g.attribute.height-h[0]-h[2]),n=iW(0,0,g.attribute.width,g.attribute.height,e,i,c,u,h);m.setAttributes({x:n.x,y:n.y,width:e,height:i})}d.scenegraph.updateNextFrame()}:()=>{aW(g,n,r,d)},m.failCallback=()=>{const t=tW();m.image=t.damage_pic.svg},g.appendChild(m),g}(h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,u,d,p,i,m);else if("video"===t)b=function(t,e,i,n,r,o,s,a,l,h,c,u,d,p){const f=rW("padding",d._getCellStyle(n,r),n,r,d);A(f)&&(h=f),p?.text?.textAlign&&(c=p?.text?.textAlign),p?.text?.textBaseline&&(u=p?.text?.textBaseline);const g=new BH({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 y=d.getCellValue(n,r),m=document.createElement("video");m.addEventListener("loadeddata",(()=>{l&&sW(n,r,m.videoWidth,m.videoHeight,d.scenegraph,h);const t=g.attribute.width,e=g.attribute.height;if(a){const{width:i,height:n}=eW(m.videoWidth,m.videoHeight,t-h[1]-h[3],e-h[0]-h[2]),r=iW(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 pW({x:o-i/2,y:s-i/2,width:i,height:i,image:Az.play.svg,cursor:Az.play.cursor});p.name="play-icon",g.appendChild(p),d.scenegraph.updateNextFrame()})),m.onerror=()=>{b.image=Az.damage_pic.svg},m.src=y,m.setAttribute("preload","auto");const b=dS({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[2]-h[0],image:m,cursor:"pointer"});return b.name="image",g.appendChild(b),g}(h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),e.keepAspectRatio,e.imageAutoSizing,u,d,p,i,m);else if("chart"===t){const t=i.internalProps.layoutMap.getChartInstance(n,r);b=_z(null,h,0,c,n,r,i.getColWidth(n),i.getRowHeight(r),u,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),s=i.getCellValue(n,r),f=i.getCellOriginValue(n,r);b=Sz(i,h,0,c,n,r,o,a,l,u,d,p,!1,null,!0,m);const g=lW(e,t,o,s,f,n,r,0,i);b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g)}else"sparkline"===t&&(b=uW(null,h,0,c,n,r,a,l,u,i,m));return b}function Rz(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.getCellType(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=qF(i._getCellStyle(t,e),i,t,e,nW).theme,p=d._vtable.padding,f=d._vtable.textAlign,g=d._vtable.textBaseline;let y,m,b;i.internalProps?.dataConfig?.mappingRules&&"body"===s&&i.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&(y=t.bgColor.mapping)})),"body"!==s?(a?.headerCustomRender,a?.headerCustomLayout):(a?.customRender||i.customRender,a?.customLayout),h?(m=i.getColsWidth(h.start.col,h.end.col),b=i.getRowsHeight(h.start.row,h.end.row)):(m=i.getColWidth(t),b=i.getRowHeight(e));const v=i.getCellValue(t,e);st(v)?(r.removeAllChild(),Tz(v,i,Mz.bind(null,o,a,i,t,e,y,m,b,r,p,f,g,u,l,h,n,d))):c=Mz(o,a,i,t,e,y,m,b,r,p,f,g,u,l,h,n,d)}else c=new BH({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));return c}function Mz(t,e,i,n,r,o,s,a,l,h,c,u,d,p,f,g,y){const m=Bz(t,e,i,n,r,i.getColWidth(n),o,s,a,g?i.scenegraph.getColGroup(n):l.parent,g?0:l.attribute.y,h,c,u,d,p,f,y);return g||(l.parent.insertAfter(m,l),l.parent.removeChild(l),i.scenegraph?.proxy.cellCache.get(n)&&i.scenegraph?.proxy.cellCache.set(n,m)),m}function Pz(t,e,i,n,r,o,s,a,l,h){let c,u,d,p,f=0;a.internalProps?.dataConfig?.mappingRules&&"body"===l&&a.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&(p=t.bgColor.mapping)}));let g=0;t.colHeight&&(g=t.colHeight);for(let y=n;y<=r;y++){const n=y,r="body"!==l?a.getHeaderDefine(e,n):a.getBodyColumnDefine(e,n),m="body"!==l||(!!r?.icon||!!r?.tree),b=qF(a._getCellStyle(e,n),a,e,n,nW).theme;b.group.width=i,b.group.height=Array.isArray(s)?s[n]:s,b._vtable.padding&&(c=b._vtable.padding),b.text.textAlign&&(u=b.text.textAlign),b.text.textBaseline&&(d=b.text.textBaseline),"body"===l||b.group.fill||(b.group.fill="#fff");let v=i,w=a.getRowHeight(n);const C=(a.isHeader(e,n)?a._getHeaderLayoutMap(e,n).headerType:a.getBodyColumnType(e,n))||"text";let x,_,S;if(("body"!==l||r?.mergeCell)&&(_=a.getCellRange(e,n),S=_.start.col!==_.end.col||_.start.row!==_.end.row,S&&(v=0,w=0,x=o.get(`${_.start.col},${_.start.row};${_.end.col},${_.end.row}`),!x))){for(let t=_.start.col;t<=_.end.col;t++)v+=a.getColWidth(t);for(let t=_.start.row;t<=_.end.row;t++)w+=a.getRowHeight(t);o.set(`${_.start.col},${_.start.row};${_.end.col},${_.end.row}`,{x:0,y:g,cellWidth:v,cellHeight:w})}if(x){const i=x.cellHeight/(_.end.row-_.start.row+1),r=new BH({x:0,y:g,width:0,height:i,visible:!1,pickable:!1});r.role="shadow-cell",r.col=e,r.row=n,r.mergeCol=_.start.col,r.mergeRow=_.start.row,t.addChild(r),t.updateColumnRowNumber(n),t.updateColumnHeight(i),_=a.getCellRange(e,n),g+=i,f=Math.max(f,x.cellWidth)}else{const o=a.getCellValue(e,n);if(st(o)){Tz(o,a,Bz.bind(null,C,r,a,e,n,i,p,v,w,t,g,c,u,d,m,S,_,b)),t.updateColumnRowNumber(n);const s=S?a.getRowHeight(n)/(_.end.row-_.start.row+1):a.getRowHeight(n);t.updateColumnHeight(s),g+=s}else{const o=Bz(C,r,a,e,n,i,p,v,w,t,g,c,u,d,m,S,_,b);t.updateColumnRowNumber(n);const s=S?o.attribute.height/(_.end.row-_.start.row+1):o.attribute.height;t.updateColumnHeight(s),g+=s}}if(h&&n>h)break}return t.setAttribute("width",i),{width:i,height:g}}function Ez(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 BH({x:e+f,y:i,width:r,height:0,clip:!1,pickable:!1});p.role="column",p.col=c,t.addChild(p);const{width:y,height:m}=Pz(p,n,r,o,s,l.scenegraph.mergeMap,"columnHeader"===a?d??u:u,l,a,h);f+=y,g=Math.max(g,m)}t.setAttribute("width",f),t.setAttribute("height",g)}async function Hz(t,e,i,n){if("left"===e&&n.colEnd+t>n.bodyRightCol?t=n.bodyRightCol-n.colEnd:"right"===e&&n.colStart-t<n.bodyLeftCol&&(t=n.colStart-n.bodyLeftCol),n.table.scenegraph.bodyGroup,t<n.colEnd-n.colStart){const r="left"===e?n.colStart:n.colEnd-t+1,o="left"===e?n.colStart+t-1:n.colEnd,s="left"===e?n.colEnd+1:n.colStart-t,a="left"===e?n.colEnd+t:n.colStart-1;lz(n.table,s,a),function(t,e,i,n){for(let r=t;r<=e;r++)n.table.scenegraph.bodyGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.colHeaderGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n),n.table.scenegraph.bottomFrozenGroup.childrenCount>0&&Iz(n.table.scenegraph.bodyGroup,i,n)}(r,o,e,n);const l=Math.max(n.bodyLeftCol,i-1*n.screenColCount),h=Math.min(n.bodyRightCol,i+2*n.screenColCount);n.colStart="left"===e?n.colStart+t:n.colStart-t,n.colEnd="left"===e?n.colEnd+t:n.colEnd-t,Dz(s,n),Oz(l,h,n),n.currentCol="left"===e?n.currentCol+t:n.currentCol-t,n.totalCol="left"===e?n.totalCol+t:n.totalCol-t,n.referenceCol=n.colStart+Math.floor((n.colEnd-n.colStart)/2),n.colUpdatePos=s,n.colUpdateDirection=e,n.table.scenegraph.stage.render(),await n.progress()}else{const r="left"===e?n.colStart+t:n.colStart-t,o="left"===e?n.colEnd+t:n.colEnd-t;lz(n.table,r,o);const s=n.table.getColsWidth(n.bodyLeftCol,r-1);console.log("distStartColY",n.bodyLeftCol,r-1,s),function(t,e,i,n){n.table.scenegraph.colHeaderGroup.forEachChildren(((r,o)=>{"group"===r.type&&Lz(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&&Lz(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&&Lz(r,"left"===i?r.col+e:r.col-e,0===o?t:r._prev.attribute.x+n.table.getColWidth(r._prev.col))}))}(s,t,e,n);const a=Math.max(n.bodyLeftCol,i-1*n.screenRowCount),l=Math.min(n.bodyRightCol,i+2*n.screenRowCount);n.colStart=r,n.colEnd=o,Dz(r,n),Oz(a,l,n),n.currentCol="left"===e?n.currentCol+t:n.currentCol-t,n.totalCol="left"===e?n.totalCol+t:n.totalCol-t,n.referenceCol=n.colStart+Math.floor((n.colEnd-n.colStart)/2),n.colUpdatePos=n.colStart,n.colUpdateDirection=o>n.bodyRightCol-(n.colEnd-n.colStart+1)?"right":"left",await n.progress()}}function Lz(t,e,i){t.col=e,t.forEachChildren((t=>{t.col=e,t.needUpdate=!0})),t.setAttribute("x",i),t.needUpdate=!0}function kz(t,e){let i=t.firstChild;for(;i;){i=e.updateCellGroupContent(i)._next}t.needUpdate=!1}function Iz(t,e,i){if("left"===e){const e=t.firstChild;Lz(e,t.lastChild.col+1,t.lastChild.attribute.x+t.lastChild.attribute.width),t.appendChild(e)}else{const e=t.lastChild;Lz(e,t.firstChild.col-1,t.firstChild.attribute.x-i.table.getColWidth(t.firstChild.col-1)),t.insertBefore(e,t.firstChild)}}function Oz(t,e,i){for(let n=t;n<=e;n++){kz(i.table.scenegraph.getColGroup(n),i);kz(i.table.scenegraph.getColGroup(n,!0),i);kz(i.table.scenegraph.getColGroupInBottom(n),i)}}function Dz(t,e){for(let i=0;i<e.table.rowCount;i++){if(i>=e.table.columnHeaderLevelCount&&i<e.rowStart||i>e.rowEnd&&i<e.table.rowCount-e.table.bottomFrozenRowCount)continue;const n=RH(e.table,t,i);if(n&&n.start.row!==i){const r=e.highPerformanceGetCell(t,i,!0),o=Rz(n.start.col,n.start.row,e.table,!0);o.col=t,o.row=i,o.setAttribute("x",e.table.getColsWidth(e.table.rowHeaderLevelCount,n.start.col-1)),r.parent.insertAfter(o,r),r.parent.removeChild(r),r.needUpdate=!1,o.needUpdate=!1,e.cellCache.get(t)&&e.cellCache.set(t,o)}}}function Fz(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.getCell(o,t);if(!e.row)continue;let i;i=e._prev?(e._prev?.attribute.y??0)+(e._prev?.attribute.height??0):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.getCell(o,t);if(!e.row)continue;let i;e._next?i=(e._next?.attribute.y??0)-(e.attribute.height??0):(i=r.getRowsHeight(r.columnHeaderLevelCount,e.row)-(e.attribute.height??0),console.log("估计位置",r.getRowsHeight(r.columnHeaderLevelCount,e.row))),e.setAttribute("y",i)}}async function Wz(t,e,i,n){if("up"===e&&n.rowEnd+t>n.bodyBottomRow?t=n.bodyBottomRow-n.rowEnd:"down"===e&&n.rowStart-t<n.bodyTopRow&&(t=n.rowStart-n.bodyTopRow),t<n.rowEnd-n.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++)zz(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++)zz(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++)zz(o,i,n)}}("up"===e?n.rowStart:n.rowEnd-t+1,"up"===e?n.rowStart+t-1:n.rowEnd,e,n);const r="up"===e?n.rowEnd+1:n.rowStart-t;"up"===e?n.rowEnd:n.rowStart;const o=Math.max(n.bodyTopRow,i-1*n.screenRowCount),s=Math.min(n.bodyBottomRow,i+2*n.screenRowCount);"autoHeight"===n.table.heightMode&&gz(n.table,o,s),n.rowStart="up"===e?n.rowStart+t:n.rowStart-t,n.rowEnd="up"===e?n.rowEnd+t:n.rowEnd-t,Nz(r,n),jz(o,s,n),"autoHeight"===n.table.heightMode&&Fz(n.bodyLeftCol,n.bodyRightCol,o,s,n.table,e),n.currentRow="up"===e?n.currentRow+t:n.currentRow-t,n.totalRow="up"===e?n.totalRow+t:n.totalRow-t,n.referenceRow=n.rowStart+Math.floor((n.rowEnd-n.rowStart)/2),n.rowUpdatePos=r,n.rowUpdateDirection=e,console.log("move end proxy",n.rowStart,n.rowEnd),console.log("move end cell",n.table.scenegraph.bodyGroup.firstChild.firstChild.row,n.table.scenegraph.bodyGroup.firstChild.lastChild.row),n.table.scenegraph.updateNextFrame(),await n.progress()}else{const r="up"===e?n.rowStart+t:n.rowStart-t,o="up"===e?n.rowEnd+t:n.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))}))}}(n.table.getRowsHeight(n.bodyTopRow,r-1),t,e,n),"autoHeight"===n.table.heightMode?(s=r,a=o):(s=Math.max(n.bodyTopRow,i-1*n.screenRowCount),a=Math.min(n.bodyBottomRow,i+2*n.screenRowCount)),console.log("更新同步范围",s,a),"autoHeight"===n.table.heightMode&&gz(n.table,s,a),n.rowStart=r,n.rowEnd=o,Nz(r,n),jz(s,a,n),console.log("updateAutoRow",o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up"),"autoHeight"===n.table.heightMode&&Fz(n.bodyLeftCol,n.bodyRightCol,s,a,n.table,o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up"),n.currentRow="up"===e?n.currentRow+t:n.currentRow-t,n.totalRow="up"===e?n.totalRow+t:n.totalRow-t,n.referenceRow=n.rowStart+Math.floor((n.rowEnd-n.rowStart)/2),n.rowUpdatePos=n.rowStart,n.rowUpdateDirection=o>n.bodyBottomRow-(n.rowEnd-n.rowStart+1)?"down":"up",console.log("move total end proxy",n.rowStart,n.rowEnd),console.log("move total end cell",n.table.scenegraph.bodyGroup.firstChild.firstChild.row,n.table.scenegraph.bodyGroup.firstChild.lastChild.row),n.table.scenegraph.updateNextFrame(),"autoHeight"!==n.table.heightMode&&await n.progress()}}function zz(t,e,i){if("up"===e){const e=t.firstChild;i.updateCellGroupPosition(e,t.lastChild.row+1,t.lastChild.attribute.y+t.lastChild.attribute.height),t.appendChild(e)}else{const e=t.lastChild;i.updateCellGroupPosition(e,t.firstChild.row-1,t.firstChild.attribute.y-e.attribute.height),t.insertBefore(e,t.firstChild)}}function jz(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)}}function Nz(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=RH(e.table,i,t);if(n&&n.start.row!==t){const r=e.highPerformanceGetCell(i,t,!0),o=Rz(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)}}}class Gz{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;colLimit=1e3;bodyLeftCol;bodyRightCol;totalCol;colStart;colEnd;taskColCount;xLimitLeft;xLimitRight;screenColCount;firstScreenColLimit;colUpdatePos;currentCol;referenceCol;screenLeftCol=0;colUpdateDirection;cellCache=new Map;constructor(t){this.table=t,this.table.isPivotChart()&&(this.rowLimit=100,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){l.setParamsForRow(),l.setParamsForColumn(),l.table.internalProps._colWidthsMap.clear(),l.table._clearColRangeWidthsMap(),lz(l.table,0,Math.min(l.firstScreenColLimit,l.table.colCount-1)),l.table.internalProps._rowHeightsMap.clear(),l.table._clearRowRangeHeightsMap(),gz(l.table,0,Math.min(l.firstScreenRowLimit,l.table.rowCount-1)),l.table.rightFrozenColCount>0&&l.table.colCount-1>l.firstScreenColLimit&&lz(l.table,l.table.colCount-1-l.table.rightFrozenColCount+1,l.table.colCount-1),l.table.bottomFrozenRowCount>0&&l.table.rowCount-1>l.firstScreenRowLimit&&lz(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()}),Ez(t,s,a,0,l.table.rowHeaderLevelCount-1,0,l.table.columnHeaderLevelCount-1,"cornerHeader",l.table),Ez(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),Ez(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&&Ez(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&&Ez(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),Ez(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 createColGroupForFirstScreen(t,e,i,n,r){this.setParamsForRow(),this.setParamsForColumn(),gz(r,this.table.columnHeaderLevelCount,Math.min(this.firstScreenRowLimit,r.rowCount-1)),Ez(t,i,n,0,r.rowHeaderLevelCount-1,r.columnHeaderLevelCount,r.rowCount-1,"rowHeader",r,this.firstScreenRowLimit),Ez(e,i,n,r.rowHeaderLevelCount,r.colCount-1,r.columnHeaderLevelCount,r.rowCount-1,"body",r,this.firstScreenRowLimit),e.firstChild?(this.currentRow=e.firstChild?.rowNumber??this.totalRow,this.rowEnd=this.currentRow,this.rowUpdatePos=this.rowEnd,this.referenceRow=Math.floor((this.rowEnd-this.rowStart)/2),await this.progress()):(this.currentRow=this.totalRow,this.rowEnd=this.currentRow,this.rowUpdatePos=this.rowEnd,this.referenceRow=Math.floor((this.rowEnd-this.rowStart)/2))}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(gz(this.table,this.currentRow+1,e),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}=Pz(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}=Pz(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}=Pz(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);if(lz(this.table,this.currentCol+1,e),this.table.columnHeaderLevelCount){const t=this.table.scenegraph.colHeaderGroup.lastChild instanceof BH?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;Ez(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 BH?this.table.scenegraph.bottomFrozenGroup.lastChild:this.table.scenegraph.bottomFrozenGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,n=t.attribute.y;Ez(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 BH?this.table.scenegraph.bodyGroup.lastChild:this.table.scenegraph.bodyGroup.lastChild._prev,n=i.attribute.x+i.attribute.width,r=i.attribute.y;Ez(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;e.screenTopRow=n;const r=n-e.referenceRow;r>0?(Wz(r,"up",n,e),e.updateBody(t)):r<0?(Wz(-r,"down",n,e),e.updateBody(t)):e.updateBody(t),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;e.screenLeftCol=i.col;const n=e.screenLeftCol-e.referenceCol;n>0?(e.table.scenegraph.setBodyAndColHeaderX(-t),await Hz(n,"left",e.screenLeftCol,e)):n<0?(e.table.scenegraph.setBodyAndColHeaderX(-t),await Hz(-n,"right",e.screenLeftCol,e)):e.table.scenegraph.setBodyAndColHeaderX(-t),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&&gz(this.table,this.rowUpdatePos,e),jz(this.rowUpdatePos,e,this),"autoHeight"===this.table.heightMode&&Fz(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);lz(this.table,this.colUpdatePos,e),Oz(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 sortCell(){for(let t=this.bodyLeftCol;t<=this.bodyRightCol;t++)for(let e=this.rowStart;e<=this.rowEnd;e++){this.highPerformanceGetCell(t,e).needUpdate=!0}let t,e;"autoHeight"===this.table.heightMode?(t=this.rowStart,e=this.rowEnd):(t=Math.max(this.bodyTopRow,this.screenTopRow-2*this.screenRowCount),e=Math.min(this.bodyBottomRow,this.screenTopRow+3*this.screenRowCount)),console.log("sort更新同步范围",t,e),"autoHeight"===this.table.heightMode&&gz(this.table,t,e);for(let i=this.bodyLeftCol;i<=this.bodyRightCol;i++)for(let n=t;n<=e;n++){const t=this.highPerformanceGetCell(i,n);this.updateCellGroupContent(t)}if(console.log("updateAutoRow",this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up"),"autoHeight"===this.table.heightMode&&Fz(this.bodyLeftCol,this.bodyRightCol,t,e,this.table,this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up"),this.rowUpdatePos=this.rowStart,this.rowUpdateDirection=this.rowEnd>this.bodyBottomRow-(this.rowEnd-this.rowStart+1)?"down":"up",this.rowEnd===this.table.scenegraph.proxy.bodyBottomRow&&this.rowStart===this.table.scenegraph.proxy.bodyTopRow);else if(this.rowEnd===this.table.scenegraph.proxy.bodyBottomRow){const t=this.table.getAllRowsHeight()-this.table.scenegraph.height;this.updateBody(t)}else this.rowStart===this.table.scenegraph.proxy.bodyTopRow&&this.updateBody(0);"autoHeight"!==this.table.heightMode&&await this.progress()}highPerformanceGetCell(t,e,i){if(e>=this.table.columnHeaderLevelCount&&e<this.table.rowCount-this.table.bottomFrozenRowCount&&(e<this.rowStart||e>this.rowEnd))return wz;if(t>=this.table.rowHeaderLevelCount&&t<this.table.colCount-this.table.rightFrozenColCount&&(t<this.colStart||t>this.colEnd))return wz;if(this.cellCache.get(t)){const n=this.cellCache.get(t);if((n._next||n._prev)&&Math.abs(n.row-e)<e){let r=Kz(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.row&&this.cellCache.set(t,r),r}const n=this.table.scenegraph.getCell(t,e,i);return n.row&&this.cellCache.set(t,n),n}}function Kz(t,e){return t?t.row===e?t:t.row>e?Kz(t._prev,e):Kz(t._next,e):null}function Uz(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 Vz(t,e,i){const n=i.scenegraph,r=$z(t.map((t=>t.row))).sort(((t,e)=>t-e)),o=$z(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=Rz(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 $z(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}new rC({});const Yz=[];function Xz(t){Yz.forEach((e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((t=>{t.setAttributes({dy:0,dx:0})}))})),Yz.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){Zz(t.scenegraph.getCell(i,e),s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),Yz.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){qz(t.scenegraph.getCell(i,e),o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),Yz.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);qz(n,o+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()),Zz(n,s+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()),Yz.push({col:i,row:e})}}}function qz(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 Zz(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 Jz(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,t.addUpdateBoundTag())}))}))}}function Qz(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 KD(i,t.attribute.width,t.attribute.height,e);t.clear(),t.appendChild(n.component),n.overlap()}}}))}))}function tj(t){const e=t.bodyGroup.firstChild instanceof BH?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 ej(t){const e=t.colHeaderGroup.firstChild instanceof BH?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 ij(t){const e=t.rowHeaderGroup.lastChild instanceof BH?t.rowHeaderGroup.lastChild:t.rowHeaderGroup.lastChild?._prev;e&&(t.bodyGroup.firstChild?t.bodyGroup.insertBefore(e,t.bodyGroup.firstChild):t.bodyGroup.appendChild(e),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width+e.attribute.width),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width-e.attribute.width))}function nj(t){const e=t.cornerHeaderGroup.lastChild instanceof BH?t.cornerHeaderGroup.lastChild:t.cornerHeaderGroup.lastChild?._prev;e&&(t.colHeaderGroup.firstChild?t.colHeaderGroup.insertBefore(e,t.colHeaderGroup.firstChild):t.bodyGroup.appendChild(e),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width+e.attribute.width),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width-e.attribute.width))}function rj(t){const{bgColor:e,borderColor:i,borderLineWidth:n,borderLineDash:r}=t,o={x:0,y:0,width:0,height:0,visible:!1,pickable:!0,fill:e};o.stroke=WW(i,void 0),o.lineWidth=n,r&&(o.lineDash=r),o.lineCap="square",Array.isArray(i)&&(o.strokeArrayColor=cF(i)),Array.isArray(n)&&(o.strokeArrayWidth=cF(n),o.lineWidth=1);const s=new BH(o);return s.role="corner-frozen",s}Ob.load(az);class oj{proxy;tableGroup;colHeaderGroup;cornerHeaderGroup;rowHeaderGroup;bodyGroup;rightFrozenGroup;bottomFrozenGroup;rightTopCellGroup;leftBottomCellGroup;rightBottomCellGroup;componentGroup;selectedRangeComponents;selectingRangeComponents;lastSelectId;component;stage;table;isPivot;transpose;hasFrozen;frozenColCount;frozenRowCount;clear;mergeMap;constructor(t){this.table=t,this.hasFrozen=!1,this.clear=!0,this.mergeMap=new Map,this.stage=function(t){return new AH(t)}({canvas:t.canvas,width:t.canvas.width,height:t.canvas.height,disableDirtyBounds:!1,background:t.theme.underlayBackgroundColor,dpr:t.internalProps.pixelRatio}),this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"}}),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;const t=this.table.tableNoFrameWidth,e=this.table.tableNoFrameHeight;this.tableGroup=new BH({x:0,y:0,width:t,height:e,clip:!0,pickable:!1}),this.tableGroup.role="table";const i=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});i.role="col-header",this.colHeaderGroup=i;const n=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});n.role="corner-header",this.cornerHeaderGroup=n;const r=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1});r.role="row-header",this.rowHeaderGroup=r;const o=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});o.role="body",this.bodyGroup=o;const s=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});s.role="right-frozen",this.rightFrozenGroup=s;const a=new BH({x:0,y:0,width:t,height:0,clip:!1,pickable:!1});a.role="bottom-frozen",this.bottomFrozenGroup=a;const l=new BH({x:0,y:0,width:0,height:0,clip:!1,pickable:!1,childrenPickable:!0});l.role="component",this.componentGroup=l,this.rightTopCellGroup=rj(this.table.theme.cornerRightTopCellStyle||this.table.theme.cornerHeaderStyle),this.leftBottomCellGroup=rj(this.table.theme.cornerLeftBottomCellStyle||this.table.theme.cornerHeaderStyle),this.rightBottomCellGroup=rj(this.table.theme.cornerRightBottomCellStyle||this.table.theme.cornerHeaderStyle),this.tableGroup.addChild(o),this.tableGroup.addChild(s),this.tableGroup.addChild(a),this.tableGroup.addChild(r),this.tableGroup.addChild(i),this.tableGroup.addChild(this.rightBottomCellGroup),this.tableGroup.addChild(this.rightTopCellGroup),this.tableGroup.addChild(this.leftBottomCellGroup),this.tableGroup.addChild(n),this.tableGroup.addChild(l)}clearCells(){this.clear=!0,this.hasFrozen=!1,this.mergeMap.clear(),this.colHeaderGroup.clear(),this.rowHeaderGroup.clear(),this.cornerHeaderGroup.clear(),this.bodyGroup.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.rightTopCellGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.leftBottomCellGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.rightTopCellGroup.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 OW(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 Gz(this.table),DW(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-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);n=this.getCell(i.start.col,i.start.row)}return n||wz}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)}getCellSize(t,e){const i=this.getCell(t,e),n=RH(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)=>{Uz(e,i,t)})),t.selectedRangeComponents.forEach(((e,i)=>{Uz(e,i,t)}))}hideHoverIcon(t,e){if(-1===t||-1===e)return;aj(this,this.getCell(t,e),"mouseenter_cell")}showHoverIcon(t,e){if(-1===t||-1===e)return;sj(this,this.getCell(t,e),"mouseenter_cell")}hideClickIcon(t,e){if(-1===t||-1===e)return;aj(this,this.getCell(t,e),"click_cell")}showClickIcon(t,e){if(-1===t||-1===e)return;sj(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,y=hS({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:y,role:o}),t.tableGroup.insertAfter(y,"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=RH(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=RH(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=RH(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=RH(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,vm.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=hS({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;let r=!1;const o=t.getColGroup(e,!0),s=o?.attribute.width;if(o?.setAttribute("width",s+i),o?.forEachChildren(((o,a)=>{if(BW(t,o,e,o.row,s,i,t.table.columnHeaderLevelCount,n)){const e=RH(t.table,o.col,o.row);if(e&&e.end.row-e.start.row)for(let i=e.start.row;i<=e.end.row;i++)RW(t,i);else RW(t,o.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!0);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(0,e-t.colHeaderGroup.attribute.height)}r=!1;const a=t.getColGroup(e),l=a.attribute.width;if(a?.setAttribute("width",l+i),a?.forEachChildren(((e,o)=>{if(BW(t,e,e.col,e.row,l,i,t.table.rowHeaderLevelCount,n)){const i=RH(t.table,e.col,e.row);if(i&&i.end.row-i.start.row)for(let e=i.start.row;e<=i.end.row;e++)RW(t,e);else RW(t,e.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!1);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}const h=t.getColGroupInBottom(e);if(h){const e=h.attribute.width;if(h?.setAttribute("width",e+i),h?.forEachChildren(((o,s)=>{if(BW(t,o,o.col,o.row,e,i,t.table.rowHeaderLevelCount,n)){const e=RH(t.table,o.col,o.row);if(e&&e.end.row-e.start.row)for(let i=e.start.row;i<=e.end.row;i++)RW(t,i);else RW(t,o.row);r=!0}})),r){let e=0;for(let i=0;i<t.table.colCount;i++){const n=t.getColGroup(i,!1);let r=0;n.forEachChildren((t=>{"cell"===t.role&&(t.setAttribute("y",r),r+=t.attribute.height)})),e=r}t.updateContainerHeight(t.table.frozenRowCount,e-t.bodyGroup.attribute.height)}}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)})),h&&t.bottomFrozenGroup.forEachChildrenSkipChild(((t,n)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))),t.table.setColWidth(e,a.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;if(i._selectedDataItemsInChart=[],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]);i._selectedDataItemsInChart.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]);i._selectedDataItemsInChart.push(t)}if(0===i._selectedDataItemsInChart.length&&0===n)return;i.internalProps.layoutMap.updateDataStateToChartInstance(),Jz(t)}}(this,t)}updateAutoColWidth(t){const e=this.table.getColWidth(t),i=hz(t,0,this.table.rowCount-1,this.table,!0);i!==e&&this.updateColWidth(t,i-e)}recalculateColWidths(){lz(this.table,0,this.table.colCount-1,!0)}recalculateRowHeights(){gz(this.table,0,this.table.rowCount-1)}resize(){this.recalculateColWidths(),"autoHeight"===this.table.heightMode&&this.recalculateRowHeights(),this.dealWidthMode(),this.dealHeightMode(),this.dealFrozen(),this.updateTableSize(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),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.rightBottomCellGroup.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.leftBottomCellGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height,width:this.table.getFrozenColsWidth()}),this.rightBottomCellGroup.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.rightTopCellGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.rightFrozenGroup.attribute.width,width:this.rightFrozenGroup.attribute.width,height:this.table.getFrozenRowsHeight()}),this.rightBottomCellGroup.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=RH(t.table,n,e);o&&o.start.col!==n||(TW(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);for(let e=n;e<=r;e++)for(let n=0;n<t.table.colCount;n++){const r=t.getCell(n,e),o=RH(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.frozenRowCount?(this.colHeaderGroup.setDeltaHeight(e),this.cornerHeaderGroup.setDeltaHeight(e),this.rowHeaderGroup.setDeltaY(e),this.bodyGroup.setDeltaY(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(),Xz(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++)tj(t),ej(t)}else if(t.table.frozenColCount<t.table.rowHeaderLevelCount)for(let e=0;e<t.table.rowHeaderLevelCount-t.table.frozenColCount;e++)ij(t),nj(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++)ij(t),nj(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++)tj(t),ej(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=RH(this.table,i,o);s?t=this.getCell(s.start.col,s.start.row):t.setAttribute("width",n);const a=cF(nW("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.getCellType(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=RH(r,t,e),s=RH(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=RH(r,t,e),s=RH(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 y=Math.min(l,d),m=Math.max(c,f),b=Math.min(h,p),v=Math.max(u,g);for(let t=y;t<=m;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=y;t<=m;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(){let t=0;this.cornerHeaderGroup.forEachChildrenSkipChild(((e,i)=>{e.setAttribute("x",t),t+=e.attribute.width}));let e=0;this.rowHeaderGroup.forEachChildrenSkipChild(((t,i)=>{t.setAttribute("x",e),e+=t.attribute.width}));let i=0;this.colHeaderGroup.forEachChildrenSkipChild(((t,e)=>{t.setAttribute("x",i),i+=t.attribute.width}));let n=0;this.bodyGroup.forEachChildrenSkipChild(((t,e)=>{t.setAttribute("x",n),n+=t.attribute.width})),this.cornerHeaderGroup.setDeltaWidth(t-this.cornerHeaderGroup.attribute.width),this.colHeaderGroup.setDeltaWidth(i-this.colHeaderGroup.attribute.width),this.rowHeaderGroup.setDeltaWidth(e-this.rowHeaderGroup.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 r=this.table.stateManeger.scroll.horizontalBarPos,o=this.table.stateManeger.scroll.verticalBarPos;this.component.updateScrollBar(),this.table.stateManeger.setScrollLeft(r),this.table.stateManeger.setScrollTop(o),this.updateNextFrame()}updateCellContentWhileResize(t,e){const i=this.table.getBodyColumnType(t,e),n=this.getCell(t,e);"image"!==i&&"video"!==i||aW(n,t,e,this.table)}createFrameBorder(){this.updateTableSize();const t=!this.isPivot;DW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,this.bodyGroup.role,t?[!0,!0,!0,!1]:void 0),DW(this.rowHeaderGroup,this.isPivot?this.table.theme.rowHeaderStyle.frameStyle:this.table.theme.bodyStyle.frameStyle,this.rowHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),DW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,this.colHeaderGroup.role,t?[!0,!0,!0,!1]:void 0),DW(this.cornerHeaderGroup,this.isPivot?this.table.theme.cornerHeaderStyle.frameStyle:this.table.theme.headerStyle.frameStyle,this.cornerHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),DW(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0)}getResizeColAt(t,e,i,n=8){if(i){if(t<i.globalAABBBounds.x1+n)return{col:i.col-1,row:i.row,x:i.globalAABBBounds.x1};if(i.globalAABBBounds.x2-n<t)return{col:i.col,row:i.row,x:i.globalAABBBounds.x2}}else;return{col:-1,row:-1}}updateIcon(t,e){CW(e,t),t.name=e.name,this.updateNextFrame()}updateFrozen(){this.clear||(this.resetFrozen(),this.dealFrozen(),this.component.updateScrollBar())}updateBorderSizeAndPosition(){this.bodyGroup.border&&(this.bodyGroup.appendChild(this.bodyGroup.border),zW(this.bodyGroup),0===this.rowHeaderGroup.attribute.width?FW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!0]):FW(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,[!0,!0,!0,!1])),this.colHeaderGroup.border&&(this.colHeaderGroup.appendChild(this.colHeaderGroup.border),zW(this.colHeaderGroup),0===this.cornerHeaderGroup.attribute.width?FW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!0]):FW(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,[!0,!0,!0,!1])),this.rowHeaderGroup.border&&(this.rowHeaderGroup.appendChild(this.rowHeaderGroup.border),zW(this.rowHeaderGroup)),this.cornerHeaderGroup.border&&(this.cornerHeaderGroup.appendChild(this.cornerHeaderGroup.border),zW(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?setTimeout((()=>{this.clearCells(),this.createSceneGraph()}),10):this.proxy.sortCell())}getCellOverflowText(t,e){const i=this.getCell(t,e).getChildByName("text",!0);if(i){const t=Wt(i.attribute.text)?i.attribute.text.join(""):i.attribute.text;let e="";if(Ft(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 Rz(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,[l.collapse,l.expand],n)}updateRow(t,e){Vz(t,e,this.table),this.recalculateColWidths(),"autoHeight"===this.table.heightMode&&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 sj(t,e,i){e.forEachChildren((e=>{"group"===e.type?sj(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!0,t.updateNextFrame())}))}function aj(t,e,i){e.forEachChildren((e=>{"group"===e.type?aj(t,e,i):e.attribute.visibleTime===i&&(e.attribute.visible=!1,t.updateNextFrame())}))}function lj(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 hj(t,e,i,n,r){const o=t.table;for(let i=0;i<o.columnHeaderLevelCount;i++)lj(t,e,i);const s=t.getColGroup(e);return s?.addUpdateBoundTag(),!0}function cj(t,e,i,n,r,o){const s=t.table;for(let i=0;i<s.columnHeaderLevelCount;i++)lj(t,e,i);const a=t.getColGroup(e);return a?.addUpdateBoundTag(),!0}function uj(t,e,i,n,r){const o=t.table;for(let e=0;e<o.colCount;e++)lj(t,e,i);return!0}function dj(t,e,i,n,r,o){const s=t.table;for(let e=0;e<s.colCount;e++)lj(t,e,i);return!0}function pj(t,e,n){const{table:r}=t,{scenegraph:o}=r,{highlightScope:s,singleStyle:a,disableHeader:l,cellPos:h,cellPosContainHeader:c}=t.hover,u=h.col,d=h.row;if(s===i.none||l&&(c.col!==e||c.row!==n)){const t=c.col,i=c.row;o.hideHoverIcon(t,i),o.showHoverIcon(e,n),c.col=e,c.row=n}if((l&&r.isHeader(e,n)||s===i.none)&&(e=-1,n=-1),u===e&&d===n)return;o.deactivateChart(u,d),o.activateChart(e,n);let p=!1;const{ranges:f,highlightScope:g}=t.select;if(-1!==u&&-1!==d&&(p=function(t,e,n,r,o,s,a){let l=!1;s===i.single?l=!!function(t,e,i,n,r){return lj(t,e,i),!0}(t,e,n)||l:s===i.row?l=!!uj(t,0,n)||l:s===i.column?l=!!hj(t,e)||l:s===i.cross&&(l=!!uj(t,0,n)||l,l=!!hj(t,e)||l);return l}(o,u,d,0,0,s),l||o.hideHoverIcon(u,d)),-1===e||-1===n)return h.col=-1,h.row=-1,void(p&&t.table.scenegraph.updateNextFrame());s===i.single?p=!!function(t,e,i,n,r){return lj(t,e,i),!0}(o,e,n)||p:s===i.row?p=!!dj(o,0,n)||p:s===i.column?p=!!cj(o,e)||p:s===i.cross&&(p=!!dj(o,0,n)||p,p=!!cj(o,e)||p),s===i.none||l||o.showHoverIcon(e,n),h.col=e,h.row=n,p&&t.table.scenegraph.updateNextFrame()}function fj(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=gj(t,e,r.col,r.row,i)),!o);s++);else n=i.sortState,n&&(r=i._getHeaderCellBySortState(n)),r&&(o=gj(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.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",R)}(n,i,s),i.scenegraph.sortCell(),i.stateManeger.updateSelectPos(-1,-1),i.fireListeners(yt.SORT_CLICK,n)}function gj(t,e,i,n,r){return r._getLayoutCellId(t,e)===r._getLayoutCellId(i,n)}const yj=it(yt,{PIVOT_SORT_CLICK:"pivot_sort_click",DRILLMENU_CLICK:"drillmenu_click"}),mj=it(yt,{VCHART_EVENT_TYPE:"vchart_event_type"});function bj(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 vj(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}class wj{table;interactionState;select;hover;hoverIcon;residentHoverIcon;columnResize;columnMove;menu;sort;frozen;scroll;tablePosition;drill;sparkLine;_clearVerticalScrollBar;_clearHorizontalScrollBar;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=e.default,this.select={highlightScope:i.single,ranges:[],cellPos:{col:-1,row:-1},selecting:!1},this.hover={highlightScope:i.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 je,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:n}=this.table.options.hover??{highlightMode:"cell"};e?this.hover.highlightScope=i.none:"cross"===t?this.hover.highlightScope=i.cross:"row"===t?this.hover.highlightScope=i.row:"column"===t?this.hover.highlightScope=i.column:"cell"===t&&(this.hover.highlightScope=i.single),this.hover.singleStyle=!e,this.hover.disableHeader=n,(this.hover.highlightScope===i.none||n)&&(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?i.none:i.single,this.select.singleStyle=!t,this.select.disableHeader=e}isSelected(t,e){let i=!1;return this.select.ranges.forEach((n=>{at(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){pj(this,t,e)}updateSelectPos(t,i,n=!1,r=!1,o=!1){-1!==i&&-1!==i&&(this.select.selecting=!0),function(t,i,n,r,o,s){const{table:a,interactionState:l}=t,{scenegraph:h}=a,{highlightScope:c,disableHeader:u,cellPos:d}=t.select;if((u&&a.isHeader(i,n)||"none"===c)&&(i=-1,n=-1),d.col!==i||d.row!==n){if(-1!==i&&-1!==n&&t.select.ranges.length>0)if(l===e.grabing){const e=t.select.ranges[t.select.ranges.length-1];i>e.start.col&&i>e.end.col&&a._makeVisibleCell(i+1,n),n>e.start.row&&n>e.end.row&&a._makeVisibleCell(i,n+1),i<e.start.col&&i<e.end.col&&a._makeVisibleCell(i-1,n),n<e.start.row&&n<e.end.row&&a._makeVisibleCell(i,n-1)}else a._makeVisibleCell(i,n);if(s){t.select.ranges=[],h.deleteAllSelectBorder(),t.select.ranges.push({start:{col:0,row:0},end:{col:a.colCount-1,row:a.rowCount-1}});const e=t.select.ranges[t.select.ranges.length-1];h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else if(-1===d.col||-1===d.row||-1!==i&&-1!==n){if(l===e.default){const e=t.select.ranges[t.select.ranges.length-1];if(r&&e){if(a.isColumnHeader(i,n)){const t=Math.min(e.start.col,e.end.col,i),r=Math.max(e.start.col,e.end.col,i),o=Math.min(e.start.row,e.end.row,n),s=a.rowCount-1;e.start={col:t,row:o},e.end={col:r,row:s}}else if(a.isRowHeader(i,n)){const t=Math.min(e.start.col,e.end.col,i),r=a.colCount-1,o=Math.min(e.start.row,e.end.row,n),s=Math.max(e.start.row,e.end.row,n);e.start={col:t,row:o},e.end={col:r,row:s}}else e.end={col:i,row:n};h.deleteLastSelectedRangeComponents(),h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else{-1===d.col||-1===d.row||o||(t.select.ranges=[],h.deleteAllSelectBorder()),a.isColumnHeader(i,n)?t.select.ranges.push({start:{col:i,row:n},end:{col:i,row:a.rowCount-1}}):a.isRowHeader(i,n)?t.select.ranges.push({start:{col:i,row:n},end:{col:a.colCount-1,row:n}}):t.select.ranges.push({start:{col:i,row:n},end:{col:i,row:n}}),d.col=i,d.row=n;const e=t.select.ranges[t.select.ranges.length-1];h.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}}else if(l===e.grabing){-1===d.col&&(d.col=i),-1===d.row&&(d.row=n);const e=t.select.ranges[t.select.ranges.length-1];e.end={col:i,row:n},d.col=i,d.row=n,h.updateCellSelectBorder(e.start.col,e.start.row,i,n)}}else d.col=-1,d.row=-1,t.select.ranges=[],h.deleteAllSelectBorder();h.updateNextFrame()}}(this,t,i,n,r,o)}checkCellRangeInSelect(t,e){return function(t,e,i,n){for(let n=0;n<i.length;n++)if(ht(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=vj(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(yt.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){this.columnResize.resizing=!0,this.columnResize.col=t,this.columnResize.x=e,this.table.scenegraph.component.showResizeCol(t,i),this.table.stateManeger.updateSelectPos(-1,-1),this.table.scenegraph.updateNextFrame()}updateResizeCol(t,e){t=Math.ceil(t),e=Math.ceil(e);let i=t-this.columnResize.x;if(Math.abs(i)<1)return;let n=this.table.colWidthsMap.get(this.columnResize.col);"number"==typeof n||(n=this.table.getColWidth(this.columnResize.col));let r=n;r+=i;const o=this.table.getMinColWidth(this.columnResize.col),s=this.table.getMaxColWidth(this.columnResize.col);if(r<o||r>s){if(n===o||n===s)return;i=n-o>s-n?s-n:o-n}i=Math.ceil(i),this.table.scenegraph.updateColWidth(this.columnResize.col,i),"adaptive"===this.table.widthMode&&this.columnResize.col<this.table.colCount-1&&this.table.scenegraph.updateColWidth(this.columnResize.col+1,-i),this.columnResize.x=t,this.table.scenegraph.component.updateResizeCol(this.columnResize.col,e),this.columnResize.col<this.table.frozenColCount&&!this.table.isPivotTable()&&!this.table.transpose&&this.table.scenegraph.component.setFrozenColumnShadow(this.table.frozenColCount-1),this.table.scenegraph.updateNextFrame()}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.getCellType(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.getCellType(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(){bj(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(yt.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(yt.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(yt.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(yt.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,PW.contextmenu)),this.table.fireListeners(yt.SHOW_MENU,{x:i,y:n,col:t,row:e,type:"contextmenu"}))}triggerDropDownMenu(t,e,i,n){this.table.fireListeners(yt.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,PW.dropDown),this.menu.bounds=this.table.scenegraph.component.menu.bounds),this.table.fireListeners(yt.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===l.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(yt.DROPDOWN_MENU_CLEAR,null),this.table.fireListeners(yt.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(A(s)&&A(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(d(e)&&(e.menuKey||e.text)===(h||"")&&t===i)return!0;if(f(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(yj.PIVOT_SORT_CLICK,{col:t,row:e,order:i||"normal",dimensionInfo:this.table.internalProps.layoutMap.getPivotDimensionInfo(t,e),cellType:this.table.getCellType(t,e)})}const n=this.sort.col,r=this.sort.row;fj(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.dimensionTitle=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.getCellType(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=aS({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=uS({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),caption:r.getBodyColumnDefine(t,e).caption,cellRange:r.getCellRelativeRect(t,e),sparkline:{pointData:d.pointData},scaleRatio:r.canvas.getBoundingClientRect().width/r.canvas.offsetWidth};r.fireListeners(yt.MOUSEOVER_CHART_SYMBOL,i)}}(t,e,i,0,this.table),this.sparkLine.col=t,this.sparkLine.row=e}}function Cj(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}function xj(t){if(t.stateManeger.endResizeCol(),t.hasListeners(yt.RESIZE_COLUMN_END)){const e=[];for(let i=0;i<t.colCount;i++)e.push(t.getColWidth(i));t.fireListeners(yt.RESIZE_COLUMN_END,{col:t.stateManeger.columnResize.col,columns:e})}}function _j(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&&(e.setScrollLeft(e.scroll.horizontalBarPos+r),e.showHorizontalScrollBar(!0)),o&&(e.setScrollTop(e.scroll.verticalBarPos+o),e.showVerticalScrollBar(!0)),t.cancelable&&(0!==n&&Sj(n,e)||0!==i&&Aj(i,e))&&t.preventDefault()}function Sj(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 Aj(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 Tj(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||!Bj(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;_j({deltaX:n,deltaY:r},i),e.cancelable&&(0!==r&&Sj(r,i)||0!==n&&Aj(n,i))&&e.preventDefault()}),{passive:!1}),window.addEventListener("touchend",(e=>{if(t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&Bj(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),_j({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 Bj(t){return!!t.changedTouches}function Rj(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 Mj{table;isTouchdown;touchMovePoints;touchSetTimeout;touchEnd;touchMove;constructor(t){this.table=t,this.bindOuterEvent(),setTimeout((()=>{this.bindSelfEvent()}),0)}bindOuterEvent(){!function(t){const i=t.table,n=i.stateManeger;document.body.addEventListener("pointermove",(r=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const{x:o,y:s}=i._getMouseAbstractPoint(r,!1);n.interactionState!==e.scrolling&&n.interactionState===e.grabing&&n.isResizeCol()&&(t.dealColumnResize(o,s),i.hasListeners(yt.RESIZE_COLUMN)&&i.fireListeners(yt.RESIZE_COLUMN,{col:i.stateManeger.columnResize.col,colWidth:i.getColWidth(i.stateManeger.columnResize.col)}))})),i.scenegraph.tableGroup.addEventListener("pointermove",(r=>{t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const o=Cj(r);if(n.interactionState!==e.scrolling)if(n.interactionState!==e.grabing){if(n.isResizeCol()||t.checkColumnResize(o)?n.updateCursor("col-resize"):n.updateCursor(),i.hasListeners(yt.MOUSELEAVE_CELL)){const t=o?.eventArgs?.target;"cell"!==t?.role||-1===i.stateManeger.hover.cellPos.col||-1===i.stateManeger.hover.cellPos.row||t.col===i.stateManeger.hover.cellPos.col&&t.row===i.stateManeger.hover.cellPos.row||i.fireListeners(yt.MOUSELEAVE_CELL,{col:i.stateManeger.hover.cellPos.col,row:i.stateManeger.hover.cellPos.row,cellRange:i.getCellRangeRelativeRect({col:i.stateManeger.hover.cellPos.col,row:i.stateManeger.hover.cellPos.row}),scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth,event:r.nativeEvent})}if(i.hasListeners(yt.MOUSEENTER_CELL)){const t=o?.eventArgs?.target;"cell"===t?.role&&kt(t.col)&&kt(t.row)&&(t.col!==i.stateManeger.hover.cellPos.col||t.row!==i.stateManeger.hover.cellPos.row)&&i.fireListeners(yt.MOUSEENTER_CELL,{col:t.col,row:t.row,cellRange:i.getCellRangeRelativeRect({col:t.col,row:t.row}),scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth,event:r.nativeEvent})}if(t.dealIconHover(o),t.dealTableHover(o),o.eventArgs&&i.hasListeners(yt.MOUSEMOVE_CELL)){let t,e;if(o.eventArgs?.target){const i=vj(o.eventArgs?.target);i&&(t=i.icon,e=i.position)}i.fireListeners(yt.MOUSEMOVE_CELL,{col:o.eventArgs.col,row:o.eventArgs.row,x:o.abstractPos.x,y:o.abstractPos.y,event:r.nativeEvent,targetIcon:t?{name:t.name,position:e,funcType:t.attribute.funcType}:void 0})}}else n.isResizeCol()||(n.isMoveCol()?t.dealColumnMover(o):t.dealTableSelect(o))})),i.scenegraph.tableGroup.addEventListener("pointerout",(e=>{const i=Cj(e),n=i?.eventArgs?.target;"table"===n?.role&&t.dealTableHover()})),i.scenegraph.tableGroup.addEventListener("pointerover",(t=>{const e=Cj(t),n=e?.eventArgs?.target;if(i.hasListeners(yt.MOUSEOVER_CHART_SYMBOL)&&"symbol"===n.type){const e=t.composedPath().find((t=>"cell"===t.roll));if(e){const{col:n,row:r}=e,o={col:n,row:r,field:i.getHeaderField(n,r),value:i.getCellValue(n,r),dataValue:i.getCellOriginValue(n,r),cellHeaderPaths:i.internalProps.layoutMap.getCellHeaderPaths(n,r),caption:i.getBodyColumnDefine(n,r).caption,cellRange:i.getCellRelativeRect(n,r),event:t.nativeEvent,sparkline:{pointData:void 0},scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth};i.fireListeners(yt.MOUSEOVER_CHART_SYMBOL,o)}}})),i.scenegraph.tableGroup.addEventListener("pointerleave",(r=>{n.isResizeCol()||(n.updateInteractionState(e.default),n.updateCursor()),t.dealTableHover();const o=r.target;o&&!o.isDescendantsOf(i.scenegraph.tableGroup)&&i.fireListeners(yt.MOUSELEAVE_TABLE,{col:-1,row:-1,event:r.nativeEvent})})),i.scenegraph.tableGroup.addEventListener("pointerupoutside",(r=>{console.log("pointerupoutside"),n.isResizeCol()&&xj(i),n.updateInteractionState(e.default),t.dealTableHover(),t.dealTableSelect()})),i.scenegraph.tableGroup.addEventListener("pointerdown",(r=>{if(0!==r.button)return;const o=Cj(r);if(n.interactionState===e.default){if(i.isPivotChart()&&"chart"!==o?.eventArgs?.target.type&&i.scenegraph.updateChartState(null),n.menu.isShow&&o.eventArgs&&o.eventArgs.target!==n.residentHoverIcon?.icon&&n.hideMenu(),!(o?.eventArgs?.target?.role?.startsWith("icon")?o.eventArgs.target:void 0))if("touch"===r.pointerType)t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.touchMove=!0,(!t.touchEnd&&t.checkColumnResize(o,!0)||!t.touchEnd&&t.chechColumnMover(o)||t.dealTableSelect(o)&&!t.touchEnd)&&n.updateInteractionState(e.grabing)}),500);else{if(t.checkColumnResize(o,!0))return i.scenegraph.updateChartState(null),void n.updateInteractionState(e.grabing);if(t.chechColumnMover(o))return void n.updateInteractionState(e.grabing);t.dealTableSelect(o)&&n.updateInteractionState(e.grabing)}if(i.hasListeners(yt.MOUSEDOWN_CELL)){const t=Cj(r);t.eventArgs&&i.fireListeners(yt.MOUSEDOWN_CELL,{col:t.eventArgs.col,row:t.eventArgs.row,event:r.nativeEvent})}}})),i.scenegraph.tableGroup.addEventListener("pointerup",(t=>{if(0===t.button){if("grabing"===n.interactionState){if(n.updateInteractionState(e.default),n.isResizeCol())xj(i);else if(n.isMoveCol()){i.stateManeger.endMoveCol();const e=Cj(t);e.eventArgs&&i.hasListeners(yt.CHANGE_HEADER_POSITION)&&i.fireListeners(yt.CHANGE_HEADER_POSITION,{target:{col:e.eventArgs.col,row:e.eventArgs.row},source:{col:i.stateManeger.columnMove.colSource,row:i.stateManeger.columnMove.colSource}})}else if(n.isSelecting()){i.stateManeger.endSelectCells();const e=Cj(t);if(e.eventArgs&&i.hasListeners(yt.DRAG_SELECT_END)){const n={event:t.nativeEvent,cells:[],col:e.eventArgs.target.col,row:e.eventArgs.target.row,scaleRatio:i.canvas.getBoundingClientRect().width/i.canvas.offsetWidth};n.cells=i.getSelectedCellInfos(),i.fireListeners(yt.DRAG_SELECT_END,n)}}}else n.interactionState===e.scrolling&&n.updateInteractionState(e.default);if(i.hasListeners(yt.MOUSEUP_CELL)){const e=Cj(t);e.eventArgs&&i.fireListeners(yt.MOUSEUP_CELL,{col:e.eventArgs.col,row:e.eventArgs.row,event:t.nativeEvent})}}})),i.scenegraph.tableGroup.addEventListener("rightdown",(t=>{const e=Cj(t);if(e.eventArgs){n.triggerContextMenu(e.eventArgs.col,e.eventArgs.row,e.abstractPos.x,e.abstractPos.y);const{col:r,row:o}=e.eventArgs;if(i.hasListeners(yt.CONTEXTMENU_CELL)){const n=i.getCellInfo(r,o);let s,a;if(e.eventArgs?.target){const t=vj(e.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,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}(i.stateManeger.select.ranges,r,o)?l.cells=[[n]]:l.cells=i.getSelectedCellInfos(),i.fireListeners(yt.CONTEXTMENU_CELL,l)}}})),i.scenegraph.tableGroup.addEventListener("click",(e=>{if(console.log("click",e.clone()),i.stateManeger.columnResize.resizing||i.stateManeger.columnMove.moving)return;const n=Cj(e);if(t.dealIconClick(e,n),!n?.eventArgs)return;const{col:r,row:o}=n.eventArgs;if(i.hasListeners(yt.CLICK_CELL)){const t=i.getCellInfo(r,o);let s,a;if(n.eventArgs?.target){const t=vj(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...t,event:e.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};i.fireListeners(yt.CLICK_CELL,l)}})),i.scenegraph.stage.addEventListener("click",(r=>{console.log("stage click");const o=r.target;o&&!o.isDescendantsOf(i.scenegraph.tableGroup)&&o!==i.scenegraph.tableGroup&&(console.log("pointerup outside table"),n.updateInteractionState(e.default),t.dealTableHover(),t.dealTableSelect(),n.updateCursor(),i.scenegraph.updateChartState(null))})),i.scenegraph.tableGroup.addEventListener("dblclick",(t=>{const e=Cj(t),n=e.eventArgs.targetCell.globalAABBBounds,{col:r,row:o}=e.eventArgs,s=i.getCellValue(r,o);if(i.internalProps.focusControl.setFocusRect(new xi(n.x1+i.scrollLeft,n.y1+i.scrollTop,n.x2-n.x1,n.y2-n.y1),s),i.hasListeners(yt.DBLCLICK_CELL)){const n=i.getCellInfo(r,o);let s,a;if(e.eventArgs?.target){const t=vj(e.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...n,event:t.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0};i.fireListeners(yt.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=>{_j(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(yt.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(yt.KEYDOWN,t)}})),n.on(e.getElement(),"copy",(t=>{if(e.keyboardOptions?.copySelected){const i=e.getCopyValue();kt(i)&&(t.preventDefault(),ct?window.clipboardData.setData("Text",i):t.clipboardData.setData("text/plain",i))}})),n.on(e.getElement(),"contextmenu",(t=>{t.preventDefault()})),n.on(e.getParentElement(),"resize",(()=>{e.resize()}))}(this),function(t){const i=t.table,n=i.stateManeger,r=i.scenegraph;r.component.vScrollBar.addEventListener("pointerover",(t=>{n.showVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerover",(t=>{n.showHorizontalScrollBar()})),r.component.vScrollBar.addEventListener("pointerout",(t=>{n.interactionState!==e.scrolling&&n.hideVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerout",(t=>{n.interactionState!==e.scrolling&&n.hideHorizontalScrollBar()})),r.component.vScrollBar._slider.addEventListener("pointerdown",(()=>{n.interactionState!==e.scrolling&&n.updateInteractionState(e.scrolling)})),r.component.vScrollBar.addEventListener("pointerup",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.vScrollBar.addEventListener("pointerupoutside",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.hScrollBar._slider.addEventListener("pointerdown",(()=>{n.interactionState!==e.scrolling&&n.updateInteractionState(e.scrolling)})),r.component.hScrollBar.addEventListener("pointerup",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)})),r.component.hScrollBar.addEventListener("pointerupoutside",(()=>{n.interactionState===e.scrolling&&n.updateInteractionState(e.default)}));const o=x(n.updateVerticalScrollBar,20),s=x(n.updateHorizontalScrollBar,20);r.component.vScrollBar.addEventListener("scroll",(t=>{const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);o(e,t)})),r.component.hScrollBar.addEventListener("scroll",(t=>{const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(e)}))}(this),Tj(this)}bindSelfEvent(){const t=this.table.stateManeger;var e;this.table.listen(yt.ICON_CLICK,(e=>{const{col:i,row:n,x:r,y:o,funcType:s,icon:a}=e;var h;s===l.dropDown?t.triggerDropDownMenu(i,n,r,o):s===l.sort?t.triggerSort(i,n,a):s===l.frozen?t.triggerFreeze(i,n,a):s===l.drillDown?(h=this.table).fireListeners(yj.DRILLMENU_CLICK,h.stateManeger.drill):s!==l.collapse&&s!==l.expand||this.table.toggleHierarchyState(i,n)})),this.table.listen(yt.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.listen(yt.SCROLL,(t=>{Xz(this.table)})),e=this.table,"browser"===vt.mode&&e.listen(yt.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.columnType){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(!Pi.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.listen(yt.DBLCLICK_CELL,(t=>{this.table._canResizeColumn(t.col,t.row)&&this.table.scenegraph.updateAutoColWidth(t.col)})),this.table.isPivotTable()&&function(t){t.listen(yt.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.dimensionTitle,r.drillDown,r.drillUp,i,n):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.columnType)):t.internalProps.layoutMap.columnObjects.some((t=>"sparkline"===t.columnType));e&&(t.listen(yt.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.listen(yt.MOUSELEAVE_TABLE,(e=>{t.stateManeger.updateSparklineHoverPose(-1,-1,0,0)})))}(this.table),function(t){t.isPivotChart()&&t.scenegraph.tableGroup.addEventListener("click",(e=>{if("axis-label"===e.target.name){const i=Cj(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(),Jz(t.scenegraph),t.scenegraph.updateNextFrame()}else t._selectedDimensionInChart&&(t._selectedDimensionInChart.length=0,t.internalProps.layoutMap.updateDataStateToChartInstance(),Jz(t.scenegraph),t.scenegraph.updateNextFrame())}))}(this.table),function(t){t.isPivotChart()&&(t.listen(yt.MOUSEENTER_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=Rj(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(yt.MOUSEENTER_AXIS,e)}}))})),t.listen(yt.MOUSELEAVE_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=Rj(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(yt.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),!0}return!1}dealColumnResize(t,e){this.table.stateManeger.updateResizeCol(t,t)}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(at(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(yt.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 b_){const t=n.pickIcon(r.global);if(t)return this.table.fireListeners(yt.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}}let Pj;const Ej=t=>{const e=t.value;return Number(e)>80?"#20a8d8":Number(e)>50?"#4dbd74":Number(e)>20?"#ffc107":"#f86c6b"};class Hj extends O{_showBar;_barColor;_barBgColor;_barPositiveColor;_barNegativeColor;_barAxisColor;_barHeight;_barBottom;_barPadding;_showBarMark;_barMarkPositiveColor;_barMarkNegativeColor;_barMarkWidth;_barMarkPosition;_barRightToLeft;static get DEFAULT(){return Pj||(Pj=new Hj)}constructor(t={},e={}){super(t,e),this._showBar=t.showBar??!0,this._barColor=t.barColor??Ej,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 Hj(this,null)}}const Lj=["type","content","font","color","width","height","marginRight","marginLeft","src","svg","name","path","positionType","tooltip","hover","cursor","shape","interactive"];class kj{expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=tW();this.expandIcon=e[h.expandIconName],this.collapseIcon=e[h.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=tW(),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 F;case"image":case"video":return D;case"chart":case"sparkline":return O;case"progressbar":return Hj}}getCellIconFromRecordValue(t,e,i){if(Array.isArray(t))return t.map((t=>this.getCellIconFromRecordValue(t,e,i)));if(!ut.isObject(t)||"function"==typeof t)return this._table.getFieldData(t,e,i);const n={},r=t;return Lj.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===r.expand?this.expandIcon:i===r.collapse?this.collapseIcon:void 0}}function Ij(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 Oj="vtable__menu-element",Dj=`${Oj}__item`,Fj=`${Oj}__content`,Wj=`${Oj}--hidden`,zj=`${Oj}--shown`,jj=`${Oj}--normal`,Nj=`${Oj}--select`,Gj=`${Oj}__icon`,Kj=`${Oj}__split`,Uj=`${Oj}__title`,Vj=`${Oj}__arrow`,$j=`${Oj}__no-event`,Yj=`${Oj}__item-text`;function Xj(){return Ij("div",[Oj,Wj])}function qj(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(A(o)&&A(a)&&at(s,o,a)&&i===h)return!0}return!1}class Zj{_handler;_rootElement;_secondElement;_menuInstanceInfo;_showChildrenIndex;_mouseEnterSecondElement;constructor(t){this._handler=new xt,this._rootElement=Xj(),this._secondElement=Xj(),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(Wj))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(Wj))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(e=>{if(this._rootElement.classList.contains(Wj))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(Wj),i?.classList.add(zj),i.innerHTML="";const s=this._menuInstanceInfo.content[n]?.children;for(let e=0;e<s.length;e++){const n=s[e],a=Jj(n,!!t.stateManeger.menu.dropDownMenuHighlight&&qj(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(Wj),t?.classList.add(zj)}else!s&&this._secondElement?.classList.contains(zj)&&setTimeout((()=>{if(!0!==this._mouseEnterSecondElement){this._showChildrenIndex=-1;const t=this._secondElement;t?.classList.remove(zj),t?.classList.add(Wj)}}),300)})),this._secondElement?.addEventListener("wheel",(t=>{t.stopPropagation()})),this._secondElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(Wj)||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(Wj))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(qj(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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,cellHeaderPaths:t.isPivotTable()?t.getCellHeaderPaths(i,n):void 0,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()}))}get rootElement(){return this._rootElement}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.dispose(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement,o=this._secondElement;if(this._menuInstanceInfo=n,r?.classList.remove(zj),r?.classList.add(Wj),o?.classList.remove(zj),o?.classList.add(Wj),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&&qj(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(qj(t,t.stateManeger.menu.dropDownMenuHighlight,"object"==typeof r?r?.menuKey||r?.text:r,e,i)){a=!0;break}}const l=Jj(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(zj),r?.classList.remove(Wj),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement,e=this._secondElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(zj),t.classList.add(Wj)),e?.parentElement&&(e.classList.remove(zj),e.classList.add(Wj))}_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 Jj(t,e){const i=Ij("div",[Dj,e?Nj:jj]);if("string"==typeof t){const e=Ij("span",[Fj,$j,Yj]);e.innerHTML=t,i.appendChild(e)}else if("object"==typeof t){const n=t.type??"item";if("split"===n)return i?.classList.add(Kj),i;if(t?.icon?.svg)if(Pi.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=Ij("span",[Gj,$j]);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=Ij("span",[Fj,$j,Yj]);if(r.innerHTML=t.text,i.appendChild(r),"title"===n)i?.classList.add($j,Uj);else if(t?.children?.length){const t=Ij("span",[Fj,$j,Vj]);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 Qj;class tN extends j{static get DEFAULT(){return Qj||(Qj=new tN)}constructor(t={},e={}){super(t,e),this.textAlign=(t.textAlign??e?.textAlign)||"center"}clone(){return new tN(this)}}class eN{normalIcon;upIcon;downIcon;freezeIcon;frozenIcon;frozenCurrentIcon;dropDownAbsoluteIcon;expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=tW();this.freezeIcon=e[h.freezeIconName],this.frozenIcon=e[h.frozenIconName],this.frozenCurrentIcon=e[h.frozenCurrentIconName],this.normalIcon=e[h.normalIconName],this.upIcon=e[h.upwardIconName],this.downIcon=e[h.downwardIconName],this.dropDownAbsoluteIcon=e[h.dropdownIconName],this.expandIcon=e[h.expandIconName],this.collapseIcon=e[h.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&&at(o,i.col,i.row)){({order:r}=e);break}}else{const t=this._table._getHeaderCellBySortState(n);t&&at(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{captionIcon:r,headerIcon:o}=this._table._getHeaderLayoutMap(t,e);r&&i.push(r);const s=this.getHierarchyIcon(t,e);if(s&&i.push(s),o){let n;if("function"==typeof o){n=o({col:t,row:e,value:this._table.getCellValue(t,e),dataValue:this._table.getCellOriginValue(t,e),table:this._table})}else n=o;const r=tW(),s=t=>{let e;e="string"==typeof t?r[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,h=-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 a=s.children[n];if(t.stateManeger.menu?.dropDownMenuHighlight&&qj(t,t.stateManeger.menu?.dropDownMenuHighlight,"object"==typeof a?a?.menuKey:a,e,i)){r=o,h=n;break}}if(t._dropDownMenuIsHighlight(e,i,o)){r=o;break}}if(-1!==r){let e;e=-1!==h?(o||t.globalDropDownMenu)[r].children[h]:(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:a.right,marginRight:0,funcType:l.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:a.right,marginRight:0,funcType:l.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===r.expand)return this.expandIcon;if(i===r.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 G;case"image":case"video":return tN}}}class iN{_table;_tooltipElement;constructor(t){this._table=t}dispose(){this.unbindTooltipElement(),this._tooltipElement&&this._tooltipElement.dispose?.(),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 nN="vtable__bubble-tooltip-element",rN=`${nN}__content`,oN=`${nN}__triangle`,sN=`${nN}--hidden`,aN=`${nN}--shown`;class lN{_handler;_rootElement;_messageElement;_triangleElement;constructor(){this._handler=new xt;const t=this._rootElement=Ij("div",[nN,sN]),e=Ij("span",[rN]),i=Ij("span",[oN]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${rN}`)||void 0,this._triangleElement=t.querySelector(`.${oN}`)||void 0}bindToCell(t,e,i,n,r){const o=this._rootElement,s=this._messageElement,a=this._triangleElement;if(o?.classList.remove(aN),o?.classList.add(sN),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(aN),o?.classList.remove(sN),!0}else this.unbindFromCell();return!1}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler?.dispose?.(),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(aN),o?.classList.remove(sN)):this.unbindFromCell()}unbindFromCell(){const t=this._rootElement;t?.parentElement&&(t.classList.remove(aN),t.classList.add(sN))}_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`,B()&&(a.style.fontSize="11px");const{x1:y,x2:m,y1:b,y2:v}=t.stateManeger.menu.bounds,w=d,C=w+f,x=l,_=w+g;return!(t.stateManeger.menu.isShow&&y<C&&m>w&&v>x&&b<_)}return!1}getComputedPosition(t,e,i,r,o,s,a){const l=this._rootElement,h=t.getCellRangeRelativeRect({col:e,row:i}),{width:c,height:u}=t.internalProps.element.getBoundingClientRect(),{width:d}=h;let p,f;const g=Math.min(.8*c,4*d);l.style.maxWidth=`${g}px`;const y=l.clientWidth,m=l.clientHeight,b=a?6:0;if(r)f=r.x,p=r.y+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(o){let e=o.placement??n.bottom;const i=o.rect.left+o.rect.width/2+t.tableX,r=o.rect.top+o.rect.height/2+t.tableY,a=o.rect.top+t.tableY,l=o.rect.bottom+t.tableY,h=o.rect.left+t.tableX,d=o.rect.right+t.tableX;let g=0;const v=()=>{g++,g>=4||(this.removeStyleFromTriangle(),e===n.top?(f=i-y/2,p=a-m-b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",s&&p<0&&(e=n.right,v())):e===n.bottom?(f=i-y/2,p=l+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",s&&p+m>u&&(e=n.left,v())):e===n.left?(p=r-m/2,f=h-y-b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",s&&f<0&&(e=n.top,v())):e===n.right&&(p=r-m/2,f=d+b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",s&&f+y>c&&(e=n.bottom,v())))};v()}return s&&(f<0?f=0:f+l.offsetWidth>c&&(f=c-l.offsetWidth)),{x:f,y:p}}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 hN extends iN{createTooltipElementInternal(){return new lN}}const cN={"bubble-tooltip":function(t){return new hN(t)}};class uN{_table;_tooltipInstances;_attachInfo;confine;constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}dispose(){const t=this._tooltipInstances;for(const e in t)t[e]?.dispose?.();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||!at(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||!at(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&&at(i.range,t,e)}_bindTableEvent(t){t.listen(yt.MOUSEENTER_CELL,(e=>{if(B())return;const{x1:i,x2:r,y1:o,y2:s}=t.stateManeger.menu.bounds;if(t.stateManeger.menu.isShow&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>i&&e.x<r&&e.y>o&&e.y<s)return;const{col:a,row:l}=e;if((!e.related||!this._isBindCell(a,l))&&t.internalProps.tooltip?.isShowOverflowTextTooltip){const i=t.getCellOverflowText(a,l),r=t.getHeaderDescription(a,l),o=t.getCellRangeRelativeRect({col:a,row:l});let s;i&&(s={content:r?`${r}\n ${i}`:i,referencePosition:{placement:n.bottom,rect:o},style:{arrowMark:!1}}),r&&(s={content:r,referencePosition:{placement:n.bottom,rect:o},style:{arrowMark:!1}}),s&&this._bindToCell(e.col,e.row,s)}})),t.listen(yt.MOUSEMOVE_CELL,(e=>{if(!B()){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.listen(yt.MOUSELEAVE_CELL,(t=>{t.related&&this._isBindCell(t.related.col,t.related.row)||this._unbindFromCell()})),t.listen(yt.SELECTED_CELL,(t=>{this._isBindCell(t.col,t.row)&&this._unbindFromCell()})),t.listen(yt.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]=cN[r](i))}isBinded(t){return JSON.stringify(t)===JSON.stringify(this._attachInfo?.tooltipOptions)}}class dN{_table;_menuElement;constructor(t){this._table=t}dispose(){this.unbindMenuElement(),this._menuElement&&this._menuElement.dispose(),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 pN="vtable__menu-element",fN=`${pN}--hidden`,gN=`${pN}--shown`;class yN{_handler;_rootElement;_menuInstanceInfo;constructor(t){this._handler=new xt,this._rootElement=Ij("div",[pN,fN]),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(fN))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(yt.DROPDOWNMENU_CLICK,{col:i,row:n,field:l,menuKey:o,text:s,highlight:h,cellType:t.getCellType(i,n)}),t.fireListeners(yt.DROPDOWN_MENU_CLEAR,null),t.fireListeners(yt.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(fN)||t.stopPropagation()}))}get rootElement(){return this._rootElement}dispose(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.dispose(),delete this._rootElement}bindToCell(t,e,i,n){const r=this._rootElement;if(this._menuInstanceInfo=n,r?.classList.remove(gN),r?.classList.add(fN),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(gN),r?.classList.remove(fN),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(gN),t.classList.add(fN))}_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 mN extends dN{createMenuElementInternal(){return new Zj(this._table)}}let bN=class extends dN{createMenuElementInternal(){return new yN(this._table)}};const vN={"dropdown-menu":function(t){return new mN(t)},"context-menu":function(t){return new mN(t)},container:t=>new bN(t)};class wN{_table;_menuInstances;_attachInfo;constructor(t){this._table=t,this._menuInstances={},this._bindTableEvent(t)}dispose(){const t=this._menuInstances;for(const e in t)t[e].dispose();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&&at(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.listen(yt.DROPDOWN_ICON_CLICK,(t=>{this._attachInfo&&this._isBindToCell(t.col,t.row)?this._unbindFromCell():this._bindToCell(t.col,t.row,"dropdown-menu")})),t.listen(yt.DROPDOWN_MENU_CLEAR,(t=>{this._unbindFromCell()})),t.listen(yt.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]=vN[i](r)),type:i,info:s}}}class CN extends EventTarget{_table;_input;constructor(t,e){if(super(),this._table=t,"node"===vt.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}dispose(){}}let xN=1;V?xN=1:(xN=Math.ceil(window.devicePixelRatio||1),xN>1&&xN%2!=0&&(xN+=1));const _N={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:!1,visible:!0};function SN(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:y,padding:m,...b}=ne({},_N,t),v=b;return i.visible&&(v.title=function(t){const e={...t};return Yt(t.style)||(e.textStyle=zL(t.style)),Yt(t.textStyle)||ne(e.textStyle,zL(t.textStyle)),t.shape?.style&&zL(e.shape.style),t.background?.style&&zL(e.background.style),e}(i)),Yt(n.focusIconStyle)||zL(n.focusIconStyle),jL(n.shape),jL(n.label),jL(n.value),jL(n.background),GF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),GF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),GF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,Yt(r.textStyle)||zL(r.textStyle),jL(r.handler),v.pager=r,o.visible&&!Yt(o.style)&&(ne(v,o.style),kt(o.padding)&&(v.padding=o.padding)),v}class AN{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=Qt(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 mL(ne({},t,{defaultSelected:this.selectedData}));e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e);let i=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,n=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;const r=this.table.tableNoFrameWidth,o=this.table.tableNoFrameHeight,s=cF(t.padding??this.option.padding??10);let a=0,l=0;"left"===this.orient?(a=s[3],l=0,i+=s[1]+s[3]):"top"===this.orient?(a=0,l=s[0],n+=s[0]+s[2]):"right"===this.orient?(a=r-i-s[1],l=0,i+=s[1]+s[3]):"bottom"===this.orient&&(a=0,l=o-n-s[2],n+=s[0]+s[2]);const h="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",c=this.position;let u=0,d=0;"horizontal"===h?u="middle"===c?(r-i)/2:"end"===c?r-i-s[1]:s[3]:d="middle"===c?(o-n)/2:"end"===c?o-n-s[2]:s[0],this.legendComponent.setAttributes({dx:u,dy:d,x:a,y:l}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(i),this.table.tableX+=Math.ceil(i)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(n),this.table.tableY+=Math.ceil(n)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(i):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(n))}getLegendAttributes(t){return{layout:"bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",items:this.getLegendItems(),maxWidth:t.width,maxHeight:t.height,...SN(this.option,t)}}getLegendItems(){return this.option.data}initEvent(){this.legendComponent&&(this.legendComponent.addEventListener(dL.legendItemClick,(t=>{const e=Xt(t,"detail.currentSelected");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_CLICK,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(dL.legendItemHover,(t=>{const e=Xt(t,"detail");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_HOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(dL.legendItemUnHover,(t=>{const e=Xt(t,"detail");this.table.scenegraph.updateNextFrame(),this.table.fireListeners(yt.LEGEND_ITEM_UNHOVER,{model:this,value:e,event:t})})))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}dispose(){this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}class TN{table;_titleOption;_titleComponent;_cacheAttrs;constructor(t,e){this.table=e,this._titleOption=t,this._titleComponent=this._createOrUpdateTitleComponent(this._getTitleAttrs())}_createOrUpdateTitleComponent(t){if(this._titleComponent)se(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=new WL(t);e.name="title",this.table.scenegraph.stage.defaultLayer.appendChild(e),this._titleComponent=e}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,cF(t.padding??this._titleOption.padding??10));return"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}),this._titleComponent}dispose(){this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent),this._titleComponent=null}_getTitleAttrs(){const t=cF(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:BN}=ft,{isTouchEvent:RN}=pt,MN=/^\$(\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 PN={};class EN extends E{internalProps;showFrozenIcon=!0;showSort=!0;padding;globalDropDownMenu;tableNoFrameWidth;tableNoFrameHeight;tableX;tableY;_widthMode;_heightMode;_autoFillWidth;customRender;canvasWidth;canvasHeight;dataSet;scenegraph;stateManeger;eventManeger;_pixelRatio;bottomFrozenRowCount=0;rightFrozenColCount=0;static get EVENT_TYPE(){return yt}options;version="0.9.3-alpha.4";pagerConf;id=`VTable${Date.now()}`;headerStyleCache;bodyStyleCache;constructor(t={}){super();const{frozenColCount:e=0,defaultRowHeight:i=40,defaultHeaderRowHeight:n,defaultColWidth:r=80,defaultHeaderColWidth:o,widthMode:s="standard",heightMode:a="standard",autoFillWidth:l=!1,keyboardOptions:h,parentElement:c,columnResizeMode:u,dragHeaderMode:d,showFrozenIcon:p,allowFrozenColCount:f,padding:g,hover:y,menu:m,select:b,customRender:v,pixelRatio:w=xN}=t;this.options=t,this._widthMode=s,this._heightMode=a,this._autoFillWidth=l,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 C=this.internalProps={};void 0!==p&&(this.showFrozenIcon=p),"number"==typeof f&&f<=0&&(this.showFrozenIcon=!1),C.handler=new xt,C.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),C.focusControl=new CN(this,C.element),C.pixelRatio=w,C.canvas=document.createElement("canvas"),C.element.appendChild(C.canvas),C.context=C.canvas.getContext("2d"),C.frozenColCount=e,C.defaultRowHeight=i,C.defaultHeaderRowHeight=n??i,C.defaultColWidth=r,C.defaultHeaderColWidth=o??r,C.keyboardOptions=h,C.columnResizeMode=u,C.dragHeaderMode=d,C._rowHeightsMap=new St,C._rowRangeHeightsMap=new Map,C._colRangeWidthsMap=new Map,this.colWidthsMap=new St,this.colContentWidthsMap=new St,this.colWidthsLimit={},C.calcWidthContext={_:C,get full(){return this._.canvas.width/(this._.context.pixelRatio??window.devicePixelRatio)}},C.cellTextOverflows={},C.focusedTable=!1,C.theme=Ui.of(t.theme??Ui.DEFAULT),c?(c.innerHTML="",c.appendChild(C.element),this._updateSize()):this._updateSize(),this.options=t,C.theme=Ui.of(t.theme??Ui.DEFAULT),C.bodyHelper=new kj(this),C.headerHelper=new eN(this),C.autoWrapText=t.autoWrapText,C.allowFrozenColCount=t.allowFrozenColCount??C.colCount,C.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this.dataSet=new xD,this.scenegraph=new oj(this),this.stateManeger=new wj(this),this.eventManeger=new Mj(this),t.legends&&(C.legends=new AN(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(C.title=new TN(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),C.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"===C.tooltip.renderMode&&(C.tooltipHandler=new uN(this,C.tooltip.confine)),C.menu=Object.assign({renderMode:"html"},t.menu),Array.isArray(t.menu?.dropDownMenuHighlight)&&this.setDropDownMenuHighlight(t.menu?.dropDownMenuHighlight),Array.isArray(t.menu?.defaultHeaderMenuItems)&&(this.globalDropDownMenu=t.menu.defaultHeaderMenuItems),"html"===C.menu.renderMode&&(C.menuHandler=new wN(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.invalidate.bind(this),200);getParentElement(){return this.options.parentElement}getElement(){return this.internalProps.element}get canvas(){return this.internalProps.canvas}resize(){this._updateSize(),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 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)}get heightMode(){return this._heightMode}set heightMode(t){t!==this._heightMode&&(this._heightMode=t)}get autoFillWidth(){return this._autoFillWidth}set autoFillWidth(t){t!==this._autoFillWidth&&(this._autoFillWidth=t)}_colWidthDefineToPxWidth(t){return XF(t)?$F(this,this._calculateAutoColWidthExpr()):$F(this,t)}_calculateAutoColWidthExpr(){const t=this.internalProps.calcWidthContext.full;let e=0;const i=[];let n=0;const r=[];for(let o=0;o<this.internalProps.colCount;o++){const s=this.getColWidthDefine(o),a=this._getColWidthLimits(o);if(XF(s))a&&(r.push(a),a.min&&(e+=a.min)),n++;else{let t=s;if(a){const i=$F(this,t),n=YF(a,i);i!==n&&(t=`${n}px`),e+=n}i.push(t)}if(e>t)return"0px"}if(r.length&&i.length){const e=(t-$F(this,`calc(${i.map((t=>"number"==typeof t?`${t}px`:t)).join(" + ")})`))/n;if(r.forEach((t=>{t.min&&e<t.min?(i.push(t.minDef),n--):t.max&&t.max<e&&(i.push(t.maxDef),n--)})),n<=0)return`${e}px`}if(i.length){const t=[];let e=0;return i.forEach((i=>{"number"==typeof i?e+=i:t.push(i)})),t.push(`${e}px`),`calc((100% - (${t.join(" + ")})) / ${n})`}return 100/n+"%"}_getColWidthLimits(t){const e=this.colWidthsLimit[t];if(!e)return null;const i={};return e.min&&(i.min=$F(this,e.min),i.minDef=e.min),e.max&&(i.max=$F(this,e.max),i.maxDef=e.max),i}_adjustColWidth(t,e){const i=this._getColWidthLimits(t);return Math.max(YF(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"===vt.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"===vt.mode&&(e=this.canvasWidth-1,i=this.canvasHeight-1);const n=Math.floor(e-U(this.getTheme().scrollStyle)),r=Math.floor(i-U(this.getTheme().scrollStyle));if(this.internalProps.theme?.frameStyle){const t=BN(this.internalProps.theme.frameStyle?.borderLineWidth??[null]),e=BN(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=this.colWidthsMap.get(e);let r;r=i?"adaptive"===this.widthMode||this.transpose?Number(i):this._adjustColWidth(e,this._colWidthDefineToPxWidth(i)):this.isRowHeader(e,0)||this.isCornerHeader(e,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[e]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth;const o=n+r;return t>=0&&e>=0&&!Number.isNaN(o)&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(o)),Math.round(o)}let r=0;for(let i=t;i<=e;i++)r+=this.isRowHeader(i,0)||this.isCornerHeader(i,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[i]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth;this.colWidthsMap.each(t,e,((t,e)=>{r+=("adaptive"===this.widthMode||this.transpose?Number(t):this._adjustColWidth(e,this._colWidthDefineToPxWidth(t)))-(this.isRowHeader(e,0)||this.isCornerHeader(e,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[e]??this.internalProps.defaultColWidth:this.defaultHeaderColWidth:this.internalProps.defaultColWidth)}));for(let i=t;i<=e;i++){if(this.colWidthsMap.has(i))continue;const t=this._adjustColWidth(i,this.internalProps.defaultColWidth);t!==this.internalProps.defaultColWidth&&(r+=t-this.internalProps.defaultColWidth)}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)}fillRowsHeight(t,e,i){for(let n=t;n<=e;n++)this.rowHeightsMap.put(n,Math.round(i)),this._rowRangeHeightsMap.set(`$0$${n}`,Math.round((this._rowRangeHeightsMap.get("$0$"+(n-1))??0)+i))}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)}getColWidthDefine(t){const e=this.colWidthsMap.get(t);return"number"==typeof e&&e<=0?0:e||(this.isRowHeader(t,0)||this.isCornerHeader(t,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.isRightFrozenColumn(t,this.columnHeaderLevelCount)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[this.rowHeaderLevelCount-this.rightFrozenColCount]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth)}getColWidth(t){const e=this.getColWidthDefine(t);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=MN.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=MN.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=$F(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=$F(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 xi(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 xi(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 xi(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 xi(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))}}invalidate(){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 xi(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)}addDisposable(t){if(!t||!t.dispose||"function"!=typeof t.dispose)throw new Error("not disposable!");(this.internalProps.disposables=this.internalProps.disposables||[]).push(t)}dispose(){const t=this.internalProps;t.tooltipHandler?.dispose?.(),t.menuHandler?.dispose?.(),JF.clearAll(),super.dispose?.(),t.handler?.dispose?.(),t.focusControl?.dispose?.(),t.disposables&&(t.disposables.forEach((t=>t?.dispose?.())),t.disposables=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:y,heightMode:m,autoFillWidth:b,customRender:v}=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=y??"standard",this.heightMode=m??"standard",this.autoFillWidth=b??!1,this.customRender=v;const w=this.internalProps;"node"!==vt.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"}(w.element,this.padding),w.frozenColCount=e,w.defaultRowHeight=i,w.defaultHeaderRowHeight=n??i,w.defaultColWidth=r,w.defaultHeaderColWidth=o??r,w.keyboardOptions=s,w.columnResizeMode=a,w.dragHeaderMode=l,w.cellTextOverflows={},w._rowHeightsMap=new St,w._rowRangeHeightsMap=new Map,w._colRangeWidthsMap=new Map,this.colWidthsMap=new St,this.colContentWidthsMap=new St,this.colWidthsLimit={},w.theme=Ui.of(t.theme??Ui.DEFAULT),w.autoWrapText=t.autoWrapText,w.allowFrozenColCount=t.allowFrozenColCount??w.colCount,w.limitMaxAutoWidth=t.limitMaxAutoWidth??450,this.dataSet=new xD,this.scenegraph.clearCells(),this.stateManeger.initState(),this._updateSize(),this.internalProps.legends?.dispose(),this.internalProps.title?.dispose(),t.legends&&(w.legends=new AN(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),t.title&&(w.title=new TN(t.title,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),w.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"!==w.tooltip.renderMode||w.tooltipHandler||(w.tooltipHandler=new uN(this,w.tooltip.confine)),w.menu=Object.assign({renderMode:"html"},t.menu),"html"!==w.menu.renderMode||w.menuHandler||(w.menuHandler=new wN(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map}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 xi(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=RN(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()}updatePager(t){this.pagerConf&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagerConf.currentPage=t.currentPage),t.perPageCount&&(this.pagerConf.perPageCount=t.perPageCount||this.pagerConf.perPageCount),this.scenegraph.clearCells(),this.dataSource.updatePager(this.pagerConf),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.invalidate())}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(),VF(this,t),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.invalidate()}get autoWrapText(){return this.internalProps.autoWrapText}set autoWrapText(t){this.internalProps.autoWrapText!==t&&(this.internalProps.autoWrapText=t,this.options.autoWrapText=t,this.internalProps.layoutMap&&(this.refreshHeader(),this.invalidate()))}get theme(){return this.internalProps.theme}set theme(t){const e=Ui.of(t);this.internalProps.theme=e||Ui.DEFAULT,this.options.theme=t,this.resize()}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).columnType}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}getCellType(t,e){return this.internalProps.layoutMap.getCellType(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.sortState=e,this.stateManeger.setSortState(this.sortState)),t){if(UF(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??R)}}this.refreshRowColCount()}else UF(this,t);this.scenegraph.createSceneGraph(),this.invalidate(),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),caption:i.caption,columnType:i.columnType?"string"==typeof i.columnType?i.columnType:"progressbar":"text",originData:this.getCellOriginRecord(t,e),cellRange:this.getCellRangeRelativeRect({col:t,row:e}),value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellType:this.getCellType(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 PN;const o=this.internalProps.headerHelper.getStyleClass(r.headerType);if(i.isBottomFrozenRow(t,e)&&this.theme.bottomFrozenStyle)n=K({},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=K({},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=K(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.columnType),a=o?.style;return r=W(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),this.bodyStyleCache.set(n,r),r}clearCellStyleCache(){this.headerStyleCache.clear()}_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=qF(i,this,t,e,nW).theme,{autoWrapText:r,lineClamp:o,textOverflow:s}=i;return{textAlign:n.text.textAlign,textBaseline:n.text.textBaseline,bgColor:Et(n.group.fill)?nW("bgColor",i,t,e,this):n.group.fill,color:Et(n.text.fill)?nW("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:Et(n.group.stroke)?nW("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(A(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(A(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.invalidate()}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 yW.measureText(t,e)}measureTextBounds(t){const e=new bW(t);return{width:e.AABBBounds.width(),height:e.AABBBounds.height()}}getCustomRender(t,e){let i;if("body"!==this.getCellType(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.getCellType(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.columnType||!t.define.imageAutoSizing)))}}var HN=Object.freeze({__proto__:null,BaseTable:EN});function LN(t,e,i){const n=t[e];return t[e]=i,n}function kN(t){for(const e in t)delete t[e]}function IN(){kN(Ri),kN(ZF),kN(Cz)}var ON=Object.freeze({__proto__:null,chartModule:function(t,e){return null!=e?LN(Cz,t,e):Cz[t]},clearAll:IN,icon:function(t,e){return null!=e?LN(ZF,t,e):ZF[t]},theme:function(t,e){return null!=e?LN(Ri,t,e):Ri[t]}});var DN=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}`}}});function FN(t,e,i,n){const r=n.getRawChartSpec(t,e);if(r&&Wt(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 WN(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 zN(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 jN=0;class NN{_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}getCellType(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}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 t,e,i,n=0;return this.columnObjects.forEach(((r,o)=>{"number"==typeof r.width?n=Math.max(r.width,n):"auto"===r.width&&(i=!0),"number"==typeof r.minWidth&&(e=Math.max(r.minWidth,e)),"number"==typeof r.maxWidth&&(t=Math.max(r.maxWidth,t))})),n=n>0?n:i?"auto":void 0,{width:n,minWidth:e,maxWidth:t}}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=jN++,{captionIcon:l}=e,h={id:a,caption:e.caption,captionIcon:l,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]=h;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:jN++,field:i.field,fieldKey:i.fieldKey,fieldFormat:i.fieldFormat,width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth,icon:i.icon,columnType:i.columnType??"text",chartModule:"chartModule"in i?i.chartModule:null,chartSpec:"chartSpec"in i?i.chartSpec:null,sparklineSpec:"sparklineSpec"in i?i.sparklineSpec:Hi,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 zN(t,e,this)}}class GN{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 St;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 St,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?Ei:t.dimensionKey)&&this.dimensionKeys.put(t.level,t.indicatorKey?Ei:t.dimensionKey),t.id||(t.id=++KN));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===r.expand&&t.children?t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)})):t.hierarchyState===r.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=r.expand,t.children.forEach((e=>{e.level=(t.level??0)+1,n+=this.setTreeNode(e,n,t)}))):t.children?(t.hierarchyState=r.collapse,t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,n,t)}))):(t.hierarchyState=r.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 KN=0,UN=0;class VN{_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=Ei;_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 GN(this.columnTree??[]),this.rowDimensionTree=new GN(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=++KN,e=Array(this.colCount-this.rowHeaderLevelCount).fill(t);this._columnHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{id:t}};this.columnHeaderObjs.push(i),this._headerObjects[t]=i}if(UN=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=++KN,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{id:t}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}UN=0,this.indicatorsAsCol=!A(this.rowDimensionKeys.find((t=>t===this.indicatorDimensionKey))),this._rowHeaderCellIds=C(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===UN)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.caption===i.value))),l={id:o,caption:i.value??a.caption,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),A(this._indicators.find((t=>t.indicatorKey===a.indicatorKey)))||this._indicators.push({id:++KN,indicatorKey:a.indicatorKey,field:a.indicatorKey,fieldFormat:a?.format,columnType: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&&(A(this._indicators.find((t=>t.indicatorKey===i.indicatorKey)))||this._indicators.push({id:++KN,indicatorKey:i.indicatorKey,field:i.indicatorKey,columnType:"text",define:Object.assign({},i)})),r[o]=l,this._headerObjects[o]=l,t[e][UN]=o;for(let i=e-1;i>=0;i--)t[i][UN]=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][UN]=o;UN++}})),r}_addHeadersForTreeMode(t,e,i,n,o,s){const a=[];return t[e]||function(e){const i=t[e]=[];if(0===UN)return i;const n=t[e-1];for(let t=0;t<n?.length;t++)i[t]=n[t]}(e),i.forEach((i=>{const l=i.id,h=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.dimensionKey)),c={id:l,caption:i.value,field:i.dimensionKey,style:i.level+1===o||"function"==typeof h?.headerStyle?h?.headerStyle:Object.assign({},h?.headerStyle,{textAlign:"left"}),headerType:h?.headerType??"text",headerIcon:h?.headerIcon,define:Object.assign(i,{linkJump:h?.linkJump,linkDetect:h?.linkDetect,templateLink:h?.templateLink,keepAspectRatio:h?.keepAspectRatio??!1,imageAutoSizing:h?.imageAutoSizing,headerCustomRender:h?.headerCustomRender,headerCustomLayout:h?.headerCustomLayout,dragHeader:h?.dragHeader}),fieldFormat:h?.headerFormat,dropDownMenu:h?.dropDownMenu,pivotInfo:{value:i.value,dimensionKey:i.dimensionKey,isPivotCorner:!1},hierarchyLevel:i.level,dimensionTotalLevel:o,hierarchyState:i.level+1===o?void 0:i.hierarchyState,width:h?.width,minWidth:h?.minWidth,maxWidth:h?.maxWidth};a[l]=c,this._headerObjects[l]=c,t[e][UN]=l;for(let i=e-1;i>=0;i--)t[i][UN]=n[i];if(i.hierarchyState===r.expand&&i.children)s&&UN++,this._addHeadersForTreeMode(t,e,i.children??[],[...n,l],o,s&&i.hierarchyState===r.expand).forEach((t=>a.push(t)));else{s&&UN++;for(let i=e+1;i<t.length;i++)t[i][UN]=l}})),a}_addCornerHeaders(t){const e=[];if(t)t.forEach(((t,i)=>{const n=++KN,r=this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t))??this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)),o={id:n,caption:t===this.indicatorDimensionKey?this.indicatorTitle:r?.dimensionTitle??"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:n,value:t},dropDownMenu:r?.cornerDropDownMenu,pivotInfo:{value:r?.dimensionTitle??"",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=++KN,i={id:t,caption:"",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){}getCellType(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}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:this.getDimension(this.colDimensionKeys[this.colDimensionKeys.length-1],"column")?.multiDimension?1:0:0}get rightFrozenColCount(){return this.showHeader&&this.showColumnHeader?this.indicatorsAsCol||this.hideIndicatorName?this.getDimension(this.rowDimensionKeys[this.rowDimensionKeys.length-1],"row")?.multiDimension?1:0:this.indicatorsDefine.find((t=>t?.multiIndicator))?1:0: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,columnType: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,columnType: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)?.caption??"",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)?.caption??"",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]))),o=this.getHeader(t,e);if(o.define.hierarchyState=o.define.hierarchyState===r.collapse?r.expand:r.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=++KN,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds.unshift(e);const i={id:t,caption:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.dimensionTitle}`:`${e.dimensionTitle}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{field:"",headerType:"text",columnType:"text"}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}return UN=0,this._rowHeaderCellIds=C(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((A(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||A(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((A(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||A(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=v(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths),n=v(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(!A(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value||A(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((!A(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value||A(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 A(n)||A(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 WN(t,e,this)}getChartDataId(t,e){return zN(t,e,this)}}const $N={isEmpty:!0,id:void 0,field:void 0,headerType:void 0,define:void 0};class YN{_headerObjects=[];_headerObjectMap={};_indicatorObjects=[];_columnWidths=[];rowTree;columnTree;rowsDefine;columnsDefine;indicatorsDefine;indicatorKeys;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;_indicatorShowType="column";indicatorsAsCol=!0;hideIndicatorName=!1;indicatorDimensionKey=Ei;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=C(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.dimensionTitle}`:`${e.dimensionTitle}`)),"");this._headerObjectMap[e]={id:e,caption:e,field:t,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,caption:"",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.dimensionTitle}`:`${e.dimensionTitle}`)),"");this._headerObjectMap[e]={id:e,caption:e,field:t,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{}},this._headerObjectMap[t]={id:t,caption:"",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,caption:"",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.caption===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],caption:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.rows[i.length-1],headerType:n?.headerType??"text",columnType:"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],caption:i[i.length-1],style:n?.headerStyle,define:{field:n?.dimensionKey??this.columns[i.length-1],headerType:n?.headerType??"text",columnType:"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,caption:i.caption??e,style:i?.headerStyle,define:{field:this.indicatorDimensionKey,headerType:i?.headerType??"text",columnType:"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,caption:t===this.indicatorDimensionKey?this.indicatorTitle:e?.dimensionTitle??t,style:this.cornerSetting?.headerStyle,define:{field:t,headerType:this.cornerSetting?.headerType??"text",columnType:"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",columnType:e?.columnType??"text"},e),fieldFormat:e?.format,columnType:e?.columnType??"text",chartModule:e&&("chartModule"in e?e.chartModule:null),chartSpec:e&&("chartSpec"in e?e.chartSpec:null),sparklineSpec:"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}getCellType(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}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]??$N}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,columnType: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,columnType: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.caption: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.caption: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(!A(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(!A(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,A(r)||A(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=C(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 function(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(Wt(n)&&(n=n[0]),!n)return;const r=i.dataset.collectedValues[n+"_align"]?i.dataset.collectedValues[n+"_align"]:i.dataset.collectedValues[n],o=i.getRecordIndexByCol(t),s=r[i.getColKeysPath()[o][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]],a=FN(t,e,"top",i);if(!1===a?.visible)return;return ne({},a,{orient:"top",type:"linear",range:s,label:{flush:!0},title:{visible:!1}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];Wt(r)&&(r=r[0]);const o=i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r],s=i.getRecordIndexByCol(t),a=o[i.getColKeysPath()[s][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]];let l=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(l=e)}));const h=FN(t,e,"bottom",i);if(!1===h?.visible)return;return ne({},h,{orient:"bottom",type:"linear",range:a,label:{flush:!0},title:{text:l?.caption,autoRotate:!0}})}if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let n=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)[0];Wt(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=FN(t,e,"left",i);if(!1===l?.visible)return;return ne({},l,{orient:"left",type:"band",data:Array.from(a).reverse(),title:{visible:!1}})}}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const n=i.getIndicatorKeyInChartSpec(t,e);let r=n[0];Wt(r)&&(r=r[0]);const o=i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r],s=i.getRecordIndexByRow(e),a=o[i.getRowKeysPath()[s][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]];let l=null;n.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(l=e)}));const h=FN(t,e,"left",i);if(!1===h?.visible)return;return ne({},h,{orient:"left",type:"linear",range:a,label:{flush:!0},title:{text:l?.caption,autoRotate:!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(Wt(n)&&(n=n[0]),!n)return;const r=i.dataset.collectedValues[n+"_align"]?i.dataset.collectedValues[n+"_align"]:i.dataset.collectedValues[n],o=i.getRecordIndexByRow(e),s=r[i.getRowKeysPath()[o][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]],a=FN(t,e,"right",i);if(!1===a?.visible)return;return ne({},a,{orient:"right",type:"linear",range:s,label:{flush:!0},title:{visible:!1}})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let n=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];Wt(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=FN(t,e,"bottom",i);if(!1===l?.visible)return;return ne({},l,{orient:"bottom",type:"band",data:Array.from(a),title:{visible:!1}})}}}(t,e,this)}getRawChartSpec(t,e){return WN(t,e,this)}getChartSpec(t,e){return function(t,e,i){let n=i.getRawChartSpec(t,e);return n?(n=Qt(n),n.axes=i.getChartAxes(t,e),n.padding=0,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)=>{Wt(r)&&(r=r[0]);const a=(i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r])[i.getColKeysPath()[o][Math.max(0,i.columnHeaderLevelCount-1-i.topAxesCount)]],l=FN(t,e,0===s?"bottom":"top",i);n.push(ne({},l,{type:"linear",orient:0===s?"bottom":"top",label:{visible:!1},title:{visible:!1},range:a,seriesIndex:s,height:-1}))}));let s=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,t)[0];Wt(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=FN(t,e,"left",i);n.push(ne({},u,{type:"band",orient:"left",label:{visible:!1,space:0},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1},width:-1,domain:Array.from(c)}))}else{const r=i.getIndicatorKeyInChartSpec(t,e),o=i.getRecordIndexByRow(e);r.forEach(((r,s)=>{Wt(r)&&(r=r[0]);const a=(i.dataset.collectedValues[r+"_align"]?i.dataset.collectedValues[r+"_align"]:i.dataset.collectedValues[r])[i.getRowKeysPath()[o][Math.max(0,i.rowHeaderLevelCount-1-i.leftAxesCount)]],l=FN(t,e,0===s?"left":"right",i);n.push(ne({},l,{type:"linear",orient:0===s?"left":"right",label:{visible:!1},title:{visible:!1},range:a,seriesIndex:s,width:-1}))}));let s=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];Wt(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=FN(t,e,"bottom",i);n.push(ne({},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,domain:Array.from(c)}))}return n}(t,e,this)}getChartDataId(t,e){return zN(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))}}class XN{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 qN{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 ZN extends qN{type=o.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 JN extends qN{type=o.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 QN extends qN{type=o.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 tG extends qN{type=o.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===o.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 eG extends qN{type=o.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 iG extends qN{type=o.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 nG(t,e){return t&&e?t.toString().localeCompare(e.toString(),"zh"):t?1:-1}function rG(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 oG(t){return 2===t.length&&Gt(t[0])&&Gt(t[1])&&t[1]>=t[0]}function sG(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 aG(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 lG(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 hG(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 cG(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 uG(t,e){const i=[t.min,t.max],n=[e.min,e.max];if(!oG(i)||!oG(n))return;const r=sG(i),o=sG(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(!lG(r,o))return}else if(0===u&&0===d){if(!lG(o,r))return}else if(c||g)if(c&&!g){if(!aG(r,o))return}else if(g&&!c){if(!aG(o,r))return}else{if(a===d)return;if(a>d){if(!hG(r,o))return}else if(!hG(o,r))return}else{if(0===a&&0===u){if(!cG(r,o))return}else if(0===d&&0===s&&!cG(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 dG{dataConfig;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;constructor(t,e,i,n,r,o,s){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=e,this.columns=i,this.indicatorKeys=n,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??{230417170554008:{by:["230417171050031","230417171050028"]}},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(r){this.records=r;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 a="undefined"!=typeof window?window.performance.now():0;this.sortKeys();const l="undefined"!=typeof window?window.performance.now():0;console.log("sortKeys:",l-a);const h="undefined"!=typeof window?window.performance.now():0;this.rowKeysPath=s?this.TreeToArr2(s):this.TreeToArr(this.ArrToTree(this.rowKeys,this.rowsIsTotal,this?.totals?.row?.showGrandTotals,this.rowGrandTotalLabel,this.rowSubTotalLabel)),this.colKeysPath=o?this.TreeToArr2(o):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())}}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(o.RECORD,ZN),this.registerAggregator(o.SUM,JN),this.registerAggregator(o.COUNT,QN),this.registerAggregator(o.MAX,eG),this.registerAggregator(o.MIN,iG),this.registerAggregator(o.AVG,tG)}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[o.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),s=i.join(this.stringJoinChar);0!==n.length&&(this.rowFlatKeys[r]||(this.rowKeys.push(n),this.rowFlatKeys[r]=1)),0!==i.length&&(this.colFlatKeys[s]||(this.colKeys.push(i),this.colFlatKeys[s]=1)),this.tree[r]||(this.tree[r]={}),this.tree[r]?.[s]||(this.tree[r][s]=[]);for(let i=0;i<this.indicatorKeys.length;i++){const n=this.getAggregatorRule(this.indicatorKeys[i]);if(this.tree[r]?.[s]?.[i]||(this.tree[r][s][i]=new this.aggregators[n?.aggregationType??o.SUM](n?.field??this.indicatorKeys[i],n?.formatFun)),e)this.indicatorKeys[i]===e&&this.tree[r]?.[s]?.[i].push(t);else if(n?.field)if("string"==typeof n?.field)A(t[n?.field])&&this.tree[r]?.[s]?.[i].push(t);else{const e=n?.field.find((e=>t[e]));e&&this.tree[r]?.[s]?.[i].push(t)}else A(t[this.indicatorKeys[i]])&&this.tree[r]?.[s]?.[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[o.MAX](this.indicatorKeys[e]),min:new this.aggregators[o.MIN](this.indicatorKeys[e]),total:new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}}this.indicatorStatistics[e].max.push(this.tree[r]?.[s]?.[e].value()),this.indicatorStatistics[e].min.push(this.tree[r]?.[s]?.[e].value()),this.indicatorStatistics[e].total.push(t)}}updateSortRules(t){this.sorted=!1,this.sortRules=t,this.sortKeys(),this.rowKeysPath=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.dataConfig.isPivotChart&&this.dealWithZeroAlign()}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 rG(e(t,[]),e(i,[]))}));break;case"value_z_to_a":this.rowKeys.sort((function(t,i){return-rG(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 rG(e([],t),e([],i))}));break;case"value_z_to_a":this.colKeys.sort((function(t,i){return-rG(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:rG})}return o}.call(this);return function(i,o){let a,l;for(let h=0;h<r.length;h++){if(l=r[h],l.sortRule?.sortByIndicator){let r=i,s=o;l.fieldIndex<t.length-1&&(r=i.slice(0,l.fieldIndex+1),r.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel),s=o.slice(0,l.fieldIndex+1),s.push(e?n.totals?.row?.subTotalLabel:n.totals?.column?.subTotalLabel)),a=l.func(r,s)}else a=l.func(i[l.fieldIndex],o[l.fieldIndex]);if(0!==a)return a*(l.sortRule?.sortType===s.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?rG(o(n,t.query),o(r,t.query)):rG(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:rG(t,e)}}(t.sortBy):t.sortType?nG:t.sortFunc?t.sortFunc:rG}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,s=t.totals?.column?.subTotalsDimensions?.length;r<s;r++){const s=t.totals.column.subTotalsDimensions[r],a=t.columns.indexOf(s);if(a>=0){const r=n.slice(0,a+1);r.push(t.totals?.column?.subTotalLabel??"小计");const s=r.join(this.stringJoinChar);this.tree[e][s]||(this.tree[e][s]=[]);for(let n=0;n<this.indicatorKeys.length;n++){if(!this.tree[e][s][n]){const t=this.getAggregatorRule(this.indicatorKeys[n]);this.tree[e][s][n]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[n],t?.formatFun)}this.tree[e][s][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??o.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((s=>{for(let i=0,a=t.totals?.row?.subTotalsDimensions?.length;i<a;i++){const a=t.totals.row.subTotalsDimensions[i],l=t.rows.indexOf(a);if(l>=0){const i=r.slice(0,l+1);i.push(t.totals?.row?.subTotalLabel??"小计");const a=i.join(this.stringJoinChar);if(this.tree[a]||(this.tree[a]={},e.push(a)),!this.tree[a][s]){this.tree[a][s]=[];for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[a][s][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[a][s][e]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[a][s][e].push(t.tree[n]?.[s]?.[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][s]||(this.tree[i][s]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[i][s][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[i][s][e]=new this.aggregators[t?.aggregationType??o.SUM](t?.field??this.indicatorKeys[e],t?.formatFun)}this.tree[i][s][e].push(t.tree[n]?.[s]?.[e])}}i(n,s)}))})),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];Wt(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"]={};for(const t in n){const o=n[t],s=r[t],a=uG(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]=pG(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}}function pG(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 fG{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 gG={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 yG{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=gG[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 mG extends fG{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 bG=Object.freeze({__proto__:null,Circle:class extends fG{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 fG{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",g(t.width)?this.width=t.width:(this._widthObj=t.width,this.needCalcSize=!0),g(t.height)?this.height=t.height:(this._heightObj=t.height,this.needCalcSize=!0),this.directionKey=gG[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 yG(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 mG({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 mG({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 fG{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=gG[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 fG{type="icon";svg;iconName;cursor;cache;constructor(t){if(super(t),this.iconName=t.iconName,f(this.iconName)){const t=tW()[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 fG{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:mG,Sector:class extends fG{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 fG{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,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=bG,t.DataStatistics=DN,t.ListTable=class extends EN{showHeader=!0;constructor(t={}){super(t);const e=this.internalProps;this.pagerConf=t.pagerConf,e.sortState=t.sortState,e.columns=t.columns?v(t.columns):t.header?v(t.header):[],this.showHeader=t.showHeader??!0,this.transpose=t.transpose??!1,this.refreshHeader(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,e.sortState):this.setRecords([])}isListTable(){return!0}isPivotTable(){return!1}isPivotChart(){return!1}get sortState(){return this.internalProps.sortState}set sortState(t){this.internalProps.sortState=t}get columns(){return this.internalProps.columns}set columns(t){this.internalProps.columns=t,this.options.columns=t,this.refreshHeader(),setTimeout((()=>{this.invalidate()}),0)}get header(){return this.internalProps.columns}set header(t){this.internalProps.columns=t,this.options.header=t,this.refreshHeader(),setTimeout((()=>{this.invalidate()}),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.invalidate()))}getCellValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.pagerConf=t.pagerConf,this.showHeader=t.showHeader??!0,i.columns=t.columns?v(t.columns):t.header?v(t.header):[],this.transpose=t.transpose??!1,this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,t.sortState):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this,e=t.internalProps,i=t.transpose,n=t.showHeader;e.headerEvents&&e.headerEvents.forEach((e=>t.unlisten(e)));const r=e.layoutMap=new NN(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.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))}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(A(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 A(e)&&(r=i.getRecordStartRowByRecordIndex(e)),this.transpose?{start:{row:t.start.row,col:A(r)?r+t.start.col:void 0},end:{row:t.end.row,col:A(r)?r+t.end.col:void 0}}:{start:{col:t.start.col,row:A(r)?r+t.start.row:void 0},end:{col:t.end.col,row:A(r)?r+t.end.row:void 0}}}return null}getHierarchyState(t,e){if(!this.getBodyColumnDefine(t,e).tree)return r.none;const i=this.getRecordIndexByRow(t,e);return this.dataSource.getHierarchyState(i)}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===r.expand?this.fireListeners(yt.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(yt.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.expand,originData:this.getCellOriginRecord(t,e)});const n=this.getRecordIndexByRow(t,e),o=this.dataSource.toggleHierarchyState(n),s=this.internalProps.layoutMap.toggleHierarchyState(o);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(s.removeCellPositions,s.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),cellType:this.getCellType(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){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 e,i,n;if(Array.isArray(this.internalProps.sortState)?({order:e,field:i,fieldKey:n}=this.internalProps.sortState?.[0]):({order:e,field:i,fieldKey:n}=this.internalProps.sortState),i){const t=this._getSortFuncFromHeaderOption(this.internalProps.columns,i,n);let r;r=n?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===n)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===i)),r?.define?.sort&&(this.dataSource.sort(r.field,e,t),this.scenegraph.sortCell())}this.stateManeger.updateSortState(t)}},t.PivotChart=class extends EN{pivotSortState;dataset;_selectedDataItemsInChart=[];_selectedDimensionInChart=[];_chartEventMap={};_axes;constructor(t){if(super(t),t.layout&&Object.assign(t,t.layout),this.setCustomStateNameToSpec(),this.internalProps.dataConfig={isPivotChart:!0},this._axes=Wt(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.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new dG(this.internalProps.dataConfig,e,i,n,t.records,t.columnTree,t.rowTree)}this.refreshHeader(),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return mj}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.dataConfig={},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 dG(this.internalProps.dataConfig,e,i,n,t.records??this.internalProps.records,t.columnTree,t.rowTree)}return this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.unlisten(t))),t.layoutMap=new YN(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 XD({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,gt)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.invalidate()}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(at(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===r.expand?this.fireListeners(mj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(mj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.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),cellType:this.getCellType(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:o.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:o.RECORD})}else{const i=!1===this.options.indicatorsAsCol?e.chartSpec.yField:e.chartSpec.xField;t.push({indicatorKey:e.indicatorKey,field:i??e.indicatorKey,aggregationType:o.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)}}))}_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}listenChart(t,e){this._chartEventMap[t]=e}unlistenChart(t){delete this._chartEventMap[t]}_bindChartEvent(t){if(t)for(const e in this._chartEventMap)t.on(e,this._chartEventMap[e])}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),Jz(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),t.addUpdateBoundTag()}}))}));Qz(t.rowHeaderGroup,t.table),Qz(t.colHeaderGroup,t.table),Qz(t.rightFrozenGroup,t.table),Qz(t.bottomFrozenGroup,t.table)}(this.scenegraph),this.invalidate()}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}),e.updateDataSync(i,n),o=e.convertDatumToPosition(t),this.invalidate()}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&&Wt(e.domain))return e.domain}}},t.PivotTable=class extends EN{pivotSortState;dataset;flatDataToObjects;constructor(t){if(super(t),t.layout&&Object.assign(t,t.layout),this.internalProps.dataConfig=t.dataConfig,this.internalProps.enableDataAnalysis=t.enableDataAnalysis,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)),[]),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.dataset=new dG(this.internalProps.dataConfig,e,i,n,t.records)}this.refreshHeader(),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,this.internalProps.sortState):this.setRecords([])}static get EVENT_TYPE(){return yj}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),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 dG(i.dataConfig,e,n,r,t.records)}return this.refreshHeader(),i.disposables&&(i.disposables.forEach((t=>t?.dispose?.())),i.disposables=null),t.dataSource?VF(this,t.dataSource):t.records?this.setRecords(t.records,void 0):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.invalidate()),this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),new Promise((t=>{setTimeout(t,0)}))}refreshHeader(){const t=this.internalProps;t.headerEvents&&t.headerEvents.forEach((t=>this.unlisten(t)));const e=this.options.records??this.internalProps.records;this.options.enableDataAnalysis?t.layoutMap=new YN(this,this.dataset):(Array.isArray(this.options.columnTree)||Array.isArray(this.options.rowTree))&&(t.layoutMap=new VN(this),e?.[0]?.constructor!==Array&&(this.flatDataToObjects=new XN({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=e?.bottomFrozenRowCount??0,t.rightFrozenColCount=e?.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 XD({dataValue:s,...n.internalProps.layoutMap.getCellHeaderPaths(e,i)},t,gt)}return s}getCellValue(t,e){if(this.internalProps.layoutMap.isHeader(t,e)){const{caption: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{caption: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.invalidate()}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(at(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===r.expand?this.fireListeners(yj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.collapse}):i===r.collapse&&this.fireListeners(yj.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:r.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),cellType:this.getCellType(t,e),isPivotCorner:this.isCornerHeader(t,e)}}},t.TYPES=c,t.clearGlobal=function(){IN()},t.core=HN,t.data=QD,t.getIcons=function(){return tW()},t.register=ON,t.themes=Vi,t.version="0.9.3-alpha.4"}));