@visactor/vchart-extension 2.1.2-alpha.8 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +13655 -2799
- package/build/index.min.js +2 -2
- package/cjs/charts/3d/arc-3d.d.ts +1 -1
- package/cjs/charts/3d/arc-3d.js +5 -4
- package/cjs/charts/3d/arc-3d.js.map +1 -1
- package/cjs/charts/3d/interface.d.ts +3 -1
- package/cjs/charts/3d/interface.js.map +1 -1
- package/cjs/charts/3d/layout.d.ts +5 -4
- package/cjs/charts/3d/layout.js +5 -5
- package/cjs/charts/3d/layout.js.map +1 -1
- package/cjs/charts/3d/plugin.d.ts +3 -2
- package/cjs/charts/3d/plugin.js +4 -4
- package/cjs/charts/3d/plugin.js.map +1 -1
- package/cjs/charts/3d/pyramid-3d.d.ts +1 -1
- package/cjs/charts/3d/pyramid-3d.js +5 -4
- package/cjs/charts/3d/pyramid-3d.js.map +1 -1
- package/cjs/charts/3d/rect-3d.d.ts +2 -2
- package/cjs/charts/3d/rect-3d.js +5 -4
- package/cjs/charts/3d/rect-3d.js.map +1 -1
- package/cjs/charts/axis-3d/index.js +2 -1
- package/cjs/charts/axis-3d/symlog-axis.js +1 -2
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -2
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +1 -1
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -2
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/funnel-3d/series.js +1 -1
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/cjs/charts/pie-3d/animation.js +6 -6
- package/cjs/charts/pie-3d/animation.js.map +1 -1
- package/cjs/charts/pie-3d/chart-spec-transformer.d.ts +2 -2
- package/cjs/charts/pie-3d/chart-spec-transformer.js +2 -2
- package/cjs/charts/pie-3d/chart-spec-transformer.js.map +1 -1
- package/cjs/charts/pie-3d/chart.d.ts +2 -2
- package/cjs/charts/pie-3d/chart.js +4 -4
- package/cjs/charts/pie-3d/chart.js.map +1 -1
- package/cjs/charts/pie-3d/constant.d.ts +2 -1
- package/cjs/charts/pie-3d/constant.js +2 -2
- package/cjs/charts/pie-3d/constant.js.map +1 -1
- package/cjs/charts/pie-3d/interface.d.ts +5 -1
- package/cjs/charts/pie-3d/interface.js.map +1 -1
- package/cjs/charts/pie-3d/series-spec-transformer.d.ts +1 -1
- package/cjs/charts/pie-3d/series-spec-transformer.js +2 -2
- package/cjs/charts/pie-3d/series-spec-transformer.js.map +1 -1
- package/cjs/charts/pie-3d/series.d.ts +3 -2
- package/cjs/charts/pie-3d/series.js +5 -5
- package/cjs/charts/pie-3d/series.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +1 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +2 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +2 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/3d/arc-3d.d.ts +1 -1
- package/esm/charts/3d/arc-3d.js +8 -2
- package/esm/charts/3d/arc-3d.js.map +1 -1
- package/esm/charts/3d/interface.d.ts +3 -1
- package/esm/charts/3d/interface.js.map +1 -1
- package/esm/charts/3d/layout.d.ts +5 -4
- package/esm/charts/3d/layout.js +5 -1
- package/esm/charts/3d/layout.js.map +1 -1
- package/esm/charts/3d/plugin.d.ts +3 -2
- package/esm/charts/3d/plugin.js +4 -2
- package/esm/charts/3d/plugin.js.map +1 -1
- package/esm/charts/3d/pyramid-3d.d.ts +1 -1
- package/esm/charts/3d/pyramid-3d.js +10 -2
- package/esm/charts/3d/pyramid-3d.js.map +1 -1
- package/esm/charts/3d/rect-3d.d.ts +2 -2
- package/esm/charts/3d/rect-3d.js +10 -2
- package/esm/charts/3d/rect-3d.js.map +1 -1
- package/esm/charts/axis-3d/index.js +2 -1
- package/esm/charts/axis-3d/symlog-axis.js +1 -2
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -2
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +1 -1
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -2
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/funnel-3d/series.js +1 -1
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/esm/charts/pie-3d/animation.js +3 -1
- package/esm/charts/pie-3d/animation.js.map +1 -1
- package/esm/charts/pie-3d/chart-spec-transformer.d.ts +2 -2
- package/esm/charts/pie-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/pie-3d/chart-spec-transformer.js.map +1 -1
- package/esm/charts/pie-3d/chart.d.ts +2 -2
- package/esm/charts/pie-3d/chart.js +5 -1
- package/esm/charts/pie-3d/chart.js.map +1 -1
- package/esm/charts/pie-3d/constant.d.ts +2 -1
- package/esm/charts/pie-3d/constant.js +1 -1
- package/esm/charts/pie-3d/constant.js.map +1 -1
- package/esm/charts/pie-3d/interface.d.ts +5 -1
- package/esm/charts/pie-3d/interface.js.map +1 -1
- package/esm/charts/pie-3d/series-spec-transformer.d.ts +1 -1
- package/esm/charts/pie-3d/series-spec-transformer.js +1 -1
- package/esm/charts/pie-3d/series-spec-transformer.js.map +1 -1
- package/esm/charts/pie-3d/series.d.ts +3 -2
- package/esm/charts/pie-3d/series.js +5 -1
- package/esm/charts/pie-3d/series.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +1 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +2 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +2 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +6 -6
package/build/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vchart"),require("@visactor/vrender-core"),require("@visactor/vutils")):"function"==typeof define&&define.amd?define(["exports","@visactor/vchart","@visactor/vrender-core","@visactor/vutils"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChartExtension={},t.VChart,t.VRender,t.VUtils)}(this,(function(t,e,i,s){"use strict";class r extends e.BaseChartSpecTransformer{transformSpec(t){const{timeData:i,timeNodes:s}=function(t){const{xField:i,yField:s,timeField:r,data:a,topN:n=10,icon:o}=t,l=new Set,h=new Map;return a.sort(((t,e)=>Number(e[i])-Number(t[i]))),a.forEach((t=>{const i=t[r];e.isValid(i)&&l.add(i),h.has(i)||h.set(i,[]);const a=h.get(i);if(a.length<n){const e=Object.assign({},t);o&&o[e[s]]&&(e.icon=o[e[s]]),a.push(e)}})),{timeData:h,timeNodes:Array.from(l).sort()}}(t),{interval:r,xField:o,yField:l,color:h,icon:c,iconPosition:d,iconShape:u,timeLabel:p,label:g,nameLabel:m,xAxis:f,yAxis:y}=t,v=r||1e3,b=Math.min(v,500);if(t.type="common",t.data=[{id:"timeData",values:i.get(s[0])},{id:"time",values:[{time:s[0]}]}],t.color={specified:Object.assign({},h)},t.region=[{clip:!0}],t.series=[{type:"bar",id:"ranking-bar",dataId:"timeData",direction:"horizontal",yField:l,xField:o,seriesField:l,extensionMark:[],label:a(g,Object.assign(Object.assign({},m),{yField:l}))}],t.axes=function(t={},e={}){const i={orient:"left",type:"band",inverse:!0,label:{style:e.label},domainLine:{style:e.domainLine},grid:{style:e.grid}},s={orient:"bottom",type:"linear",nice:!1,animation:!0,label:{style:t.label},domainLine:{style:t.domainLine},grid:{style:t.grid},innerOffset:{right:"10%"}};t.label&&(s.label=t.label);return[i,s]}(f,y),t.player={type:"continuous",auto:!0,loop:!1,interval:v,specs:s.map((t=>({data:[{id:"timeData",values:i.get(t)},{id:"time",values:[{time:t}]}]})))},t.tooltip={visible:!1},t.customMark=[],function(t,{interval:e,exchangeDuration:i}){t.animationAppear=!1,t.animationUpdate={bar:[{type:"update",options:{excludeChannels:["y"]},easing:"linear",duration:e},{channel:["y"],easing:"circInOut",duration:i}],axis:{duration:e,easing:"linear"}},t.animationEnter={bar:[{type:"moveIn",duration:i,easing:"cubicInOut",options:{direction:"y",orient:"negative",point:(t,e,i)=>({y:i.groupHeight+e.getBounds().height()})}}]},t.animationExit={bar:[{type:"moveOut",duration:i,easing:"cubicInOut",options:{direction:"y",orient:"negative"}}]}}(t,{interval:v,exchangeDuration:b}),p&&!1===p.visible||t.customMark.push(function(t={}){return{type:"text",dataId:"time",style:Object.assign({textBaseline:"bottom",fontSize:200,textAlign:"end",fontWeight:600,text:t=>t.time,x:(t,e)=>{var i;return(null===(i=e.vchart.getChart().getCanvasRect())||void 0===i?void 0:i.width)-50},y:(t,e)=>{var i;return(null===(i=e.vchart.getChart().getCanvasRect())||void 0===i?void 0:i.height)-80},fill:"grey",fillOpacity:.5},t)}}(p.style)),c){const e=function(t="bar-end",e="circle",{interval:i,exchangeDuration:s}){return{type:"symbol",dataId:"timeData",style:{symbolType:e,stroke:"white",lineWidth:1,size:(t,e)=>{var i,s;const r=e.vchart,a=null===(i=r.getChart())||void 0===i?void 0:i.getSeriesInIndex(0)[0];if(r&&a){const t=null!==(s=a.getYAxisHelper().getBandwidth(0))&&void 0!==s?s:0;return Math.max(t-4,0)}return 10},background:t=>t.icon,x:(e,i)=>{var s,r;const a=i.vchart,n=null===(s=a.getChart())||void 0===s?void 0:s.getSeriesInIndex(0)[0];if(a&&n){const i=null!==(r=n.getYAxisHelper().getBandwidth(0))&&void 0!==r?r:0;return"bar-start"===t?i/2:"axis"===t?-i/2:n.dataToPositionX(e)-i/2}},y:(t,e)=>{var i,s;const r=e.vchart,a=null===(i=r.getChart())||void 0===i?void 0:i.getSeriesInIndex(0)[0];if(r&&a){const e=null!==(s=a.getYAxisHelper().getBandwidth(0))&&void 0!==s?s:0;return a.dataToPositionY(t)+e/2}},scaleY:"rect"===e?1.2:1},animationUpdate:n(i,s),animationEnter:[{type:"moveIn",duration:s,easing:"cubicInOut",options:{direction:"y",orient:"negative",point:(t,e,i)=>({y:i.groupHeight+e.getBounds().height()})}}],animationExit:[{type:"moveOut",duration:s,easing:"cubicInOut",options:{direction:"y",orient:"negative"}}]}}(d,u,{interval:v,exchangeDuration:b});t.series[0].extensionMark.push(e)}super.transformSpec(t)}}function a(t={},e){var i,s,r,a;const n=[];return!1!==t.visible&&n.push({visible:!0,overlap:!1,style:Object.assign({fill:"rgb(64, 64, 64)"},t.style),smartInvert:{fillStrategy:(null===(i=t.style)||void 0===i?void 0:i.fill)?"null":void 0,strokeStrategy:(null===(s=t.style)||void 0===s?void 0:s.stroke)?"null":void 0}}),e.visible&&n.push({visible:!0,overlap:!1,style:Object.assign({},e.style),smartInvert:{fillStrategy:(null===(r=e.style)||void 0===r?void 0:r.fill)?"null":void 0,strokeStrategy:(null===(a=e.style)||void 0===a?void 0:a.stroke)?"null":void 0},position:"bar-end"===e.position?"inside-right":"inside-left",formatter:`{${e.yField}}`}),n}function n(t,e){return[{duration:e,easing:"cubicInOut",channel:["y"]},{options:{excludeChannels:["y"]},channel:["x","x2","x1"],easing:"linear",duration:t}]}class o extends e.BaseChart{constructor(){super(...arguments),this.type="rankingBar",this.transformerConstructor=r}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,timeField:n,data:o}=this._spec;return r&&a&&n?!!o||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField`, `timeField` "),!1)}}o.type="rankingBar",o.view="singleDefault",o.transformerConstructor=r;const l=1e3,h="#21252c",c={labelLayout:"top",bar:{style:{cornerRadius:5}},barBackground:{type:"rect",style:{fill:"rgba(33,37,44,0.1)",cornerRadius:5}},rankingIcon:{visible:!0,style:{fill:h,size:20}},nameLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:h,textBaseline:"middle"}},orderLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:h,textBaseline:"middle"}},valueLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:h,textBaseline:"middle"}},pageSize:5,scrollSize:1,animationAppear:{enable:!0,type:"grow",duration:l,easing:"linear"},animationUpdate:{enable:!0,type:"grow",duration:l,easing:"linear"},animationNormal:{interval:l}},d="dataKey",u="VCHART_ORDER",p="SUPPLY_DATA_KEY";class g extends e.CommonChartSpecTransformer{constructor(){super(...arguments),this.formatMap={},this.paginateDataArr=t=>{const{scrollSize:e=1,pageSize:i=5}=t,s=this.originalData,r={};let a=0;for(let n=0;n<s.length;n+=e)if(a++,r[`page${a}`]=s.slice(n,n+i),n+i-1>=s.length-1){s.push(...Array.from({length:n+i-s.length},(e=>({[t.yField]:100*Math.random(),[t.xField]:null,[p]:!0}))));break}return{orderCount:a,result:r}},this.processRankingData=t=>{const e=[];t.data.forEach(((t,e)=>t[u]=e+1<10?`0${e+1}`:e+1));const i=this.paginateDataArr(t).result,s=this.paginateDataArr(t).orderCount;this.orderCount=s;const r=t.pageSize-i[`page${s}`].length;return i[`page${s}`].push(...Array.from({length:r},(e=>({[t.yField]:100*Math.random(),[t.xField]:null,[p]:!0})))),Object.keys(i).forEach((s=>{e.push({data:[{id:"datas",values:i[s].map((e=>Object.assign(Object.assign({},e),{[d]:e[t.yField]})))},{id:"order",values:[{order:s}]}]})})),e}}isSpecValid(t){const{xField:e,yField:i,data:s}=t;return!!(e&&i&&s&&0!==s.length)}transformSpec(t){var e;super.transformSpec(t),this.isSpecValid(t)?(this.normalizeSpec(t),this.upgradeTextMeasure(t),this.upgradeFormatMap(t),this.processData(t),this.transformBaseSpec(t),this.transformAnimationSpec(t),this.transformAxesSpec(t),t.extensionMark=[this.generateBarBackground(t),...this.generateDecorateHaloIcons(t),this.generateRankingIcon(t),this.generateNameLabel(t),this.generateOrderLabel(t),this.generateValueLabel(t)],this.transformPaddingSpec(t),null===(e=t.customTransformSpec)||void 0===e||e.call(t,t),super.transformSpec(t)):t.series=[]}normalizeSpec(t){(function t(e,i){for(const s in i)"__proto__"!==s&&"constructor"!==s&&"prototype"!==s&&"object"==typeof i[s]&&null!==i[s]?(e.hasOwnProperty(s)||(e[s]=Array.isArray(i[s])?[]:{}),t(e[s],i[s])):e.hasOwnProperty(s)||"object"!=typeof e||(e[s]=i[s]);return e})(t,c),((t,i)=>{i.forEach((i=>{var s,r,a,n,o,l,h;e.isArray(t[i])?null===(s=t[i])||void 0===s||s.forEach(((e,s)=>{var r,a,n;t[i][s]=Object.assign(Object.assign({},e),{style:Object.assign(Object.assign({},null==e?void 0:e.style),{visible:null===(n=null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.visible)&&void 0!==a?a:null==e?void 0:e.visible)||void 0===n||n})})})):t[i]=Object.assign(Object.assign({},t[i]),{style:Object.assign(Object.assign({},null===(r=t[i])||void 0===r?void 0:r.style),{visible:null===(h=null!==(o=null===(n=null===(a=t[i])||void 0===a?void 0:a.style)||void 0===n?void 0:n.visible)&&void 0!==o?o:null===(l=t[i])||void 0===l?void 0:l.visible)||void 0===h||h})})}))})(t,["barBackground","rankingIcon","decorateHaloIcons","orderLabel","nameLabel","valueLabel"])}upgradeTextMeasure(t){var i,s,r,a,n,o,l,h,c;null===(i=this.nameLabelTextMeasure)||void 0===i||i.release(),null===(s=this.valueLabelTextMeasure)||void 0===s||s.release(),null===(r=this.orderLabelTextMeasure)||void 0===r||r.release(),this.nameLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(n=null===(a=t.nameLabel)||void 0===a?void 0:a.style)&&void 0!==n?n:{}}),this.valueLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(l=null===(o=t.valueLabel)||void 0===o?void 0:o.style)&&void 0!==l?l:{}}),this.orderLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(c=null===(h=t.orderLabel)||void 0===h?void 0:h.style)&&void 0!==c?c:{}})}upgradeFormatMap(t){this.formatMap[t.yField]=t.nameLabel.formatMethod,this.formatMap[t.xField]=t.valueLabel.formatMethod,this.formatMap[u]=t.orderLabel.formatMethod}processData(t){var i;(null===(i=t.data[0])||void 0===i?void 0:i.values)||(this.originalData=t.data,this.originalSpec=e.cloneDeep(t),this.dataSpecs=this.processRankingData(t),t.data=this.dataSpecs[0].data)}transformBaseSpec(t){var e,i,s;t.type="common",t.dataKey=d,t.series=[{type:"bar",direction:"horizontal",xField:t.xField,yField:t.yField,barWidth:null!==(i=null===(e=t.bar)||void 0===e?void 0:e.height)&&void 0!==i?i:10,bar:Object.assign(Object.assign({},t.bar),{style:Object.assign(Object.assign({},null===(s=t.bar)||void 0===s?void 0:s.style),{x1:0,visible:e=>{var i,s;return!e[p]&&(null===(s=null===(i=t.bar)||void 0===i?void 0:i.style)||void 0===s||s)}})})}]}transformAnimationSpec(t){var e,i,s;t.animationUpdate.enable&&this.orderCount>1&&(t.player=Object.assign({specs:this.dataSpecs,auto:!0,visible:!1,interval:(null!==(i=null===(e=t.animationNormal)||void 0===e?void 0:e.interval)&&void 0!==i?i:1e3)+(null!==(s=t.animationUpdate.duration)&&void 0!==s?s:1e3)/2,loop:!0},t.player),t.animationExit=this.getAnimationExit(this.originalSpec),t.animationEnter=this.getAnimationEnter(this.originalSpec),t.animationUpdate=this.getAnimationUpdate(this.originalSpec)),t.animationNormal=this.originalSpec.animationNormal,t.animationAppear=this.getAnimationAppear(this.originalSpec,"rect")}transformAxesSpec(t){const{min:e,max:i}=((t,e)=>{let i,s;const r=t.map((t=>t[e])).filter((t=>null!=t));if(0===r.length)i=0,s=1;else{i=Math.min(...r)-(Math.max(...r)-Math.min(...r))/3,s=(Math.max(...r)-i)/.8+i;const t=10,e=i;i===s&&(i=e-t,s=(4*e+t)/4)}return{min:i,max:s}})(this.originalData,t.xField);t.axes=[{orient:"left",type:"band",visible:!1,inverse:!0,paddingOuter:.5},{orient:"bottom",label:{visible:!0},type:"linear",visible:!1,min:e,max:i}]}generateBarBackground(t){var e;return{type:t.barBackground.type,dataId:"data",visible:!0,dataKey:d,zIndex:-99,state:null===(e=t.barBackground)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({x:(e,i)=>"symbol"===t.barBackground.type?i.getRegion().getLayoutRect().width/2:0,y:(e,i)=>i.valueToY([e[t.yField]])+i.yBandwidth()/2-("symbol"===t.barBackground.type?0:t.bar.height/2),size:(e,i)=>[i.getRegion().getLayoutRect().width,t.bar.height],width:(t,e)=>e.getRegion().getLayoutRect().width,height:t.bar.height},t.barBackground.style),{visible:e=>!e[p]&&t.barBackground.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"barBack"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateDecorateHaloIcons(t){var e;return null===(e=t.decorateHaloIcons)||void 0===e?void 0:e.map((e=>({type:"symbol",dataId:"data",visible:!0,dataKey:d,state:null==e?void 0:e.state,style:Object.assign(Object.assign({x:(e,i)=>{if(void 0!==e[t.xField]&&null!==e[t.xField])return i.valueToX([e[t.xField]])},y:(e,i)=>i.valueToY([e[t.yField]])+i.yBandwidth()/2},e.style),{visible:t=>!t[p]&&e.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"symbol"),animationUpdate:this.getAnimationUpdate(this.originalSpec)})))}generateRankingIcon(t){return{type:"symbol",dataId:"data",visible:!0,dataKey:d,state:t.rankingIcon.state,style:Object.assign(Object.assign({x:e=>"bothEnd"===t.labelLayout?-(10+this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).width+(t.orderLabel.style.visible?5+this.orderLabelTextMeasure.fullMeasure(this.formatDatum(u,e)).width:0)+8):5,y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5-Math.max(this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).height,this.orderLabelTextMeasure.fullMeasure(this.formatDatum(u,e)).height)/2},t.rankingIcon.style),{lineWidth:0,stroke:null,visible:e=>!e[p]&&t.rankingIcon.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateNameLabel(t){var e;return{type:"text",dataId:"data",dataKey:d,state:null===(e=t.nameLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:e=>this.formatDatum(t.yField,e),x:()=>{var e;return"bothEnd"===t.labelLayout?-10:(t.rankingIcon.style.visible?8+(null!==(e=t.rankingIcon.style.size)&&void 0!==e?e:10):0)+(t.orderLabel.style.visible?5+this.getMaxDataLabelLens(t,u,this.orderLabelTextMeasure):0)},y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.nameLabel.style),{textAlign:"bothEnd"===t.labelLayout?"right":"left",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[p]&&t.nameLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateOrderLabel(t){var e;return{type:"text",dataId:"data",dataKey:d,state:null===(e=t.orderLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:t=>this.formatDatum(u,t),x:e=>{var i;return"bothEnd"===t.labelLayout?-(10+this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).width+5):t.rankingIcon.style.visible?8+(null!==(i=t.rankingIcon.style.size)&&void 0!==i?i:10):0},y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.orderLabel.style),{textAlign:"bothEnd"===t.labelLayout?"right":"left",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[p]&&t.orderLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateValueLabel(t){var e;return{type:"text",dataId:"data",visible:!0,dataKey:d,state:null===(e=t.valueLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:e=>this.formatDatum(t.xField,e),x:(e,i)=>"bothEnd"===t.labelLayout?i.getRegion().getLayoutRect().width+5:i.getRegion().getLayoutRect().width,y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.valueLabel.style),{textAlign:"bothEnd"===t.labelLayout?"left":"right",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[p]&&t.valueLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}transformPaddingSpec(t){var e;const i=t.decorateHaloIcons.length>0?Math.max(...t.decorateHaloIcons.map((t=>{var e,i;return null!==(i=null===(e=t.style)||void 0===e?void 0:e.size)&&void 0!==i?i:18}))):0;t.padding=Object.assign({left:"bothEnd"===t.labelLayout?10+this.getMaxDataLabelLens(t,t.yField,this.nameLabelTextMeasure)+(t.orderLabel.style.visible?5+this.getMaxDataLabelLens(t,u,this.orderLabelTextMeasure):0)+(t.rankingIcon.style.visible?8+(null!==(e=t.rankingIcon.style.size)&&void 0!==e?e:10):0)+5:5+i/2,right:"bothEnd"===t.labelLayout?5+this.getMaxDataLabelLens(t,t.xField,this.valueLabelTextMeasure)+5:15,top:0,bottom:0},t.padding)}getMaxDataLabelLens(t,e,i){const s=this.originalData.map((t=>t[p]?0:i.fullMeasure(this.formatDatum(e,t)).width));return Math.max(...s)}formatDatum(t,e){var i;return(null===(i=this.formatMap)||void 0===i?void 0:i[t])?this.formatMap[t](e[t],e):e[t]}getLabelWidth(t,e){return e+t}getAnimationExit(t){var e,i,s,r,a;return!1!==(null===(e=t.animationUpdate)||void 0===e?void 0:e.enable)&&{type:"moveOut",options:{direction:"y",orient:"negative",excludeChannels:["x"],point:(e,i)=>({y:i.getGraphicAttribute("y")-t.height/(t.pageSize+1)*Math.min(t.scrollSize,t.pageSize)})},duration:null!==(s=null===(i=t.animationUpdate)||void 0===i?void 0:i.duration)&&void 0!==s?s:1e3,easing:null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r.easing)&&void 0!==a?a:"linear"}}getAnimationEnter(t){var e,i,s,r,a;return!1!==(null===(e=t.animationUpdate)||void 0===e?void 0:e.enable)&&{type:"moveIn",options:{direction:"y",orient:"negative",excludeChannels:["x"],point:(e,i)=>({y:i.getGraphicAttribute("y")+t.height/(t.pageSize+1)*Math.min(t.scrollSize,t.pageSize)})},duration:null!==(s=null===(i=t.animationUpdate)||void 0===i?void 0:i.duration)&&void 0!==s?s:1e3,easing:null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r.easing)&&void 0!==a?a:"linear"}}getAnimationAppear(t,e){var i,s,r,a,n,o,l,h,c,d,u,p,g;return!1!==(null===(i=t.animationAppear)||void 0===i?void 0:i.enable)&&("rect"===e?{type:"growWidthIn",oneByOne:!1,duration:null!==(r=null===(s=t.animationAppear)||void 0===s?void 0:s.duration)&&void 0!==r?r:1e3,easing:null!==(n=null===(a=t.animationAppear)||void 0===a?void 0:a.easing)&&void 0!==n?n:"linear",options:{}}:"symbol"===e?{channel:{x:{from:0,to:(t,e)=>e.getGraphicAttribute("x")}},duration:null!==(l=null===(o=t.animationAppear)||void 0===o?void 0:o.duration)&&void 0!==l?l:1e3,easing:null!==(c=null===(h=t.animationAppear)||void 0===h?void 0:h.easing)&&void 0!==c?c:"linear"}:{channel:{opacity:{from:0,to:1}},duration:null!==(u=null===(d=t.animationAppear)||void 0===d?void 0:d.duration)&&void 0!==u?u:1e3,easing:null!==(g=null===(p=t.animationAppear)||void 0===p?void 0:p.easing)&&void 0!==g?g:"linear"})}getAnimationUpdate(t){var e,i,s,r;return!1!==t.animationUpdate.enable&&{duration:null!==(i=null===(e=t.animationUpdate)||void 0===e?void 0:e.duration)&&void 0!==i?i:1e3,easing:null!==(r=null===(s=t.animationUpdate)||void 0===s?void 0:s.easing)&&void 0!==r?r:"linear"}}}class m extends e.BaseChart{constructor(){super(...arguments),this.type="rankingList",this.transformerConstructor=g}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}m.type="rankingList",m.view="singleDefault",m.transformerConstructor=g;
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vchart"),require("@visactor/vrender-core"),require("@visactor/vdataset"),require("@visactor/vutils")):"function"==typeof define&&define.amd?define(["exports","@visactor/vchart","@visactor/vrender-core","@visactor/vdataset","@visactor/vutils"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChartExtension={},t.VChart,t.VRender,t.VDataset,t.VUtils)}(this,(function(t,e,i,s,r){"use strict";class a extends e.BaseChartSpecTransformer{transformSpec(t){const{timeData:i,timeNodes:s}=function(t){const{xField:i,yField:s,timeField:r,data:a,topN:n=10,icon:o}=t,l=new Set,h=new Map;return a.sort(((t,e)=>Number(e[i])-Number(t[i]))),a.forEach((t=>{const i=t[r];e.isValid(i)&&l.add(i),h.has(i)||h.set(i,[]);const a=h.get(i);if(a.length<n){const e=Object.assign({},t);o&&o[e[s]]&&(e.icon=o[e[s]]),a.push(e)}})),{timeData:h,timeNodes:Array.from(l).sort()}}(t),{interval:r,xField:a,yField:l,color:h,icon:c,iconPosition:d,iconShape:u,timeLabel:p,label:g,nameLabel:m,xAxis:f,yAxis:v}=t,y=r||1e3,_=Math.min(y,500);if(t.type="common",t.data=[{id:"timeData",values:i.get(s[0])},{id:"time",values:[{time:s[0]}]}],t.color={specified:Object.assign({},h)},t.region=[{clip:!0}],t.series=[{type:"bar",id:"ranking-bar",dataId:"timeData",direction:"horizontal",yField:l,xField:a,seriesField:l,extensionMark:[],label:n(g,Object.assign(Object.assign({},m),{yField:l}))}],t.axes=function(t={},e={}){const i={orient:"left",type:"band",inverse:!0,label:{style:e.label},domainLine:{style:e.domainLine},grid:{style:e.grid}},s={orient:"bottom",type:"linear",nice:!1,animation:!0,label:{style:t.label},domainLine:{style:t.domainLine},grid:{style:t.grid},innerOffset:{right:"10%"}};t.label&&(s.label=t.label);return[i,s]}(f,v),t.player={type:"continuous",auto:!0,loop:!1,interval:y,specs:s.map((t=>({data:[{id:"timeData",values:i.get(t)},{id:"time",values:[{time:t}]}]})))},t.tooltip={visible:!1},t.customMark=[],function(t,{interval:e,exchangeDuration:i}){t.animationAppear=!1,t.animationUpdate={bar:[{type:"update",options:{excludeChannels:["y"]},easing:"linear",duration:e},{channel:["y"],easing:"circInOut",duration:i}],axis:{duration:e,easing:"linear"}},t.animationEnter={bar:[{type:"moveIn",duration:i,easing:"cubicInOut",options:{direction:"y",orient:"negative",point:(t,e,i)=>({y:i.groupHeight+e.getBounds().height()})}}]},t.animationExit={bar:[{type:"moveOut",duration:i,easing:"cubicInOut",options:{direction:"y",orient:"negative"}}]}}(t,{interval:y,exchangeDuration:_}),p&&!1===p.visible||t.customMark.push(function(t={}){return{type:"text",dataId:"time",style:Object.assign({textBaseline:"bottom",fontSize:200,textAlign:"end",fontWeight:600,text:t=>t.time,x:(t,e)=>{var i;return(null===(i=e.vchart.getChart().getCanvasRect())||void 0===i?void 0:i.width)-50},y:(t,e)=>{var i;return(null===(i=e.vchart.getChart().getCanvasRect())||void 0===i?void 0:i.height)-80},fill:"grey",fillOpacity:.5},t)}}(p.style)),c){const e=function(t="bar-end",e="circle",{interval:i,exchangeDuration:s}){return{type:"symbol",dataId:"timeData",style:{symbolType:e,stroke:"white",lineWidth:1,size:(t,e)=>{var i,s;const r=e.vchart,a=null===(i=r.getChart())||void 0===i?void 0:i.getSeriesInIndex(0)[0];if(r&&a){const t=null!==(s=a.getYAxisHelper().getBandwidth(0))&&void 0!==s?s:0;return Math.max(t-4,0)}return 10},background:t=>t.icon,x:(e,i)=>{var s,r;const a=i.vchart,n=null===(s=a.getChart())||void 0===s?void 0:s.getSeriesInIndex(0)[0];if(a&&n){const i=null!==(r=n.getYAxisHelper().getBandwidth(0))&&void 0!==r?r:0;return"bar-start"===t?i/2:"axis"===t?-i/2:n.dataToPositionX(e)-i/2}},y:(t,e)=>{var i,s;const r=e.vchart,a=null===(i=r.getChart())||void 0===i?void 0:i.getSeriesInIndex(0)[0];if(r&&a){const e=null!==(s=a.getYAxisHelper().getBandwidth(0))&&void 0!==s?s:0;return a.dataToPositionY(t)+e/2}},scaleY:"rect"===e?1.2:1},animationUpdate:o(i,s),animationEnter:[{type:"moveIn",duration:s,easing:"cubicInOut",options:{direction:"y",orient:"negative",point:(t,e,i)=>({y:i.groupHeight+e.getBounds().height()})}}],animationExit:[{type:"moveOut",duration:s,easing:"cubicInOut",options:{direction:"y",orient:"negative"}}]}}(d,u,{interval:y,exchangeDuration:_});t.series[0].extensionMark.push(e)}super.transformSpec(t)}}function n(t={},e){var i,s,r,a;const n=[];return!1!==t.visible&&n.push({visible:!0,overlap:!1,style:Object.assign({fill:"rgb(64, 64, 64)"},t.style),smartInvert:{fillStrategy:(null===(i=t.style)||void 0===i?void 0:i.fill)?"null":void 0,strokeStrategy:(null===(s=t.style)||void 0===s?void 0:s.stroke)?"null":void 0}}),e.visible&&n.push({visible:!0,overlap:!1,style:Object.assign({},e.style),smartInvert:{fillStrategy:(null===(r=e.style)||void 0===r?void 0:r.fill)?"null":void 0,strokeStrategy:(null===(a=e.style)||void 0===a?void 0:a.stroke)?"null":void 0},position:"bar-end"===e.position?"inside-right":"inside-left",formatter:`{${e.yField}}`}),n}function o(t,e){return[{duration:e,easing:"cubicInOut",channel:["y"]},{options:{excludeChannels:["y"]},channel:["x","x2","x1"],easing:"linear",duration:t}]}class l extends e.BaseChart{constructor(){super(...arguments),this.type="rankingBar",this.transformerConstructor=a}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,timeField:n,data:o}=this._spec;return r&&a&&n?!!o||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField`, `timeField` "),!1)}}l.type="rankingBar",l.view="singleDefault",l.transformerConstructor=a;const h=1e3,c="#21252c",d={labelLayout:"top",bar:{style:{cornerRadius:5}},barBackground:{type:"rect",style:{fill:"rgba(33,37,44,0.1)",cornerRadius:5}},rankingIcon:{visible:!0,style:{fill:c,size:20}},nameLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:c,textBaseline:"middle"}},orderLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:c,textBaseline:"middle"}},valueLabel:{visible:!0,style:{fontSize:20,fontWeight:"normal",fill:c,textBaseline:"middle"}},pageSize:5,scrollSize:1,animationAppear:{enable:!0,type:"grow",duration:h,easing:"linear"},animationUpdate:{enable:!0,type:"grow",duration:h,easing:"linear"},animationNormal:{interval:h}},u="dataKey",p="VCHART_ORDER",g="SUPPLY_DATA_KEY";class m extends e.CommonChartSpecTransformer{constructor(){super(...arguments),this.formatMap={},this.paginateDataArr=t=>{const{scrollSize:e=1,pageSize:i=5}=t,s=this.originalData,r={};let a=0;for(let n=0;n<s.length;n+=e)if(a++,r[`page${a}`]=s.slice(n,n+i),n+i-1>=s.length-1){s.push(...Array.from({length:n+i-s.length},(e=>({[t.yField]:100*Math.random(),[t.xField]:null,[g]:!0}))));break}return{orderCount:a,result:r}},this.processRankingData=t=>{const e=[];t.data.forEach(((t,e)=>t[p]=e+1<10?`0${e+1}`:e+1));const i=this.paginateDataArr(t).result,s=this.paginateDataArr(t).orderCount;this.orderCount=s;const r=t.pageSize-i[`page${s}`].length;return i[`page${s}`].push(...Array.from({length:r},(e=>({[t.yField]:100*Math.random(),[t.xField]:null,[g]:!0})))),Object.keys(i).forEach((s=>{e.push({data:[{id:"datas",values:i[s].map((e=>Object.assign(Object.assign({},e),{[u]:e[t.yField]})))},{id:"order",values:[{order:s}]}]})})),e}}isSpecValid(t){const{xField:e,yField:i,data:s}=t;return!!(e&&i&&s&&0!==s.length)}transformSpec(t){var e;super.transformSpec(t),this.isSpecValid(t)?(this.normalizeSpec(t),this.upgradeTextMeasure(t),this.upgradeFormatMap(t),this.processData(t),this.transformBaseSpec(t),this.transformAnimationSpec(t),this.transformAxesSpec(t),t.extensionMark=[this.generateBarBackground(t),...this.generateDecorateHaloIcons(t),this.generateRankingIcon(t),this.generateNameLabel(t),this.generateOrderLabel(t),this.generateValueLabel(t)],this.transformPaddingSpec(t),null===(e=t.customTransformSpec)||void 0===e||e.call(t,t),super.transformSpec(t)):t.series=[]}normalizeSpec(t){(function t(e,i){for(const s in i)"__proto__"!==s&&"constructor"!==s&&"prototype"!==s&&"object"==typeof i[s]&&null!==i[s]?(e.hasOwnProperty(s)||(e[s]=Array.isArray(i[s])?[]:{}),t(e[s],i[s])):e.hasOwnProperty(s)||"object"!=typeof e||(e[s]=i[s]);return e})(t,d),((t,i)=>{i.forEach((i=>{var s,r,a,n,o,l,h;e.isArray(t[i])?null===(s=t[i])||void 0===s||s.forEach(((e,s)=>{var r,a,n;t[i][s]=Object.assign(Object.assign({},e),{style:Object.assign(Object.assign({},null==e?void 0:e.style),{visible:null===(n=null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.visible)&&void 0!==a?a:null==e?void 0:e.visible)||void 0===n||n})})})):t[i]=Object.assign(Object.assign({},t[i]),{style:Object.assign(Object.assign({},null===(r=t[i])||void 0===r?void 0:r.style),{visible:null===(h=null!==(o=null===(n=null===(a=t[i])||void 0===a?void 0:a.style)||void 0===n?void 0:n.visible)&&void 0!==o?o:null===(l=t[i])||void 0===l?void 0:l.visible)||void 0===h||h})})}))})(t,["barBackground","rankingIcon","decorateHaloIcons","orderLabel","nameLabel","valueLabel"])}upgradeTextMeasure(t){var i,s,r,a,n,o,l,h,c;null===(i=this.nameLabelTextMeasure)||void 0===i||i.release(),null===(s=this.valueLabelTextMeasure)||void 0===s||s.release(),null===(r=this.orderLabelTextMeasure)||void 0===r||r.release(),this.nameLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(n=null===(a=t.nameLabel)||void 0===a?void 0:a.style)&&void 0!==n?n:{}}),this.valueLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(l=null===(o=t.valueLabel)||void 0===o?void 0:o.style)&&void 0!==l?l:{}}),this.orderLabelTextMeasure=new e.TextMeasure({defaultFontParams:null!==(c=null===(h=t.orderLabel)||void 0===h?void 0:h.style)&&void 0!==c?c:{}})}upgradeFormatMap(t){this.formatMap[t.yField]=t.nameLabel.formatMethod,this.formatMap[t.xField]=t.valueLabel.formatMethod,this.formatMap[p]=t.orderLabel.formatMethod}processData(t){var i;(null===(i=t.data[0])||void 0===i?void 0:i.values)||(this.originalData=t.data,this.originalSpec=e.cloneDeep(t),this.dataSpecs=this.processRankingData(t),t.data=this.dataSpecs[0].data)}transformBaseSpec(t){var e,i,s;t.type="common",t.dataKey=u,t.series=[{type:"bar",direction:"horizontal",xField:t.xField,yField:t.yField,barWidth:null!==(i=null===(e=t.bar)||void 0===e?void 0:e.height)&&void 0!==i?i:10,bar:Object.assign(Object.assign({},t.bar),{style:Object.assign(Object.assign({},null===(s=t.bar)||void 0===s?void 0:s.style),{x1:0,visible:e=>{var i,s;return!e[g]&&(null===(s=null===(i=t.bar)||void 0===i?void 0:i.style)||void 0===s||s)}})})}]}transformAnimationSpec(t){var e,i,s;t.animationUpdate.enable&&this.orderCount>1&&(t.player=Object.assign({specs:this.dataSpecs,auto:!0,visible:!1,interval:(null!==(i=null===(e=t.animationNormal)||void 0===e?void 0:e.interval)&&void 0!==i?i:1e3)+(null!==(s=t.animationUpdate.duration)&&void 0!==s?s:1e3)/2,loop:!0},t.player),t.animationExit=this.getAnimationExit(this.originalSpec),t.animationEnter=this.getAnimationEnter(this.originalSpec),t.animationUpdate=this.getAnimationUpdate(this.originalSpec)),t.animationNormal=this.originalSpec.animationNormal,t.animationAppear=this.getAnimationAppear(this.originalSpec,"rect")}transformAxesSpec(t){const{min:e,max:i}=((t,e)=>{let i,s;const r=t.map((t=>t[e])).filter((t=>null!=t));if(0===r.length)i=0,s=1;else{i=Math.min(...r)-(Math.max(...r)-Math.min(...r))/3,s=(Math.max(...r)-i)/.8+i;const t=10,e=i;i===s&&(i=e-t,s=(4*e+t)/4)}return{min:i,max:s}})(this.originalData,t.xField);t.axes=[{orient:"left",type:"band",visible:!1,inverse:!0,paddingOuter:.5},{orient:"bottom",label:{visible:!0},type:"linear",visible:!1,min:e,max:i}]}generateBarBackground(t){var e;return{type:t.barBackground.type,dataId:"data",visible:!0,dataKey:u,zIndex:-99,state:null===(e=t.barBackground)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({x:(e,i)=>"symbol"===t.barBackground.type?i.getRegion().getLayoutRect().width/2:0,y:(e,i)=>i.valueToY([e[t.yField]])+i.yBandwidth()/2-("symbol"===t.barBackground.type?0:t.bar.height/2),size:(e,i)=>[i.getRegion().getLayoutRect().width,t.bar.height],width:(t,e)=>e.getRegion().getLayoutRect().width,height:t.bar.height},t.barBackground.style),{visible:e=>!e[g]&&t.barBackground.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"barBack"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateDecorateHaloIcons(t){var e;return null===(e=t.decorateHaloIcons)||void 0===e?void 0:e.map((e=>({type:"symbol",dataId:"data",visible:!0,dataKey:u,state:null==e?void 0:e.state,style:Object.assign(Object.assign({x:(e,i)=>{if(void 0!==e[t.xField]&&null!==e[t.xField])return i.valueToX([e[t.xField]])},y:(e,i)=>i.valueToY([e[t.yField]])+i.yBandwidth()/2},e.style),{visible:t=>!t[g]&&e.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"symbol"),animationUpdate:this.getAnimationUpdate(this.originalSpec)})))}generateRankingIcon(t){return{type:"symbol",dataId:"data",visible:!0,dataKey:u,state:t.rankingIcon.state,style:Object.assign(Object.assign({x:e=>"bothEnd"===t.labelLayout?-(10+this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).width+(t.orderLabel.style.visible?5+this.orderLabelTextMeasure.fullMeasure(this.formatDatum(p,e)).width:0)+8):5,y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5-Math.max(this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).height,this.orderLabelTextMeasure.fullMeasure(this.formatDatum(p,e)).height)/2},t.rankingIcon.style),{lineWidth:0,stroke:null,visible:e=>!e[g]&&t.rankingIcon.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateNameLabel(t){var e;return{type:"text",dataId:"data",dataKey:u,state:null===(e=t.nameLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:e=>this.formatDatum(t.yField,e),x:()=>{var e;return"bothEnd"===t.labelLayout?-10:(t.rankingIcon.style.visible?8+(null!==(e=t.rankingIcon.style.size)&&void 0!==e?e:10):0)+(t.orderLabel.style.visible?5+this.getMaxDataLabelLens(t,p,this.orderLabelTextMeasure):0)},y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.nameLabel.style),{textAlign:"bothEnd"===t.labelLayout?"right":"left",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[g]&&t.nameLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateOrderLabel(t){var e;return{type:"text",dataId:"data",dataKey:u,state:null===(e=t.orderLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:t=>this.formatDatum(p,t),x:e=>{var i;return"bothEnd"===t.labelLayout?-(10+this.nameLabelTextMeasure.fullMeasure(this.formatDatum(t.yField,e)).width+5):t.rankingIcon.style.visible?8+(null!==(i=t.rankingIcon.style.size)&&void 0!==i?i:10):0},y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.orderLabel.style),{textAlign:"bothEnd"===t.labelLayout?"right":"left",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[g]&&t.orderLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}generateValueLabel(t){var e;return{type:"text",dataId:"data",visible:!0,dataKey:u,state:null===(e=t.valueLabel)||void 0===e?void 0:e.state,style:Object.assign(Object.assign({text:e=>this.formatDatum(t.xField,e),x:(e,i)=>"bothEnd"===t.labelLayout?i.getRegion().getLayoutRect().width+5:i.getRegion().getLayoutRect().width,y:(e,i)=>"bothEnd"===t.labelLayout?i.valueToY([e[t.yField]])+i.yBandwidth()/2:i.valueToY([e[t.yField]])+i.yBandwidth()/2-t.bar.height/2-5},t.valueLabel.style),{textAlign:"bothEnd"===t.labelLayout?"left":"right",textBaseline:"bothEnd"===t.labelLayout?"middle":"bottom",visible:e=>!e[g]&&t.valueLabel.style.visible}),animation:!0,animationEnter:this.getAnimationEnter(this.originalSpec),animationExit:this.getAnimationExit(this.originalSpec),animationAppear:this.getAnimationAppear(this.originalSpec,"text"),animationUpdate:this.getAnimationUpdate(this.originalSpec)}}transformPaddingSpec(t){var e;const i=t.decorateHaloIcons.length>0?Math.max(...t.decorateHaloIcons.map((t=>{var e,i;return null!==(i=null===(e=t.style)||void 0===e?void 0:e.size)&&void 0!==i?i:18}))):0;t.padding=Object.assign({left:"bothEnd"===t.labelLayout?10+this.getMaxDataLabelLens(t,t.yField,this.nameLabelTextMeasure)+(t.orderLabel.style.visible?5+this.getMaxDataLabelLens(t,p,this.orderLabelTextMeasure):0)+(t.rankingIcon.style.visible?8+(null!==(e=t.rankingIcon.style.size)&&void 0!==e?e:10):0)+5:5+i/2,right:"bothEnd"===t.labelLayout?5+this.getMaxDataLabelLens(t,t.xField,this.valueLabelTextMeasure)+5:15,top:0,bottom:0},t.padding)}getMaxDataLabelLens(t,e,i){const s=this.originalData.map((t=>t[g]?0:i.fullMeasure(this.formatDatum(e,t)).width));return Math.max(...s)}formatDatum(t,e){var i;return(null===(i=this.formatMap)||void 0===i?void 0:i[t])?this.formatMap[t](e[t],e):e[t]}getLabelWidth(t,e){return e+t}getAnimationExit(t){var e,i,s,r,a;return!1!==(null===(e=t.animationUpdate)||void 0===e?void 0:e.enable)&&{type:"moveOut",options:{direction:"y",orient:"negative",excludeChannels:["x"],point:(e,i)=>({y:i.getGraphicAttribute("y")-t.height/(t.pageSize+1)*Math.min(t.scrollSize,t.pageSize)})},duration:null!==(s=null===(i=t.animationUpdate)||void 0===i?void 0:i.duration)&&void 0!==s?s:1e3,easing:null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r.easing)&&void 0!==a?a:"linear"}}getAnimationEnter(t){var e,i,s,r,a;return!1!==(null===(e=t.animationUpdate)||void 0===e?void 0:e.enable)&&{type:"moveIn",options:{direction:"y",orient:"negative",excludeChannels:["x"],point:(e,i)=>({y:i.getGraphicAttribute("y")+t.height/(t.pageSize+1)*Math.min(t.scrollSize,t.pageSize)})},duration:null!==(s=null===(i=t.animationUpdate)||void 0===i?void 0:i.duration)&&void 0!==s?s:1e3,easing:null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r.easing)&&void 0!==a?a:"linear"}}getAnimationAppear(t,e){var i,s,r,a,n,o,l,h,c,d,u,p,g;return!1!==(null===(i=t.animationAppear)||void 0===i?void 0:i.enable)&&("rect"===e?{type:"growWidthIn",oneByOne:!1,duration:null!==(r=null===(s=t.animationAppear)||void 0===s?void 0:s.duration)&&void 0!==r?r:1e3,easing:null!==(n=null===(a=t.animationAppear)||void 0===a?void 0:a.easing)&&void 0!==n?n:"linear",options:{}}:"symbol"===e?{channel:{x:{from:0,to:(t,e)=>e.getGraphicAttribute("x")}},duration:null!==(l=null===(o=t.animationAppear)||void 0===o?void 0:o.duration)&&void 0!==l?l:1e3,easing:null!==(c=null===(h=t.animationAppear)||void 0===h?void 0:h.easing)&&void 0!==c?c:"linear"}:{channel:{opacity:{from:0,to:1}},duration:null!==(u=null===(d=t.animationAppear)||void 0===d?void 0:d.duration)&&void 0!==u?u:1e3,easing:null!==(g=null===(p=t.animationAppear)||void 0===p?void 0:p.easing)&&void 0!==g?g:"linear"})}getAnimationUpdate(t){var e,i,s,r;return!1!==t.animationUpdate.enable&&{duration:null!==(i=null===(e=t.animationUpdate)||void 0===e?void 0:e.duration)&&void 0!==i?i:1e3,easing:null!==(r=null===(s=t.animationUpdate)||void 0===s?void 0:s.easing)&&void 0!==r?r:"linear"}}}class f extends e.BaseChart{constructor(){super(...arguments),this.type="rankingList",this.transformerConstructor=m}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}f.type="rankingList",f.view="singleDefault",f.transformerConstructor=m;
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function f(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i}const y={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},v={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},b={fill:"#606773",fontSize:12},x={fill:"#eff1f9"};class _ extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:s}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=f(t,["arrows"]),s=e.filter((t=>"left"===t.position)),r=e.filter((t=>"right"===t.position)),a=S(r,i),n=S(s,i),o=[];a&&(a.name="arrowRight",o.push(a));n&&(n.name="arrowLeft",o.push(n));return o}(e);t&&t.length&&i.push(...t)}if(s&&s.visible){const t=function(t){const{style:e={}}=t,i=f(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},x),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:s}=i.getLayoutRect();return s},height:(t,e)=>{const i=e.getPoints(t),s=i[0];return i[3].y-s.y}})})}(s);t&&i.push(t)}t.extensionMark=i,super.transformSpec(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.conversionArrow=t.conversionArrow,e.funnelBackground=t.funnelBackground,e}}function S(t,i){if(0===(null==t?void 0:t.length))return null;const{line:s,symbol:r,text:a,margin:n}=i,o=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},h=function(t={},e){const{style:i={}}=t,s=f(t,["style"]),r=(t,e)=>{var i,s;const{from:r,to:a}=t,{vchart:n}=e,o=null===(s=null===(i=null==n?void 0:n.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===s?void 0:s.latestData;return!(a>o.length-1||r>o.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},s),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},y),i),{renderable:r,points:(t,i)=>{if(!r(t,i))return[];let s=t.layout.points;return s=A(t,i,e),s}})})}(s,n);h&&o.push(h);const c=function(t={},e){const{style:i={}}=t,s=f(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},s),{style:Object.assign(Object.assign(Object.assign({},v),i),{x:(t,i)=>{var s,r;let a=t.layout.points;return a=A(t,i,e),null!==(r=null===(s=a[(null==a?void 0:a.length)-1])||void 0===s?void 0:s.x)&&void 0!==r?r:NaN},y:(t,i)=>{var s,r;let a=t.layout.points;return a=A(t,i,e),null!==(r=null===(s=a[(null==a?void 0:a.length)-1])||void 0===s?void 0:s.y)&&void 0!==r?r:NaN},angle:t=>"left"===t.position?90:-90})})}(r,n);c&&o.push(c);const d=function(t={},i){const{style:s={},formatMethod:r,textMargin:a=4}=t,n=f(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},n),{style:Object.assign(Object.assign(Object.assign({},b),{text:(t,i)=>{var s,a,n,o,l,h,c;const{text:d}=t;let u=d;if(e.isFunction(r)){const{vchart:e}=i,{from:p,to:g}=t,{field:m}=t.context,f=null!==(n=null===(a=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===a?void 0:a.latestData)&&void 0!==n?n:[],y=null!==(c=null===(h=null===(l=null===(o=null==e?void 0:e.getChart())||void 0===o?void 0:o.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===h?void 0:h.latestData)&&void 0!==c?c:[],v=y.find((t=>t[m]===f[p][m])),b=y.find((t=>t[m]===f[g][m]));u=r(d,{arrow:t,from:v,to:b})}return u},x:(t,e)=>{var s,r;let n=t.layout.points;return n=A(t,e,i),null!==(r=(null===(s=n[1])||void 0===s?void 0:s.x)+("left"===t.position?-a:a))&&void 0!==r?r:NaN},y:(t,e)=>{var s,r,a;let n=t.layout.points;return n=A(t,e,i),null!==(a=((null===(s=n[1])||void 0===s?void 0:s.y)+(null===(r=n[2])||void 0===r?void 0:r.y))/2)&&void 0!==a?a:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),s)})}(a,n);return d&&o.push(d),l.children=o,l}function A(t,e,i){var s,r,a,n,o;const{vchart:l}=e,{from:h,to:c}=t,{field:d}=t.context,u=null===(r=null===(s=null==l?void 0:l.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===r?void 0:r.latestData,p=null===(o=null===(n=null===(a=null==l?void 0:l.getChart())||void 0===a?void 0:a.getAllSeries()[0])||void 0===n?void 0:n.getViewData())||void 0===o?void 0:o.latestData;let g=[];if(u&&u.length){const s=p.find((t=>t[d]===u[h][d])),r=p.find((t=>t[d]===u[c][d])),a=p[0];if(s&&r&&a){g=function(t,e,i,s,r=12){const{layout:a,distance:n,position:o}=t,{level:l,fromIndex:h,toIndex:c,fromTotal:d,toTotal:u}=a,p="right"===o,g=p?e[1]:e[0],m=p?e[2]:e[3],f=Math.abs(g.y-m.y),y=p?i[1]:i[0],v=p?i[2]:i[3],b=Math.abs(y.y-v.y),x=p?s[1]:s[0],_=f/(d+1),S=b/(u+1),A=g.y+_*(h+1),T=y.y+S*(c+1),C=p?-1:1,M=[{x:g.x-r*C,y:A},{x:x.x-(r+(l+1)*n)*C,y:A},{x:x.x-(r+(l+1)*n)*C,y:T},{x:y.x-r*C,y:T}];return M}(t,e.getPoints(s),e.getPoints(r),e.getPoints(a),i),t.layout.points=g}}return g}function T(t,e){const{from:i,to:s}=t,{from:r,to:a}=e;return s>r&&a>i}function C(t,e){const{from:i,to:s}=t,{from:r,to:a}=e;return i===r&&s===a}const M=(t,i)=>{var s,r,a;if(!t||!(null===(s=t.arrows)||void 0===s?void 0:s.length))return[];const{arrows:n}=t,o=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:s,to:r,position:a="right"}=t;return Object.assign(Object.assign({},t),{position:a,distance:t.distance||40,from:Math.min(s,r),to:Math.max(s,r),span:Math.abs(s-r),isLayout:!1,context:{field:i},layout:{level:0},id:`${s}-${r}-${a}-${e}`})}))}(n,i.categoryField),l=o.filter((t=>"left"===t.position)),h=o.filter((t=>"right"===t.position));return[...null!==(r=k(l))&&void 0!==r?r:[],...null!==(a=k(h))&&void 0!==a?a:[]]};function k(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const s=i.get(t.from);if(e.isValid(s)){const e=s.fromArrows.find((e=>C(e,t)));e?t.layout.duplicateNode=e:s.degree+=1,s.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const r=i.get(t.to);if(e.isValid(r)){const e=r.toArrows.find((e=>C(e,t)));e?t.layout.duplicateNode=e:r.degree+=1,r.toArrows.push(t)}else i.set(t.to,{toArrows:[t],fromArrows:[],totalArrows:[],degree:1})})),i.forEach((t=>{t.fromArrows.sort(((t,e)=>e.span-t.span)),t.toArrows.sort(((t,e)=>t.span-e.span)),t.totalArrows=[...t.toArrows,...t.fromArrows]})),t.sort(((t,e)=>t.span-e.span)).forEach((s=>{var r;const a=t.filter((t=>t.layout.isLayout)),n=e.maxInArray(a,((t,e)=>t.layout.level-e.layout.level));let o=null!==(r=null==n?void 0:n.layout.level)&&void 0!==r?r:0;for(;o>=0;){if(a.some((t=>t.layout.level===o&&T(t,s)))){o+=1;break}--o}s.layout.level=Math.max(0,o),s.layout.fromTotal=i.get(s.from).degree,s.layout.toTotal=i.get(s.to).degree;const l=s.layout.duplicateNode;l?(s.layout.fromIndex=l.layout.fromIndex,s.layout.toIndex=l.layout.toIndex):(s.layout.fromIndex=w(s,i.get(s.from).totalArrows),s.layout.toIndex=w(s,i.get(s.to).totalArrows)),s.layout.isLayout=!0})),t}function w(t,e){let i=0,s=0;for(let r=0;r<e.length;r++){const a=e[r];if(a===t){i=r-s;break}a.layout.duplicateNode&&s++}return i}class P extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=_}}P.type="conversionFunnel",P.transformerConstructor=_;class O extends e.FunnelSeries{initData(){var t;super.initData();const{conversionArrow:i}=this._spec;i&&(null===(t=i.arrows)||void 0===t?void 0:t.length)&&(this._arrowData=new e.DataView(this._dataSet,{name:`${e.PREFIX}_series_${this.id}_arrowData`}),this._dataSet.getTransform("conversionArrow")||this._dataSet.registerTransform("conversionArrow",M),this._arrowData.parse(i).transform({type:"conversionArrow",options:{categoryField:this._spec.categoryField}}))}afterCompile(){var t;null===(t=super.afterCompile)||void 0===t||t.call(this);const e=this.getMarkInName("arrowRight");e&&e.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"right"===t.position}])}));const i=this.getMarkInName("arrowLeft");i&&i.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"left"===t.position}])}))}}const B="dataKey";class L extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a;super.transformSpec(t);const n=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].nodes;e.push({data:[{id:"nodes",values:s.map(((t,e)=>Object.assign(Object.assign({},t),{[B]:e})))},{id:"endpoints",values:[]},{id:"iter",values:[{iter:i}]},{id:"background",values:[{iter:i,x:t.scope[0],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[1]}]}]})})),e}(t),o="neighborhood"!==t.taskType;t.type="common",t.dataKey=B,t.data=n[0].data,t.series=[{id:"background-series",type:"area",dataId:"background",interactive:!1,persent:!0,xField:"x",yField:"y",point:{visible:!1},line:{visible:!1},area:{visible:!0,interactive:!1,style:{background:e=>"neighborhood"===t.taskType?"":`https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/sequence-scatter-bgimg-2/${e.iter}.png`,fill:"transparent",fillOpacity:.5}},hover:{enable:!1},select:{enable:!1}},{id:"line-series",type:"line",dataId:"endpoints",xField:"x",yField:"y",seriesField:"edgeId",animation:!0,point:{visible:!1},line:{visible:!0,style:{stroke:t=>t.color,lineDash:t=>"same_type"===t.type?[0,0]:[3,2],lineWidth:.8,strokeOpacity:.6}}},{id:"scatter-series",type:"scatter",dataId:"nodes",xField:t.xField,yField:t.yField,seriesField:"label",point:{state:{hover:{scaleX:1.5,scaleY:1.5,fillOpacity:1},hover_reverse:{scaleX:1,scaleY:1,fillOpacity:.3}},style:{size:()=>"neighborhood"===t.taskType?6:4,fill:e=>{var i;return null!==(i=t.labelColor[e.label])&&void 0!==i?i:"gray"},fillOpacity:t=>t.confidence}},label:{visible:!0,style:{visible:()=>"neighborhood"===t.taskType,type:"text",fontFamily:"Console",fontStyle:"italic",fontSize:12,fill:"black",fillOpacity:.6,text:t=>t.id}}}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:n}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",inverse:!0,min:t.scope[1],max:t.scope[3]},{orient:"bottom",type:"linear",min:t.scope[0],max:t.scope[2]}],t.customMark=[{type:"text",dataId:"iter",style:Object.assign({x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(a=t.infoLabel)||void 0===a?void 0:a.style)}],t.legends=[{seriesId:"scatter-series",visible:!0,orient:"right",position:"middle",data:t=>t.map((t=>(t.shape.outerBorder={stroke:t.shape.fill,distance:2,lineWidth:1},t))),title:{visible:!0,align:"left",textStyle:{text:"Classes",fontFamily:"Console",fontSize:18,fontWeight:"bold"}},item:{visible:!0,width:"8%",value:{alignRight:!0,style:{fill:"#000",fillOpacity:1,fontSize:12},state:{unselected:{fill:"#d8d8d8"}}}}}],t.tooltip={visible:o,seriesId:"scatter-series",lockAfterClick:!1,activeType:"mark",trigger:"hover",mark:{title:{visible:!0,value:"Info"},content:[{key:"Label",value:t=>t.label,shapeType:"circle",shapeSize:8},{key:"Prediction",value:t=>t.prediction,shapeType:"circle",shapeSize:8,shapeFill:e=>{var i;return null!==(i=t.labelColor[e.prediction])&&void 0!==i?i:"gray"}},{key:"Confidence",value:t=>t.confidence.toFixed(2),shapeType:"square",shapeSize:8,shapeFill:t=>t.label===t.prediction?"green":"red"}]},style:{panel:{padding:{top:10,bottom:15,left:10,right:10},backgroundColor:"#fff",border:{color:"#eee",width:1,radius:10}},titleLabel:{fontSize:20,fontFamily:"Times New Roman",fill:"brown",fontWeight:"bold",textAlign:"center",lineHeight:24},keyLabel:{fontSize:16,fontFamily:"Times New Roman",fill:"black",textAlign:"center",lineHeight:15,spacing:10},valueLabel:{fontSize:14,fill:"black",textAlign:"center",lineHeight:15,spacing:10}}},t.dataZoom=[{visible:!1,orient:"left",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}},{visible:!1,orient:"bottom",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}}],super.transformSpec(t)}}class E extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=L}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}E.type="sequenceScatterLink",E.view="singleDefault",E.transformerConstructor=L;const D=.2;function F(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const I="dataKey";class R extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a,n;super.transformSpec(t);const o=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[I]:e}))),r=function(t,e=100,i){const s=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),r=[];return Object.entries(s).forEach((([t,s])=>{const a=i||function(t){return t.length**(-1/6)}(s),n=s.map((t=>t.x)),o=s.map((t=>t.y)),l=Math.min(...n),h=Math.max(...n),c=Math.min(...o),d=Math.max(...o),u=l-(h-l)*D,p=c-(d-c)*D;for(let i=0;i<e;i++)for(let n=0;n<e;n++){const e=u+.1*i,o=p+.1*n;let l=0;for(const t of s)l+=F(Math.sqrt((e-t.x)**2+(o-t.y)**2)/a);l/=s.length*a*a,r.push({x:e,y:o,kde:l,label:t})}})),r}(s,150);e.push({data:[{id:"nodes",values:s},{id:"iter",values:[{iter:i}]},{id:"kde",values:r}]})})),e}(t);t.type="common",t.dataKey=I,t.data=o[0].data,t.scales=[{id:"colorScale",type:"ordinal",specified:{0:"rgb(150, 10, 100)",1:"rgb(31, 119, 180)",2:"rgb(255, 127, 14)",3:"rgb(44, 160, 44)",4:"rgb(214, 39, 40)",5:"rgb(148, 103, 189)",6:"rgb(140, 86, 75)",7:"rgb(227, 119, 194)",8:"rgb(127, 127, 127)",9:"rgb(188, 189, 34)",10:"rgb(23, 190, 207)"}},{id:"brighterColorScale",type:"ordinal",specified:{0:"rgb(150, 10, 150)",1:"rgb(31, 119, 230)",2:"rgb(255, 127, 64)",3:"rgb(44, 160, 94)",4:"rgb(214, 39, 90)",5:"rgb(148, 103, 239)",6:"rgb(140, 86, 125)",7:"rgb(227, 119, 244)",8:"rgb(127, 127, 177)",9:"rgb(188, 189, 84)",10:"rgb(23, 190, 255)"}},...null!==(e=t.scales)&&void 0!==e?e:[]],t.series=[{type:"scatter",dataIndex:0,xField:t.xField,yField:t.yField,seriesField:t.seriesField,size:5,point:{zIndex:1e3,style:{fill:{scale:"colorScale",field:t.seriesField}}}}];t.customMark=[{type:"text",dataIndex:1,style:Object.assign({text:t=>t.iter,x:10,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:25,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(i=t.infoLabel)||void 0===i?void 0:i.style)},{type:"symbol",dataIndex:2,style:{symbolType:"rect",x:(t,e)=>54+(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToX)([t.x]),y:(t,e)=>(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToY)([t.y])+26,size:5,fill:{scale:"brighterColorScale",field:"label"},fillOpacity:t=>10*t.kde}}],t.tooltip={visible:!0,fields:["x","y","label"]},t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:o}),t.animationAppear={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"},t.animationUpdate={duration:null!==(n=null===(a=t.player)||void 0===a?void 0:a.duration)&&void 0!==n?n:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class N extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=R}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}N.type="sequenceScatterKDE",N.view="singleDefault",N.transformerConstructor=R;const j="dataKey";function U(t){const e=[];return Object.keys(t.data).forEach((i=>{let s=null;if(t.backgroundColors&&t.backgroundColors[i]){const e=function(t,e){var i;if("undefined"==typeof document)throw new Error("Canvas rendering requires browser environment with document object");const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)throw new Error("Failed to get 2D rendering context from canvas");const a=r.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let s=0;s<300;s++){const r=(null===(i=t[e])||void 0===i?void 0:i[s])||[0,0,0],n=4*(300*e+s);a.data[n]=Math.round(255*r[0]),a.data[n+1]=Math.round(255*r[1]),a.data[n+2]=Math.round(255*r[2]),a.data[n+3]=255}return r.putImageData(a,0,0),s.toDataURL("image/png")}(t.backgroundColors[i],t);s={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[j]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:s?[s]:[]}]})})),e}class z extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a;super.transformSpec(t);const n=U(t);t.type="common",t.dataKey=j,t.data=n[0].data,t.width=300,t.height=300,t.autoFit=!1,t.series=[{type:"scatter",xField:t.xField,yField:t.yField}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:n}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear"},{orient:"bottom",label:{visible:!0},type:"linear"}],t.customMark=[{type:"image",dataIndex:2,style:{x:0,y:0,width:300,height:300,image:t=>t.imageData,zIndex:-1}},{type:"text",dataIndex:1,style:Object.assign({text:t=>t.inter,x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(a=t.infoLabel)||void 0===a?void 0:a.style)}],t.tooltip={visible:!1},super.transformSpec(t)}}class V extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterPixel",this.transformerConstructor=z}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}V.type="sequenceScatterPixel",V.view="singleDefault",V.transformerConstructor=z;class G extends e.BarChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.barWidth=t.barWidth,e.barMaxWidth=t.barMaxWidth,e.barMinWidth=t.barMinWidth,e.barGapInGroup=t.barGapInGroup,e}}var W,H,$,X,Y;!function(t){t.bar3d="bar3d",t.histogram3d="histogram3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}(W||(W={})),function(t){t.rect3d="rect3d",t.arc3d="arc3d",t.pyramid3d="pyramid3d"}(H||(H={})),function(t){t.bar3d="bar3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}($||($={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(X||(X={})),function(t){t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical"}(Y||(Y={}));const K=t=>t.zField||t.series&&t.series.some((t=>t.zField));class q extends e.BasePlugin{constructor(){super(q.type),this.type="VChart3dPlugin"}onInit(t,e){var i,s;if(this._is3d=!!(s=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(s.type)||K(s),!0),this._is3d){const{globalInstance:e}=t;e.getCompiler().getStage().set3dOptions(Object.assign({},null===(i=e._option)||void 0===i?void 0:i.options3d))}}onBeforeInitChart(t,e,i){this._is3d&&K(e)&&(e.layout={type:"layout3d"})}}q.pluginType="chart",q.type="VChart3dPlugin";const Z=()=>{e.registerChartPlugin(q),e.registerDirectionalLight(),e.registerOrthoCamera(),e.registerViewTransform3dPlugin()},Q={label:{name:"label",type:"text"},bar3d:{name:"bar3d",type:"rect3d"}};class J extends e.BarSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar3d")}}class tt extends e.BaseMark{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}setDataLabelType(){return"rect"}constructor(t,e){super(t,e),this.type=tt.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}tt.type="rect3d";const et=()=>{e.Factory.registerMark(tt.type,tt),e.registerShadowRoot(),e.registerRect3d(),e.registerRectAnimation(),e.Factory.registerGraphicComponent("rect3d",e.createRect3d)};class it extends e.BarSeries{constructor(){super(...arguments),this.type=$.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=J}}it.type=$.bar3d,it.mark=Q,it.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},it.transformerConstructor=J;const st=()=>{e.Factory.registerAnimation("bar3d",((t,i)=>({appear:e.barPresetAnimation(t,i),enter:e.barGrowIn(t,!1),exit:e.barGrowOut(t,!1),disappear:e.barGrowOut(t)}))),et(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(it.type,it)};class rt extends e.Layout{layoutItems(t,i,s,r){this._layoutInit(t,i,s,r);const a={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(i,a);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},o=i.filter((t=>"absolute"===t.layoutType)),l=o.filter((t=>"z"===t.layoutOrient));let h={width:0,height:0};if(l.length){h=l[0].getLayoutRect()}this.leftCurrent+=h.width/8,this.rightCurrent-=h.width/8,this.topCurrent+=h.height/8,this.bottomCurrent-=h.height/8;const{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(i);this.layoutRegionItems(c,d,u,g,a),this._processAutoIndent(c,d,u,g,p,n,a);const m=o.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(m);const f=d.filter((t=>"axes"===t.model.specKey&&e.isXAxis(t.layoutOrient)))[0],y=d.filter((t=>"axes"===t.model.specKey&&e.isYAxis(t.layoutOrient)))[0];if(f&&l.length){const t=f.getLayoutStartPoint(),e=f.getLayoutRect(),i={x:"left"===y.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};l[0].model.directionStr="left"===y.layoutOrient?"r2l":"l2r";const s=f.getLayoutRect(),r=y.getLayoutRect(),a={length:l[0].getLayoutRect().width,width:s.width,height:r.height};f.model.setLayout3dBox&&f.model.setLayout3dBox(a),y.model.setLayout3dBox&&y.model.setLayout3dBox(a),l[0].model.setLayout3dBox&&l[0].model.setLayout3dBox(a),this.layoutZAxisItems(l,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this.rightCurrent,s=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const r="left"===t.layoutOrient||"right"===t.layoutOrient,a=t.getLastComputeOutBounds();r?(e.top=Math.max(e.top,a.y1-this.topCurrent),e.bottom=Math.max(e.bottom,a.y2-s)):(e.left=Math.max(e.left,a.x1-this.leftCurrent),e.right=Math.max(e.right,a.x2-i))})),e}}rt.type="layout3d";const at=()=>{e.Factory.registerLayout(rt.type,rt)};class nt extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=G,this.type="bar3d",this.seriesType=$.bar3d}}nt.type="bar3d",nt.seriesType=$.bar3d,nt.transformerConstructor=G;const ot=Object.assign(Object.assign({},e.baseSeriesMark),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class lt extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ht extends e.BasePolygonMark{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=ht.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}ht.type="pyramid3d";const ct=e.getFunnelTheme(!0);class dt extends e.FunnelSeries{constructor(){super(...arguments),this.type=$.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=lt}initMark(){var t,e,i,s,r,a,n,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},dt.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},dt.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(r=this._spec.outerLabel)&&void 0!==r?r:{},{line:e}=null!==(n=null===(a=this._theme)||void 0===a?void 0:a.outerLabel)&&void 0!==n?n:{};this._funnelOuterLabelMark.label=this._createMark(dt.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(dt.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series)}initLabelMarkStyle(t){var i,s;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series),this._labelMark=t,null===(i=this._funnelOuterLabelMark)||void 0===i||i.label,null===(s=this._funnelOuterLabelMark)||void 0===s||s.line}}dt.type=$.funnel3d,dt.mark=ot,dt.builtInTheme={funnel3d:ct},dt.transformerConstructor=lt;const ut=()=>{e.Factory.registerMark(ht.type,ht),e.registerShadowRoot(),e.registerPyramid3d(),e.registerPolygonAnimation(),e.Factory.registerGraphicComponent("pyramid3d",e.createPyramid3d),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(dt.type,dt)};class pt extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=$.funnel3d}}pt.type="funnel3d",pt.seriesType=$.funnel3d,pt.transformerConstructor=e.FunnelChartSpecTransformer;class gt extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=$.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}gt.type="histogram3d",gt.seriesType=$.bar3d,gt.transformerConstructor=e.HistogramChartSpecTransformer;class mt extends e.BasePieChartSpecTransformer{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class ft{static GenAutoIncrementId(){return ft.auto_increment_id++}}ft.auto_increment_id=0;const yt=new class{},vt=s.tau-1e-8;class bt{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,a,n){if(Math.abs(a-r)>vt)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let o,l,h,c,d=1/0,u=-1/0,p=1/0,g=-1/0;function m(t){h=i*Math.cos(t),c=i*Math.sin(t),h<d&&(d=h),h>u&&(u=h),c<p&&(p=c),c>g&&(g=c)}if(m(r),m(a),a!==r)if((r%=s.tau)<0&&(r+=s.tau),(a%=s.tau)<0&&(a+=s.tau),a<r&&(n=!n,o=r,r=a,a=o),n)for(a-=s.tau,o=r-r%s.halfPi,l=0;l<4&&o>a;++l,o-=s.halfPi)m(o);else for(o=r-r%s.halfPi+s.halfPi,l=0;l<4&&o<a;++l,o+=s.halfPi)m(o);this.bounds.add(t+d,e+p),this.bounds.add(t+u,e+g)}arcTo(t,e,i,s,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,s,r,a){this.bounds.add(t,e),this.bounds.add(i,s),this.bounds.add(r,a)}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,s){this.bounds.add(t,e),this.bounds.add(i,s)}rect(t,e,i,s){this.bounds.add(t,e),this.bounds.add(t+i,e+s)}clear(){this.bounds.clear()}release(...t){}}class xt{constructor(){this._curves=[],this.bounds=new s.AABBBounds}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const _t=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,St={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},At={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Tt,Ct,Mt,kt,wt,Pt;var Ot,Bt,Lt,Et,Dt,Ft;function It(t){const e=t[0],i=t[1],s=t[2],r=t[3],a=t[4],n=t[5],o=t[6],l=t[7],h=l*a,c=-o*n,d=o*a,u=l*n,p=Math.cos(s),g=Math.sin(s),m=Math.cos(r),f=Math.sin(r),y=.5*(r-s),v=Math.sin(.5*y),b=8/3*v*v/Math.sin(y),x=e+p-b*g,_=i+g+b*p,S=e+m,A=i+f,T=S+b*f,C=A-b*m;return[h*x+c*_,d*x+u*_,h*T+c*C,d*T+u*C,h*S+c*A,d*S+u*A]}function Rt(t,e,i,r){const a=function(t,e,i,r,a,n,o,l,h){const c=s.degreeToRadian(o),d=Math.sin(c),u=Math.cos(c),p=u*(l-t)*.5+d*(h-e)*.5,g=u*(h-e)*.5-d*(l-t)*.5;let m=p*p/((i=Math.abs(i))*i)+g*g/((r=Math.abs(r))*r);m>1&&(m=Math.sqrt(m),i*=m,r*=m);const f=u/i,y=d/i,v=-d/r,b=u/r,x=f*l+y*h,_=v*l+b*h,S=f*t+y*e,A=v*t+b*e;let T=1/((S-x)*(S-x)+(A-_)*(A-_))-.25;T<0&&(T=0);let C=Math.sqrt(T);n===a&&(C=-C);const M=.5*(x+S)-C*(A-_),k=.5*(_+A)+C*(S-x),w=Math.atan2(_-k,x-M);let P=Math.atan2(A-k,S-M)-w;P<0&&1===n?P+=s.tau:P>0&&0===n&&(P-=s.tau);const O=Math.ceil(Math.abs(P/(s.halfPi+.001))),B=[];for(let t=0;t<O;++t){const e=w+t*P/O,s=w+(t+1)*P/O;B[t]=[M,k,e,s,i,r,d,u]}return B}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,i);for(let e=0;e<a.length;++e){const i=It(a[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_PAINT=64]="UPDATE_PAINT",t[t.CLEAR_PAINT=191]="CLEAR_PAINT",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(Ot||(Ot={})),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"}(Bt||(Bt={})),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"}(Lt||(Lt={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Et||(Et={})),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"}(Dt||(Dt={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Ft||(Ft={}));const Nt=[(t,e,i,s,r,a,n)=>e.arc(t[1]*r+i,t[2]*a+s,t[3]*(r+a)/2,t[4],t[5],t[6],n),(t,e,i,s,r,a,n)=>e.arcTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,t[5]*(r+a)/2,n),(t,e,i,s,r,a,n)=>e.bezierCurveTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,t[5]*r+i,t[6]*a+s,n),(t,e,i,s)=>e.closePath(),(t,e,i,s,r,a)=>e.ellipse(t[1]*r+i,t[2]*a+s,t[3]*r,t[4]*a,t[5],t[6],t[7],t[8]),(t,e,i,s,r,a,n)=>e.lineTo(t[1]*r+i,t[2]*a+s,n),(t,e,i,s,r,a,n)=>e.moveTo(t[1]*r+i,t[2]*a+s,n),(t,e,i,s,r,a,n)=>e.quadraticCurveTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,n),(t,e,i,s,r,a,n)=>e.rect(t[1]*r+i,t[2]*a+s,t[3]*r,t[4]*a,n)];function jt(t,e,i=0,s=0,r=1,a=1,n){for(let o=0;o<t.length;o++){const l=t[o];Nt[l[0]](l,e,i,s,r,a,n)}}class Ut{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function zt(t,e){let i=0;const r=t.length;for(let a=0;a<r;a++){const n=t[a],o=e[a],l=t[(a+1)%r],h=e[(a+1)%r];i+=s.PointService.distanceNN(n,o,l,h)}return i/2}function Vt(t,e,i,s,r){const a=1-r;return a*a*a*t+3*e*r*a*a+3*i*r*r*a+s*r*r*r}function Gt(t,e,i,r,a){const n=Vt(t.x,e.x,i.x,r.x,a),o=Vt(t.y,e.y,i.y,r.y,a);return new s.Point(n,o)}function Wt(t,e,i,s){const r=1-s;return r*r*t+2*r*s*e+s*s*i}function Ht(t,e,i,r){const a=Wt(t.x,e.x,i.x,r),n=Wt(t.y,e.y,i.y,r);return new s.Point(a,n)}class $t extends Ut{constructor(t,e,i,s){super(),this.type=Dt.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=s}_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 Gt(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,s=this.p3,zt([t.x,e.x,i.x,s.x],[t.y,e.y,i.y,s.y])):60;var t,e,i,s}calcProjLength(t){return t===Et.ROW?s.abs(this.p0.x-this.p3.x):t===Et.COLUMN?s.abs(this.p0.y-this.p3.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),a=this.getPointAt(i);return s.atan2(a.y-r.y,a.x-r.x)}draw(t,e,i,r,a,n){if(t.moveTo(this.p0.x*r+e,this.p0.y*a+i),n>=1)t.bezierCurveTo(this.p1.x*r+e,this.p1.y*a+i,this.p2.x*r+e,this.p2.y*a+i,this.p3.x*r+e,this.p3.y*a+i);else if(n>0){const[o]=function(t,e){const{p0:i,p1:r,p2:a,p3:n}=t,o=Gt(i,r,a,n,e),l=s.PointService.pointAtPP(i,r,e),h=s.PointService.pointAtPP(r,a,e),c=s.PointService.pointAtPP(a,n,e),d=s.PointService.pointAtPP(l,h,e),u=s.PointService.pointAtPP(h,c,e);return[new $t(i,l,d,o),new $t(o,u,c,n)]}(this,n);t.bezierCurveTo(o.p1.x*r+e,o.p1.y*a+i,o.p2.x*r+e,o.p2.y*a+i,o.p3.x*r+e,o.p3.y*a+i)}}includeX(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=s.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(s.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}class Xt extends Ut{constructor(t,e){super(),this.type=Dt.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return s.PointService.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=s.atan2(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()?s.PointService.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Et.ROW?s.abs(this.p0.x-this.p1.x):t===Et.COLUMN?s.abs(this.p0.y-this.p1.y):0}draw(t,e,i,s,r,a){if(t.moveTo(this.p0.x*s+e,this.p0.y*r+i),a>=1)t.lineTo(this.p1.x*s+e,this.p1.y*r+i);else if(a>0){const n=this.getPointAt(a);t.lineTo(n.x*s+e,n.y*r+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Yt{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,r,a,n,o,l){const h=new $t(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(a,n));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=a,this._lastY=n,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const r=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,r,a){const n=new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e));return n.originP1=r,n.originP2=a,n.defined=i,n}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Et.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],r=null!==(e=i.p3)&&void 0!==e?e:i.p1;return s.abs(t.p0.y-r.y)}if(t===Et.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],r=null!==(i=e.p3)&&void 0!==i?i:e.p1;return s.abs(t.p0.x-r.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Kt extends Yt{bezierCurveTo(t,e,i,s,r,a,n,o){return super.bezierCurveTo(e,t,s,i,a,r,n,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function qt(t,e,i=1){let s=!1;for(let i=0,r=e.length;i<=r;i++)i>=r===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Zt(t,e,i){const r=null!=e?e:s.abs(i[i.length-1].x-i[0].x)>s.abs(i[i.length-1].y-i[0].y)?Et.ROW:Et.COLUMN;return"monotoneY"===t?new Kt(t,r):new Yt(t,r)}class Qt{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Jt(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=Zt("linear",i,t);return function(t,e){qt(t,e,1)}(new Qt(r,s),t),r}function te(t,e,i,s,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class ee{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&&te(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:te(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function ie(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Jt(t,e);const r=Zt("basis",i,t);return function(t,e){qt(t,e,2)}(new ee(r,s),t),r}function se(t){return t<0?-1:1}function re(t,e,i){const s=t._x1-t._x0,r=e-t._x1,a=(t._y1-t._y0)/(s||Number(r<0&&-0)),n=(i-t._y1)/(r||Number(s<0&&-0)),o=(a*r+n*s)/(s+r);return(se(a)+se(n))*Math.min(Math.abs(a),Math.abs(n),.5*Math.abs(o))||0}function ae(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ne(t,e,i,s,r){const a=t._x0,n=t._y0,o=t._x1,l=t._y1,h=(o-a)/3;t.context.bezierCurveTo(a+h,n+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class oe{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:ne(this,this._t0,ae(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,ne(this,ae(this,e=re(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ne(this,this._t0,e=re(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class le extends oe{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function he(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Jt(t,e);const r=Zt("monotoneX",i,t);return function(t,e){qt(t,e,2)}(new oe(r,s),t),r}function ce(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Jt(t,e);const r=Zt("monotoneY",i,t);return function(t,e){qt(t,e,2)}(new le(r,s),t),r}class de{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class ue extends de{lineEnd(){this.context.closePath()}}function pe(t,e,i={}){const{direction:r,startPoint:a}=i;if(t.length<2-Number(!!a))return null;const n=new Yt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Et.ROW:Et.COLUMN);return ge(new de(n,e,a),t),n}function ge(t,e){return qt(t,e,1)}class me extends Qt{lineEnd(){this.context.closePath()}}function fe(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=Zt("linear",i,t);return function(t,e){qt(t,e,1)}(new me(r,s),t),r}function ye(t,e,i,r,a){let n=t._x1,o=t._y1,l=t._x2,h=t._y2;if(t._l01_a>s.epsilon){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>s.epsilon){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);l=(l*s+t._x1*t._l23_2a-e*t._l12_2a)/r,h=(h*s+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(n,o,l,h,t._x2,t._y2,r,t.lastPoint1)}function ve(t,e){return function(i,s,r={}){const{direction:a,startPoint:n}=r;if(i.length<2-Number(!!n))return null;if(i.length<3-Number(!!n))return Jt(i,r);const o=Zt(t,a,i);return qt(new e(o,s,n),i,2),o}}const be=ve("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ye(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const xe=ve("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ye(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class _e extends Ut{constructor(t,e,i){super(),this.type=Dt.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Ht(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,zt([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Et.ROW?s.abs(this.p0.x-this.p2.x):t===Et.COLUMN?s.abs(this.p0.y-this.p2.y):0}getAngleAt(t){const e=s.max(t-.01,0),i=s.min(t+.01,1),r=this.getPointAt(e),a=this.getPointAt(i);return s.atan2(a.y-r.y,a.x-r.x)}draw(t,e,i,r,a,n){if(t.moveTo(this.p0.x*r+e,this.p0.y*a+i),n>=1)t.quadraticCurveTo(this.p1.x*r+e,this.p1.y*a+i,this.p2.x*r+e,this.p2.y*a+i);else if(n>0){const[o]=function(t,e){const{p0:i,p1:r,p2:a}=t,n=Ht(i,r,a,e),o=s.PointService.pointAtPP(i,r,e),l=s.PointService.pointAtPP(r,a,e);return[new _e(i,o,n),new _e(n,l,a)]}(this,n);t.quadraticCurveTo(o.p1.x*r+e,o.p1.y*a+i,o.p2.x*r+e,o.p2.y*a+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Se{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Xt(new s.Point(this._lastX,this._lastY),new s.Point(t,e))}quadraticCurveTo(t,e,i,r){const a=new _e(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r));this.path.addCurve(a),this._lastX=i,this._lastY=r}bezierCurveTo(t,e,i,r,a,n){const o=new $t(new s.Point(this._lastX,this._lastY),new s.Point(t,e),new s.Point(i,r),new s.Point(a,n));this.path.addCurve(o),this._lastX=a,this._lastY=n}arcTo(t,e,i,s,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,r,a,n,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,r,a){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ae(t,e,i){var r,a;switch(e){case"linear":default:return Jt(t,i);case"basis":return ie(t,i);case"monotoneX":return he(t,i);case"monotoneY":return ce(t,i);case"step":return pe(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:r,startPoint:a}=i;if(t.length<2-Number(!!a))return null;const n=new Yt("step",null!=r?r:s.abs(t[t.length-1].x-t[0].x)>s.abs(t[t.length-1].y-t[0].y)?Et.ROW:Et.COLUMN);return ge(new ue(n,e,a),t),n}(t,.5,i);case"stepBefore":return pe(t,0,i);case"stepAfter":return pe(t,1,i);case"catmullRom":return be(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"catmullRomClosed":return xe(t,null!==(a=null==i?void 0:i.curveTension)&&void 0!==a?a:.5,i);case"linearClosed":return fe(t,i)}}class Te extends xt{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new bt(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([At.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([At.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([At.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,a){return this.commandList.push([At.C,t,e,i,s,r,a]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,r,a),this}arcTo(t,e,i,s,r){return this.commandList.push([At.AT,t,e,i,s,r]),this._ctx&&this._ctx.arcTo(t,e,i,s,r),this}ellipse(t,e,i,s,r,a,n,o){return this.commandList.push([At.E,t,e,i,s,r,a,n,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,r,a,n,o),this}rect(t,e,i,s){return this.commandList.push([At.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,r,a){return this.commandList.push([At.A,t,e,i,s,r,a]),this._ctx&&this._ctx.arc(t,e,i,s,r,a),this}closePath(){return this.commandList.push([At.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Se(this);jt(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[At.M]=t=>`M${t[1]} ${t[2]}`,t[At.L]=t=>`L${t[1]} ${t[2]}`,t[At.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[At.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[At.A]=t=>{const e=[],i=t[1],s=t[2],r=t[3];((t,e,i,s,r,a,n,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e<u;e++){const i=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),d=Math.cos(i),u=Math.sin(i),g=Math.cos(l),m=Math.sin(l),f=d*a+s,y=u*n+r,v=g*a+s,b=m*n+r,x=o?-1:1,_=a*c*x,S=n*c*x;t.push(f-_*u,y+S*d,v+_*m,b-S*g,v,b)}})(e,t[4],t[5],i,s,r,r,t[6]);let a="";for(let t=0;t<e.length;t+=6)a+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return a},t[At.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[At.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,r){this.clear();const a=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const r=[];for(let t=0,a=e.length;t<a;t++)if(Tt=e[t],Ct=Tt.slice(1),Mt=Tt[0],i=[Mt],s=Ct.match(_t),null!==s){for(let t=0,e=s.length;t<e;t++)kt=s[t],wt=parseFloat(kt),Number.isNaN(wt)||i.push(wt);if(Pt=St[Mt],i.length-1>Pt){let t,e=Mt;for(let s=1,a=i.length;s<a;s+=Pt){t=[e];for(let e=s,r=s+Pt;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}(t);return this._runCommandStrList(a,e,i,s,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const r=Ae(e,i);"x"===s?this.direction=Et.ROW:"y"===s?this.direction=Et.COLUMN:"auto"===s&&(this.direction=r.direction),this._curves=r.curves}fromCustomPath2D(t,e,i,s,r){return this.clear(),this._runCommandList(t.commandList,e,i,s,r),this._updateBounds(),this}transform(t,e,i,s){const r=this.commandList;if(!this.transformCbList){const t=[];t[At.M]=this.moveToTransform,t[At.L]=this.lineToTransform,t[At.Q]=this.quadraticCurveToTransform,t[At.C]=this.bezierCurveToTransform,t[At.AT]=this.arcToTransform,t[At.E]=this.ellipseTransform,t[At.R]=this.rectTransform,t[At.A]=this.arcTransform,t[At.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*s+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*(s+r)/2}ellipseTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}rectTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}arcTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*(s+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,r=1){let a,n,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m<f;++m){switch(a=t[m],1===s&&1===r||(a=Me(a,s,r)),a[0]){case"l":d+=a[1],u+=a[2],this.lineTo(d+e,u+i);break;case"L":d=a[1],u=a[2],this.lineTo(d+e,u+i);break;case"h":d+=a[1],this.lineTo(d+e,u+i);break;case"H":d=a[1],this.lineTo(d+e,u+i);break;case"v":u+=a[1],this.lineTo(d+e,u+i);break;case"V":u=a[1],this.lineTo(d+e,u+i);break;case"m":d+=a[1],u+=a[2],this.moveTo(d+e,u+i);break;case"M":d=a[1],u=a[2],this.moveTo(d+e,u+i);break;case"c":n=d+a[5],o=u+a[6],p=d+a[3],g=u+a[4],this.bezierCurveTo(d+a[1]+e,u+a[2]+i,p+e,g+i,n+e,o+i),d=n,u=o;break;case"C":d=a[5],u=a[6],p=a[3],g=a[4],this.bezierCurveTo(a[1]+e,a[2]+i,p+e,g+i,d+e,u+i);break;case"s":n=d+a[3],o=u+a[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=d+a[1],h=u+a[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,n+e,o+i),p=l,g=h,d=n,u=o;break;case"S":n=a[3],o=a[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=a[1],h=a[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,n+e,o+i),p=l,g=h,d=n,u=o;break;case"q":n=d+a[3],o=u+a[4],p=d+a[1],g=u+a[2],this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o;break;case"Q":n=a[3],o=a[4],this.quadraticCurveTo(a[1]+e,a[2]+i,n+e,o+i),d=n,u=o,p=a[1],g=a[2];break;case"t":n=d+a[1],o=u+a[2],null===c[0].match(/[QqTt]/)?(p=d,g=u):"t"===c[0]?(p=2*d-l,g=2*u-h):"q"===c[0]&&(p=2*d-p,g=2*u-g),l=p,h=g,this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o,p=d+a[1],g=u+a[2];break;case"T":n=a[1],o=a[2],p=2*d-p,g=2*u-g,this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o;break;case"a":Rt(this,d+e,u+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+e,a[7]+u+i]),d+=a[6],u+=a[7];break;case"A":Rt(this,d+e,u+i,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+i]),d=a[6],u=a[7];break;case"z":case"Z":this.closePath()}c=a}}_runCommandList(t,e=0,i=0,s=1,r=1){if(0!==e||0!==i||1!==s||1!==r)for(let a=0,n=t.length;a<n;++a){const n=t[a].slice();switch(n[0]){case At.L:this.lineToTransform(n,e,i,s,r);break;case At.M:this.moveToTransform(n,e,i,s,r);break;case At.C:this.bezierCurveToTransform(n,e,i,s,r);break;case At.Q:this.quadraticCurveToTransform(n,e,i,s,r);break;case At.A:this.arcToTransform(n,e,i,s,r);break;case At.E:this.ellipseTransform(n,e,i,s,r);break;case At.R:this.rectTransform(n,e,i,s,r);break;case At.AT:this.arcToTransform(n,e,i,s,r);break;case At.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),jt(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Et.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.y-e.p1.y)}if(this.direction===Et.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return s.abs(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s<this._curves.length;s++){e=this._curves[s];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,r){this.tryBuildCurves();const a=this.getLength()*r;let n=0;for(let r=0;r<this._curves.length;r++){const o=this._curves[r],l=o.getLength(this.direction);if(!(n+l<=a)){const r=1-(n+l-a)/l;o.draw(t,i,s,e,e,r);break}o.draw(t,i,s,e,e,1),n+=l}}}const Ce=["l",0,0,0,0,0,0,0];function Me(t,e,i){const s=Ce[0]=t[0];if("a"===s||"A"===s)Ce[1]=e*t[1],Ce[2]=i*t[2],Ce[3]=t[3],Ce[4]=t[4],Ce[5]=t[5],Ce[6]=e*t[6],Ce[7]=i*t[7];else if("h"===s||"H"===s)Ce[1]=e*t[1];else if("v"===s||"V"===s)Ce[1]=i*t[1];else for(let s=1,r=t.length;s<r;++s)Ce[s]=(s%2==1?e:i)*t[s];return Ce}var ke;!function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ke||(ke={}));const we={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new s.Matrix},Pe={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Oe=Object.assign({outerBorder:Object.assign(Object.assign({},Pe),{distance:0}),innerBorder:Object.assign(Object.assign({},Pe),{distance:0})},Pe),Be={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:ke.fontBounding,keepCenterInLine:!1},Le=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,backgroundPosition:"top-left",blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Oe),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Ee={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},De=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null,roughStyle:null},{_debug_bounds:!1}),Le),we),Fe=Object.assign(Object.assign({},De),{startAngle:0,endAngle:s.pi2,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,clipRange:1,cap:!1,forceShowCap:!1}),Ie=Object.assign(Object.assign(Object.assign({},De),Ee),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),Re=Object.assign(Object.assign({},De),{radius:1,startAngle:0,endAngle:s.pi2}),Ne=Object.assign(Object.assign({},De),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1,cornerType:"round"}),je=Object.assign(Object.assign({},De),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Ue=Object.assign(Object.assign(Object.assign({},De),Ee),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),ze=Object.assign(Object.assign({},De),{path:new Te,fillStrokeOrder:1,clipRange:1,customPath:()=>{s.Logger.getInstance().warn("空函数")}}),Ve=Object.assign(Object.assign({},De),{points:[],cornerRadius:0,closePath:!0}),Ge=Object.assign(Object.assign({},De),{width:100,height:100,spikes:5,thickness:.5}),We=Object.assign(Object.assign({},De),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},De),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const He=Object.assign(Object.assign({},De),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),$e=Object.assign(Object.assign(Object.assign({},De),Be),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Xe=Object.assign(Object.assign(Object.assign({},De),Be),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ye=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},De),{fill:!0,cornerRadius:0,cornerType:"round"}),Ke=Object.assign(Object.assign({},Ye),{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});function qe(t){return function(){var t,e;const i=null===(t=yt.global)||void 0===t?void 0:t.env,s=i?null===(e=yt.canvasFactory)||void 0===e?void 0:e.call(yt,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Ze=1e-4,Qe=Math.sqrt(3),Je=1/3;function ti(t){return t>-pi&&t<pi}function ei(t){return t>pi||t<-pi}const ii=[0,0],si=[0,0],ri=[0,0];function ai(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ni(t,e,i,s){const r=1-s;return r*(r*t+2*s*e)+s*s*i}function oi(t,e,i,s,r){const a=1-r;return a*a*(a*t+3*r*e)+r*r*(r*s+3*a*i)}function li(t){return(t%=s.pi2)<0&&(t+=s.pi2),t}function hi(t,e,i,s,r,a,n,o,l){if(0===n)return!1;const h=n;return!(l>e+h&&l>s+h&&l>a+h||l<e-h&&l<s-h&&l<a-h||o>t+h&&o>i+h&&o>r+h||o<t-h&&o<i-h&&o<r-h)&&function(t,e,i,s,r,a,n,o,l){let h=0,c=.005,d=1/0;ii[0]=n,ii[1]=o;for(let n=0;n<1;n+=.05){si[0]=ni(t,i,r,n),si[1]=ni(e,s,a,n);const o=ai(ii,si);o<d&&(h=n,d=o)}d=1/0;for(let n=0;n<32&&!(c<Ze);n++){const n=h-c,o=h+c;si[0]=ni(t,i,r,n),si[1]=ni(e,s,a,n);const l=ai(si,ii);if(n>=0&&l<d)h=n,d=l;else{ri[0]=ni(t,i,r,o),ri[1]=ni(e,s,a,o);const n=ai(ri,ii);o<=1&&n<d?(h=o,d=n):c*=.5}}return l&&(l[0]=ni(t,i,r,h),l[1]=ni(e,s,a,h)),Math.sqrt(d)}(t,e,i,s,r,a,o,l,null)<=h/2}function ci(t,e,i,s,r,a,n,o,l,h,c){if(0===l)return!1;const d=l;return!(c>e+d&&c>s+d&&c>a+d&&c>o+d||c<e-d&&c<s-d&&c<a-d&&c<o-d||h>t+d&&h>i+d&&h>r+d&&h>n+d||h<t-d&&h<i-d&&h<r-d&&h<n-d)&&function(t,e,i,s,r,a,n,o,l,h,c){let d,u,p,g,m=0,f=.005,y=1/0;ii[0]=l,ii[1]=h;for(let l=0;l<1;l+=.05)si[0]=oi(t,i,r,n,l),si[1]=oi(e,s,a,o,l),p=ai(ii,si),p<y&&(m=l,y=p);y=1/0;for(let l=0;l<32&&!(f<Ze);l++)d=m-f,u=m+f,si[0]=oi(t,i,r,n,d),si[1]=oi(e,s,a,o,d),p=ai(si,ii),d>=0&&p<y?(m=d,y=p):(ri[0]=oi(t,i,r,n,u),ri[1]=oi(e,s,a,o,u),g=ai(ri,ii),u<=1&&g<y?(m=u,y=g):f*=.5);return c&&(c[0]=oi(t,i,r,n,m),c[1]=oi(e,s,a,o,m)),Math.sqrt(y)}(t,e,i,s,r,a,n,o,h,c,null)<=d/2}function di(t,e,i,r,a,n,o,l,h){if(0===o)return!1;const c=o;l-=t,h-=e;const d=Math.sqrt(l*l+h*h);if(d-c>i||d+c<i)return!1;if(Math.abs(r-a)%s.pi2<1e-4)return!0;if(n){const t=r;r=li(a),a=li(t)}else r=li(r),a=li(a);r>a&&(a+=s.pi2);let u=Math.atan2(h,l);return u<0&&(u+=s.pi2),u>=r&&u<=a||u+s.pi2>=r&&u+s.pi2<=a}function ui(t,e,i,s,r,a,n){if(0===r)return!1;const o=r,l=r/2;let h=0,c=t;if(n>e+l&&n>s+l||n<e-l&&n<s-l||a>t+l&&a>i+l||a<t-l&&a<i-l)return!1;if(t===i)return Math.abs(a-t)<=o/2;h=(e-s)/(t-i),c=(t*s-i*e)/(t-i);const d=h*a-n+c;return d*d/(h*h+1)<=o/2*o/2}const pi=1e-4;function gi(t,e,i,s,r){const a=6*i-12*e+6*t,n=9*e+3*s-3*t-9*i,o=3*e-3*t;let l=0;if(ti(n)){if(ei(a)){const t=-o/a;t>=0&&t<=1&&(r[l++]=t)}}else{const t=a*a-4*n*o;if(ti(t))r[0]=-a/(2*n);else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*n),s=(-a-e)/(2*n);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}const mi=[-1,-1,-1],fi=[-1,-1];function yi(){const t=fi[0];fi[0]=fi[1],fi[1]=t}function vi(t,e,i,s,r,a,n,o,l,h){if(h>e&&h>s&&h>a&&h>o||h<e&&h<s&&h<a&&h<o)return 0;const c=function(t,e,i,s,r,a){const n=s+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-r,c=o*o-3*n*l,d=o*l-9*n*h,u=l*l-3*o*h;let p=0;if(ti(c)&&ti(d))if(ti(o))a[0]=0;else{const t=-l/o;t>=0&&t<=1&&(a[p++]=t)}else{const t=d*d-4*c*u;if(ti(t)){const t=d/c,e=-o/n+t,i=-t/2;e>=0&&e<=1&&(a[p++]=e),i>=0&&i<=1&&(a[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*n*(-d+e),s=c*o+1.5*n*(-d-e);i=i<0?-Math.pow(-i,Je):Math.pow(i,Je),s=s<0?-Math.pow(-s,Je):Math.pow(s,Je);const r=(-o-(i+s))/(3*n);r>=0&&r<=1&&(a[p++]=r)}else{const t=(2*c*o-3*n*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),r=(-o-2*i*s)/(3*n),l=(-o+i*(s+Qe*Math.sin(e)))/(3*n),h=(-o+i*(s-Qe*Math.sin(e)))/(3*n);r>=0&&r<=1&&(a[p++]=r),l>=0&&l<=1&&(a[p++]=l),h>=0&&h<=1&&(a[p++]=h)}}return p}(e,s,a,o,h,mi);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h<c;h++){const c=mi[h],m=0===c||1===c?.5:1;oi(t,i,r,n,c)<l||(u<0&&(u=gi(e,s,a,o,fi),fi[1]<fi[0]&&u>1&&yi(),p=oi(e,s,a,o,fi[0]),u>1&&(g=oi(e,s,a,o,fi[1]))),2===u?c<fi[0]?d+=p<e?m:-m:c<fi[1]?d+=g<p?m:-m:d+=o<g?m:-m:c<fi[0]?d+=p<e?m:-m:d+=o<p?m:-m)}return d}function bi(t,e,i,s,r,a,n,o){if(o>e&&o>s&&o>a||o<e&&o<s&&o<a)return 0;const l=function(t,e,i,s,r){const a=t-2*e+i,n=2*(e-t),o=t-s;let l=0;if(ti(a)){if(ei(n)){const t=-o/n;t>=0&&t<=1&&(r[l++]=t)}}else{const t=n*n-4*a*o;if(ti(t)){const t=-n/(2*a);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-n+e)/(2*a),s=(-n-e)/(2*a);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}(e,s,a,o,mi);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,a);if(h>=0&&h<=1){let o=0;const c=ni(e,s,a,h);for(let s=0;s<l;s++){const l=0===mi[s]||1===mi[s]?.5:1;ni(t,i,r,mi[s])<n||(mi[s]<h?o+=c<e?l:-l:o+=a<c?l:-l)}return o}const c=0===mi[0]||1===mi[0]?.5:1;return ni(t,i,r,mi[0])<n?0:a<e?c:-c}function xi(t,e,i,r,a,n,o,l){if((l-=e)>i||l<-i)return 0;const h=Math.sqrt(i*i-l*l);mi[0]=-h,mi[1]=h;const c=Math.abs(r-a);if(c<1e-4)return 0;if(c>=s.pi2-1e-4){r=0,a=s.pi2;const e=n?1:-1;return o>=mi[0]+t&&o<=mi[1]+t?e:0}if(r>a){const t=r;r=a,a=t}r<0&&(r+=s.pi2,a+=s.pi2);let d=0;for(let e=0;e<2;e++){const i=mi[e];if(i+t>o){let t=Math.atan2(l,i),e=n?1:-1;t<0&&(t=s.pi2+t),(t>=r&&t<=a||t+s.pi2>=r&&t+s.pi2<=a)&&(t>s.pi/2&&t<1.5*s.pi&&(e=-e),d+=e)}}return d}function _i(t){return Math.round(t/s.pi*1e8)/1e8%2*s.pi}function Si(t,e){let i=_i(t[0]);i<0&&(i+=s.pi2);const r=i-t[0];let a=t[1];a+=r,!e&&a-i>=s.pi2?a=i+s.pi2:e&&i-a>=s.pi2?a=i-s.pi2:!e&&i>a?a=i+(s.pi2-_i(i-a)):e&&i<a&&(a=i-(s.pi2-_i(a-i))),t[0]=i,t[1]=a}const Ai=[0,0];function Ti(t,e,i,r,a){const n=t,o=t.length;let l,h,c=0,d=0,u=0,p=0,g=0;for(let t=0;t<o;t++){const o=n[t],m=0===t;o[0]===At.M&&t>1&&(i||(c+=s.isPointInLine(d,u,p,g,r,a))),m&&(d=o[1],u=o[2],p=d,g=u);const f=o[0],y=o[1],v=o[2],b=o[3],x=o[4],_=o[5],S=o[6];let A=x,T=_;Ai[0]=A,Ai[1]=T,Si(Ai,Boolean(o[6])),A=Ai[0],T=Ai[1];const C=A,M=T-A,k=!!(1-(o[6]?0:1)),w=(r-y)*b/b+y;switch(f){case At.M:p=y,g=v,d=p,u=g;break;case At.L:if(i){if(ui(d,u,y,v,e,r,a))return!0}else c+=s.isPointInLine(d,u,y,v,r,a)||0;d=y,u=v;break;case At.C:if(i){if(ci(d,u,y,v,b,x,_,S,e,r,a))return!0}else c+=vi(d,u,y,v,b,x,_,S,r,a)||0;d=_,u=S;break;case At.Q:if(i){if(hi(d,u,y,v,b,x,e,r,a))return!0}else c+=bi(d,u,y,v,b,x,r,a)||0;d=b,u=x;break;case At.A:if(l=Math.cos(C)*b+y,h=Math.sin(C)*b+v,m?(p=l,g=h):c+=s.isPointInLine(d,u,l,h,r,a),i){if(di(y,v,b,C,C+M,k,e,w,a))return!0}else c+=xi(y,v,b,C,C+M,k,w,a);d=Math.cos(C+M)*b+y,u=Math.sin(C+M)*b+v;break;case At.R:if(p=d=y,g=u=v,l=p+b,h=g+x,i){if(ui(p,g,l,g,e,r,a)||ui(l,g,l,h,e,r,a)||ui(l,h,p,h,e,r,a)||ui(p,h,p,g,e,r,a))return!0}else c+=s.isPointInLine(l,g,l,h,r,a),c+=s.isPointInLine(p,h,p,g,r,a);break;case At.Z:if(i){if(ui(d,u,p,g,e,r,a))return!0}else c+=s.isPointInLine(d,u,p,g,r,a);d=p,u=g}}return i||(m=u,f=g,Math.abs(m-f)<pi)||(c+=s.isPointInLine(d,u,p,g,r,a)||0),0!==c;var m,f}const Ci=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=qe(Object.assign({nativeCanvas:yt.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=qe(Object.assign({nativeCanvas:yt.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Mi{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=Mi.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&s.isFunction(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&s.isFunction(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class ki extends Mi{constructor(t,e){super(),this.type=t,this.detail=e}}const wi={dispatchEvent(t){var e;if(!(t instanceof Mi))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),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 ki(t,e))}};var Pi,Oi=function(t,e,i,s){return new(i||(i=Promise))((function(r,a){function n(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(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(n,o)}l((s=s.apply(t,e||[])).next())}))};class Bi extends s.EventEmitter{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=ft.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Oi(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&s.Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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 s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<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 r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,a=s.isObject(i)&&i.once,n=s.isFunction(e)?void 0:e;return t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent,a?super.once(t,e,n):super.on(t,e,n),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const r=s.isBoolean(i,!0)&&i||s.isObject(i)&&i.capture,a=s.isFunction(e)?void 0:e;t=r?`${t}capture`:t,e=s.isFunction(e)?e:e.handleEvent;const n=s.isObject(i)&&i.once;return super.off(t,e,a,n),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return s.isObject(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class Li{static GetImage(t,e){var i;const s=Li.cache.get(t);s?"fail"===s.loadState?yt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Li.loadImage(t,e)}static GetSvg(t,e){var i;let s=Li.cache.get(t);s?"fail"===s.loadState?yt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Li.cache.set(t,s),s.dataPromise=yt.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Li.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Li.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=yt.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=yt.global.loadBlob(t):"json"===e&&(i.dataPromise=yt.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Li.isLoading&&Li.toLoadAueue.length){Li.isLoading=!0;const t=Li.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,r={type:"image",loadState:"init"};if(Li.cache.set(i,r),r.dataPromise=yt.global.loadImage(i),r.dataPromise){r.waitingMark=s;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Li.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Li.loading()})).catch((t=>{console.error(t),Li.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Li.loading()}))}}),0)}static loadImage(t,e){const i=Ei(t,Li.toLoadAueue);if(-1!==i)return Li.toLoadAueue[i].marks.push(e),void Li.loading();Li.toLoadAueue.push({url:t,marks:[e]}),Li.loading()}static improveImageLoading(t){const e=Ei(t,Li.toLoadAueue);if(-1!==e){const t=Li.toLoadAueue.splice(e,1);Li.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ei(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Li.cache=new Map,Li.isLoading=!1,Li.toLoadAueue=[],Li.onLoadSuccessCb=[],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"}(Pi||(Pi={}));const Di=[0,0,0,0],Fi=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ii=[1,2,3,0,1,2,3,0];function Ri(t,e,i,r){for(;t>=s.pi2;)t-=s.pi2;for(;t<0;)t+=s.pi2;for(;t>e;)e+=s.pi2;Fi[0].x=i,Fi[1].y=i,Fi[2].x=-i,Fi[3].y=-i;const a=Math.ceil(t/s.halfPi)%4,n=Math.ceil(e/s.halfPi)%4;if(r.add(s.cos(t)*i,s.sin(t)*i),r.add(s.cos(e)*i,s.sin(e)*i),a!==n||e-t>s.pi){let t=!1;for(let e=0;e<Ii.length;e++)if(t||a!==Ii[e]){if(t&&n===Ii[e])break;if(t){const t=Fi[Ii[e]];r.add(t.x,t.y)}}else{t=!0;const e=Fi[a];r.add(e.x,e.y)}}}class Ni{bounds(t,e){if(s.isNumber(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}}function ji(t,e,i,r,a){return a?t.arc(i,r,e,0,s.tau,!1,a):t.arc(i,r,e,0,s.tau),!1}var Ui=new class extends Ni{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,r){return ji(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,a){return ji(t,this.parseSize(e)/2+r,i,s,a)}drawToSvgPath(t,e,i,s){const r=this.parseSize(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`}};var zi=new class extends Ni{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,r){return function(t,e,i,s,r){return t.moveTo(-3*e+i,-e+s,r),t.lineTo(-e+i,-e+s,r),t.lineTo(-e+i,-3*e+s,r),t.lineTo(e+i,-3*e+s,r),t.lineTo(e+i,-e+s,r),t.lineTo(3*e+i,-e+s,r),t.lineTo(3*e+i,e+s,r),t.lineTo(e+i,e+s,r),t.lineTo(e+i,3*e+s,r),t.lineTo(-e+i,3*e+s,r),t.lineTo(-e+i,e+s,r),t.lineTo(-3*e+i,e+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r)}drawOffset(t,e,i,s,r,a){return function(t,e,i,s,r,a){return t.moveTo(-3*e+i-r,-e+s-r,a),t.lineTo(-e+i-r,-e+s-r,a),t.lineTo(-e+i-r,-3*e+s-r,a),t.lineTo(e+i+r,-3*e+s-r,a),t.lineTo(e+i+r,-e+s-r,a),t.lineTo(3*e+i+r,-e+s-r,a),t.lineTo(3*e+i+r,e+s+r,a),t.lineTo(e+i+r,e+s+r,a),t.lineTo(e+i+r,3*e+s+r,a),t.lineTo(-e+i-r,3*e+s+r,a),t.lineTo(-e+i-r,e+s+r,a),t.lineTo(-3*e+i-r,e+s+r,a),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r,a)}};function Vi(t,e,i,s,r){return t.moveTo(i,s-e,r),t.lineTo(e+i,s,r),t.lineTo(i,s+e,r),t.lineTo(i-e,s,r),t.closePath(),!0}var Gi=new class extends Ni{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,r){return Vi(t,this.parseSize(e)/2,i,s,r)}drawFitDir(t,e,i,s,r){return Vi(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,a){return Vi(t,this.parseSize(e)/2+r,i,s,a)}};function Wi(t,e,i,s){const r=2*e;return t.rect(i-e,s-e,r,r),!1}var Hi=new class extends Ni{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Wi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Wi(t,this.parseSize(e)/2+r,i,s)}};function $i(t,e,i,s,r=0){return t.moveTo(i+e+2*r,e+s+r),t.lineTo(i-e-2*r,e+s+r),t.lineTo(i,s-e-2*r),t.closePath(),!0}class Xi extends Ni{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return $i(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return $i(t,this.parseSize(e)/2,i,s,r)}}var Yi=new Xi;var Ki=new class extends Xi{constructor(){super(...arguments),this.type="triangle"}};const qi=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Zi=Math.sin(s.tau/10)*qi,Qi=-Math.cos(s.tau/10)*qi;function Ji(t,e,i,r){const a=Zi*e,n=Qi*e;t.moveTo(i,-e+r),t.lineTo(a+i,n+r);for(let o=1;o<5;++o){const l=s.tau*o/5,h=Math.cos(l),c=Math.sin(l);t.lineTo(c*e+i,-h*e+r),t.lineTo(h*a-c*n+i,c*a+h*n+r)}return t.closePath(),!0}var ts=new class extends Ni{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Ji(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ji(t,this.parseSize(e)/2+r,i,s)}};const es=s.sqrt(3);function is(t,e,i,s){const r=e,a=r/es,n=a/5,o=e;return t.moveTo(0+i,-r+s),t.lineTo(a/2+i,s),t.lineTo(n/2+i,s),t.lineTo(n/2+i,o+s),t.lineTo(-n/2+i,o+s),t.lineTo(-n/2+i,s),t.lineTo(-a/2+i,s),t.closePath(),!0}var ss=new class extends Ni{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return is(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return is(t,this.parseSize(e)/2+r,i,s)}};function rs(t,e,i,s){const r=2*e;return t.moveTo(i,-e+s),t.lineTo(r/3/2+i,e+s),t.lineTo(-r/3/2+i,e+s),t.closePath(),!0}var as=new class extends Ni{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return rs(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return rs(t,this.parseSize(e)/2+r,i,s)}};function ns(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var os=new class extends Ni{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return ns(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ns(t,this.parseSize(e)/2+r,i,s)}};const ls=-.5,hs=s.sqrt(3)/2,cs=1/s.sqrt(12);function ds(t,e,i,s){const r=e/2,a=e*cs,n=r,o=e*cs+e,l=-n,h=o;return t.moveTo(r+i,a+s),t.lineTo(n+i,o+s),t.lineTo(l+i,h+s),t.lineTo(ls*r-hs*a+i,hs*r+ls*a+s),t.lineTo(ls*n-hs*o+i,hs*n+ls*o+s),t.lineTo(ls*l-hs*h+i,hs*l+ls*h+s),t.lineTo(ls*r+hs*a+i,ls*a-hs*r+s),t.lineTo(ls*n+hs*o+i,ls*o-hs*n+s),t.lineTo(ls*l+hs*h+i,ls*h-hs*l+s),t.closePath(),!1}var us=new class extends Ni{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return ds(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ds(t,this.parseSize(e)/2+r,i,s)}};function ps(t,e,i,s,r){return t.moveTo(-e+i-2*r,s),t.lineTo(e+i+r,e+s+2*r),t.lineTo(e+i+r,s-e-2*r),t.closePath(),!0}var gs=new class extends Ni{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ps(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,r){return ps(t,this.parseSize(e)/2,i,s,r)}};function ms(t,e,i,s,r=0){return t.moveTo(i-e-r,e+s+2*r),t.lineTo(e+i+2*r,s),t.lineTo(i-e-r,s-e-2*r),t.closePath(),!0}var fs=new class extends Ni{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return ms(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ms(t,this.parseSize(e)/2,i,s,r)}};function ys(t,e,i,s,r=0){return t.moveTo(i-e-2*r,s-e-r),t.lineTo(i+e+2*r,s-e-r),t.lineTo(i,s+e+2*r),t.closePath(),!0}var vs=new class extends Ni{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ys(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ys(t,this.parseSize(e)/2,i,s,r)}};const bs=s.sqrt(3);function xs(t,e,i,s){const r=e*bs;return t.moveTo(i,s+-r/3*2),t.lineTo(e+i,s+r),t.lineTo(i-e,s+r),t.closePath(),!0}var _s=new class extends Ni{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return xs(t,this.parseSize(e)/2/bs,i,s)}drawOffset(t,e,i,s,r){return xs(t,this.parseSize(e)/2/bs+r,i,s)}};function Ss(t,e,i,s){const r=2*e;return t.moveTo(e+i,s-r),t.lineTo(i-e,s),t.lineTo(e+i,r+s),!0}var As=new class extends Ni{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return Ss(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Ss(t,this.parseSize(e)/4+r,i,s)}};function Ts(t,e,i,s){const r=2*e;return t.moveTo(i-e,s-r),t.lineTo(i+e,s),t.lineTo(i-e,r+s),!0}var Cs=new class extends Ni{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Ts(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Ts(t,this.parseSize(e)/4+r,i,s)}};function Ms(t,e,i,s){const r=2*e;return t.moveTo(i-r,s+e),t.lineTo(i,s-e),t.lineTo(i+r,s+e),!0}var ks=new class extends Ni{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Ms(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Ms(t,this.parseSize(e)/4+r,i,s)}};function ws(t,e,i,s){const r=2*e;return t.moveTo(i-r,s-e),t.lineTo(i,s+e),t.lineTo(i+r,s-e),!0}var Ps=new class extends Ni{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return ws(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return ws(t,this.parseSize(e)/4+r,i,s)}};function Os(t,e,i,s,r){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Bs=new class extends Ni{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,r){return Os(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return Os(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function Ls(t,e,i,s,r){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Es=new class extends Ni{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,r){return Ls(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return Ls(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function Ds(t,e,i,s,r){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Fs=new class extends Ni{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,r){return Ds(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return Ds(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function Is(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Rs(t,e,i,s){const r=e,a=e/2;return t.rect(i-r/2,s-a/2,r,a),!1}var Ns=new class extends Ni{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,r){return s.isNumber(e)?Rs(t,e,i,r):Is(t,e,i,r)}drawWithClipRange(t,e,i,r,a,n,o){s.isNumber(e)&&(e=[e,e/2]);const l=2*(e[0]+e[1])*a,h=[{x:i+e[0]/2,y:r-e[1]/2},{x:i+e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r-e[1]/2}];let c=0,d=h[3];t.moveTo(d.x,d.y);for(let e=0;e<h.length;e++){const i=h[e],s=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(c+s>l){const e=(i.x-d.x)*(l-c)/s,r=(i.y-d.y)*(l-c)/s;t.lineTo(d.x+e,d.y+r);break}t.lineTo(i.x,i.y),d=i,c+=s}return!1}drawOffset(t,e,i,r,a){return s.isNumber(e)?Rs(t,e+2*a,i,r):Is(t,[e[0]+2*a,e[1]+2*a],i,r)}};const js=new s.AABBBounds;class Us{constructor(t,e,i=!1){this.pathStr="",this.type=t,s.isArray(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,r,a,n){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),jt(r.path.commandList,t,i,s,e,e),n&&n(r.path,r.attribute)})),!1):(jt(this.path.commandList,t,i,s,e+r,e+r),!1)}draw(t,e,i,s,r,a){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,r,a)}parseSize(t){return s.isNumber(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,r,a,n){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((a=>{a.path.drawWithClipRange(t,e,i,s,r),n&&n(a.path,a.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,r),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{js.x1=i.bounds.x1*t,js.y1=i.bounds.y1*t,js.x2=i.bounds.x2*t,js.y2=i.bounds.y2*t,e.union(js)}))}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 zs={};[Ui,zi,Gi,Hi,_s,Ki,ts,ss,as,os,us,gs,fs,Yi,vs,As,Cs,ks,Ps,Ns,Bs,Es,Fs].forEach((t=>{zs[t.type]=t}));const Vs={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Gs{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Ws(t,e,i,s){const r=t.indexOf(e,i);if(-1===r)throw new Error(s);return r+e.length-1}function Hs(t,e,i,s=">"){const r=function(t,e,i=">"){let s,r="";for(let a=e;a<t.length;a++){let e=t[a];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===i[0]){if(!i[1])return{data:r,index:a};if(t[a+1]===i[1])return{data:r,index:a}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,s);if(!r)return;let a=r.data;const n=r.index,o=a.search(/\s/);let l=a,h=!0;-1!==o&&(l=a.substr(0,o).replace(/\s\s*$/,""),a=a.substr(o+1));const c=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==r.data.substr(t+1))}return{tagName:l,tagExp:a,closeIndex:n,attrExpPresent:h,rawTagName:c}}const $s=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Xs{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const r=function(t,e){const i=[];let s=e.exec(t);for(;s;){const r=[];r.startIndex=e.lastIndex-s[0].length;const a=s.length;for(let t=0;t<a;t++)r.push(s[t]);i.push(r),s=e.exec(t)}return i}(t,$s),a=r.length;for(let t=0;t<a;t++){const e=r[t][1],i=r[t][4];e&&(s[e]=void 0===i||(isNaN(i)?i:Number(i)))}return s}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new Gs("!xml");let i=e,s="",r="";for(let a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){const e=Ws(t,">",a,"Closing Tag is not closed."),n=r.lastIndexOf(".");r=r.substring(0,n),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",a=e}else if("?"===t[a+1])a=Hs(t,a,!1,"?>").closeIndex+1;else if("!--"===t.substr(a+1,3))a=Ws(t,"--\x3e",a+4,"Comment is not closed.");else{const n=Hs(t,a,!1);let o=n.tagName,l=n.tagExp;const h=n.attrExpPresent,c=n.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1);const t=new Gs(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new Gs(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),i=t}s="",a=c}else s+=t[a];return e.child}}function Ys(t,e){return Ks(t)}function Ks(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],a=qs(r);if(void 0!==a&&r[a]){const t=Ks(r[a]);s=t,Object.keys(s).length,r[":@"]&&Zs(t,r[":@"]),void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(t)):i[a]=t}}var s;return i}function qs(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Zs(t,e,i){if(e){const i=Object.keys(e),s=i.length;for(let r=0;r<s;r++){const s=i[r];t[s]=e[s]}}}class Qs{constructor(t){this.options=Object.assign({},Qs.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Ys(new Xs(this.options).parseXml(t),this.options)}}Qs.defaultOptions={};let Js=0;function tr(){return Js++}var er;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(er||(er={}));const ir=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>ir.set(t,!0)));const sr=new Map;[""].forEach((t=>sr.set(t,!0)));const rr=tr(),ar=tr();tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr(),tr();const nr={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},or=Object.keys(nr),lr={duration:200,easing:"cubicOut"};function hr(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function cr(t,e,i){const s=i[0],r=i[1],a=i[2];let n,o,l,h,c,d,u,p,g,m,f,y;return e===t?(t[12]=e[0]*s+e[4]*r+e[8]*a+e[12],t[13]=e[1]*s+e[5]*r+e[9]*a+e[13],t[14]=e[2]*s+e[6]*r+e[10]*a+e[14],t[15]=e[3]*s+e[7]*r+e[11]*a+e[15]):(n=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],y=e[11],t[0]=n,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=y,t[12]=n*s+c*r+g*a+e[12],t[13]=o*s+d*r+m*a+e[13],t[14]=l*s+u*r+f*a+e[14],t[15]=h*s+p*r+y*a+e[15]),t}function dr(t,e,i){const s=e[0],r=e[1],a=e[2],n=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],y=e[14],v=e[15];let b=i[0],x=i[1],_=i[2],S=i[3];return t[0]=b*s+x*o+_*d+S*m,t[1]=b*r+x*l+_*u+S*f,t[2]=b*a+x*h+_*p+S*y,t[3]=b*n+x*c+_*g+S*v,b=i[4],x=i[5],_=i[6],S=i[7],t[4]=b*s+x*o+_*d+S*m,t[5]=b*r+x*l+_*u+S*f,t[6]=b*a+x*h+_*p+S*y,t[7]=b*n+x*c+_*g+S*v,b=i[8],x=i[9],_=i[10],S=i[11],t[8]=b*s+x*o+_*d+S*m,t[9]=b*r+x*l+_*u+S*f,t[10]=b*a+x*h+_*p+S*y,t[11]=b*n+x*c+_*g+S*v,b=i[12],x=i[13],_=i[14],S=i[15],t[12]=b*s+x*o+_*d+S*m,t[13]=b*r+x*l+_*u+S*f,t[14]=b*a+x*h+_*p+S*y,t[15]=b*n+x*c+_*g+S*v,t}function ur(t,e,i){const s=e[0],r=e[1],a=e[2];let n=i[3]*s+i[7]*r+i[11]*a+i[15];return n=n||1,t[0]=(i[0]*s+i[4]*r+i[8]*a+i[12])/n,t[1]=(i[1]*s+i[5]*r+i[9]*a+i[13])/n,t[2]=(i[2]*s+i[6]*r+i[10]*a+i[14])/n,t}class pr{constructor(){this.pools=[]}static identity(t){return hr(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 pr.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(...t){this.pools=[]}}const gr=new class{constructor(){this.pools=[]}allocate(t,e,i,r,a,n){if(!this.pools.length)return new s.Matrix(t,e,i,r,a,n);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=r,o.e=a,o.f=n,o}allocateByObj(t){if(!this.pools.length)return new s.Matrix(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}},mr=new pr,fr=new s.Matrix(1,0,0,1,0,0),yr={x:0,y:0};class vr{get nativeContext(){return this.path}constructor(t,e){this.matrix=new s.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.path=new Te,this._clearMatrix=new s.Matrix(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return gr.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new s.Matrix(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(gr.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(gr.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,r=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,s,r,a,n=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*r,o*a),n&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,r,a,n=!0){this.matrix.multiply(t,e,i,s,r,a),n&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,r,a){this.path.arc(t,e,i,s,r,a)}arcTo(t,e,i,s,r){this.path.arcTo(t,e,i,s,r)}bezierCurveTo(t,e,i,s,r,a){this.path.bezierCurveTo(t,e,i,s,r,a)}closePath(){this.path.closePath()}ellipse(t,e,i,s,r,a,n,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,r,a){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},yr),function(t,e,i){return Ti(t,0,!1,e,i)}(this.path.commandList,yr.x,yr.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},yr);const i=function(t,e,i){let s=e;const{a:r,b:a,c:n,d:o}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+a*a),h=Math.sign(o)*Math.sqrt(n*n+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ti(t,e,!0,i,s)}(this.path.commandList,i,yr.x,yr.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,r){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,r){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(fr,t,e)}setClearMatrix(t,e,i,s,r,a){this._clearMatrix.setValue(t,e,i,s,r,a)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>gr.free(t))),this.stack.length=0}}var br;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(br||(br={}));class xr{static Get(t,e=br.Color1,i=[0,0,0,1]){if(e===br.Color1){const e=xr.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const r=s.Color.parseColorString(t);if(r){const e=[r.r/255,r.g/255,r.b/255,r.opacity];xr.store1[t]=e,xr.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const r=xr.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;const a=s.Color.parseColorString(t);return a&&(xr.store1[t]=[a.r/255,a.g/255,a.b/255,a.opacity],xr.store255[t]=[a.r,a.g,a.b,a.opacity],i[0]=a.r,i[1]=a.g,i[2]=a.b,i[3]=a.opacity),i}static Set(t,e,i){if(e===br.Color1){if(xr.store1[t])return;xr.store1[t]=i,xr.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(xr.store255[t])return;xr.store255[t]=i,xr.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}xr.store255={},xr.store1={};const _r=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Sr(t){return null==t?void 0:t}class Ar{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const r=null!==(i=t.priority)&&void 0!==i?i:0,a=null!==(s=e.priority)&&void 0!==s?s:0;return r!==a?r-a:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const r=new Map;return e.forEach((([,t])=>{var e,i,a,n;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),r.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Sr(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(a=t.exclude)&&void 0!==a?a:[]),suppress:new Set(null!==(n=t.suppress)&&void 0!==n?n:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(r,"exclude"),this.expandRelationClosure(r,"suppress"),r}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>_r.has(t)))){const r=e;return{name:null!==(i=r.name)&&void 0!==i?i:t,priority:null!==(s=r.priority)&&void 0!==s?s:0,patch:Sr(r.patch),resolver:r.resolver,declaredAffectedKeys:r.declaredAffectedKeys,exclude:r.exclude,suppress:r.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const r=new Set,a=(t,e)=>{const n=i.get(t);n&&n.size&&n.forEach((t=>{t===s||e.has(t)||r.has(t)||(r.add(t),e.add(t),a(t,e),e.delete(t))}))};a(s,new Set([s])),t[e]=r}))}}function Tr(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Cr(t){if(!Tr(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Cr(t[i])})),e}function Mr(t,e){var i;const s=null!==(i=Cr(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];Tr(r)&&Tr(i)?s[t]=Mr(r,i):s[t]=Cr(i)})),s}class kr{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),r=s.active,a=r.filter((t=>!s.suppressedSet.has(t))),n=r.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,r)||!this.sameArray(this._effectiveStates,a)||!this.sameArray(this._suppressed,n);return this._activeStates=r,this._effectiveStates=a,this._suppressed=n,!o&&this.resolverCacheValid||this.recomputePatch(a),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],r=this.compiledDefinitions.get(s);r&&(r.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s<t&&(t-=1))})),r.suppress.forEach((t=>{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const r=this.compiledDefinitions.get(t);if(r&&(r.patch&&this.mergeInto(i,r.patch),r.hasResolver)){const a=s?this.resolverPatchCache.get(t):null===(e=r.resolver)||void 0===e?void 0:e.call(r,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});a&&(s||this.resolverPatchCache.set(t,a),this.mergeInto(i,a))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Cr(e[i])})):Object.keys(e).forEach((i=>{var s;const r=e[i],a=t[i],n=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];Tr(a)&&Tr(r)?t[i]=Mr(a,r):!Tr(a)&&Tr(n)&&Tr(r)?t[i]=Mr(n,r):t[i]=Cr(r)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}}var wr;!function(t){t[t.NONE=0]="NONE",t[t.PAINT=1]="PAINT",t[t.SHAPE=2]="SHAPE",t[t.BOUNDS=4]="BOUNDS",t[t.TRANSFORM=8]="TRANSFORM",t[t.LAYOUT=16]="LAYOUT",t[t.PICK=32]="PICK"}(wr||(wr={}));const Pr={fill:wr.PAINT,opacity:wr.PAINT,fillOpacity:wr.PAINT,strokeOpacity:wr.PAINT,lineDash:wr.PAINT,lineDashOffset:wr.PAINT,lineCap:wr.PAINT,lineJoin:wr.PAINT,miterLimit:wr.PAINT,shadowColor:wr.PAINT,x:wr.TRANSFORM|wr.BOUNDS,y:wr.TRANSFORM|wr.BOUNDS,scaleX:wr.TRANSFORM|wr.BOUNDS,scaleY:wr.TRANSFORM|wr.BOUNDS,angle:wr.TRANSFORM|wr.BOUNDS,anchor:wr.TRANSFORM|wr.BOUNDS,anchor3d:wr.TRANSFORM|wr.BOUNDS,postMatrix:wr.TRANSFORM|wr.BOUNDS,layout:wr.LAYOUT,zIndex:wr.PAINT,visible:wr.PAINT|wr.PICK,lineWidth:wr.SHAPE|wr.BOUNDS|wr.PICK,width:wr.SHAPE|wr.BOUNDS,height:wr.SHAPE|wr.BOUNDS},Or={stroke:(t,e)=>(null!=t&&!1!==t)!=(null!=e&&!1!==e)?wr.PAINT|wr.BOUNDS|wr.PICK:wr.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?wr.PAINT|wr.BOUNDS:wr.PAINT}};class Br{analyzeTransition(t,e,i={}){var s,r;const a={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return a;const n=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),(d=null===(r=i.animateConfig)||void 0===r?void 0:r.noAnimateAttrs)?Array.isArray(d)?d.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(d).reduce(((t,e)=>(d[e]&&(t[e]=1),t)),{}):{}),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(n[e])a.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;a.animateAttrs[e]=l(e)}else a.animateAttrs[e]=i};var d;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const u=i.extraAnimateAttrs;if(u)for(const e in u){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(u,e)||i&&void 0!==t[e]||c(e,u[e])}return a}applyTransition(t,e,i,s={}){var r,a,n;if(i){const i=null!==(r=s.animateConfig)&&void 0!==r?r:lr;null===(a=t.applyAnimationState)||void 0===a||a.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),n=e.noAnimateAttrs,Object.keys(n).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Lt.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Lt.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Lt.STATE}),e}applyClearTransition(t,e,i,s={}){var r;const a=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(r=s.shouldSkipDefaultAttribute)&&void 0!==r?r:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,a,i,s)}}const Lr=new Ar;function Er(t,e=t.revision+1){var i;const s=(r=t.parentScope,a=t.localStateDefinitions,n=t.themeStateDefinitions,Object.assign({},r?r.effectiveSourceDefinitions:n,a));var r,a,n;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=Lr.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function Dr(t){if(t)return t.parentScope&&Dr(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Er(t),t}const Fr=new s.AABBBounds,Ir=new s.Matrix,Rr=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Nr=["x","y"],jr=["scaleX","scaleY"],Ur=["angle"],zr=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),Vr=new s.Point,Gr=[],Wr=wr.PAINT|wr.SHAPE|wr.BOUNDS|wr.TRANSFORM|wr.LAYOUT;function Hr(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function $r(t){if(!Hr(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Hr(s)?$r(s):s})),i}function Xr(t,e){return t===e||!!(Hr(t)||Hr(e)||Array.isArray(t)||Array.isArray(e))&&s.isEqual(t,e)}function Yr(t,e){var i;const s=null!==(i=$r(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];Hr(r)&&Hr(i)?s[t]=Yr(r,i):s[t]=$r(i)})),s}const Kr={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class qr extends Bi{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(qr.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get AABBBounds(){return this.tryUpdateAABBBounds()}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}get baseAttributes(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}set baseAttributes(t){t!==this.attribute?this._baseAttributes=t:this._baseAttributes=void 0}constructor(t={}){var e;super(),this._AABBBounds=new s.AABBBounds,this._updateTag=Ot.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background&&this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0),t.texture&&Zr(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}get normalAttrs(){return this.baseAttributes}set normalAttrs(t){}getBaseAttributesStorage(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:yt.graphicService}getAttributes(){return this.attribute}getStateTransitionOrchestrator(){return this.stateTransitionOrchestrator||(this.stateTransitionOrchestrator=new Br),this.stateTransitionOrchestrator}resolveBoundSharedStateScope(){var t;let e=this.parent;for(;e;){if(e.sharedStateScope)return e.sharedStateScope;e=e.parent}return null===(t=this.stage)||void 0===t?void 0:t.rootSharedStateScope}syncSharedStateScopeBindingFromTree(t=!0){var e;const i=this.resolveBoundSharedStateScope();return this.boundSharedStateScope===i?(this.syncSharedStateActiveRegistrations(),!1):(this.boundSharedStateScope=i,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.syncSharedStateActiveRegistrations(),t&&(null===(e=this.currentStates)||void 0===e?void 0:e.length)&&this.markSharedStateDirty(),!0)}syncSharedStateScopeBindingOnTreeChange(t=!0){var e,i;return!!((null===(e=this.currentStates)||void 0===e?void 0:e.length)||this.boundSharedStateScope||(null===(i=this.registeredActiveScopes)||void 0===i?void 0:i.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingFromTree(t)}syncSharedStateActiveRegistrations(){var t;const e=this.registeredActiveScopes;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.boundSharedStateScope)return(null==e?void 0:e.size)&&(e.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){var t,e,i;this.sharedStateDirty=!0,t=this.stage,e=this,t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e),function(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&Dr(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Lt.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(Dr(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Ar).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),r=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...r],this.resolvedStatePatch=a,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=$r(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],r=e[t];"deep"===this.stateMergeMode&&Hr(r)&&Hr(s)?e[t]=Yr(r,s):e[t]=$r(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),r=s;return Object.keys(e).forEach((e=>{const a=Object.prototype.hasOwnProperty.call(t,e);if(a&&void 0!==t[e])return;const n=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,r)||(i[e]=void 0===t?t:$r(t))};if(a)n(this.getStateTransitionDefaultAttribute(e,r));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];n(void 0===t?this.getStateTransitionDefaultAttribute(e,r):t)}else n(this.getStateTransitionDefaultAttribute(e,r))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((r=>{if(!0===(null==i?void 0:i[r]))return;const a=Object.prototype.hasOwnProperty.call(e,r),n=t[r];if(!a)return void(Object.prototype.hasOwnProperty.call(t,r)&&(s.set(r,{prev:n,next:void 0}),delete t[r]));const o=e[r];Xr(n,o)||(s.set(r,{prev:n,next:o}),t[r]=$r(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var r;let a="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const r=Or[t];return r?r(e,i):null!==(s=Pr[t])&&void 0!==s?s:wr.PAINT}(e,i,s):null!==(r=Pr[e])&&void 0!==r?r:wr.PAINT;return a&wr.PICK&&(a|=wr.BOUNDS),a===wr.PAINT&&this.needUpdateTag(e)&&(a=wr.SHAPE|wr.BOUNDS),t|a}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&Wr)!==Wr?(t&wr.SHAPE?this.addUpdateShapeAndBoundsTag():t&wr.BOUNDS&&this.addUpdateBoundTag(),t&wr.PAINT&&this.addUpdatePaintTag(),t&wr.TRANSFORM&&this.addUpdatePositionTag(),t&wr.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=wr.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,r;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(r=this.stateEngine)||void 0===r||r.invalidateResolverCache(),this.recomputeCurrentStatePatch());const a=this._syncAttribute();this.submitUpdateByDelta(a,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Hr(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Hr(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,r=this.getBaseAttributesStorage();let a=!1,n=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(a=!0,r[t]=s[t],!n&&this.needUpdateTag(t)&&(n=!0));a&&(this.attribute=r,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(n),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.getBaseAttributesStorage()[s]=t[s]}}_commitAnimationStaticAttributes(t,e){if(!t)return;const i=t,s=this.getBaseAttributesStorage(),r=this.attribute,a=new Map;let n=!1;for(const t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;n=!0;const e=r[t],o=i[t];s[t]=o,r[t]=o,Xr(e,o)||a.set(t,{prev:e,next:o})}n&&(this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!0,this.submitUpdateByDelta(a),this.onAttributeUpdate(e))}applyAnimationTransientAttributes(t,e=!1,i){const s=t;let r,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r||(this.detachAttributeFromBaseAttributes(),r=this.attribute),r[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attributeMayContainTransientAttrs=!0,this.valid=this.isValid(),this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}applyTransientAttributes(t,e=!1,i){this.detachAttributeFromBaseAttributes();const s=new Map,r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],a=this.attribute[i],n=t[i];Xr(a,n)||(s.set(i,{prev:a,next:n}),this.attribute[i]=n)}s.size&&(this.attributeMayContainTransientAttrs=!0),this.valid=this.isValid(),this.submitUpdateByDelta(s,e),this.onAttributeUpdate(i)}_restoreAttributeFromStaticTruth(t,e){this._syncFinalAttributeFromStaticTruth(e);const i=this._syncAttribute(e);this.submitUpdateByDelta(i),this.onAttributeUpdate(t)}collectStatePatchDeltaKeys(t,e){const i=t?Object.keys(t):[];if(!e)return i;for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(null!=t?t:{},s)&&i.push(s);return i}getStaticTruthValueForStateKey(t,e){var i;const s=null!==(i=this.baseAttributes)&&void 0!==i?i:{},r=e;if(r&&Object.prototype.hasOwnProperty.call(r,t)){const e=r[t],i=s[t];return"deep"===this.stateMergeMode&&Hr(i)&&Hr(e)?{hasValue:!0,value:Yr(i,e)}:{hasValue:!0,value:e}}return Object.prototype.hasOwnProperty.call(s,t)?{hasValue:!0,value:s[t]}:{hasValue:!1,value:void 0}}syncStatePatchDeltaToTarget(t,e,i,s=!1){let r=wr.NONE;for(let a=0;a<e.length;a++){const n=e[a],o=t[n],l=this.getStaticTruthValueForStateKey(n,i);if(!l.hasValue){Object.prototype.hasOwnProperty.call(t,n)&&(delete t[n],s&&(r=this.mergeAttributeDeltaCategory(r,n,o,void 0)));continue}if(Xr(o,l.value))continue;const h=$r(l.value);t[n]=h,s&&(r=this.mergeAttributeDeltaCategory(r,n,o,h))}return r}restoreAttributeFromStatePatchDelta(t,e,i){this.detachAttributeFromBaseAttributes();const s=this.collectStatePatchDeltaKeys(t,e),r=this.finalAttribute;r&&this.syncStatePatchDeltaToTarget(r,s,e,!1);const a=this.syncStatePatchDeltaToTarget(this.attribute,s,e,!0);this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitUpdateByCategory(a),this.onAttributeUpdate(i)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,s;const{dx:r=t.dx,dy:a=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Vr.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),Vr.y=a+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Vr.x=r,Vr.y=a;return Vr}onAnimateBind(t){this.detachAttributeFromBaseAttributes(),this._emitCustomEvent("animate-bind",t)}visitTrackedAnimates(t){const e=this.forEachTrackedAnimate;"function"!=typeof e?this.animates&&this.animates.forEach(t):e.call(this,t)}hasAnyTrackedAnimate(){var t;const e=this.hasTrackedAnimate;if("function"==typeof e)return e.call(this);const i=this.getTrackedAnimates;return"function"==typeof i?i.call(this).size>0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&Ot.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new s.OBBBounds),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=zs[t];if(e)return e;if(e=qr.userSymbolMap[t],e)return e;if(!0===((i=t=Vs[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new Qs,{svg:i}=e.parse(t);if(!i)return null;const r=s.isArray(i.path)?i.path:[i.path];Fr.clear();const a=[];r.forEach((t=>{const e=(new Te).fromString(t.d),i={};or.forEach((e=>{t[e]&&(i[nr[e]]=t[e])})),a.push({path:e,attribute:i}),Fr.union(e.bounds)}));const n=Fr.width(),o=Fr.height(),l=1/s.max(n,o);a.forEach((t=>t.path.transform(0,0,l,l)));const h=new Us(t,a,!0);return qr.userSymbolMap[t]=h,h}var i;const r=(new Te).fromString(t),a=r.bounds.width(),n=r.bounds.height(),o=1/s.max(a,n);r.transform(0,0,o,o);const l=new Us(t,r);return qr.userSymbolMap[t]=l,l}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const r=this.attribute,a=this.updateAABBBounds(r,i,this._AABBBounds,t),{boundsPadding:n=i.boundsPadding}=r,o=(l=n)?s.isArray(l)?0===l.length?0:1===l.length?l[0]:2===l.length?(Di[0]=l[0],Di[2]=l[0],Di[1]=l[1],Di[3]=l[1],Di):l:l:0;var l;return o&&a.expand(o),this.clearUpdateBoundTag(),a}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new bt(t);return jt(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new s.Matrix),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Ot.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Ot.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ot.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ot.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ot.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&Ot.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ot.CLEAR_SHAPE}containsPoint(t,e,i,r){if(!r)return!1;if(i===Bt.GLOBAL){const i=new s.Point(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return r.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const r=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,r,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(r)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Lt.STATE||null!=i&&i>=Lt.ANIMATE_BIND&&i<=Lt.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,r=this.setFinalAttributes;s&&"function"==typeof r&&r.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var r,a;const n=this.context,o=null!==(r=null==n?void 0:n.diffAttrs)&&void 0!==r?r:t,l=null==i?void 0:i.type;if(!e.length||!o||l===Lt.STATE||null!=l&&l>=Lt.ANIMATE_BIND&&l<=Lt.ANIMATE_END)return;const h=this.transientFromAttrsBeforePreventAnimateDiffAttrs===o;let c=h&&null!==(a=this.transientFromAttrsBeforePreventAnimate)&&void 0!==a?a:null;h||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let d=!1;for(let i=0;i<e.length;i++){const r=e[i];if(!Object.prototype.hasOwnProperty.call(o,r))continue;const a=this.attribute[r],n=t[r];s.isEqual(a,n)||(null!=c||(c={}),c[r]=$r(a),d=!0)}d&&(this.transientFromAttrsBeforePreventAnimate=c,this.transientFromAttrsBeforePreventAnimateDiffAttrs=o)}consumeTransientFromAttrsBeforePreventAnimate(t){const e=this.transientFromAttrsBeforePreventAnimate,i=this.transientFromAttrsBeforePreventAnimateDiffAttrs;if(!e||!i)return null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(!Object.prototype.hasOwnProperty.call(i,e)||!s.isEqual(i[e],t[e])))return null;let r=null,a=!1;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?(null!=r||(r={}),r[i]=e[i]):a=!0);if(a){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e[s]);this.transientFromAttrsBeforePreventAnimate=i}else this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null;return r}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),t.texture&&Zr(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,e,i):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(e,i))}setAttribute(t,e,i,s){const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(r)this._setAttributes(r,i,s);else if(this.canCommitBaseAttributesByTouchedKeys())this.commitBaseAttributeBySingleKey(t,e,!!i,s);else{const r={[t]:e};this.applyBaseAttributes(r),this.commitBaseAttributeMutation(!!i,s)}"background"===t?this.loadImage(e,!0):"texture"===t&&Zr(e)?this.loadImage(e,!1):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Rr){for(let i=0;i<e.length;i++){const s=e[i];if(-1!==t.indexOf(s))return!0}return!1}needUpdateTag(t,e=Rr){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Lt.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,this._baseAttributes=void 0,this.resolvedStatePatch=void 0,this.attributeMayContainTransientAttrs=!1,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0),t.texture&&Zr(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=Ot.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,s;if(0===t&&0===e)return this;const r={type:Lt.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Nr,r);a&&(t=a.x,e=a.y,delete a.x,delete a.y);const n=this.baseAttributes,o=n.postMatrix,l=a||{};if(o){const i=o.clone();yt.transformUtil.fromMatrix(i,i).translate(t,e),l.postMatrix=i}else l.x=(null!==(i=n.x)&&void 0!==i?i:we.x)+t,l.y=(null!==(s=n.y)&&void 0!==s?s:we.y)+e;return this.commitInternalBaseAttributes(l,r),this}translateTo(t,e){const i=this.baseAttributes;if(i.x===t&&i.y===e)return this;const s={type:Lt.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Nr,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({x:t,y:e},s),this)}scale(t,e,i){var r,a;if(1===t&&1===e)return this;const n={type:Lt.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,jr,n);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY);const l=this.baseAttributes,h=o||{};if(i){let{postMatrix:r}=this.baseAttributes;r=r?r.clone():new s.Matrix,yt.transformUtil.fromMatrix(r,r).scale(t,e,i),h.postMatrix=r}else h.scaleX=(null!==(r=l.scaleX)&&void 0!==r?r:we.scaleX)*t,h.scaleY=(null!==(a=l.scaleY)&&void 0!==a?a:we.scaleY)*e;return this.commitInternalBaseAttributes(h,n),this}scaleTo(t,e){const i=this.baseAttributes;if(i.scaleX===t&&i.scaleY===e)return this;const s={type:Lt.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,jr,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({scaleX:t,scaleY:e},s),this)}rotate(t,e){var i;if(0===t)return this;const r={type:Lt.ROTATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,Ur,r);a&&delete a.angle;const n=this.baseAttributes,o=a||{};if(e){let{postMatrix:i}=this.baseAttributes;i=i?i.clone():new s.Matrix,yt.transformUtil.fromMatrix(i,i).rotate(t,e),o.postMatrix=i}else o.angle=(null!==(i=n.angle)&&void 0!==i?i:we.angle)+t;return this.commitInternalBaseAttributes(o,r),this}rotateTo(t){if(this.baseAttributes.angle===t)return this;const e={type:Lt.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Ur,e);return i?(this.commitInternalBaseAttributes(i,e),this):(this.commitInternalBaseAttributes({angle:t},e),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!s.isNil(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}getStateResolveBaseAttrs(){var t;return null!==(t=this.baseAttributes)&&void 0!==t?t:this.attribute}syncStateResolveContext(t=this.getStateResolveBaseAttrs()){var e;return null===(e=this.stateEngine)||void 0===e||e.setResolveContext(this,t),t}ensureStateEngine(t=this.getStateResolveBaseAttrs()){const{compiledDefinitions:e}=this.resolveEffectiveCompiledDefinitions();return this.compiledStateDefinitions=e,e?this.stateEngine&&this.stateEngineCompiledDefinitions===e&&this.stateEngineStateSort===this.stateSort&&this.stateEngineMergeMode===this.stateMergeMode||(this.stateEngine=new kr({compiledDefinitions:e,stateSort:this.stateSort,mergeMode:this.stateMergeMode}),this.stateEngineCompiledDefinitions=e,this.stateEngineStateSort=this.stateSort,this.stateEngineMergeMode=this.stateMergeMode):(this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0),this.syncStateResolveContext(t),this.stateEngine&&this.currentStates&&!this.sameStateNames(this.stateEngine.activeStates,this.currentStates)&&this.stateEngine.applyStates(this.currentStates),this.stateEngine}toGraphicStateTransition(t){return{changed:t.changed,states:[...t.activeStates],effectiveStates:[...t.effectiveStates]}}sortLocalStates(t){return this.stateSort?[...t].sort(this.stateSort):[...t]}resolveLocalUseStatesTransition(t){var e;if(!t.length)return this.resolveLocalClearStatesTransition();const i=null!==(e=this.currentStates)&&void 0!==e?e:Gr,s=i.length!==t.length||t.some(((t,e)=>i[e]!==t)),r=this.sortLocalStates(t);return{changed:s,states:s?r:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const r=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(r)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),r=this.ensureStateEngine(s);e&&(null==r||r.invalidateResolverCache());const a=r?this.toGraphicStateTransition(r.applyStates(t)):this.resolveLocalUseStatesTransition(t),n=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:a,effectiveStates:null!==(i=a.effectiveStates)&&void 0!==i?i:a.states,resolvedStateAttrs:n}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},r=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of r){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Xr(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const r=null!==(s=this.currentStates)&&void 0!==s?s:Gr,a=this.resolvedStatePatch,{transition:n,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(a,l);h&&!this.beforeStateUpdate(l,r,n.states,e,!1)||(this.currentStates=n.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,n.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,a))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Lt.STATE}):this.restoreAttributeFromStatePatchDelta(a,this.resolvedStatePatch,{type:Lt.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:lr}applyStateAttrs(t,e,i,s,r,a){const n=i?this.resolveStateAnimateConfig(r):void 0,o=n?{animateConfig:n,extraAnimateAttrs:a,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:n,extraAnimateAttrs:a,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const r=null!==(e=this.currentStates)&&void 0!==e?e:Gr,a=this.resolvedStatePatch,n=this.resolveClearStatesTransition();if(!n.changed&&0===r.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?$r(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};n.changed&&!this.beforeStateUpdate(o,r,n.states,t,!0)||(this.currentStates=n.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,n.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,a))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Lt.STATE}):this.restoreAttributeFromStatePatchDelta(a,void 0,{type:Lt.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,r;const{hasAnimation:a,animateSameStatePatchChange:n,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:Gr,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(r=this.registeredActiveScopes)||void 0===r?void 0:r.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,a,n):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,a)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(a)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:Gr,r=this.resolvedStatePatch,{transition:a,effectiveStates:n,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!a.changed&&this.sameStateNames(s,a.states)||this.beforeStateUpdate(o,s,a.states,e,!1)&&(this.currentStates=a.states,this.effectiveStates=[...n],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Lt.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Lt.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Lt.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==s[t])return!1;return!0}addUpdateBoundTag(){this._updateTag|=Ot.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdatePaintTag(){this._updateTag|=Ot.UPDATE_PAINT}addUpdateShapeTag(){this._updateTag|=Ot.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ot.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addBroadUpdateTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ot.UPDATE_SHAPE_AND_BOUNDS|Ot.UPDATE_PAINT|Ot.UPDATE_GLOBAL_LOCAL_MATRIX|Ot.UPDATE_LAYOUT,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ot.UPDATE_SHAPE_AND_BOUNDS)===Ot.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ot.CLEAR_BOUNDS}clearUpdatePaintTag(){this._updateTag&=Ot.CLEAR_PAINT}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ot.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ot.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ot.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ot.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ot.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ot.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ot.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],r=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=r();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=r();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=we.x,y:e=we.y,scaleX:i=we.scaleX,scaleY:r=we.scaleY,angle:a=we.angle,scaleCenter:n,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const c={};if(o&&a&&(h=this.getAnchor(o,c)),!n||1===i&&1===r)s.normalTransform(this._transMatrix,this._transMatrix.reset(),t,e,i,r,a,o&&h);else{const s=this._transMatrix;s.reset(),s.translate(h[0],h[1]),s.rotate(a),s.translate(-h[0],-h[1]),s.translate(t,e),h=this.getAnchor(n,c,!0),yt.transformUtil.fromMatrix(s,s).scale(i,r,{x:h[0],y:h[1]})}const d=this.getOffsetXY(we);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,l){const t=Ir.setValue(l.a,l.b,l.c,l.d,l.e,l.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){var i,s,r,a,n,o,l,h,c,d;const u=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:yt.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(a=this.currentStates)||void 0===a?void 0:a.length)||this.boundSharedStateScope||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Lt.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Lt.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=yt.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return s.isString(t,!0)?this.pathProxy=(new Te).fromString(t):this.pathProxy=new Te,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):!!(t.fill||t.stroke||"string"==typeof t.gradient&&Array.isArray(t.stops))}(t)))return void(this.backgroundImg=!1);if(!t)return;const i=t;this.resources||(this.resources=new Map);const r={data:"init",state:null};this.resources.set(i,r),"string"==typeof t?(r.state="loading",t.startsWith("<svg")?(Li.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(s.isValidUrl(t)||t.includes("/")||s.isBase64(t))&&(Li.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):s.isObject(t)?(r.state="success",r.data=t,this.backgroundImg=this.backgroundImg||e):r.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const s=this.resources.get(t);s&&(s.state="success",s.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(){if(!this.mayHaveTrackedAnimates())return;const t=[];this.visitTrackedAnimates((e=>{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const r=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:yt.graphicService;null===(s=null==r?void 0:r.onRelease)||void 0===s||s.call(r,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const r=new ki(t,e);r.bubbles=!1;const a=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return a?(r.manager=a,this.dispatchEvent(r)):Bi.prototype.dispatchEvent.call(this,r)}return!0}beforeStateUpdate(t,e,i,s,r){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Lt.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!r})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Lt.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||yt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new vr(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function Zr(t){return!!t&&("string"==typeof t?!zr.has(t)&&(t.startsWith("<svg")||s.isValidUrl(t)||t.includes("/")||s.isBase64(t)):s.isObject(t))}qr.userSymbolMap={},qr.mixin(wi);const Qr={arc:Fe,area:Ie,circle:Re,line:Ue,path:ze,symbol:He,text:$e,rect:We,polygon:Ve,star:Ge,richtext:Xe,richtextIcon:Ke,image:Ye,group:Ne,glyph:je},Jr=Object.keys(Qr);function ta(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const ea={arc:Object.assign({},Qr.arc),area:Object.assign({},Qr.area),circle:Object.assign({},Qr.circle),line:Object.assign({},Qr.line),path:Object.assign({},Qr.path),symbol:Object.assign({},Qr.symbol),text:Object.assign({},Qr.text),rect:Object.assign({},Qr.rect),polygon:Object.assign({},Qr.polygon),star:Object.assign({},Qr.star),richtext:Object.assign({},Qr.richtext),richtextIcon:Object.assign({},Qr.richtextIcon),image:Object.assign({},Qr.image),group:Object.assign({},Qr.group),glyph:Object.assign({},Qr.glyph)};const ia=new class{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Jr.forEach((t=>{this._defaultTheme[t]=Object.create(ea[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const r=this.getParentWithTheme(t);if(r){const t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,s.Logger.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Jr.forEach((s=>{const r=Object.create(ea[s]);t&&t[s]&&ta(r,t[s]),i[s]&&ta(r,i[s]),e[s]&&ta(r,e[s]),this.combinedTheme[s]=r})),e.common&&Jr.forEach((t=>{ta(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}};function sa(t,e){return t.glyphHost?sa(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)):ia.getTheme()}return null}(t)||t.attachedThemeGraphic&&sa(t.attachedThemeGraphic)||ia.getTheme()}new class{constructor(){this.time=Ft.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:y=l.backgroundMode,backgroundFit:v=l.backgroundFit,backgroundKeepAspectRatio:b=l.backgroundKeepAspectRatio,backgroundScale:x=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:T=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const r=t.resources.get(function(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}(g));if(!r||"success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=sa(t.parent).group,{scrollX:s=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,r)}A&&e.clip();const a=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,r.data,a,{backgroundMode:y,backgroundFit:v,backgroundKeepAspectRatio:b,backgroundScale:x,backgroundOffsetX:_,backgroundOffsetY:S,backgroundPosition:T}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){!function(t,e,i,s){var r,a;const{backgroundMode:n,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),m=function(t){if(!t)return null;const e=la(t.naturalWidth,t.videoWidth,t.width),i=la(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:f,backgroundSizing:y}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=na[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:aa({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:n,backgroundFit:o,backgroundKeepAspectRatio:l});let v=p,b=g;if(p<=0||g<=0)return;if("no-repeat"===f){let s=null!==(r=null==m?void 0:m.width)&&void 0!==r?r:p,n=null!==(a=null==m?void 0:m.height)&&void 0!==a?a:g;if("cover"!==y&&"contain"!==y||!m)"fill"===y&&(s=p,n=g);else{const t="cover"===y?Math.max(p/m.width,g/m.height):Math.min(p/m.width,g/m.height);s=m.width*t,n=m.height*t}s*=h,n*=h;const{x:o,y:l}=function(t,e,i){const[s,r]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:ra.has(t)?["center",t]:[t,"center"]}let r,a;const n=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?n.push(e):a=e:r=e}return null==r&&n.length&&(r=n.shift()),null==a&&n.length&&(a=n.shift()),[null!=r?r:"left",null!=a?a:"top"]}(t);return{x:oa(s,e,"left","center","right"),y:oa(r,i,"top","center","bottom")}}(u,p-s,g-n);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,n)}if(o&&"repeat"!==f&&m){const i=m.width,s=m.height;"repeat-x"===f?(v=i*(g/s),b=g):"repeat-y"===f&&(b=s*(p/i),v=p);const r=t.dpr,a=Ci.allocate({width:v,height:b,dpr:r}),n=a.getContext("2d");n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.clearRect(0,0,v,b),n.drawImage(e,0,0,v,b),e=a.nativeCanvas),Ci.free(a)}const x=t.dpr,_=t.createPattern(e,f);_.setTransform&&_.setTransform(new DOMMatrix([1/x,0,0,1/x,0,0])),t.fillStyle=_,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}(t,e,i,s)}};const ra=new Set(["top","center","bottom"]);function aa({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const na={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function oa(t,e,i,s,r){if("number"==typeof t&&Number.isFinite(t))return t;const a=`${null!=t?t:""}`.trim().toLowerCase();if(!a||a===i)return 0;if(a===s)return e/2;if(a===r)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(a))return e*parseFloat(a)/100;const n=Number(a);return Number.isFinite(n)?n:0}function la(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}const ha=new class{constructor(){this.time=Ft.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){var p,g;const{clipConfig:m}=t.attribute;if(!m)return;const f=t.getClipPath();if(!f)return;const y=!(c||d),v=t.AABBBounds,b=null!==(p=t.attribute.width)&&void 0!==p?p:v.width(),x=null!==(g=t.attribute.height)&&void 0!==g?g:v.height();y&&e.save(),e.beginPath(),!1===f.draw(e,[b,x],i+b/2,s+x/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),y&&e.clip()}};const ca=new class{constructor(){this.time=Ft.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};const da=new class{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}};const ua=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){pa(t,e)}CreateGraphic(t,e){return this.store.has(t)?function(t,e){return da.create(t,e)}(t,e):null}};function pa(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");ua.registerStore(t,e),da.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function ga(t,e,i){var s;const{x:r=i.x,y:a=i.y,z:n=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:y}=e.attribute,v=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;v[0]=i.x1+(i.x2-i.x1)*t}else v[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;v[1]=i.x1+(i.x2-i.x1)*t}else v[1]=f[1];v[2]=null!==(s=f[2])&&void 0!==s?s:0}if(hr(t),cr(t,t,[r+o,a+l,n+h]),cr(t,t,[v[0],v[1],v[2]]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[4],n=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*r+h*s,t[5]=n*r+c*s,t[6]=o*r+d*s,t[7]=l*r+u*s,t[8]=h*r-a*s,t[9]=c*r-n*s,t[10]=d*r-o*s,t[11]=u*r-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[0],n=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*r-h*s,t[1]=n*r-c*s,t[2]=o*r-d*s,t[3]=l*r-u*s,t[8]=a*s+h*r,t[9]=n*s+c*r,t[10]=o*s+d*r,t[11]=l*s+u*r}(t,t,p),cr(t,t,[-v[0],-v[1],v[2]]),function(t,e,i){const s=i[0],r=i[1],a=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=mr.allocate(),s=[0,0];if(y){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}cr(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[0],n=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*r+h*s,t[1]=n*r+c*s,t[2]=o*r+d*s,t[3]=l*r+u*s,t[4]=h*r-a*s,t[5]=c*r-n*s,t[6]=d*r-o*s,t[7]=u*r-l*s}(i,i,m),cr(i,i,[-s[0],-s[1],0]),dr(t,t,i)}}class ma{static registerPlugin(t,e){ma._pluginClasses[t]=e}static getPlugin(t){return ma._pluginClasses[t]}}ma._pluginClasses={};const fa=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Rr];class ya extends qr{constructor(t){super(t),this.type="arc",this.numberType=rr}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:r=t.outerPadding}=this.attribute;let{outerRadius:a=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(a+=r,n-=i,0===e||"0%"===e)return 0;const o=Math.abs(a-n),l=t=>Math.min(s.isNumber(t,!0)?t:o*parseFloat(t)/100,o/2);if(s.isArray(e)){const t=e.map((t=>l(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return l(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:r=t.cap,clipRange:a=t.clipRange}=this.attribute,n=i-e>=0?1:-1;let o=i-e;if(o*=Math.max(0,Math.min(a,1)),e=s.clampAngleByRadian(e),i=e+o,r&&s.abs(o)>s.epsilon&&s.abs(o)<s.pi2-s.epsilon){let a=1,o=1;r.length&&(a=Number(r[0]),o=Number(r[1]));let{outerRadius:l=t.outerRadius,innerRadius:h=t.innerRadius}=this.attribute;const{outerPadding:c=t.outerPadding,innerPadding:d=t.innerPadding}=this.attribute;l+=c,h-=d;const u=Math.abs(l-h)/2,p=u/l;if(u>s.epsilon&&l>s.epsilon)return{startAngle:e-n*p*a,endAngle:i+n*p*o,sc:n*p*a,ec:n*p*o}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:r=i.innerPadding,outerPadding:a=i.outerPadding,padAngle:n=i.padAngle}=this.attribute;let{outerRadius:o=i.outerRadius,innerRadius:l=i.innerRadius}=this.attribute;o+=a,l-=r;const{padRadius:h=s.sqrt(o*o+l*l)}=this.attribute,c=s.abs(e-t);let d=t,u=e,p=t,g=e;const m=n/2;let f=c,y=c;if(m>s.epsilon&&h>s.epsilon){const i=e>t?1:-1;let r=s.asin(Number(h)/l*s.sin(m)),a=s.asin(Number(h)/o*s.sin(m));return(f-=2*r)>s.epsilon?(r*=i,p+=r,g-=r):(f=0,p=g=(t+e)/2),(y-=2*a)>s.epsilon?(a*=i,d+=a,u-=a):(y=0,d=u=(t+e)/2),{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:y}}return{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:y}}getGraphicTheme(){return sa(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:a}=yt.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:n=t.lineWidth}=s;i.expand(a+(r+n)/2)}})(t,e,r),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return yt.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:n=e.innerPadding}=t;return s+=a,r-=n,s<r&&(s=r),i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:r=e.outerRadius,innerRadius:a=e.innerRadius}=t;const{outerPadding:n=e.outerPadding,innerPadding:o=e.innerPadding}=t;if(r+=n,a-=o,r<a){const t=r;r=a,a=t}let{endAngle:l=e.endAngle,startAngle:h=e.startAngle}=t;if(h>l){const t=h;h=l,l=t}return r<=s.epsilon?i.set(0,0,0,0):Math.abs(l-h)>s.pi2-s.epsilon?i.set(-r,-r,r,r):(Ri(h,l,r,i),Ri(h,l,a,i)),i}needUpdateTags(t){return super.needUpdateTags(t,fa)}needUpdateTag(t){return super.needUpdateTag(t,fa)}toCustomPath(){var t,e,i,r;let a=super.toCustomPath();if(a)return a;const n=this.attribute,{startAngle:o,endAngle:l}=this.getParsedAngle();let h=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),c=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(r=n.outerPadding)&&void 0!==r?r:0);const d=s.abs(l-o),u=l>o;if(c<h){const t=c;c=h,h=t}if(a=new Te,c<=s.epsilon)a.moveTo(0,0);else if(d>=s.pi2-s.epsilon)a.moveTo(0+c*s.cos(o),0+c*s.sin(o)),a.arc(0,0,c,o,l,!u),h>s.epsilon&&(a.moveTo(0+h*s.cos(l),0+h*s.sin(l)),a.arc(0,0,h,l,o,u));else{const t=c*s.cos(o),e=c*s.sin(o),i=h*s.cos(l),r=h*s.sin(l);a.moveTo(0+t,0+e),a.arc(0,0,c,o,l,!u),a.lineTo(0+i,0+r),a.arc(0,0,h,l,o,u),a.closePath()}return a}clone(){return new ya(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ya.NOWORK_ANIMATE_ATTR}}ya.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Kr);class va extends ya{constructor(t){super(t),this.type="arc3d",this.numberType=ar}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,n=r+a;return i.setValue(-n,-n,n,n),yt.graphicService.updateTempAABBBounds(i),yt.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return va.NOWORK_ANIMATE_ATTR}}function ba(t){return new va(t)}function xa(t,e){return!(!t&&!e)}function _a(t,e){let i;return i=s.isArray(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Sa(t,e,i){return i&&t*e>0}function Aa(t,e){return t*e>0}va.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Kr);const Ta=Symbol.for("Arc3dRender"),Ca=Symbol.for("GraphicRender");class Ma{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class ka{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Ma(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}const wa=new ka;const Pa={x:0,y:0,z:0,lastModelMatrix:null};class Oa{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(ha),e(ca),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ft.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ft.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,r,a,n,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,r,a,n,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,r,a,n,o){if(!t.pathProxy)return!1;const l=sa(t,null==a?void 0:a.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:y=l.y}=t.attribute,v=Sa(d,u,h),b=Aa(d,g),x=xa(h),_=_a(c,p);if(!m)return!0;if(!x&&!_)return!0;if(!(v||b||n||o))return!0;e.beginPath();return jt(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,_,v,b,l,r,n,o),_&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i-f,s-y,l),e.stroke())),x&&(n?n(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i-f,s-y,l),e.fill())),this.afterRenderStep(t,e,i,s,x,_,v,b,l,r,n,o),!0}valid(t,e,i,s){const{fill:r=e.fill,background:a,stroke:n=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Sa(o,l,r),p=Aa(o,c),g=xa(r,a),m=_a(n,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||a)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i,s=!1){const{x:r=e.x,y:a=e.y,z:n=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Pa.x=r,Pa.y=a,Pa.z=n,Pa.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=mr.allocate(),r=mr.allocate();ga(r,t,e),dr(s,d||s,r),Pa.x=0,Pa.y=0,Pa.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),mr.free(r)}if(g&&!d){const s=t.getOffsetXY(e);Pa.x+=s.x,Pa.y+=s.y,Pa.z=n,i.setTransformForCurrent()}else if(p)Pa.x=0,Pa.y=0,Pa.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Pa.x+=s.x,Pa.y+=s.y,this.transformWithoutTranslate(i,Pa.x,Pa.y,Pa.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Pa.x=0,Pa.y=0,Pa.z=0;return Pa}transformUseContext2d(t,e,i,s){const r=s.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,a=e.y2-e.y1,n=s.project(0,0,i),o=s.project(r,0,i),l=s.project(r,a,i),h={x:0,y:0},c={x:r,y:0},d={x:r,y:a};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*n.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*n.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*n.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*n.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*n.x)*u,v=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*n.y)*u;s.setTransform(p,g,m,f,y,v,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,r,a,n){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(r,a,!1),t.rotate(n,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,r,a){const{context:n}=s;if(!n)return;const{renderable:o}=t.attribute;if(!1===o)return;n.highPerformanceSave();const l=this.transform(t,e,n,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,n,h,c,s,r)||(this.drawShape(t,n,h,c,s,r,null,null,a),this.z=0,n.modelMatrix!==u&&mr.free(n.modelMatrix),n.modelMatrix=u),n.highPerformanceRestore()}}class Ba extends Oa{constructor(){super(...arguments),this.numberType=ar}drawShape(t,e,i,r,a,n,o,l){var h;const c=sa(t,null==n?void 0:n.theme).arc,{fill:d=c.fill}=t.attribute,u=this.valid(t,c,o,l);if(!u)return;const{fVisible:p,sVisible:g,doFill:m,doStroke:f}=u,y=null!==(h=this.z)&&void 0!==h?h:0,{outerPadding:v=c.outerPadding,innerPadding:b=c.innerPadding,height:x=10}=t.attribute;let{outerRadius:_=c.outerRadius,innerRadius:S=c.innerRadius}=t.attribute;_+=v,S-=b;const A=xr.Get(d,br.Color255),{light:T}=a.stage||{},C=a.hack_pieFace,M={top:y,bottom:y+x},k={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,r,a,n,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=s.abs(h-l),d=h>l;let u=!1;if(n<o){const t=n;n=o,o=t}if(n<=s.epsilon)e.moveTo(i,r,a);else if(c>=s.pi2-s.epsilon)e.moveTo(i+n*s.cos(l),r+n*s.sin(l),a),e.arc(i,r,n,l,h,!d,a),o>s.epsilon&&(e.moveTo(i+o*s.cos(h),r+o*s.sin(h),a),e.arc(i,r,o,h,l,d,a));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:m,innerEndAngle:f,innerStartAngle:y}=t.getParsePadAngle(l,h),v=n*s.cos(g),b=n*s.sin(g),x=o*s.cos(f),_=o*s.sin(f);c<.001?u=!0:(e.moveTo(i+v,r+b,a),e.arc(i,r,n,g,m,!d,a)),!(o>s.epsilon)||p<.001?(e.lineTo(i+x,r+_,a),u=!0):(e.lineTo(i+x,r+_,a),e.arc(i,r,o,f,y,d,a))}e.closePath()}(t,e,i,r,M[C],_,S),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(k[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,r,S,0,s.pi2,!0,M.top),e.clip()),e.beginPath(),function(t,e,i,r,a,n,o,l){const{startAngle:h,endAngle:c}=t.getParsedAngle(),d=s.abs(c-h),u=c>h;let p=!1;if(o<=s.epsilon)e.moveTo(i,r,a);else if(d>=s.pi2-s.epsilon)e.moveTo(i+o*s.cos(h),r+o*s.sin(h),a),e.arc(i,r,o,h,c,!u,a),e.lineTo(i+o*s.cos(c),r+o*s.sin(c),n),e.arc(i,r,o,c,h,u,n);else{const{innerouterDeltaAngle:t,innerouterStartAngle:d,innerouterEndAngle:g}=l(h,c),m=o*s.cos(d),f=o*s.sin(d),y=o*s.cos(g),v=o*s.sin(g);t<.001?p=!0:(e.moveTo(i+m,r+f,a),e.arc(i,r,o,d,g,!u,a),e.lineTo(i+y,r+v,n),e.arc(i,r,o,g,d,u,n))}e.closePath()}(t,e,i,r,M.top,M.bottom,"outside"===C?_:S,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:r,outerStartAngle:a,outerEndAngle:n,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:s,innerouterEndAngle:n,innerouterStartAngle:a}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,r,c),e.fillStyle=T?T.computeColor(k[C],A):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,r,c),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,s){const r=sa(t,null==s?void 0:s.theme).arc;this._draw(t,r,!1,i,s)}}const La=new WeakSet;const Ea=function({bind:t}){(function(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)})(La,t)||(t(Ba).toDynamicValue((()=>new Ba)).inSingletonScope(),t(Ta).toService(Ba),t(Ca).toService(Ta))};class Da{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=xr.Get(e,br.Color1),this.ambient=i;const r=s.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){const i=this.formatedDir,r=s.min(s.max((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let a;a=s.isString(e)?xr.Get(e,br.Color1):e;const n=this.colorRgb;return`rgb(${n[0]*a[0]*r}, ${n[1]*a[1]*r}, ${n[2]*a[2]*r})`}}class Fa{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=mr.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=mr.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,r){let a,n,o,l,h,c,d,u,p,g;const m=e[0],f=e[1],y=e[2],v=r[0],b=r[1],x=r[2],_=i[0],S=i[1],A=i[2];Math.abs(m-_)<s.epsilon&&Math.abs(f-S)<s.epsilon&&Math.abs(y-A)<s.epsilon?hr(t):(d=m-_,u=f-S,p=y-A,g=1/Math.hypot(d,u,p),d*=g,u*=g,p*=g,a=b*p-x*u,n=x*d-v*p,o=v*u-b*d,g=Math.hypot(a,n,o),g?(g=1/g,a*=g,n*=g,o*=g):(a=0,n=0,o=0),l=u*o-p*n,h=p*a-d*o,c=d*n-u*a,g=Math.hypot(l,h,c),g?(g=1/g,l*=g,h*=g,c*=g):(l=0,h=0,c=0),t[0]=a,t[1]=l,t[2]=d,t[3]=0,t[4]=n,t[5]=h,t[6]=u,t[7]=0,t[8]=o,t[9]=c,t[10]=p,t[11]=0,t[12]=-(a*m+n*f+o*y),t[13]=-(l*m+h*f+c*y),t[14]=-(d*m+u*f+p*y),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=mr.allocate()),this._vp=dr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=mr.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=mr.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return function(t,e,i,s,r,a,n){const o=1/(e-i),l=1/(s-r),h=1/(a-n);t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(r+s)*l,t[14]=(n+a)*h,t[15]=1}(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=mr.allocate()),this._vp=dr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return ur(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:r}=this._params.viewParams;ur(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const a=this.getProjectionScale(i);return{x:t*a+r[0],y:e*a+r[1]}}}const Ia=Symbol.for("CanvasArc3dPicker"),Ra=Symbol.for("CanvasPickerContribution");class Na extends i.BaseRender{contains(t,e,s){const{pickContext:r}=null!=s?s:{};if(!r)return!1;const a=t.getGraphicTheme();r.highPerformanceSave();const n=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=n;let d=e;if(r.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,r,o,l,s,null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u))),this.canvasRenderer.z=0,r.modelMatrix!==c&&i.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),u}}class ja extends Na{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=i.ARC3D_NUMBER_TYPE,this.themeType="arc"}}let Ua=!1;function za(t){var e;Ua||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ta))&&(Ua=!0,t.bind(Ia).toDynamicValue((()=>new ja(function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}(t,Ta)))).inSingletonScope(),t.bind(Ra).toService(Ia))}function Va(){if(Va.__loaded)return;Va.__loaded=!0;const t=wa;pa("arc3d",ba),ma.registerPlugin("DirectionalLight",Da),ma.registerPlugin("OrthoCamera",Fa),Ea({bind:t.bind}),za(t)}Va.__loaded=!1;const Ga=Va;class Wa extends e.BaseArcMark{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=Wa.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Wa.type="arc3d";const Ha=Object.assign(Object.assign({},e.baseSeriesMark),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class $a extends e.PieSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class Xa extends e.BasePieSeries{constructor(){super(...arguments),this.type=$.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=$a}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",e.AttributeLevel.Series)}initLabelMarkStyle(t,i={}){t&&(super.initLabelMarkStyle(t),this.setMarkStyle(t,{support3d:!0},void 0,e.AttributeLevel.Mark))}}Xa.type=$.pie3d,Xa.mark=Ha,Xa.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},Xa.transformerConstructor=$a;const Ya=()=>{e.Factory.registerAnimation("pie3d",((t,i)=>({appear:e.piePresetAnimation(t,i),enter:e.pieEnter(t),exit:e.pieExit(t),disappear:e.pieDisappear(t)}))),e.registerArcAnimation(),e.registerShadowRoot(),Ga(),e.Factory.registerGraphicComponent("arc3d",e.createArc3d),e.Factory.registerMark("arc3d",Wa),e.Factory.registerSeries(Xa.type,Xa)};class Ka extends e.BasePieChart{constructor(){super(...arguments),this.transformerConstructor=mt,this.type="pie3d",this.seriesType=$.pie3d}}Ka.type="pie3d",Ka.seriesType=$.pie3d,Ka.transformerConstructor=mt;const qa="combinationCandlestick";class Za extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){const e=[t.openField,t.highField,t.lowField,t.closeField],i=super._getDefaultSeriesSpec(t,["candlestick","openField","highField","lowField","closeField","rising","falling","doji"]);return i.yField=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),e.setDefaultCrosshairForCartesianChart(t)}}class Qa extends e.GlyphMark{constructor(){super(...arguments),this.type=Qa.type}setGlyphConfig(t){super.setGlyphConfig(t),this._subMarks={line:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"}},this._positionChannels=["x","boxWidth","open","close","high","low"],this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{const{x:s=i.attribute.x,boxWidth:r=i.attribute.boxWidth,open:a=i.attribute.open,close:n=i.attribute.close,low:o=i.attribute.low,high:l=i.attribute.high}=t,h={};return h.line={points:[{x:s,y:o},{x:s,y:l}]},h.box={x:s-r/2,x1:s+r/2,y:Math.min(a,n),y1:Math.max(a,n),drawStrokeWhenZeroWH:!0},h}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}Qa.type="candlestick";class Ja extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:a,high:n,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(a)&&e.isValidNumber(l)&&(a>l?(h.from.open=o,h.to.open=a,h.from.close=o,h.to.close=l,e.isValidNumber(n)&&(h.from.high=o,h.to.high=n)):(h.from.open=n,h.to.open=a,h.from.close=n,h.to.close=l,e.isValidNumber(o)&&(h.from.low=n,h.to.low=o))),h})(this.target,this.params,this.params.options);return t}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class tn extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:a,high:n,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(a)&&e.isValidNumber(l)&&(a>l?(h.from.open=a,h.to.open=o,h.from.close=l,h.to.close=o,e.isValidNumber(n)&&(h.from.high=n,h.to.high=o)):(h.from.open=a,h.to.open=n,h.from.close=l,h.to.close=n,e.isValidNumber(o)&&(h.from.low=o,h.to.low=n))),h})(this.target,this.params,this.params.options);return t}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const en="candlestick";var sn,rn;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(sn||(sn={})),function(t){t.candlestick="candlestick"}(rn||(rn={}));const an=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class nn extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case sn.OPEN:return this.series.getOpenField();case sn.HIGH:return this.series.getHighField();case sn.LOW:return this.series.getLowField();case sn.CLOSE:return this.series.getCloseField();case sn.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case sn.OPEN:return e[this.series.getOpenField()];case sn.HIGH:return e[this.series.getHighField()];case sn.LOW:return e[this.series.getLowField()];case sn.CLOSE:return e[this.series.getCloseField()];case sn.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>this.series.getMarkInName("candlestick").getAttribute("stroke",t)}getDefaultContentList(t){return[{key:this.getContentKey(sn.OPEN),value:this.getContentValue(sn.OPEN)},{key:this.getContentKey(sn.HIGH),value:this.getContentValue(sn.HIGH)},{key:this.getContentKey(sn.LOW),value:this.getContentValue(sn.LOW)},{key:this.getContentKey(sn.CLOSE),value:this.getContentValue(sn.CLOSE)},{key:this.getContentKey(sn.SERIES_FIELD),value:this.getContentValue(sn.SERIES_FIELD)}]}}const on={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class ln extends e.CartesianSeries{constructor(){super(...arguments),this.type=en,this._mergedStyles={rising:{},falling:{},doji:{}}}getOpenField(){return this._openField}getHighField(){return this._highField}getLowField(){return this._lowField}getCloseField(){return this._closeField}getBoxFill(){return this._boxFill}getStrokeColor(){return this._strokeColor}setAttrFromSpec(){var t,e,i,s,r,a,n,o;super.setAttrFromSpec();const l=this._spec,h=null!==(e=null===(t=l.candlestick)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._openField=l.openField,this._highField=l.highField,this._lowField=l.lowField,this._closeField=l.closeField,this._boxWidth=h.boxWidth,this._boxFill=h.boxFill,this._strokeColor=h.strokeColor,this._buildMergedStyles(h,null!==(s=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==s?s:{},null!==(a=null===(r=l.falling)||void 0===r?void 0:r.style)&&void 0!==a?a:{},null!==(o=null===(n=l.doji)||void 0===n?void 0:n.style)&&void 0!==o?o:{})}initMark(){this._candlestickMark=this._createMark(ln.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const s={fill:t=>this.mergeStyle(t).boxFill,stroke:t=>this.mergeStyle(t).stroke,lineWidth:t=>this.mergeStyle(t).lineWidth,boxWidth:null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth.bind(this),x:this.dataToPositionX.bind(this)};i.setGlyphConfig({}),this.setMarkStyle(i,s,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,s=this._yAxisHelper;if(i&&s){const{dataToPosition:r}=s,a=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),a),high:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),a),low:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),a),close:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),a)},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}init(t){super.init(t),this.initCandlestickMarkStyle()}_initAnimationSpec(t={}){const i=e.merge({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{i[t]&&"scaleIn"===i[t].type?i[t].type="candlestickScaleIn":i[t]&&"scaleOut"===i[t].type&&(i[t].type="candlestickScaleOut")})),i}initAnimation(){var t;const i=e.getGroupAnimationParams(this);if(this._candlestickMark){const s=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),r=this._initAnimationSpec(e.userAnimationConfig(en,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(s,r,i))}}initTooltip(){this._tooltipHelper=new nn(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,s,r){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,s),this._mergedStyles.doji=e.merge({},t,r)}mergeStyle(t){const e=this.getDatumPositionValues(t,this._openField)[0],i=this.getDatumPositionValues(t,this._closeField)[0];return e<i?this._mergedStyles.rising:e>i?this._mergedStyles.falling:this._mergedStyles.doji}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._xAxisHelper,e=this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}getActiveMarks(){return[this._candlestickMark]}}ln.type=en,ln.builtInTheme={candlestick:on},ln.mark=an;const hn=()=>{e.registerGlyphMark(),e.registerLine(),e.registerRect(),e.Factory.registerGraphicComponent("line",(t=>e.createLine(t))),e.Factory.registerGraphicComponent("rect",(t=>e.createRect(t))),e.Factory.registerMark(Qa.type,Qa),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Ja),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",tn),e.Factory.registerSeries(ln.type,ln)};class cn extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}cn.type="candlestick",cn.seriesType=en,cn.transformerConstructor=Za;function dn(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class un extends e.CartesianChartSpecTransformer{needAxes(){return!0}transformSpec(t){this.transformRegion(t),void 0===t.tooltip&&(t.tooltip={}),this.transformSeriesSpec(t),this._transformAxisSpec(t),this._transformLayout(t)}transformRegion(t){var e,i;const s=t;s.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&s.region.push(null!==(i=t.previewRegion)&&void 0!==i?i:{})}transformSeriesSpec(t){var i;t.series=null!==(i=t.series)&&void 0!==i?i:[],t.series.forEach((e=>{this._transformSeriesData(t,e),e.regionIndex=0}));const s=t.series.find((e=>e.id===t.candlestickSeries.id));let r;s?(e.merge(s,t.candlestickSeries),r=s):(t.series.push(t.candlestickSeries),r=t.candlestickSeries),dn(r),this._transformSeriesData(t,r),r.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const s=t.series.find((t=>t.id===i.id));let r;s?(e.merge(s,i),r=s):(t.series.push(i),r=i),r.regionIndex=1,this._transformSeriesData(t,r)}))}_transformSeriesData(t,i){var s;i.data&&(t.data=e.array(null!==(s=t.data)&&void 0!==s?s:[]),e.array(i.data).forEach(((e,s)=>{t.data.push(e),0===s&&(i.dataIndex=t.data.length-1,"id"in e?i.dataId=e.id:"name"in e&&(i.dataId=e.name))})),delete i.data)}_transformAxisSpec(t){super._transformAxisSpec(t),t.previewSeries&&(t.previewAxes||(t.previewAxes={type:"linear",orient:"left",visible:!1}),t.previewAxes.regionIndex=[1],t.axes.push(t.previewAxes),t.axes.forEach((e=>{e!==t.previewAxes&&("left"!==e.orient&&"right"!==e.orient||(e.regionIndex=[0]))})))}_transformDataZoomSpec(t){t.dataZoom&&e.array(t.dataZoom).forEach((t=>{"left"!==t.orient&&"right"!==t.orient||(t.regionIndex=[0])}))}_transformLayout(t){var i,s;const r={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let a=0,n=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&a++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?a++:n++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?a++:n++)})),t.axes){const i={top:!1,bottom:!1,left:!1,right:!1,z:!1};e.array(t.axes).forEach((t=>{i[t.orient]||(i[t.orient]=!0,"top"===t.orient||"bottom"===t.orient?a++:n++)}))}a++,n++,t.previewSeries&&a++,r.row=a,r.col=n;const o={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(s=t.title)||void 0===s?void 0:s.visible)&&this._layoutOrientItem(r,t.title,o,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(r,i,o,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(r,t,o,{specKey:"dataZoom",index:e},"one")})),t.axes){const e={left:!1,right:!1};t.axes.forEach(((t,i)=>{"left"!==t.orient&&"right"!==t.orient||e[t.orient]||(e[t.orient]=!0,this._layoutOrientItem(r,t,o,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(r,{orient:"top"},o,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(r,{orient:"bottom"},o,{specKey:"region",index:1},"one"),s=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==s){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:s};r.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;r.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else r.rowHeight.push({index:i.row,size:t.previewHeight})}const h=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(r,t.axes[h],o,{specKey:"axes",index:h},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const s=r.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));s&&("top"===e.orient||"bottom"===e.orient?s.col=l.col:s.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=r.elements.find((t=>"modelKey"in t&&"dataZoom"===t.modelKey&&t.modelIndex===e));i&&("top"===t.orient||"bottom"===t.orient?i.col=l.col:i.row=l.row)})),t.layout=r}_layoutOrientItem(t,e,i,s,r){var a;const n={modelKey:s.specKey,modelIndex:s.index,col:0,row:0},o=null!==(a=e.orient)&&void 0!==a?a:"top",{span:l,index:h}=this._getLayoutElementCommon(t,i,r,o);return t.elements.push(n),"top"===o?(n.row=i.top,n.rowSpan=1,n.colSpan=l,n.col=h,i.top++):"bottom"===o?(n.row=t.row-i.bottom-1,n.rowSpan=1,n.colSpan=l,n.col=h,i.bottom++):"left"===o?(n.col=i.left,n.colSpan=1,n.rowSpan=l,n.row=h,i.left++):"right"===o&&(n.col=t.col-i.right-1,n.colSpan=1,n.rowSpan=l,n.row=h,i.right++),n}_getLayoutElementCommon(t,e,i,s){return"top"===s||"bottom"===s?{span:"total"===i?t.col:"one"===i?1:t.col-e.left-e.right,index:"total"===i?0:e.left}:{span:"total"===i?t.row:"one"===i?1:t.row-e.top-e.bottom,index:"total"===i?0:e.top}}}class pn extends e.BaseChart{constructor(){super(...arguments),this.type=qa,this.transformerConstructor=un}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,s)=>{var r;return[...null!==(r=e.getCartesianDimensionInfo(t,i,s))&&void 0!==r?r:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}pn.type=qa,pn.transformerConstructor=un,e.mixin(pn,e.StackChartMixin);const gn=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class mn extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=$.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(e.BaseWordCloudSeries.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",e.AttributeLevel.Series)}initAnimation(){var t,i;const s=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(e.animationConfig(null===(i=e.Factory.getAnimationInKey("wordCloud3d"))||void 0===i?void 0:i((()=>{var t;const e=this.getCompiler().getStage(),i=e.width-s.left||0-s.right||0,r=e.height-s.top||0-s.bottom||0,a=Math.max(i,r)/2;return{center:{x:a,y:a,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:a},r:a}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}mn.type=$.wordCloud3d,mn.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const fn=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:gn(t)}))),e.Factory.registerSeries(mn.type,mn)},yn=()=>{fn()};class vn extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class bn extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=vn,this.type="wordCloud3d",this.seriesType=$.wordCloud3d}}bn.type="wordCloud3d",bn.seriesType=$.wordCloud3d,bn.transformerConstructor=vn;const xn=()=>{Z(),fn(),e.Factory.registerChart(bn.type,bn)},_n={label:{space:0}};class Sn{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const s=e.isZAxis(this._orient),r=e.isXAxis(this._orient),a=e.isYAxis(this._orient);let n=0,o=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let a=1;a<t.length;a++){const n=t[a],{x:o,y:l}=n.getLayoutStartPoint(),{width:h,height:c}=n.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}n=Math.abs(r-i),o=Math.abs(s-e)}let l=0,h=0;const{width:c,height:d}=this.getLayoutRect();let u={x:0,y:0};r?(u={x:c,y:0},l=n,h=c):a&&(u={x:0,y:d},l=o,h=d);const p=this.layout3dBox?this.layout3dBox.length:0;if(!s){const e=this.getLabelItems(h);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(r),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:p,length:l},t}return((t,i)=>{var s;const r=e.getCombinedSizeOfRegions(t.getRegions()),{width:a}=t.getLayoutRect(),n=a,o=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,h={x:o,y:0},c=t.getLabelItems(n),d={start:{x:0,y:0},end:h,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(s=t.directionStr)&&void 0!==s?s:"r2l";let p=[0,0],g=-Math.PI/2,m=0;return"l2r"===u&&(m=t.layout3dBox.length,p=[0,0,0],g=Math.PI/2),d.z=m,d.alpha=g,d.anchor3d=p,i||(d.grid={type:"line",start:{x:0,y:0},end:h,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:r.height,alpha:g,z:m,anchor3d:p}),d})(this,i)}}const An=Object.assign(Object.assign({},Q),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Tn extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=$.rangeColumn3d,this._barMarkType="rect3d",this._barName=$.bar3d}}Tn.type=$.rangeColumn3d,Tn.mark=An;const Cn=()=>{et(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Tn.type,Tn)};class Mn extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class kn extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class wn extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=kn,this.type="rangeColumn3d",this.seriesType=$.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}wn.type="rangeColumn3d",wn.seriesType=$.rangeColumn3d,wn.transformerConstructor=kn;const Pn="pictogram",On="pictogram";var Bn;!function(t){t.pictogram="pictogram"}(Bn||(Bn={}));const Ln=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class En extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===On}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","svg","pictogram","defaultFillColor"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}const Dn=new Map,Fn="_vchartViewportRect";let In;const Rn=/-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;function Nn(t,i){Dn.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),In||(In=new e.DataSet,e.registerDataSetInstanceParser(In,"svg",e.svgParser));const s=new e.DataView(In);s.parse(i,{type:"svg"});const r=s.latestData,a=function(t){var e,i,s,r;const a=null===(e=t.match(/<svg\b[\s\S]*?>/i))||void 0===e?void 0:e[0],n=null===(i=null==a?void 0:a.match(/\benable-background\s*=\s*(['"])(.*?)\1/i))||void 0===i?void 0:i[2];if(!n||!/^\s*new\b/i.test(n))return null;const o=null!==(r=null===(s=n.match(Rn))||void 0===s?void 0:s.map(Number))&&void 0!==r?r:[],[l,h,c,d]=o;return!Number.isFinite(l)||!Number.isFinite(h)||!Number.isFinite(c)||!Number.isFinite(d)||c<=0||d<=0?null:{x:l,y:h,width:c,height:d}}(i);r&&a&&!r.viewBoxRect&&!function(t){return Number.isFinite(t.width)&&Number.isFinite(t.height)&&t.width>0&&t.height>0}(r)&&(r[Fn]=a),Dn.set(t,s)}function jn(t){Dn.has(t)?Dn.delete(t):e.warn(`map type of '${t}' does not exists.`)}function Un(t){return Dn.get(t)}class zn extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,s,r;const a=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},n=t.svg,o=null===(r=null===(s=Dn.get(n))||void 0===s?void 0:s.latestData)||void 0===r?void 0:r.elements;if(o&&o.length){o.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(a[e]=t[e])}))}return a}}class Vn extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)},this.markTooltipValueCallback=(t,e)=>{const{measureFields:i}=this._seriesCacheInfo;if(i[0]&&t.data)return t.data[i[0]]},this.markTooltipKeyCallback=t=>{var e;return null===(e=t.data)||void 0===e?void 0:e[this.series.getDimensionField()[0]]}}}const Gn="element-highlight-by-graphic-name";class Wn extends e.ElementHighlight{constructor(){super(...arguments),this.type=Gn,this.handleStart=t=>{if(t&&t.item&&this.isGraphicInMark(t.item)){if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}}},this.handleReset=t=>{t&&t.item&&this.isGraphicInMark(t.item)&&this.reset()}}_filterByName(t){var e;return!!(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)}_parseTargetKey(t){return t.node.name}start(t){if(e.isNil(t))return;const{interaction:i,highlightState:s,blurState:r}=this.options,a=i.getStatedGraphics(this),n=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&n.push(e)}))})),i.updateStates(this,n,a,s,r),i.setStatedGraphics(this,n)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}Wn.type=Gn;const Hn="element-select-by-graphic-name";class $n extends e.ElementSelect{constructor(){super(...arguments),this.type=Hn}start(t){const e=null==t?void 0:t.name;e&&this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{t.name===e&&super.start(t)}))}))}}$n.type=Hn;function Xn(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const Yn=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&Xn(i)?1:0},Kn=(t,e)=>{var i;const s=null!==(i=t.fill)&&void 0!==i?i:e;return s&&Xn(s)?s:void 0},qn=(t,e)=>{var i;const s=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!s||!Xn(s))&&s},Zn=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:Kn(t),lineWidth:Yn(t),stroke:qn(t)}),Qn={group:t=>{const e=Zn(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},Zn(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},Zn(t)),{fill:Kn(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},Zn(t)),{fill:Kn(t,"#000"),points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),line:t=>Object.assign(Object.assign({},Zn(t)),{points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),path:t=>Object.assign(Object.assign({},Zn(t)),{path:t.d,fillStrokeOrder:!1,fill:Kn(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},Zn(t)),{outerRadius:null!==(e=t.r)&&void 0!==e?e:t.ry,x:parseFloat(t.cx),y:parseFloat(t.cy),startAngle:0,endAngle:2*Math.PI,scaleX:parseFloat(t.rx)/parseFloat(t.ry)||1,fill:Kn(t,"#000")})},text:(t,e)=>{var i,s;return Object.assign(Object.assign({},Zn(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(s=t.textAnchor)&&void 0!==s?s:"middle",anchor:[0,0],fill:Kn(t,"#000")})}},Jn=t=>{var i,s;if(!t||!t[0])return{};const{elements:r}=t[0].latestData;if(r&&r.length){r.forEach(((t,i)=>{var s;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:r,transform:a}=t,n={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(n,t._inheritStyle,null===(s=t.parent)||void 0===s?void 0:s._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(n,t._inheritStyle,t.attributes),Qn[r]?t._finalAttributes=Qn[r](n,t.value):t._finalAttributes=n,a&&(t._finalAttributes.postMatrix=Object.assign({},a))}));const t=r.filter((t=>"text"===t.tagName));for(let a=0;a<t.length;a++){const n=t[a]._uniqueId,o=r.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===n){e=!0;break}i=i.parent}return e}));if(o&&o.length){const r=null!==(s=null===(i=t[a]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==s?s:0;let n=r;for(let t=0;t<o.length;t++){const i=o[t];if("group"===i.graphicType)n=r;else if(i.value&&void 0===i.parent._textGroupStyle.x){const s=o.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(s){n+=e.measureText(s.value,s._finalAttributes).width}i._finalAttributes.x=n}}}}}return r};class to extends e.GeoSeries{constructor(){super(...arguments),this.type=On,this._idToMark=new Map}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.svg=this._spec.svg,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this.svg||null===(t=this._option)||void 0===t||t.onError("svg source is not specified !"),this._parsedSvgResult=null===(e=Un(this.svg))||void 0===e?void 0:e.latestData,this._parsedSvgResult||null===(i=this._option)||void 0===i||i.onError(`'${this.svg}' is not registered !`)}getDatumCenter(t){return[Number.NaN,Number.NaN]}getDatumName(t){return t.name||t._nameFromParent}getMarksWithoutRoot(){return this.getMarks().filter((t=>t.name&&!t.name.includes("seriesGroup")&&!t.name.includes("root")&&t!==this._pictogramMark))}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getTransformMatrix=this.getRootMatrix.bind(this),this._markAttributeContext.coordToPosition=this.coordToPosition.bind(this),this._markAttributeContext.dataToPosition=this.dataToPosition.bind(this)}_defaultHoverConfig(t){return{type:"element-highlight-by-graphic-name",trigger:t.trigger,triggerOff:"pointerout",blurState:e.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:e.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(t){const i="multiple"===t.mode,s=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:s,reverseState:e.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:e.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}initMark(){var t;if(this._pictogramMark=this._createMark(to.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,to.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(to.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:s,name:r,parent:a,id:n,_nameFromParent:o,_uniqueId:l}=i,h=this._createMark({type:s,name:null!=r?r:o},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==a?void 0:a._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,to.mark.pictogram.name)});h&&(h.setData(this._mapViewData),h.setUserId(l),this._idToMark.set(l,h),"group"!==h.type&&h.setMarkConfig({graphicName:h.name}),h.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(to.mark.label,{isSeriesMark:!1,parent:this._pictogramMark,groupKey:"_uniqueId",skipBeforeLayouted:!0});t&&(this._labelMark=t,this._labelMark.setData(this._mapViewData))}initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:t=>!!this._validElement(t),x:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.y},text:t=>t[this.nameField],textAlign:"center",textBaseline:"middle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}initMarkStyle(){const{root:t}=this._parsedSvgResult,i=this._getSvgViewportRect(),s=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,Qn.group(t.attributes),"normal",e.AttributeLevel.Built_In),this.setMarkStyle(this._pictogramMark,{postMatrix:()=>this._getFittedSvgRootMatrix()},"normal",e.AttributeLevel.Built_In),i&&this._pictogramMark.setMarkConfig({clip:!0,clipPath:[e.createRect(Object.assign(Object.assign({},i),{fill:!0}))]}));for(const t of s){const{_uniqueId:i,_finalAttributes:s}=t,r=this._idToMark.get(i),a=this._validElement(t);r&&(this.setMarkStyle(r,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),a?(this.initMarkStyleWithSpec(r,e.merge({},this._spec.pictogram,this._spec[r.name])),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Series),r.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(r.setMarkConfig({interactive:!1}),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new Vn(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const s=t[this.nameField];if(!s)return null;const r=this.getMarksWithoutRoot().filter((t=>t.name===s));if(!r||0===r.length)return null;let a=new e.Bounds;i?r.forEach((t=>{a=a.union(t.getGraphics()[0].globalAABBBounds)})):r.forEach((t=>{a=a.union(t.getProduct().AABBBounds)}));const n={x:(a.x1+a.x2)/2,y:(a.y1+a.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();n.x-=t,n.y-=e}return n}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,s=this.getRootMatrix();if(!s)return null;const r={};return s.getInverse().transformPoint({x:e,y:i},r),r}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}_getSvgRootMatrix(){var t,i;const s=null===(i=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.root)||void 0===i?void 0:i.transform;return s?new e.Matrix(s.a,s.b,s.c,s.d,s.e,s.f):new e.Matrix}_getSvgViewportRect(){var t,e,i,s;const r=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.viewBoxRect;if(r)return r;const{width:a,height:n}=null!==(e=this._parsedSvgResult)&&void 0!==e?e:{};return Number.isFinite(a)&&Number.isFinite(n)&&a>0&&n>0?{x:0,y:0,width:a,height:n}:null!==(s=null===(i=this._parsedSvgResult)||void 0===i?void 0:i[Fn])&&void 0!==s?s:null}_getSvgRootBounds(t){const i=this._getSvgViewportRect();if(!i)return null;const s=(new e.Bounds).setValue(i.x,i.y,i.x+i.width,i.y+i.height);return s.transformWithMatrix(t),s}_appendMatrixScale(t,i,s){const r=new e.Matrix;return r.translate(s.x,s.y),r.scale(i,i),r.translate(-s.x,-s.y),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_appendMatrixTranslate(t,i,s){const r=new e.Matrix;return r.translate(i,s),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_getFittedSvgRootMatrix(){const t=this._getSvgRootMatrix(),e=this._getSvgRootBounds(t);if(!e)return t;const i=e.width(),s=e.height();if(!Number.isFinite(i)||!Number.isFinite(s)||i<=0||s<=0)return t;const{width:r,height:a}=this.getLayoutRect(),n=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,l=Math.min(r/i,a/s),h=this._appendMatrixScale(t,l,{x:n,y:o});return this._appendMatrixTranslate(h,r/2-n,a/2-o)}initData(){var t,i;super.initData();const s=Dn.get(this.svg);s||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const r=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",Jn),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),r.parse([s],{type:"dataview"}).transform({type:"pictogram"}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"name",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"_nameFromParent",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",r.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,r)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const t=this.getPictogramRootGraphic();t&&t.setAttributes({postMatrix:this._getFittedSvgRootMatrix()})}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this))}handleZoom(t){const{scale:i,scaleCenter:s}=t;if(1===i)return;const r=this.getPictogramRootGraphic();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new e.Matrix}),r.scale(i,i,s))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getPictogramRootGraphic();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new e.Matrix}),s.translate(i[0],i[1]))}getMarkData(t){var e;return null!==(e=t.data)&&void 0!==e?e:{}}getMeasureField(){return[this.valueField]}getDimensionField(){return[this.nameField]}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({data:{[t]:e}}),shapeType:i})))}release(){this._parsedSvgResult=null,this._idToMark.clear(),this._idToMark=null}}to.type=On,to.mark=Ln,to.transformerConstructor=zn;const eo=()=>{e.Factory.registerSeries(to.type,to),e.Factory.registerImplement("registerSVG",Nn),e.Factory.registerImplement("unregisterSVG",jn),e.Factory.registerInteractionTrigger(Wn.type,Wn),e.Factory.registerInteractionTrigger($n.type,$n)};class io extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=En,this.type=Pn,this.seriesType=On}}io.type=On,io.seriesType=Pn,io.transformerConstructor=En;class so extends e.BaseChartSpecTransformer{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["urlField","nameField","valueField","imageSize","imageSizeRange","ratio","maskShape","imageMask","layoutConfig","image"])}}const ro="imageCloud",ao="imageCloud";var no;!function(t){t.image="image",t.imageMask="imageMask"}(no||(no={}));const oo=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class lo extends e.ACustomAnimate{constructor(t,e,i,s,r){var a;super(t,e,i,s,r),this._rotations=null!==(a=null==r?void 0:r.rotation)&&void 0!==a?a:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var s;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const r=360*this._rotations*e*Math.PI/180,a=Math.abs(Math.cos(r))*(null!==(s=this._scaleX)&&void 0!==s?s:1);this.target.attribute.scaleX=a,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function ho(t,i){switch(i){case"axialRotate":return[{custom:lo,customParameters:{rotation:1},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration},{channel:{y:{from:(e,i)=>t.height()+i.getFinalAttribute().y},fillOpacity:{from:0,to:1}},easing:"sineInOut"}];case"growIn":return{channel:{scaleX:{from:0,to:1},scaleY:{from:0,to:1},x:{from:()=>t.center().x},y:{from:()=>t.center().y}},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};case"scaleIn":return{type:"scaleIn",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};default:return{type:"fadeIn",easing:"linear",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration}}}class co extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,r=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&r)return null!==(i=r[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}class uo extends e.BaseSeries{constructor(){super(...arguments),this.type=ao}setValueField(t){e.isValid(t)&&(this._valueField=t)}setAttrFromSpec(){super.setAttrFromSpec(),this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._urlField=this._spec.urlField}initMark(){var t;(null===(t=this._spec.imageMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(oo.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(oo.image,{key:t=>`${t[e.DEFAULT_DATA_KEY]}-${t.frequency}`,isSeriesMark:!0,skipBeforeLayouted:!0})}initMarkStyle(){this._initImageMarkStyle(),this._initMaskMarkStyle()}_initImageMarkStyle(){var t,i;if(!this._imageMark)return;this._imageMark.setTransform([Object.assign({type:"imagecloud"},this._imageCloudTransformOption())]),this.setMarkStyle(this._imageMark,{x:t=>t.x,y:t=>t.y,width:t=>t.width,height:t=>t.height,visible:t=>t.visible,angle:t=>t.angle,clipConfig:t=>t.clipConfig,image:t=>t[this._urlField],scaleCenter:["50%","50%"]},"normal",e.AttributeLevel.Series);"masked"===(null===(t=this._spec.layoutConfig)||void 0===t?void 0:t.placement)&&(this.setMarkStyle(this._imageMark,{globalCompositeOperation:"source-atop"},"normal",e.AttributeLevel.Series),this.setMarkStyle(this._rootMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,globalCompositeOperation:"destination-in",clip:!0,drawMode:1},"normal",e.AttributeLevel.Series)),"stack"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.layoutMode)&&this.setMarkStyle(this._imageMark,{stroke:"white",lineWidth:2,shadowBlur:6,shadowColor:"grey"},"normal",e.AttributeLevel.Series)}isFillingImage(t){return t._frequency>1}_initMaskMarkStyle(){this._maskMark&&(this._maskMark.setMarkConfig({interactive:!1}),this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height},"normal",e.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new co(this),this._imageMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark)}_imageCloudTransformOption(){var t;return{size:()=>{const{width:t,height:e}=this._region.getLayoutRect();return[t,e]},image:{field:this._urlField},weight:{field:this._valueField},imageConfig:{imageSize:this._spec.imageSize,imageSizeRange:this._spec.imageSizeRange,padding:null===(t=this._spec.image)||void 0===t?void 0:t.padding},ratio:this._spec.ratio,mask:this._spec.maskShape,maskConfig:this._spec.imageMask,layoutConfig:this._spec.layoutConfig,createCanvas:e.vglobal.createCanvas.bind(e.vglobal),createImage:e.createImage,onUpdateMaskCanvas:((t,e)=>{var i;t&&this._maskMark&&this._maskMark.getProduct().getChildren().forEach((e=>{e.setAttribute("background",t)})),e&&"masked"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.placement)&&this._rootMark.getProduct().setAttribute("background",e)}).bind(this),onLayoutFinished:()=>{var t,e;return null===(e=null===(t=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===t?void 0:t.afterWordcloudShapeDraw)||void 0===e?void 0:e.call(t,this._option.globalInstance)}}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.isFillingImage=this.isFillingImage.bind(this)}initAnimation(){[this._imageMark].forEach((t=>{var i,s;if(t){const r=null===(s=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===s?void 0:s.preset,a={center:()=>{const{width:t,height:e}=this._region.getLayoutRect();return{x:t/2,y:e/2}},height:()=>{const{height:t}=this._region.getLayoutRect();return t}};t.setAnimationConfig(e.animationConfig(e.Factory.getAnimationInKey("imageCloud")(a,r),e.userAnimationConfig("image",this._spec,this._markAttributeContext)))}}))}getDimensionField(){var t;return[null!==(t=this._nameField)&&void 0!==t?t:this._spec.urlField]}getMeasureField(){return[this._valueField]}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getActiveMarks(){return[this._imageMark]}getMarkData(t){var e;return null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t}getGroupFields(){return[]}dataToPosition(t){return null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}valueToPosition(t,e){return null}getStackGroupFields(){return[]}getStackValueField(){return""}}uo.type=ao,uo.mark=oo;const po=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:ho(t,e),enter:ho(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries(uo.type,uo),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class go extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=go.transformerConstructor,this.type=ro,this.seriesType=ao}}go.type=ro,go.seriesType=ao,go.transformerConstructor=so;class mo extends e.BaseChartSpecTransformer{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["timeField","eventField","seriesField","titleField","subTitleField","iconField","dot","title","subTitle","icon","line","arrow","labelPosition","sortDataByAxis"])}_setDefaultXAxisSpec(t){return{type:"band",orient:"bottom",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_setDefaultYAxisSpec(t){return{type:"band",inverse:!0,orient:"left",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_transformAxisSpec(t){t.axes||(t.axes=[]);const e={x:!1,y:!1};t.axes.forEach((i=>{const{orient:r}=i;let a=null;"top"!==r&&"bottom"!==r||(e.x=!0,a=this._setDefaultXAxisSpec(t)),"left"!==r&&"right"!==r||(e.y=!0,a=this._setDefaultYAxisSpec(t)),a&&Object.keys(a).forEach((t=>{i[t]=s.isObject(i[t])?s.merge(a[t],i[t]):s.isNil(i[t])?a[t]:i[t]}))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t))}transformSpec(t){var e,i;super.transformSpec(t),this.transformSeriesSpec(t),this._transformAxisSpec(t);const s=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===s?(t.timeField&&!t.yField&&(t.yField=t.timeField),t.xField||(t.xField=t.seriesField||"__vchart_timeline_dummy__")):(t.timeField&&!t.xField&&(t.xField=t.timeField),t.yField||(t.yField=t.seriesField||"__vchart_timeline_dummy__"))}))}}const fo="event",yo=Object.assign(Object.assign({},e.baseSeriesMark),{line:{name:"line",type:"line"},dot:{name:"dot",type:"symbol"},icon:{name:"icon",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},arrow:{name:"arrow",type:"path"}});class vo extends e.CartesianSeries{constructor(){super(...arguments),this.type=fo,this.transformerConstructor=e.BaseSeriesSpecTransformer,this.coordinate="cartesian"}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),this._timeField=this._spec.timeField,this._eventField=this._spec.eventField,this._subTitleField=this._spec.subTitleField,this._iconField=this._spec.iconField,this._labelPosition=this._spec.labelPosition}getDimensionField(){return this._timeField?[this._timeField]:[]}getMeasureField(){const t=[];return this._eventField&&t.push(this._eventField),this._subTitleField&&t.push(this._subTitleField),t}initMark(){this._axisLineMark=this._createMark(vo.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark(vo.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark(vo.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark(vo.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark(vo.mark.title),this._subTitleMark=this._createMark(vo.mark.subTitle)}initTooltip(){super.initTooltip(),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark),this._titleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._titleMark),this._subTitleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._subTitleMark),this._iconMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._iconMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}initMarkStyle(){var t,i,r,a,n,o,l,h,c,d,u;this._axisLineMark&&this.setMarkStyle(this._axisLineMark,{points:this._getAxisPoints.bind(this),visible:this._isFirstDataInGroup.bind(this),stroke:"#c0c3c7",lineWidth:1},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const p=this._spec.dot,g="number"==typeof(null===(t=null==p?void 0:p.style)||void 0===t?void 0:t.size)?p.style.size:8,m=this._spec.title,f=null!==(i=null==m?void 0:m.style)&&void 0!==i?i:{},y=this._spec.subTitle,v=null!==(r=null==y?void 0:y.style)&&void 0!==r?r:{},b="number"==typeof f.fontSize?f.fontSize:14,x=g/2+(null!==(a=null==m?void 0:m.offset)&&void 0!==a?a:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:g,fill:null!==(o=null===(n=null==p?void 0:p.style)||void 0===n?void 0:n.fill)&&void 0!==o?o:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(h=null===(l=null==p?void 0:p.style)||void 0===l?void 0:l.fill)&&void 0!==h?h:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},f),{x:t=>this._getTitlePosition(t,x).x,y:t=>this._getTitlePosition(t,x).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!0),text:t=>this._getDatumString(t,this._eventField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._subTitleMark&&this.setMarkStyle(this._subTitleMark,Object.assign(Object.assign({},v),{x:t=>this._getSubTitlePosition(t,x,b).x,y:t=>this._getSubTitlePosition(t,x,b).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!1),text:t=>this._getDatumString(t,this._subTitleField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const _=this._spec.icon,S="number"==typeof(null===(c=null==_?void 0:_.style)||void 0===c?void 0:c.size)?_.style.size:20,A=(s.isValid(null==_?void 0:_.offset)?_.offset+g/2:x)+S/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,A).x,y:t=>this._getIconPosition(t,A).y,size:S,fill:null!==(u=null===(d=null==_?void 0:_.style)||void 0===d?void 0:d.fill)&&void 0!==u?u:this.getColorAttribute(),shape:t=>this._getDatumString(t,this._iconField)||"circle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}_getLabelSide(t){const e=this._getViewDataList().indexOf(t),i=this._labelPosition;if("vertical"===this.direction)switch(i){case"left":default:return"primary";case"right":return"secondary";case"left-right":return e%2==0?"primary":"secondary";case"right-left":return e%2==0?"secondary":"primary"}else switch(i){case"top":default:return"primary";case"bottom":return"secondary";case"top-bottom":return e%2==0?"primary":"secondary";case"bottom-top":return e%2==0?"secondary":"primary"}}_getLabelTextAlign(t){if("vertical"===this.direction){return"primary"===this._getLabelSide(t)?"right":"left"}return"center"}_getLabelTextBaseline(t,e){if("vertical"===this.direction)return"middle";return"primary"===this._getLabelSide(t)?"bottom":"top"}_getTitlePosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===s?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var s,r,a,n;const o=this._getPoint(t),l=this._getLabelSide(t),h=null!==(r=null===(s=this._spec.title)||void 0===s?void 0:s.subTitleGap)&&void 0!==r?r:4;if("vertical"===this.direction){const t=null!==(n=null===(a=this._spec.title)||void 0===a?void 0:a.style)&&void 0!==n?n:{},s="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?o.x-e:o.x+e,y:o.y+s+h}}return{x:o.x,y:"primary"===l?o.y-(e+i+h):o.y+(e+i+h)}}_getIconPosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===s?i.y+e:i.y-e}}_getViewDataList(){var t,e;return null!==(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)&&void 0!==e?e:[]}_getPoint(t){if("vertical"===this.direction){return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._timeField)}}return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._timeField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField)}}_getPositionFromAxis(t,e,i){var s,r,a,n,o,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const h=t[i];return"band"!==(null===(r=null===(s=e.getSpec)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.type)&&e.isContinuous?null!==(l=null===(o=e.valueToPosition)||void 0===o?void 0:o.call(e,h))&&void 0!==l?l:this._getDefaultPosition(i):null!==(n=null===(a=e.dataToPosition)||void 0===a?void 0:a.call(e,[h],{bandPosition:.5}))&&void 0!==n?n:this._getDefaultPosition(i)}onXAxisHelperUpdate(){var t;null===(t=super.onXAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}onYAxisHelperUpdate(){var t;null===(t=super.onYAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}_getDefaultPosition(t){const e=this._region.getLayoutRect();if(!this._seriesField||t===this._seriesField){return"vertical"!==this.direction?.5*e.height:.5*e.width}return 0}_getAxisPoints(t){const e=this._region.getLayoutRect();if("vertical"===this.direction){const i=this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField);return[{x:i,y:0},{x:i,y:e.height}]}const i=this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField);return[{x:0,y:i},{x:e.width,y:i}]}_isFirstDataInGroup(t){if(!this._seriesField){return 0===this._getViewDataList().indexOf(t)}const e=this._getViewDataList(),i=t[this._seriesField];return t===e.find((t=>this._seriesField&&t[this._seriesField]===i))}_getNextDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||i===e.length-1)return null;if(!this._seriesField)return e[i+1];const s=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getPreviousDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||0===i)return null;if(!this._seriesField)return e[i-1];const s=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getArrowPath(t){var e,i;const s=this._getPoint(t),r=this._getNextDatum(t),a=this._getPreviousDatum(t),n=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,o=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=a?{x:s.x,y:(this._getPoint(a).y+s.y)/2}:{x:s.x,y:t?0:o.height},i=r?{x:s.x,y:(this._getPoint(r).y+s.y)/2}:{x:s.x,y:t?o.height:0},l=t?1:-1,h=n/3,c=n/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*h} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*h} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*h} Z`}const l=this.getXAxisHelper().isInverse(),h=a?{x:(this._getPoint(a).x+s.x)/2,y:s.y}:{x:l?o.width:0,y:s.y},c=r?{x:(this._getPoint(r).x+s.x)/2,y:s.y}:{x:l?0:o.width,y:s.y},d=l?-1:1,u=n/2,p=n/3;return`M ${h.x} ${h.y-u} L ${h.x+d*p} ${h.y} L ${h.x} ${h.y+u} \n L ${c.x-d*p} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-d*p} ${c.y-u} Z`}_getDatumString(t,e){if(!t||!e)return"";const i=t[e];return"string"==typeof i?i:null==i?"":String(i)}valueToPosition(t,e){if(t&&"object"==typeof t)return this.dataToPosition(t);const i={};return this._timeField&&(i[this._timeField]=t),this._eventField&&void 0!==e&&(i[this._eventField]=e),this._getPoint(i)}getActiveMarks(){return[this._axisLineMark,this._dotMark,this._iconMark,this._arrowMark,this._titleMark,this._subTitleMark].filter(Boolean)}}vo.type=fo,vo.mark=yo,vo.builtInTheme={event:{dot:{style:{size:8}},icon:{visible:!1,style:{size:20}},line:{visible:!0,style:{stroke:"#c0c3c7",lineWidth:1}},title:{visible:!0,offset:6,subTitleGap:4,style:{fontSize:14}},subTitle:{visible:!0,style:{fontSize:12}},arrow:{visible:!1,thickness:16}}},vo.transformerConstructor=e.BaseSeriesSpecTransformer;const bo=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries(vo.type,vo)};class xo extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=mo,this.type="timeline",this.seriesType="event"}}xo.type="timeline",xo.seriesType="event",xo.transformerConstructor=mo;const _o="seriesBreak";function So(t,e,i,s,r=!1){const a=[],{x:n,y:o}=t,{x:l,y:h}=e,c=r?Math.floor((h-o)/(2*i)):Math.floor((l-n)/(2*i)),d=Math.PI/180*s,u=i*Math.cos(d),p=i*Math.sin(d);a.push(`M ${n} ${o}`);for(let t=0;t<=c;t++){const e=r?n+(t%2==0?u:-u):n+t*i*2,s=r?o+t*i*2:t%2==0?o-p:o+p;a.push(`L ${e} ${s}`)}return a.push(`L ${r?n:l} ${r?h:o}`),a.join(" ")}class Ao extends e.AbstractComponent{constructor(){super(...arguments),this.name=_o}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],s=[];t.forEach((t=>{const{start:r,end:a}=t;((t,i)=>{const{start:s,end:r}=i,a=s.x===r.x,n=a?"x":"y",o=a?"y":"x";let l=!0;const h=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[n],s[n])){const e=Math.min(s[o],r[o]),i=Math.max(s[o],r[o]),a=Math.min(t.start[o],t.end[o]),n=Math.max(t.start[o],t.end[o]);if(!(i<a-h||e>n+h))return t.start[o]=Math.min(a,e),t.end[o]=Math.max(n,i),void(l=!1)}})),l&&t.push(i)})(r.x===a.x?i:s,t)})),[...i,...s].forEach(((t,i)=>{var s;const{start:r,end:a,size:n=4,gap:o=5,style:l={}}=t,h=f(t,["start","end","size","gap","style"]),c=e.createGroup({}),d=r.x===a.x;let u,p,g,m;d?(u={x:r.x-o/2,y:r.y},p={x:a.x-o/2,y:a.y},g={x:r.x+o/2,y:r.y},m={x:a.x+o/2,y:a.y}):(u={x:r.x,y:r.y-o/2},p={x:a.x,y:a.y-o/2},g={x:r.x,y:r.y+o/2},m={x:a.x,y:a.y+o/2});const y=So(u,p,n,d?75:15,d),v=So(r,a,n,d?75:15,d),b=So(g,m,n,d?75:15,d);c.add(e.createPath(Object.assign(Object.assign({path:y,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:b,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:v,stroke:"#fff",lineWidth:o,pickable:!1,zIndex:0})),c.name="series-break",c.data=h,e.isValid(h.axisId)&&(c.id=`${null!==(s=h.axisId)&&void 0!==s?s:""}_${i}`),this.add(c)}))}}function To(t,e,i=1){return Math.abs(t-e)<i}function Co(t,i){return{type:"component",componentType:_o,interactive:!0,zIndex:500,style:{data:(s,r)=>{const a=[],n=r.vchart.getChart(),o="horizontal"===n.getAllSeries()[0].direction;return t.forEach(((t,s)=>{var r,l;const h=t.id,c=e.isValid(h)?n.getComponentByUserId(h):i&&e.isValid(i[s])?n.getComponentByIndex("axes",i[s]):null===(r=n.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===r?void 0:r[0];if(!c)return;const d=null!=h?h:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let a=1;a<t.length;a++){const n=t[a],{x:o,y:l}=n.getLayoutStartPoint(),{width:h,height:c}=n.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}return{x1:e,y1:i,x2:s,y2:r}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:s=5}=t,r=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),h=(r+l)/2+(o?u.x1:u.y1);n.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const n=t.AABBBounds;let c,p,g,m,f=!1;o?(f=n.x1<(r+l-s)/2&&n.x2>(r+l+s)/2,c=h,p=Math.max(n.y1+u.y1-2,u.y1),g=h,m=Math.min(n.y2+u.y1+2,u.y2)):(f=n.y1<(r+l-s)/2&&n.y2>(r+l+s)/2,c=Math.max(n.x1+u.x1-2,u.x1),p=h,g=Math.min(n.x2+u.x1+2,u.x2),m=h),f&&a.push({start:{x:c,y:p},end:{x:g,y:m},gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{ko(t,"line").forEach((t=>{Mo(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t).forEach((t=>{let r,n;o?(r={x:h,y:Math.max(t[1]+u.y1-10,u.y1)},n={x:h,y:Math.min(t[1]+u.y1+10,u.y2)}):(r={x:Math.max(t[0]+u.x1-10,u.x1),y:h},n={x:Math.min(t[0]+u.x1+10,u.x2),y:h}),a.push({start:r,end:n,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{ko(t,"area").forEach((t=>{const n=Mo(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t);n.sort(((t,e)=>t[0]-e[0]));for(let r=0;r<n.length-1;r++){const l={x:n[r][0],y:n[r][1]},h={x:n[r+1][0],y:n[r+1][1]};if(wo(o?{x:l.x,y:(l.y+h.y)/2}:{x:(l.x+h.x)/2,y:l.y},t)){let t,r;o?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},r={x:h.x+u.x1,y:Math.min(h.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},r={x:Math.min(h.x+u.x1+0,u.x2),y:h.y+u.y1}),a.push({start:t,end:r,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}}}))}))}}))}))})),a}}}}function Mo(t,i){const s=[];for(let r=1;r<i.length;r++){const a=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[r].x,i[r].y],[i[r-1].x,i[r-1].y]);a&&!s.find((t=>To(e.PointService.distancePP({x:t[0],y:t[1]},{x:a[0],y:a[1]}),0)))&&s.push(a)}return s}function ko(t,e){const{points:i,segments:s}=t.attribute,r=[];let a=[];const n=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var s,n;if(!1===t.defined){if(r.push(a),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)a.push({x:i[t].x,y:i[t].y});a.push(a[0])}a=[],i=[]}else a.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(s=t.x1)&&void 0!==s?s:t.x,y:null!==(n=t.y1)&&void 0!==n?n:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)a.push({x:i[t].x,y:i[t].y});a.push(a[0])}r.push(a)}};return i&&i.length?n(i):s&&s.length&&s.forEach((t=>{n(t.points)})),r}function wo(t,e){const{x:i,y:s}=t;let r=!1;for(let t=0,a=e.length-1;t<e.length;a=t++){const{x:n,y:o}=e[t],{x:l,y:h}=e[a];o>s!=h>s&&i<(l-n)*(s-o)/(h-o)+n&&(r=!r)}return r}const Po="barLink";class Oo extends e.AbstractComponent{constructor(){super(...arguments),this.name=Po}render(){const{data:t,linkStyle:i,areaStyle:s,styleMap:r,label:a,linkType:n="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,o)=>{var l,h,c,d,u;const{linePoints:p,areaPoints:g,id:m=o,color:f,data:y}=t;if(g&&!1!==(null===(l=null==r?void 0:r[`area-${m}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:g,fillOpacity:.3,fill:f,zIndex:0},s),null==r?void 0:r[`area-${m}`]));t.name="bar-link-area",t.id=`area-${m}`,this.add(t)}if(p&&!1!==(null===(h=null==r?void 0:r[`line-${m}`])||void 0===h?void 0:h.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(d=null==r?void 0:r[`line-${m}`])||void 0===d?void 0:d.lineWidth)){const{startSymbol:t={},endSymbol:s={},lineStyle:a}=i||{},n=e.cloneDeep(t),o=e.cloneDeep(s);(null==r?void 0:r[`line-${m}`])&&r[`line-${m}`].stroke&&(n.style=Object.assign(Object.assign({},n.style),{color:r[`line-${m}`].stroke}),o.style=Object.assign(Object.assign({},o.style),{color:r[`line-${m}`].stroke})),n.symbolType||n.originSymbolType||(n.originSymbolType="solidArrow"),o.symbolType||o.originSymbolType||(o.originSymbolType="solidArrow");const l=new e.Segment({points:p,startSymbol:Object.assign({size:8},n),endSymbol:Object.assign({size:8},o),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},a),null==r?void 0:r[`line-${m}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${m}`,this.add(l)}if((null==a?void 0:a.visible)&&!1!==(null===(u=null==r?void 0:r[`label-${m}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=a,[s,o]=y;let l=s[e.STACK_FIELD_END],h=o[e.STACK_FIELD_END];"value"===n&&(l=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START],h=o[e.STACK_FIELD_END]-o[e.STACK_FIELD_START]);const c=h-l,d=(h-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(p[0].x+p[1].x),y:.5*(p[0].y+p[1].y),text:i?i(c,d,y):`${c} ${d}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==r?void 0:r[`label-${m}`]));u.name="bar-link-label",u.id=`label-${m}`,this.add(u)}})))}}function Bo(t,i,s){const{isHorizontal:r,isXAxisInverse:a,isYAxisInverse:n,linkType:o,doFill:l,regionStartX:h,regionStartY:c}=s,d=t.AABBBounds,u=i.AABBBounds;let p,g;return r?(p=[{x:(d.x1+d.x2)/2+h,y:d.y1+c},{x:(u.x1+u.x2)/2+h,y:u.y2+c}],a?("total"===o&&(p=[{x:d.x1+h,y:d.y1+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x1+h,x1:d.x2+h,y:d.y1+c},{x:u.x1+h,x1:u.x2+h,y:u.y2+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x2+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,x1:d.x1+h,y:d.y1+c},{x:u.x2+h,x1:u.x1+h,y:u.y2+c}]))):(p=[{x:d.x2+h,y:(d.y1+d.y2)/2+c},{x:u.x1+h,y:(u.y1+u.y2)/2+c}],n?("total"===o&&(p=[{x:d.x2+h,y:d.y2+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,y:d.y2+c,y1:d.y1+c},{x:u.x1+h,y:u.y2+c,y1:u.y1+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x1+h,y:u.y1+c}]),l&&(g=[{x:d.x2+h,y:d.y1+c,y1:d.y2+c},{x:u.x1+h,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:g,linePoints:p,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function Lo(t={},i){const{linkType:s="total",doFill:r}=t,a=f(t,["linkType","doFill"]);return{type:"component",componentType:Po,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:a}=i,n=a.getChart().getAllRegions(),o=[];return n.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:a,y:n}=t.getLayoutStartPoint();if(i.length){const t=i[0].getGroupFields(),l=[];i.forEach((t=>{var e;(null===(e=t.getMarkInName("bar"))||void 0===e?void 0:e.getGraphics()).forEach((t=>{l.push(t)}))}));const h=function(t,i){const s={};for(let r=0;r<t.length;r++){const a=t[r],n=e.getDatumOfGraphic(a),o=i.map((t=>n[t])).join("-");s[o]||(s[o]=[]),s[o].push(a)}return s}(l,t);Object.values(h).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],d="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),p=c.getXAxisHelper().isInverse(),g=Object.values(h);if(g.length)if(d){g[0][0].AABBBounds.y1<g[g.length-1][0].AABBBounds.y1&&g.reverse()}else{g[0][0].AABBBounds.x1>g[g.length-1][0].AABBBounds.x1&&g.reverse()}for(let t=0;t<g.length-1;t++){const e=g[t],i=g[t+1];if(e.forEach(((t,e)=>{var l;const h=Bo(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:a,regionStartY:n});o.push(h)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=Bo(t,i[l],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:a,regionStartY:n});o.push(e)}}}}})),o},linkType:s},a),i)}}const Eo="seriesLabel";function Do(t,e=10,i=10,s=.1){const r=t.length;if(!t.every(isFinite))return t;if(!(r>1))return t;const a=function(t,e,i){t=+t,e=+e;let s=arguments.length;i=s<2?(e=t,t=0,1):s<3?1:+i;let r=-1;s=0|Math.max(0,Math.ceil((e-t)/i));const a=new Array(s);for(;++r<s;)a[r]=t+r*i;return a}(t.length);for(let n=0;n<i;++n){a.sort(((e,i)=>{return s=t[e],r=t[i],null==s||null==r?NaN:s<r?-1:s>r?1:s>=r?0:NaN;var s,r}));let i=0;for(let s=1;s<r;++s){let r=t[a[s]]-t[a[s-1]];r<e&&(r=(e-r)/2,i=Math.max(i,r),t[a[s-1]]-=r,t[a[s]]+=r)}if(i<s)break}return t}function Fo(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function Io(t,e=10,i=10){const s=t.length;let r,a=0;do{r=!1;for(let i=0;i<s;++i)for(let a=i+1;a<s;++a){const s=t[i].AABBBounds,n=t[a].AABBBounds;if(Fo(s,n)){const i=e-(n.x1-s.x2);i>0&&(t[a].attribute.x+=i,n.x1+=i,n.x2+=i,r=!0)}}a++}while(r&&a<i)}function Ro(t,i){const{label:s,line:r}=i;return{type:"component",componentType:Eo,interactive:!1,style:{position:t,layout:(t,e)=>{var i;return null!==(i=e.vchart.getChart().getAllSeries()[0].getSpec().direction)&&void 0!==i?i:"vertical"},data:(i,s)=>{var r;const a=s.vchart.getChart(),n=a.getAllSeries()[0],o="horizontal"===n.direction,l=o?n.getYAxisHelper():n.getXAxisHelper(),h=null===(r=l.getScale)||void 0===r?void 0:r.call(l,0),c=l.isInverse(),d=n.getDimensionField()[0],u=n.getSeriesField(),p=a.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),g=[];if(1===p.length&&["bar","area","line","waterfall"].includes(p[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(h.domain()):h.domain()[0],s=n.getRegion(),{x:r,y:l}=s.getLayoutStartPoint();let m=0;a.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===p[0]?"bar":p[0]).getGraphics().forEach((s=>{var a;const n=s.context.data.find((t=>t[d]===i));if(n){const i=s.AABBBounds;let h,f,y,v;"bar"===p[0]||"waterfall"===p[0]?(h="end"===t?{x:o?(i.x1+i.x2)/2:c?i.x1:i.x2,y:o?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:o?(i.x1+i.x2)/2:c?i.x2:i.x1,y:o?c?i.y1:i.y2:(i.y1+i.y2)/2},f=s.attribute.fill):(h=e.dataToPosition(n),f=s.attribute.stroke||s.attribute.fill),"end"===t?(y=o?"center":c?"end":"start",v=o?c?"top":"bottom":"middle"):(y=o?"center":c?"start":"end",v=o?c?"bottom":"top":"middle");const b=null!==(a=n[u])&&void 0!==a?a:n[d];g.push({point:{x:h.x+r,y:h.y+l},label:b,color:f,textAlign:y,textBaseline:v,series:e,datum:n,id:`${t}-${m}`,position:t}),m++}}))}))}))}return g},line:r,label:Object.assign({space:12},s)}}}class No extends e.AbstractComponent{constructor(){super(...arguments),this.name=Eo}render(){var t,i,s,r;this.removeAllChild();const{data:a,layout:n,label:o,line:l={}}=this.attribute;if(e.isEmpty(a))return;const h=null!==(t=null==o?void 0:o.styleMap)&&void 0!==t?t:{},c={},d=a.filter((t=>{var e;return!1!==(null===(e=h[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===n){const t=1.5*(null!==(s=null===(i=null==o?void 0:o.style)||void 0===i?void 0:i.fontSize)&&void 0!==s?s:12),r=(t,i,s)=>{var r,a,n,o,l,h,c,d;const{label:u,color:p,textAlign:g,textBaseline:m,id:f}=t,y=null!==(a=null===(r=s[f])||void 0===r?void 0:r.formatMethod)&&void 0!==a?a:null===(n=this.attribute.label)||void 0===n?void 0:n.formatMethod,v=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:y?y(u,t.datum,{series:t.series}):u},null===(o=this.attribute.label)||void 0===o?void 0:o.style),i),{textAlign:g,textBaseline:m,fill:null!==(c=null===(h=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fill)&&void 0!==c?c:p}),null===(d=s[f])||void 0===d?void 0:d.style));return v.name="series-label-text",v.id=f,this.add(v),v};["start","end"].forEach((e=>{const i=d.filter((t=>t.position===e)),s=Do(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const a={x:t.point.x+(null!==(i=null==o?void 0:o.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:s[e]};r(t,a,h),c[t.id]=a}))}))}else{const t=[],i=[];d.forEach((s=>{var r,a,n,l,c;const{point:d,label:u,color:p,textAlign:g,textBaseline:m,id:f,position:y}=s,v={x:d.x,y:d.y},b=null!==(a=null===(r=h[f])||void 0===r?void 0:r.formatMethod)&&void 0!==a?a:null==o?void 0:o.formatMethod,x=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:b?b(u,s.datum,{series:s.series}):u},null==o?void 0:o.style),v),{textAlign:g,textBaseline:m,fill:null!==(l=null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.fill)&&void 0!==l?l:p}),null===(c=h[f])||void 0===c?void 0:c.style));x.id=f,x.name="series-label-text",this.add(x),"start"===y?t.push(x):"end"===y&&i.push(x)})),t.length&&Io(t,4,10),i.length&&Io(i,4,10);const s=null!==(r=null==o?void 0:o.space)&&void 0!==r?r:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+s*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&d.forEach((t=>{var i,s,r,a,o,d;const{point:u,color:p,id:g}=t,m={x:c[g].x+(null!==(r=null===(s=null===(i=h[g])||void 0===i?void 0:i.style)||void 0===s?void 0:s.dx)&&void 0!==r?r:0),y:c[g].y+(null!==(d=null===(o=null===(a=h[g])||void 0===a?void 0:a.style)||void 0===o?void 0:o.dy)&&void 0!==d?d:0)};if(!1!==l.autoVisible){if("vertical"===n&&u.y!==m.y||"horizontal"===n&&u.x!==m.x){const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}))}}function jo(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Uo(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function zo(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:Uo(t.rect),anchorCandidates:Xo(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const r=i[t],a=r.bound;let n=s.some((t=>jo(t,a)));if(r.anchorCandidates)if(n&&(null===(e=r.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<r.anchorCandidates.length;t++){const e=r.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+a.x2-a.x1,y2:e.y+a.y2-a.y1,anchor:e};if(!s.some((t=>jo(t,i)))){s.push(i),n=!1;break}}n&&s.push(r.bound)}else s.push(r.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Vo(t,i,s){const r=t.map((t=>t.pointCoord)),{x1:a,x2:n,y1:o,y2:l}=e.getAABBFromPoints(r),h=s([(a+n)/2,(o+l)/2]);if(!h)return[];const c=t.map((t=>{const r=t.rect,a=Ho(i,t.pointCoord)?s(function(t,i,s,r=200){const a=5621/r;let n=i;for(let i=1;i<=a;i++){const i=e.destination(n,r,s);if(!Ho(t,i))return[i.x,i.y];n=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],Go(Wo(t.point,h)))):t.point;a&&(r.x=a.x,r.y=a.y);const n=Go(Wo(t.point,h));let o;const l=[];return n>=-45&&n<45?(o="top",l.push("left","right")):n>=45&&n<135?o="right":n>=-135&&n<-45?(o="left",l.push("left")):(o="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=$o(t.rect,o,0),t}));return zo(c)}function Go(t){return t>180?t-360:t}function Wo(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function Ho(t,i){for(let s=0;s<t.length;s++){if(e.isPointInPolygon(i,t[s]))return!0}return!1}function $o(t,e,i=0){const s=Object.assign({},t);return"top"===e?(s.x-=t.width/2,s.y-=i+t.height/2):"bottom"===e?(s.x-=t.width/2,s.y+=i-t.height/2):"left"===e?(s.x-=i+t.width,s.y-=t.height/2):"right"===e&&(s.x+=i,s.y-=t.height/2),s}function Xo(t,e,i,s=0){const r=[];return t.forEach((t=>{const{x:a,y:n}=$o(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);r.push({x:a,y:n})})),r}const Yo={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"black"}}};class Ko extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return Yo}}class qo extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Ko,this.layoutType="none",this.layoutZIndex=e.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return e.getSpecInfo(t,this.specKey,this.type,(t=>t.visible&&e.isValid(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,r,a,n,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(r=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.longitudeField,this._latitudeField=null===(o=null===(n=(a=this._regions[0]).getSpec)||void 0===n?void 0:n.call(a))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const i=t.getViewData();if(i){const t=new e.DataView(this._option.dataSet,{name:`${this.name}_data`});t.parse([i],{type:"dataview"}),t.transform({type:"copyDataView",level:e.TransformLevel.copyDataView},!1),this._data=new e.CompilableData(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(()=>(this.handleZoom(),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("element-highlight:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this._updateDatum(null)}))):"click"===t&&(this.event.on("element-select:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("elementSelectReset",(t=>{this._activeDatum&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const i=[],s=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var s;const r=new e.MarkPoint({position:void 0,animation:!1});return r&&(r.name=`${this.name}_marker_${i}`,r.id=null!==(s=this._spec.id)&&void 0!==s?s:`${this.name}_marker_${this.id}`,r.setAttribute("zIndex",this.layoutZIndex)),r})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:r,contentMarks:a}=this._evaluateMarker(this._data.getLatestData()[e],e);r&&i.push(r),a&&s.push(a)}));const r=this._layoutLabels(i);this._layoutMarkers(r,s),this._renderMarkers()}_evaluateMarker(t,i){var s,r,a,n,o,l,h,c,d,u,p,g,m,f;let y=0,v=0,b=0,x=0,_=0;const S=this._spec.position||"top",A=this._spec.offset,T=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),C=this._spec.space||0;v+=((null==T?void 0:T.left)||0)+((null==T?void 0:T.right)||0),b+=((null==T?void 0:T.top)||0)+((null==T?void 0:T.bottom)||0);const M={},k=this.dataToPosition(t),w=e.graphicCreator.group({});if(w.name=`${this.name}_marker_itemContainer_${i}`,M.container=w,null===(r=this._spec.background)||void 0===r?void 0:r.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(k),M.labelBackground=t,w.appendChild(t)}if(null===(a=this._spec.icon)||void 0===a?void 0:a.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null!==(o=null===(n=this._spec.icon.style)||void 0===n?void 0:n.symbolType)&&void 0!==o?o:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,r=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;M.icon=t,w.appendChild(t),_=s,x+=r,y++}if(null===(d=this._spec.nameLabel)||void 0===d?void 0:d.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(k),i.setAttribute("text",t[this.nameField]);const s=i.AABBBounds,r=null!==(u=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==u?u:0,a=null!==(p=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==p?p:0;M.nameLabel=i,w.appendChild(i),_=Math.max(_,r),x+=a,y++}if((null===(g=this._spec.valueLabel)||void 0===g?void 0:g.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(k),i.setAttribute("text",t[this.valueField]);const s=i.AABBBounds,r=null!==(m=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==m?m:0,a=null!==(f=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==f?f:0;M.valueLabel=i,w.appendChild(i),_=Math.max(_,r),x+=a,y++}const P=Object.values(M).find((t=>!!t&&"group"!==t.type)),O={x:null==P?void 0:P.getComputedAttribute("x"),y:null==P?void 0:P.getComputedAttribute("y")},B={x:O.x,y:O.y,width:0,height:0};B.width=v+x+(y-1)*C,B.height=b+_;const L={rect:B,point:O,index:i};if("outer"!==S){const t=["top","right","left","bottom"].filter((t=>t!==S));L.rect=$o(B,S,A),L.anchors=t,L.offset=A}else L.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:L,contentMarks:M}}_layoutMarkers(t,i){var s,r,a;for(let n=0;n<i.length;n++){if(!t[n]||!i[n])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:c,container:d}=i[n],u=t[n],p=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),g=this._spec.space||0,m=u.height/2;let f=(null==p?void 0:p.left)||0;[o,l,h].forEach(((t,e)=>{var i,s;if(t){const r=t.AABBBounds;let a=0;"symbol"===t.type&&(a+=(null!==(i=r.x2-r.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+a,y:m}),f+=null!==(s=r.x2-r.x1)&&void 0!==s?s:0,2!==e&&(f+=g)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==d||d.setAttributes({dx:-u.width/2,dy:-u.height/2});const y=this._data.getLatestData()[n],v=this.dataToPosition(y),b=this.getRegions()[0].getLayoutStartPoint(),x=!(!(null===(r=this._spec.leader)||void 0===r?void 0:r.visible)||!(o||l||h));this._markerComponents[n].setAttributes({x:b.x,y:b.y,position:v,visible:this._activeDatum.includes(y),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>d,autoRotate:!1,offsetX:u.x+u.width/2-v.x,offsetY:u.y+u.height/2-v.y},itemLine:{visible:x,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(a=this._spec.leader)||void 0===a?void 0:a.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;t<this._markerComponents.length;t++)this.getContainer().add(this._markerComponents[t])}_layoutLabels(t){return"outer"===this._spec.position&&this._map?Vo(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):zo(t)}_isRelativeModel(t){var e,i,s;const r=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===r}_isRelativeSeries(t){var e;return(null===(e=t.context)||void 0===e?void 0:e.modelId)===this._series.id}_getNeedClearVRenderComponents(){return this._markerComponents}getVRenderComponents(){return this._markerComponents}}qo.type="mapLabel",qo.specKey="mapLabel",qo.transformerConstructor=Ko;const Zo="regressionLine";class Qo extends e.AbstractComponent{constructor(){super(...arguments),this.name=Zo}render(){this.removeAllChild();const{data:t,line:i={},label:s,name:r="regression-line",confidenceInterval:a}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:n}=t;if(t.area&&!1!==(null==a?void 0:a.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(n)?{fill:n,fillOpacity:.12}:null),null==a?void 0:a.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const s=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(n)?{stroke:n}:null),null==i?void 0:i.style));s.name=`${r}-curve`,this.add(s)}const o=e.last(t.line);if(s&&!1!==s.visible&&s.text&&o){const t=e.createText(Object.assign(Object.assign(Object.assign({},o),{text:s.text,textAlign:"end",textBaseline:"middle"}),s.style));t.name=`${r}-label`,this.add(t)}}))}}const Jo=(t,i,s=(t=>t.x),r=(t=>t.y),a)=>{switch(t){case"logisitc":return e.regressionLogistic(i,s,r);case"lowess":return e.regressionLowess(i,s,r);case"polynomial":return e.regressionPolynomial(i,s,r,{degree:a});default:return e.regressionLinear(i,s,r)}};function tl(t,i){const{color:s,line:r,confidenceInterval:a,label:n}=i;return{type:"component",componentType:Zo,interactive:!1,style:{data:(r,a)=>{const n=a.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),o=[];return n&&n.length&&n.forEach((r=>{var a,n;const l=r.getRegion().getLayoutStartPoint(),h=r.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+h.height),d=r.getColorAttribute(),u=r.getSeriesKeys(),p=r.getViewData().latestData,g=null===(a=r.fieldX)||void 0===a?void 0:a[0],m=null===(n=r.fieldY)||void 0===n?void 0:n[0];g&&m&&p&&!(p.length<=2)&&u.forEach((e=>{var a;const n=p.filter((t=>t[null==d?void 0:d.field]===e));if(!n.length)return;const{evaluateGrid:u,confidenceInterval:f}=Jo(t,n,(t=>null==t?void 0:t[g]),(t=>null==t?void 0:t[m]),i.polynomialDegree),y=Math.max(3,Math.floor(n.length/4)),v=u(y),b=f(y);o.push({color:null!=s?s:null===(a=null==d?void 0:d.scale)||void 0===a?void 0:a.scale(e),line:v.map((e=>{const i={[g]:e.x,[m]:e.y};return{x:r.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+h.height*(1-e.y):r.dataToPositionY(i)+l.y)}})),area:b.map((t=>{const e={[g]:t.x,[m]:t.lower};return{x:r.dataToPositionX(e)+l.x,y:c(r.dataToPositionY(e)+l.y),y1:c(r.dataToPositionY({[m]:t.upper})+l.y)}}))})}))})),o},line:r,confidenceInterval:a,label:n}}}function el(t){const{color:i,line:s,confidenceInterval:r,label:a}=t;return{type:"component",componentType:Zo,interactive:!1,zIndex:500,style:{data:(s,r)=>{const a=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),n=[];return a&&a.length&&a.forEach((s=>{var r,a,o;const l=s.getRegion().getLayoutStartPoint(),h=s.getRegion().getLayoutStartPoint(),c=s.getRegion().getLayoutRect(),d=e.clamper(h.y,h.y+c.height),u=s.getViewData().latestData,p=null===(r=s.fieldX)||void 0===r?void 0:r[0],g=null===(a=s.fieldY)||void 0===a?void 0:a[0],m="horizontal"===s.direction,f=s.getRawDataStatisticsByField(p).values;if(m||!p||!g||!u||u.length<=2||f.length<=2)return;const{evaluateGrid:y,confidenceInterval:v}=e.regressionPolynomial(u,(t=>f.indexOf(null==t?void 0:t[p])),(t=>null==t?void 0:t[g]),{degree:t.degree}),b=f.length,x=y(b),_=v(b),S=s.getXAxisHelper().getBandwidth(0)/2;n.push({color:null!=i?i:null===(o=s.getOption().globalScale.getScale("color"))||void 0===o?void 0:o.scale(s.getSeriesKeys()[0]),line:x.map((t=>{const e={[p]:f[t.x],[g]:t.y};return{x:s.dataToPositionX(e)+l.x+S,y:d(s.dataToPositionY(e)+l.y)}})),area:_.map((t=>{const e={[p]:f[t.x],[g]:t.lower};return{x:s.dataToPositionX(e)+l.x+S,y:d(s.dataToPositionY(e)+l.y),y1:d(s.dataToPositionY({[g]:t.upper})+l.y)}}))})})),n},line:s,confidenceInterval:r,label:a}}}const il=(t,i,s)=>{switch(t){case"kde":return e.kde(i,s);case"ecdf":return e.ecdf(i)}};function sl(t,i){const{line:s,label:r,color:a}=i;return{type:"component",componentType:Zo,interactive:!1,zIndex:500,style:{data:(i,s)=>{const r=s.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),n=[];return r&&r.length&&r.forEach((i=>{var s,r,o,l,h,c,d,u;const p=i.getRegion().getLayoutStartPoint(),g=i._rawData,m=null==g?void 0:g.rawData,f=null===(r=null===(s=g.transformsArr)||void 0===s?void 0:s.find((t=>"bin"===t.type)))||void 0===r?void 0:r.options,y=null===(o=i.fieldX)||void 0===o?void 0:o[0],v=i.getYAxisHelper().getScale(0),b=i.getViewData().latestData;if(!(m&&m.length&&(null==f?void 0:f.field)&&v&&b&&b.length))return;const x=m.map((t=>t[f.field])),_=il(t,x,"kde"===t?{bandwidth:b[0][null!==(h=null===(l=f.outputNames)||void 0===l?void 0:l.x1)&&void 0!==h?h:"x1"]-b[0][null!==(d=null===(c=f.outputNames)||void 0===c?void 0:c.x0)&&void 0!==d?d:"x0"]}:null),S=Math.max(3,Math.floor(x.length/4)),A=_.evaluateGrid(S),T=v.range(),C=T[0],M=e.last(T),k="kde"===t?t=>v.scale(t*m.length*_.bandwidth):t=>C+(M-C)*t;n.push({color:null!=a?a:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:A.map((t=>{const e={[y]:t.x};return{x:i.dataToPositionX(e)+p.x,y:k(t.y)+p.y}}))})})),n},line:s,label:r}}}const rl="ExtensionMarkSyncStatePlugin";class al extends e.BasePlugin{constructor(){super(rl),this.type=rl}onAfterInitChart(t,i){var s;if(!this._detectSyncState(i))return;const r=t.globalInstance.getChart();if(!r)return;const a=r.getEvent();if(this._subscribedEvent===a)return;null===(s=this._unsubscribeAfterRender)||void 0===s||s.call(this);const n=()=>this._syncStates();a.on(e.ChartEvent.afterRender,n),this._subscribedEvent=a,this._unsubscribeAfterRender=()=>{a.off(e.ChartEvent.afterRender,n),this._subscribedEvent=void 0}}release(){var t;null===(t=this._unsubscribeAfterRender)||void 0===t||t.call(this),super.release()}_detectSyncState(t){const e=null==t?void 0:t.series;return!!(null==e?void 0:e.some((t=>this._hasExtensionMarkWithSyncState(t.extensionMark))))||this._hasExtensionMarkWithSyncState(null==t?void 0:t.extensionMark)}_hasExtensionMarkWithSyncState(t){return!!(null==t?void 0:t.some((t=>"group"!==t.type&&t.syncState)))}_syncStates(){var t;const e=null===(t=this.service)||void 0===t?void 0:t.globalInstance.getChart();e&&e.getAllSeries().forEach((t=>{var e,i;const s=null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.extensionMark)||void 0===i?void 0:i.filter((t=>"group"!==t.type&&t.syncState));(null==s?void 0:s.length)&&this._syncSeriesStates(t,s)}))}_syncSeriesStates(t,i){const s=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(r)&&s.set(String(r),t)}))})),0===s.size)return;const r=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,a)=>{const n=e.isValid(i.name)?`${i.name}`:`${r}_${a}`,o=t.getMarkInName(n);o&&o.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(r))return;const a=s.get(String(r));if(!a)return;const n=a.currentStates;(null==n?void 0:n.length)?t.useStates(n):t.clearStates()}))}))}}al.pluginType="chart",al.type=rl;t.BAR_LINK=Po,t.Bar3dChart=nt,t.Bar3dChartSpecTransformer=G,t.Bar3dSeries=it,t.Bar3dSeriesSpecTransformer=J,t.BarLinkComponent=Oo,t.CandlestickChart=cn,t.CandlestickChartSpecTransformer=Za,t.CandlestickSeries=ln,t.CombinationCandlestickChart=pn,t.CombinationCandlestickChart_TYPE=qa,t.ConversionFunnelChart=P,t.ConversionFunnelSeries=O,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=al,t.Funnel3dChart=pt,t.Funnel3dSeries=dt,t.Funnel3dSeriesSpecTransformer=lt,t.Histogram3dChart=gt,t.ImageCloudChart=go,t.MapLabelComponent=qo,t.PictogramChart=io,t.PictogramChartSpecTransformer=En,t.PictogramSeries=to,t.Pie3dChart=Ka,t.Pie3dChartSpecTransformer=mt,t.Pie3dSeries=Xa,t.Pie3dSeriesSpecTransformer=$a,t.REGRESSION_LINE=Zo,t.RangeColumn3dChart=wn,t.RangeColumn3dChartSpecTransformer=kn,t.RangeColumn3dSeries=Tn,t.RangeColumn3dSeriesSpecTransformer=Mn,t.RankingBar=o,t.RankingList=m,t.RegressionLine=Qo,t.SERIES_BREAK=_o,t.SVG_VIEWPORT_RECT_KEY=Fn,t.SequenceScatterKDE=N,t.SequenceScatterLink=E,t.SequenceScatterPixel=V,t.SeriesBreakComponent=Ao,t.SeriesLabelComponent=No,t.TimelineChart=xo,t.WordCloud3dChart=bn,t.WordCloud3dChartSpecTransformer=vn,t.WordCloud3dSeries=mn,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==Po)),t.customMark.push(Lo(i))},t.appendBarRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Zo))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Zo)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=f(e,["visible"]);t.customMark.push(el(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Zo))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),Zo)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=f(e,["type"]);t.customMark.push(sl(i,s))}}))},t.appendScatterRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,Zo))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.scatter)),Zo)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=f(e,["type"]);t.customMark.push(tl(i,s))}}))},t.appendSeriesBreakConfig=t=>{var i;if(null===(i=t.axes)||void 0===i?void 0:i.length){const i=t.axes.filter((t=>t.breaks&&t.breaks.length&&!1!==t.visible));if(i.length)return t.customMark=e.array(t.customMark).filter((t=>t.componentType!==_o)),t.customMark.push(Co(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var s,r,a;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==Eo)),i||(i=null!==(a=null!==(s=e.get(t,Eo))&&void 0!==s?s:e.get(null===(r=t.series)||void 0===r?void 0:r[0],Eo))&&void 0!==a?a:{}),i.visible){const{position:e="end"}=i,s=f(i,["position"]);t.customMark.push(Ro(e,s))}},t.clearSVGSource=function(){Dn.clear(),In=null},t.getBarLinkConfig=Lo,t.getBarRegressionLineConfig=el,t.getHistogramRegressionLineConfig=sl,t.getSVGSource=Un,t.getScatterRegressionLineConfig=tl,t.getSeriesBreakConfig=Co,t.getSeriesLabelConfig=Ro,t.register3DPlugin=Z,t.registerAxis3dPlugin=()=>{Z(),at(),(()=>{e.registerCartesianBandAxis();const t=e.Factory.getComponentInKey(e.CartesianBandAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianBandAxis.builtInTheme.axisX),_n)}),e.mixin(t,Sn)})(),(()=>{e.registerCartesianLinearAxis();const t=e.Factory.getComponentInKey(e.CartesianLinearAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLinearAxis.builtInTheme.axisX),_n)}),e.mixin(t,Sn)})(),(()=>{e.registerCartesianTimeAxis();const t=e.Factory.getComponentInKey(e.CartesianTimeAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),_n)}),e.mixin(t,Sn)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianSymlogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),_n)}),e.mixin(t,Sn)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianLogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLogAxis.builtInTheme.axisX),_n)}),e.mixin(t,Sn)})()},t.registerBar3dChart=()=>{Z(),at(),st(),e.Factory.registerChart(nt.type,nt)},t.registerBar3dSeries=st,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(Po,(t=>new Oo(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),hn(),e.Factory.registerChart(cn.type,cn)},t.registerCandlestickSeries=hn,t.registerCombinationCandlestickChart=()=>{hn(),e.Factory.registerChart(pn.type,pn)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([P]),i.useSeries([O]))},t.registerEventSeries=bo,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(al)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),at(),ut(),e.Factory.registerChart(pt.type,pt)},t.registerFunnel3dSeries=ut,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),at(),st(),e.Factory.registerChart(gt.type,gt)},t.registerImageCloudChart=()=>{po(),e.Factory.registerChart(go.type,go)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([qo])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),eo(),e.Factory.registerChart(io.type,io)},t.registerPictogramSeries=eo,t.registerPie3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),at(),Ya(),e.Factory.registerChart(Ka.type,Ka)},t.registerPie3dSeries=Ya,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),at(),Cn(),e.Factory.registerChart(wn.type,wn)},t.registerRangeColumn3dSeries=Cn,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([o])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([m,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(Zo,(t=>new Qo(t)))},t.registerSVGSource=Nn,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([N,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([E,e.ScatterChart])},t.registerSequenceScatterPixel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([V,e.ScatterChart])},t.registerSeriesBreak=()=>{e.Factory.registerGraphicComponent("seriesBreak",(t=>new Ao(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new No(t)))},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),bo(),e.Factory.registerChart(xo.type,xo)},t.registerWordCloud3dChart=xn,t.registerWordCloud3dSeries=fn,t.registerWordCloudShape3dChart=()=>{Z(),yn(),xn()},t.registerWordCloudShape3dSeries=yn,t.svgSourceMap=Dn,t.transformCandlestickSeriesSpec=dn,t.unregisterSVGSource=jn}));
|
|
16
|
+
function v(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i}const y={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},_={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},b={fill:"#606773",fontSize:12},S={fill:"#eff1f9"};class A extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:s}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=v(t,["arrows"]),s=e.filter((t=>"left"===t.position)),r=e.filter((t=>"right"===t.position)),a=x(r,i),n=x(s,i),o=[];a&&(a.name="arrowRight",o.push(a));n&&(n.name="arrowLeft",o.push(n));return o}(e);t&&t.length&&i.push(...t)}if(s&&s.visible){const t=function(t){const{style:e={}}=t,i=v(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},S),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:s}=i.getLayoutRect();return s},height:(t,e)=>{const i=e.getPoints(t),s=i[0];return i[3].y-s.y}})})}(s);t&&i.push(t)}t.extensionMark=i,super.transformSpec(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.conversionArrow=t.conversionArrow,e.funnelBackground=t.funnelBackground,e}}function x(t,i){if(0===(null==t?void 0:t.length))return null;const{line:s,symbol:r,text:a,margin:n}=i,o=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},h=function(t={},e){const{style:i={}}=t,s=v(t,["style"]),r=(t,e)=>{var i,s;const{from:r,to:a}=t,{vchart:n}=e,o=null===(s=null===(i=null==n?void 0:n.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===s?void 0:s.latestData;return!(a>o.length-1||r>o.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},s),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},y),i),{renderable:r,points:(t,i)=>{if(!r(t,i))return[];let s=t.layout.points;return s=T(t,i,e),s}})})}(s,n);h&&o.push(h);const c=function(t={},e){const{style:i={}}=t,s=v(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},s),{style:Object.assign(Object.assign(Object.assign({},_),i),{x:(t,i)=>{var s,r;let a=t.layout.points;return a=T(t,i,e),null!==(r=null===(s=a[(null==a?void 0:a.length)-1])||void 0===s?void 0:s.x)&&void 0!==r?r:NaN},y:(t,i)=>{var s,r;let a=t.layout.points;return a=T(t,i,e),null!==(r=null===(s=a[(null==a?void 0:a.length)-1])||void 0===s?void 0:s.y)&&void 0!==r?r:NaN},angle:t=>"left"===t.position?90:-90})})}(r,n);c&&o.push(c);const d=function(t={},i){const{style:s={},formatMethod:r,textMargin:a=4}=t,n=v(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},n),{style:Object.assign(Object.assign(Object.assign({},b),{text:(t,i)=>{var s,a,n,o,l,h,c;const{text:d}=t;let u=d;if(e.isFunction(r)){const{vchart:e}=i,{from:p,to:g}=t,{field:m}=t.context,f=null!==(n=null===(a=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===a?void 0:a.latestData)&&void 0!==n?n:[],v=null!==(c=null===(h=null===(l=null===(o=null==e?void 0:e.getChart())||void 0===o?void 0:o.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===h?void 0:h.latestData)&&void 0!==c?c:[],y=v.find((t=>t[m]===f[p][m])),_=v.find((t=>t[m]===f[g][m]));u=r(d,{arrow:t,from:y,to:_})}return u},x:(t,e)=>{var s,r;let n=t.layout.points;return n=T(t,e,i),null!==(r=(null===(s=n[1])||void 0===s?void 0:s.x)+("left"===t.position?-a:a))&&void 0!==r?r:NaN},y:(t,e)=>{var s,r,a;let n=t.layout.points;return n=T(t,e,i),null!==(a=((null===(s=n[1])||void 0===s?void 0:s.y)+(null===(r=n[2])||void 0===r?void 0:r.y))/2)&&void 0!==a?a:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),s)})}(a,n);return d&&o.push(d),l.children=o,l}function T(t,e,i){var s,r,a,n,o;const{vchart:l}=e,{from:h,to:c}=t,{field:d}=t.context,u=null===(r=null===(s=null==l?void 0:l.getChart())||void 0===s?void 0:s.getSeriesData())||void 0===r?void 0:r.latestData,p=null===(o=null===(n=null===(a=null==l?void 0:l.getChart())||void 0===a?void 0:a.getAllSeries()[0])||void 0===n?void 0:n.getViewData())||void 0===o?void 0:o.latestData;let g=[];if(u&&u.length){const s=p.find((t=>t[d]===u[h][d])),r=p.find((t=>t[d]===u[c][d])),a=p[0];if(s&&r&&a){g=function(t,e,i,s,r=12){const{layout:a,distance:n,position:o}=t,{level:l,fromIndex:h,toIndex:c,fromTotal:d,toTotal:u}=a,p="right"===o,g=p?e[1]:e[0],m=p?e[2]:e[3],f=Math.abs(g.y-m.y),v=p?i[1]:i[0],y=p?i[2]:i[3],_=Math.abs(v.y-y.y),b=p?s[1]:s[0],S=f/(d+1),A=_/(u+1),x=g.y+S*(h+1),T=v.y+A*(c+1),C=p?-1:1,k=[{x:g.x-r*C,y:x},{x:b.x-(r+(l+1)*n)*C,y:x},{x:b.x-(r+(l+1)*n)*C,y:T},{x:v.x-r*C,y:T}];return k}(t,e.getPoints(s),e.getPoints(r),e.getPoints(a),i),t.layout.points=g}}return g}function C(t,e){const{from:i,to:s}=t,{from:r,to:a}=e;return s>r&&a>i}function k(t,e){const{from:i,to:s}=t,{from:r,to:a}=e;return i===r&&s===a}const M=(t,i)=>{var s,r,a;if(!t||!(null===(s=t.arrows)||void 0===s?void 0:s.length))return[];const{arrows:n}=t,o=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:s,to:r,position:a="right"}=t;return Object.assign(Object.assign({},t),{position:a,distance:t.distance||40,from:Math.min(s,r),to:Math.max(s,r),span:Math.abs(s-r),isLayout:!1,context:{field:i},layout:{level:0},id:`${s}-${r}-${a}-${e}`})}))}(n,i.categoryField),l=o.filter((t=>"left"===t.position)),h=o.filter((t=>"right"===t.position));return[...null!==(r=E(l))&&void 0!==r?r:[],...null!==(a=E(h))&&void 0!==a?a:[]]};function E(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const s=i.get(t.from);if(e.isValid(s)){const e=s.fromArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:s.degree+=1,s.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const r=i.get(t.to);if(e.isValid(r)){const e=r.toArrows.find((e=>k(e,t)));e?t.layout.duplicateNode=e:r.degree+=1,r.toArrows.push(t)}else i.set(t.to,{toArrows:[t],fromArrows:[],totalArrows:[],degree:1})})),i.forEach((t=>{t.fromArrows.sort(((t,e)=>e.span-t.span)),t.toArrows.sort(((t,e)=>t.span-e.span)),t.totalArrows=[...t.toArrows,...t.fromArrows]})),t.sort(((t,e)=>t.span-e.span)).forEach((s=>{var r;const a=t.filter((t=>t.layout.isLayout)),n=e.maxInArray(a,((t,e)=>t.layout.level-e.layout.level));let o=null!==(r=null==n?void 0:n.layout.level)&&void 0!==r?r:0;for(;o>=0;){if(a.some((t=>t.layout.level===o&&C(t,s)))){o+=1;break}--o}s.layout.level=Math.max(0,o),s.layout.fromTotal=i.get(s.from).degree,s.layout.toTotal=i.get(s.to).degree;const l=s.layout.duplicateNode;l?(s.layout.fromIndex=l.layout.fromIndex,s.layout.toIndex=l.layout.toIndex):(s.layout.fromIndex=w(s,i.get(s.from).totalArrows),s.layout.toIndex=w(s,i.get(s.to).totalArrows)),s.layout.isLayout=!0})),t}function w(t,e){let i=0,s=0;for(let r=0;r<e.length;r++){const a=e[r];if(a===t){i=r-s;break}a.layout.duplicateNode&&s++}return i}class O extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=A}}O.type="conversionFunnel",O.transformerConstructor=A;class P extends e.FunnelSeries{initData(){var t;super.initData();const{conversionArrow:i}=this._spec;i&&(null===(t=i.arrows)||void 0===t?void 0:t.length)&&(this._arrowData=new e.DataView(this._dataSet,{name:`${e.PREFIX}_series_${this.id}_arrowData`}),this._dataSet.getTransform("conversionArrow")||this._dataSet.registerTransform("conversionArrow",M),this._arrowData.parse(i).transform({type:"conversionArrow",options:{categoryField:this._spec.categoryField}}))}afterCompile(){var t;null===(t=super.afterCompile)||void 0===t||t.call(this);const e=this.getMarkInName("arrowRight");e&&e.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"right"===t.position}])}));const i=this.getMarkInName("arrowLeft");i&&i.getMarks().forEach((t=>{t.setDataView(this._arrowData),t.compileData(),t.setTransform([{type:"filter",callback:t=>"left"===t.position}])}))}}const B="dataKey";class D extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a;super.transformSpec(t);const n=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].nodes;e.push({data:[{id:"nodes",values:s.map(((t,e)=>Object.assign(Object.assign({},t),{[B]:e})))},{id:"endpoints",values:[]},{id:"iter",values:[{iter:i}]},{id:"background",values:[{iter:i,x:t.scope[0],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[3]},{iter:i,x:t.scope[2],y:t.scope[1]},{iter:i,x:t.scope[0],y:t.scope[1]}]}]})})),e}(t),o="neighborhood"!==t.taskType;t.type="common",t.dataKey=B,t.data=n[0].data,t.series=[{id:"background-series",type:"area",dataId:"background",interactive:!1,persent:!0,xField:"x",yField:"y",point:{visible:!1},line:{visible:!1},area:{visible:!0,interactive:!1,style:{background:e=>"neighborhood"===t.taskType?"":`https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/sequence-scatter-bgimg-2/${e.iter}.png`,fill:"transparent",fillOpacity:.5}},hover:{enable:!1},select:{enable:!1}},{id:"line-series",type:"line",dataId:"endpoints",xField:"x",yField:"y",seriesField:"edgeId",animation:!0,point:{visible:!1},line:{visible:!0,style:{stroke:t=>t.color,lineDash:t=>"same_type"===t.type?[0,0]:[3,2],lineWidth:.8,strokeOpacity:.6}}},{id:"scatter-series",type:"scatter",dataId:"nodes",xField:t.xField,yField:t.yField,seriesField:"label",point:{state:{hover:{scaleX:1.5,scaleY:1.5,fillOpacity:1},hover_reverse:{scaleX:1,scaleY:1,fillOpacity:.3}},style:{size:()=>"neighborhood"===t.taskType?6:4,fill:e=>{var i;return null!==(i=t.labelColor[e.label])&&void 0!==i?i:"gray"},fillOpacity:t=>t.confidence}},label:{visible:!0,style:{visible:()=>"neighborhood"===t.taskType,type:"text",fontFamily:"Console",fontStyle:"italic",fontSize:12,fill:"black",fillOpacity:.6,text:t=>t.id}}}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:n}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",inverse:!0,min:t.scope[1],max:t.scope[3]},{orient:"bottom",type:"linear",min:t.scope[0],max:t.scope[2]}],t.customMark=[{type:"text",dataId:"iter",style:Object.assign({x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(a=t.infoLabel)||void 0===a?void 0:a.style)}],t.legends=[{seriesId:"scatter-series",visible:!0,orient:"right",position:"middle",data:t=>t.map((t=>(t.shape.outerBorder={stroke:t.shape.fill,distance:2,lineWidth:1},t))),title:{visible:!0,align:"left",textStyle:{text:"Classes",fontFamily:"Console",fontSize:18,fontWeight:"bold"}},item:{visible:!0,width:"8%",value:{alignRight:!0,style:{fill:"#000",fillOpacity:1,fontSize:12},state:{unselected:{fill:"#d8d8d8"}}}}}],t.tooltip={visible:o,seriesId:"scatter-series",lockAfterClick:!1,activeType:"mark",trigger:"hover",mark:{title:{visible:!0,value:"Info"},content:[{key:"Label",value:t=>t.label,shapeType:"circle",shapeSize:8},{key:"Prediction",value:t=>t.prediction,shapeType:"circle",shapeSize:8,shapeFill:e=>{var i;return null!==(i=t.labelColor[e.prediction])&&void 0!==i?i:"gray"}},{key:"Confidence",value:t=>t.confidence.toFixed(2),shapeType:"square",shapeSize:8,shapeFill:t=>t.label===t.prediction?"green":"red"}]},style:{panel:{padding:{top:10,bottom:15,left:10,right:10},backgroundColor:"#fff",border:{color:"#eee",width:1,radius:10}},titleLabel:{fontSize:20,fontFamily:"Times New Roman",fill:"brown",fontWeight:"bold",textAlign:"center",lineHeight:24},keyLabel:{fontSize:16,fontFamily:"Times New Roman",fill:"black",textAlign:"center",lineHeight:15,spacing:10},valueLabel:{fontSize:14,fill:"black",textAlign:"center",lineHeight:15,spacing:10}}},t.dataZoom=[{visible:!1,orient:"left",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}},{visible:!1,orient:"bottom",filterMode:"axis",showDetail:!1,roamZoom:{enable:!0,focus:!0,rate:3},roamDrag:{enable:!0,reverse:!0,rate:1}}],super.transformSpec(t)}}class I extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=D}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}I.type="sequenceScatterLink",I.view="singleDefault",I.transformerConstructor=D;const R=.2;function L(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const F="dataKey";class N extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a,n;super.transformSpec(t);const o=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const s=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[F]:e}))),r=function(t,e=100,i){const s=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),r=[];return Object.entries(s).forEach((([t,s])=>{const a=i||function(t){return t.length**(-1/6)}(s),n=s.map((t=>t.x)),o=s.map((t=>t.y)),l=Math.min(...n),h=Math.max(...n),c=Math.min(...o),d=Math.max(...o),u=l-(h-l)*R,p=c-(d-c)*R;for(let i=0;i<e;i++)for(let n=0;n<e;n++){const e=u+.1*i,o=p+.1*n;let l=0;for(const t of s)l+=L(Math.sqrt((e-t.x)**2+(o-t.y)**2)/a);l/=s.length*a*a,r.push({x:e,y:o,kde:l,label:t})}})),r}(s,150);e.push({data:[{id:"nodes",values:s},{id:"iter",values:[{iter:i}]},{id:"kde",values:r}]})})),e}(t);t.type="common",t.dataKey=F,t.data=o[0].data,t.scales=[{id:"colorScale",type:"ordinal",specified:{0:"rgb(150, 10, 100)",1:"rgb(31, 119, 180)",2:"rgb(255, 127, 14)",3:"rgb(44, 160, 44)",4:"rgb(214, 39, 40)",5:"rgb(148, 103, 189)",6:"rgb(140, 86, 75)",7:"rgb(227, 119, 194)",8:"rgb(127, 127, 127)",9:"rgb(188, 189, 34)",10:"rgb(23, 190, 207)"}},{id:"brighterColorScale",type:"ordinal",specified:{0:"rgb(150, 10, 150)",1:"rgb(31, 119, 230)",2:"rgb(255, 127, 64)",3:"rgb(44, 160, 94)",4:"rgb(214, 39, 90)",5:"rgb(148, 103, 239)",6:"rgb(140, 86, 125)",7:"rgb(227, 119, 244)",8:"rgb(127, 127, 177)",9:"rgb(188, 189, 84)",10:"rgb(23, 190, 255)"}},...null!==(e=t.scales)&&void 0!==e?e:[]],t.series=[{type:"scatter",dataIndex:0,xField:t.xField,yField:t.yField,seriesField:t.seriesField,size:5,point:{zIndex:1e3,style:{fill:{scale:"colorScale",field:t.seriesField}}}}];t.customMark=[{type:"text",dataIndex:1,style:Object.assign({text:t=>t.iter,x:10,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:25,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(i=t.infoLabel)||void 0===i?void 0:i.style)},{type:"symbol",dataIndex:2,style:{symbolType:"rect",x:(t,e)=>54+(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToX)([t.x]),y:(t,e)=>(0,e.chart.getAllSeries()[0]._markAttributeContext.valueToY)([t.y])+26,size:5,fill:{scale:"brighterColorScale",field:"label"},fillOpacity:t=>10*t.kde}}],t.tooltip={visible:!0,fields:["x","y","label"]},t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:o}),t.animationAppear={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"},t.animationUpdate={duration:null!==(n=null===(a=t.player)||void 0===a?void 0:a.duration)&&void 0!==n?n:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class j extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=N}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}j.type="sequenceScatterKDE",j.view="singleDefault",j.transformerConstructor=N;const U="dataKey";function V(t){const e=[];return Object.keys(t.data).forEach((i=>{let s=null;if(t.backgroundColors&&t.backgroundColors[i]){const e=function(t,e){var i;if("undefined"==typeof document)throw new Error("Canvas rendering requires browser environment with document object");const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)throw new Error("Failed to get 2D rendering context from canvas");const a=r.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let s=0;s<300;s++){const r=(null===(i=t[e])||void 0===i?void 0:i[s])||[0,0,0],n=4*(300*e+s);a.data[n]=Math.round(255*r[0]),a.data[n+1]=Math.round(255*r[1]),a.data[n+2]=Math.round(255*r[2]),a.data[n+3]=255}return r.putImageData(a,0,0),s.toDataURL("image/png")}(t.backgroundColors[i],t);s={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[U]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:s?[s]:[]}]})})),e}class G extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,s,r,a;super.transformSpec(t);const n=V(t);t.type="common",t.dataKey=U,t.data=n[0].data,t.width=300,t.height=300,t.autoFit=!1,t.series=[{type:"scatter",xField:t.xField,yField:t.yField}],t.player&&(t.player=Object.assign(Object.assign({},t.player),{specs:n}),t.animationAppear={duration:null!==(i=null===(e=t.player)||void 0===e?void 0:e.duration)&&void 0!==i?i:2e3,easing:"linear"},t.animationUpdate={duration:null!==(r=null===(s=t.player)||void 0===s?void 0:s.duration)&&void 0!==r?r:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear"},{orient:"bottom",label:{visible:!0},type:"linear"}],t.customMark=[{type:"image",dataIndex:2,style:{x:0,y:0,width:300,height:300,image:t=>t.imageData,zIndex:-1}},{type:"text",dataIndex:1,style:Object.assign({text:t=>t.inter,x:50,y:()=>10,textBaseline:"top",textAlign:"left",fontSize:100,fontWeight:"bolder",fill:"black",fillOpacity:.2},null===(a=t.infoLabel)||void 0===a?void 0:a.style)}],t.tooltip={visible:!1},super.transformSpec(t)}}class K extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterPixel",this.transformerConstructor=G}init(){this.isValid()&&super.init()}isValid(){var t,e,i,s;const{xField:r,yField:a,data:n}=this._spec;return r&&a?!!n||(null===(s=(i=this._option).onError)||void 0===s||s.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}K.type="sequenceScatterPixel",K.view="singleDefault",K.transformerConstructor=G;class z extends e.BarChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.barWidth=t.barWidth,e.barMaxWidth=t.barMaxWidth,e.barMinWidth=t.barMinWidth,e.barGapInGroup=t.barGapInGroup,e}}var H,W,$,Y,X;!function(t){t.bar3d="bar3d",t.histogram3d="histogram3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}(H||(H={})),function(t){t.rect3d="rect3d",t.arc3d="arc3d",t.pyramid3d="pyramid3d"}(W||(W={})),function(t){t.bar3d="bar3d",t.rangeColumn3d="rangeColumn3d",t.pie3d="pie3d",t.wordCloud3d="wordCloud3d",t.funnel3d="funnel3d"}($||($={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(Y||(Y={})),function(t){t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical"}(X||(X={}));let q=0;function Z(){return q>=9999999&&(q=0),q++}class Q{constructor(t){this.id=Z(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}let J=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s,r){t._components[e]={cmp:i,alwaysCheck:s,createOrder:null!=r?r:0}}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const r=t._graphicComponents[e];return r?r(i,s):null}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerGrammarTransform(e,i){t._grammarTransforms[e]=i}static getGrammarTransform(e){return t._grammarTransforms[e]}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerVChartPlugin(e,i){t._vChartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){return t._charts[e]?new t._charts[e](i,s):null}static getChart(e){return t._charts[e]}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new s.transformerConstructor(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){return t._regions[e]?new t._regions[e](i,s):null}static createRegionSpecTransformer(e,i){return t._regions[e]?new t._regions[e].transformerConstructor(i):null}static createSeries(e,i,s){return t._series[e]?new t._series[e](i,s):null}static createSeriesSpecTransformer(e,i){return t._series[e]?new t._series[e].transformerConstructor(i):null}static createMark(e,i,s){if(!t._marks[e])return null;const r=new t._marks[e](i,s);return"group"===r.type&&r.setMarkConfig({interactive:!1}),r}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getSeriesBuiltInTheme(e){for(const i in t._series){const s=t._series[i];if(s&&s.builtInTheme&&s.builtInTheme[e])return s.builtInTheme[e]}return null}static getComponentBuiltInTheme(e){for(const i in t._components){const s=t._components[i];if(s&&s.cmp&&s.cmp.builtInTheme&&s.cmp.builtInTheme[e])return s.cmp.builtInTheme[e]}return null}static getChartPlugins(){return Object.values(t._chartPlugin)}static getVChartPlugins(){return Object.values(t._vChartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}static createInteractionTrigger(e,i){const s=t._interactionTriggers[e];return s?new s(i):null}static hasInteractionTrigger(e){return!!t._interactionTriggers[e]}static getComposedEvent(e){return t._composedEventMap[e]}};J._charts={},J._series={},J._components={},J._graphicComponents={},J._marks={},J._regions={},J._animations={},J._implements={},J._chartPlugin={},J._vChartPlugin={},J._componentPlugin={},J.transforms={fields:s.fields,filter:s.filter,fold:s.fold},J.dataParser={csv:s.csvParser,dsv:s.dsvParser,tsv:s.tsvParser},J._layout={},J._grammarTransforms={},J._stageEventPlugins={},J.registerStageEventPlugin=(t,e)=>{J._stageEventPlugins[t]=e},J.getStageEventPlugin=t=>J._stageEventPlugins[t],J._interactionTriggers={},J.registerInteractionTrigger=(t,e)=>{J._interactionTriggers[t]=e},J._composedEventMap={},J.registerComposedEvent=(t,e)=>{J._composedEventMap[t]=e},J._tooltipProcessors={},J.registerTooltipProcessor=(t,e)=>{J._tooltipProcessors[t]=e},J.createTooltipProcessor=(t,e)=>{const i=J._tooltipProcessors[t];return i?new i(e):null};const tt=t=>t.zField||t.series&&t.series.some((t=>t.zField));class et extends Q{constructor(){super(et.type),this.type="VChart3dPlugin"}onInit(t,e){var i,s;if(this._is3d=!!(s=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(s.type)||tt(s),!0),this._is3d){const{globalInstance:e}=t;e.getCompiler().getStage().set3dOptions(Object.assign({},null===(i=e._option)||void 0===i?void 0:i.options3d))}}onBeforeInitChart(t,e,i){this._is3d&&tt(e)&&(e.layout={type:"layout3d"})}}et.pluginType="chart",et.type="VChart3dPlugin";const it=()=>{var t;t=et,J.registerChartPlugin(t.type,t),i.registerDirectionalLight(),i.registerOrthoCamera(),i.registerViewTransform3dPlugin()},st={label:{name:"label",type:"text"},bar3d:{name:"bar3d",type:"rect3d"}};class rt extends e.BarSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar3d")}}class at{static GenAutoIncrementId(){return at.auto_increment_id++}}at.auto_increment_id=0;const nt=new class{},ot=r.tau-1e-8;class lt{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,a,n){if(Math.abs(a-s)>ot)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let o,l,h,c,d=1/0,u=-1/0,p=1/0,g=-1/0;function m(t){h=i*Math.cos(t),c=i*Math.sin(t),h<d&&(d=h),h>u&&(u=h),c<p&&(p=c),c>g&&(g=c)}if(m(s),m(a),a!==s)if((s%=r.tau)<0&&(s+=r.tau),(a%=r.tau)<0&&(a+=r.tau),a<s&&(n=!n,o=s,s=a,a=o),n)for(a-=r.tau,o=s-s%r.halfPi,l=0;l<4&&o>a;++l,o-=r.halfPi)m(o);else for(o=s-s%r.halfPi+r.halfPi,l=0;l<4&&o<a;++l,o+=r.halfPi)m(o);this.bounds.add(t+d,e+p),this.bounds.add(t+u,e+g)}arcTo(t,e,i,s,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,s,r,a){this.bounds.add(t,e),this.bounds.add(i,s),this.bounds.add(r,a)}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,s){this.bounds.add(t,e),this.bounds.add(i,s)}rect(t,e,i,s){this.bounds.add(t,e),this.bounds.add(t+i,e+s)}clear(){this.bounds.clear()}release(...t){}}class ht{constructor(){this._curves=[],this.bounds=new r.AABBBounds}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ct=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,dt={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},ut={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let pt,gt,mt,ft,vt,yt;var _t,bt,St,At,xt,Tt;function Ct(t){const e=t[0],i=t[1],s=t[2],r=t[3],a=t[4],n=t[5],o=t[6],l=t[7],h=l*a,c=-o*n,d=o*a,u=l*n,p=Math.cos(s),g=Math.sin(s),m=Math.cos(r),f=Math.sin(r),v=.5*(r-s),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,S=i+g+_*p,A=e+m,x=i+f,T=A+_*f,C=x-_*m;return[h*b+c*S,d*b+u*S,h*T+c*C,d*T+u*C,h*A+c*x,d*A+u*x]}function kt(t,e,i,s){const a=function(t,e,i,s,a,n,o,l,h){const c=r.degreeToRadian(o),d=Math.sin(c),u=Math.cos(c),p=u*(l-t)*.5+d*(h-e)*.5,g=u*(h-e)*.5-d*(l-t)*.5;let m=p*p/((i=Math.abs(i))*i)+g*g/((s=Math.abs(s))*s);m>1&&(m=Math.sqrt(m),i*=m,s*=m);const f=u/i,v=d/i,y=-d/s,_=u/s,b=f*l+v*h,S=y*l+_*h,A=f*t+v*e,x=y*t+_*e;let T=1/((A-b)*(A-b)+(x-S)*(x-S))-.25;T<0&&(T=0);let C=Math.sqrt(T);n===a&&(C=-C);const k=.5*(b+A)-C*(x-S),M=.5*(S+x)+C*(A-b),E=Math.atan2(S-M,b-k);let w=Math.atan2(x-M,A-k)-E;w<0&&1===n?w+=r.tau:w>0&&0===n&&(w-=r.tau);const O=Math.ceil(Math.abs(w/(r.halfPi+.001))),P=[];for(let t=0;t<O;++t){const e=E+t*w/O,r=E+(t+1)*w/O;P[t]=[k,M,e,r,i,s,d,u]}return P}(s[5],s[6],s[0],s[1],s[3],s[4],s[2],e,i);for(let e=0;e<a.length;++e){const i=Ct(a[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_PAINT=64]="UPDATE_PAINT",t[t.CLEAR_PAINT=191]="CLEAR_PAINT",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(_t||(_t={})),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"}(bt||(bt={})),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"}(St||(St={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(At||(At={})),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"}(xt||(xt={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Tt||(Tt={}));const Mt=[(t,e,i,s,r,a,n)=>e.arc(t[1]*r+i,t[2]*a+s,t[3]*(r+a)/2,t[4],t[5],t[6],n),(t,e,i,s,r,a,n)=>e.arcTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,t[5]*(r+a)/2,n),(t,e,i,s,r,a,n)=>e.bezierCurveTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,t[5]*r+i,t[6]*a+s,n),(t,e,i,s)=>e.closePath(),(t,e,i,s,r,a)=>e.ellipse(t[1]*r+i,t[2]*a+s,t[3]*r,t[4]*a,t[5],t[6],t[7],t[8]),(t,e,i,s,r,a,n)=>e.lineTo(t[1]*r+i,t[2]*a+s,n),(t,e,i,s,r,a,n)=>e.moveTo(t[1]*r+i,t[2]*a+s,n),(t,e,i,s,r,a,n)=>e.quadraticCurveTo(t[1]*r+i,t[2]*a+s,t[3]*r+i,t[4]*a+s,n),(t,e,i,s,r,a,n)=>e.rect(t[1]*r+i,t[2]*a+s,t[3]*r,t[4]*a,n)];function Et(t,e,i=0,s=0,r=1,a=1,n){for(let o=0;o<t.length;o++){const l=t[o];Mt[l[0]](l,e,i,s,r,a,n)}}class wt{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Ot(t,e){let i=0;const s=t.length;for(let a=0;a<s;a++){const n=t[a],o=e[a],l=t[(a+1)%s],h=e[(a+1)%s];i+=r.PointService.distanceNN(n,o,l,h)}return i/2}function Pt(t,e,i,s,r){const a=1-r;return a*a*a*t+3*e*r*a*a+3*i*r*r*a+s*r*r*r}function Bt(t,e,i,s,a){const n=Pt(t.x,e.x,i.x,s.x,a),o=Pt(t.y,e.y,i.y,s.y,a);return new r.Point(n,o)}function Dt(t,e,i,s){const r=1-s;return r*r*t+2*r*s*e+s*s*i}function It(t,e,i,s){const a=Dt(t.x,e.x,i.x,s),n=Dt(t.y,e.y,i.y,s);return new r.Point(a,n)}class Rt extends wt{constructor(t,e,i,s){super(),this.type=xt.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=s}_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 Bt(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,s=this.p3,Ot([t.x,e.x,i.x,s.x],[t.y,e.y,i.y,s.y])):60;var t,e,i,s}calcProjLength(t){return t===At.ROW?r.abs(this.p0.x-this.p3.x):t===At.COLUMN?r.abs(this.p0.y-this.p3.y):0}getAngleAt(t){const e=r.max(t-.01,0),i=r.min(t+.01,1),s=this.getPointAt(e),a=this.getPointAt(i);return r.atan2(a.y-s.y,a.x-s.x)}draw(t,e,i,s,a,n){if(t.moveTo(this.p0.x*s+e,this.p0.y*a+i),n>=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*a+i,this.p2.x*s+e,this.p2.y*a+i,this.p3.x*s+e,this.p3.y*a+i);else if(n>0){const[o]=function(t,e){const{p0:i,p1:s,p2:a,p3:n}=t,o=Bt(i,s,a,n,e),l=r.PointService.pointAtPP(i,s,e),h=r.PointService.pointAtPP(s,a,e),c=r.PointService.pointAtPP(a,n,e),d=r.PointService.pointAtPP(l,h,e),u=r.PointService.pointAtPP(h,c,e);return[new Rt(i,l,d,o),new Rt(o,u,c,n)]}(this,n);t.bezierCurveTo(o.p1.x*s+e,o.p1.y*a+i,o.p2.x*s+e,o.p2.y*a+i,o.p3.x*s+e,o.p3.y*a+i)}}includeX(t){const e=r.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=r.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=r.min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(r.max(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}class Lt extends wt{constructor(t,e){super(),this.type=xt.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return r.PointService.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=r.atan2(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()?r.PointService.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===At.ROW?r.abs(this.p0.x-this.p1.x):t===At.COLUMN?r.abs(this.p0.y-this.p1.y):0}draw(t,e,i,s,r,a){if(t.moveTo(this.p0.x*s+e,this.p0.y*r+i),a>=1)t.lineTo(this.p1.x*s+e,this.p1.y*r+i);else if(a>0){const n=this.getPointAt(a);t.lineTo(n.x*s+e,n.y*r+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Ft{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,a,n,o,l){const h=new Rt(new r.Point(this._lastX,this._lastY),new r.Point(t,e),new r.Point(i,s),new r.Point(a,n));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=a,this._lastY=n,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const r=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,a){const n=new Lt(new r.Point(this._lastX,this._lastY),new r.Point(t,e));return n.originP1=s,n.originP2=a,n.defined=i,n}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===At.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return r.abs(t.p0.y-s.y)}if(t===At.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return r.abs(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Nt extends Ft{bezierCurveTo(t,e,i,s,r,a,n,o){return super.bezierCurveTo(e,t,s,i,a,r,n,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function jt(t,e,i=1){let s=!1;for(let i=0,r=e.length;i<=r;i++)i>=r===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ut(t,e,i){const s=null!=e?e:r.abs(i[i.length-1].x-i[0].x)>r.abs(i[i.length-1].y-i[0].y)?At.ROW:At.COLUMN;return"monotoneY"===t?new Nt(t,s):new Ft(t,s)}class Vt{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Gt(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=Ut("linear",i,t);return function(t,e){jt(t,e,1)}(new Vt(r,s),t),r}function Kt(t,e,i,s,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class zt{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&&Kt(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Kt(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Ht(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Gt(t,e);const r=Ut("basis",i,t);return function(t,e){jt(t,e,2)}(new zt(r,s),t),r}function Wt(t){return t<0?-1:1}function $t(t,e,i){const s=t._x1-t._x0,r=e-t._x1,a=(t._y1-t._y0)/(s||Number(r<0&&-0)),n=(i-t._y1)/(r||Number(s<0&&-0)),o=(a*r+n*s)/(s+r);return(Wt(a)+Wt(n))*Math.min(Math.abs(a),Math.abs(n),.5*Math.abs(o))||0}function Yt(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Xt(t,e,i,s,r){const a=t._x0,n=t._y0,o=t._x1,l=t._y1,h=(o-a)/3;t.context.bezierCurveTo(a+h,n+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qt{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Xt(this,this._t0,Yt(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Xt(this,Yt(this,e=$t(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Xt(this,this._t0,e=$t(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zt extends qt{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Qt(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Gt(t,e);const r=Ut("monotoneX",i,t);return function(t,e){jt(t,e,2)}(new qt(r,s),t),r}function Jt(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Gt(t,e);const r=Ut("monotoneY",i,t);return function(t,e){jt(t,e,2)}(new Zt(r,s),t),r}let te=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ee extends te{lineEnd(){this.context.closePath()}}function ie(t,e,i={}){const{direction:s,startPoint:a}=i;if(t.length<2-Number(!!a))return null;const n=new Ft("step",null!=s?s:r.abs(t[t.length-1].x-t[0].x)>r.abs(t[t.length-1].y-t[0].y)?At.ROW:At.COLUMN);return se(new te(n,e,a),t),n}function se(t,e){return jt(t,e,1)}class re extends Vt{lineEnd(){this.context.closePath()}}function ae(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const r=Ut("linear",i,t);return function(t,e){jt(t,e,1)}(new re(r,s),t),r}function ne(t,e,i,s,a){let n=t._x1,o=t._y1,l=t._x2,h=t._y2;if(t._l01_a>r.epsilon){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>r.epsilon){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);l=(l*s+t._x1*t._l23_2a-e*t._l12_2a)/r,h=(h*s+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(n,o,l,h,t._x2,t._y2,s,t.lastPoint1)}function oe(t,e){return function(i,s,r={}){const{direction:a,startPoint:n}=r;if(i.length<2-Number(!!n))return null;if(i.length<3-Number(!!n))return Gt(i,r);const o=Ut(t,a,i);return jt(new e(o,s,n),i,2),o}}const le=oe("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ne(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const he=oe("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ne(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class ce extends wt{constructor(t,e,i){super(),this.type=xt.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return It(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Ot([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===At.ROW?r.abs(this.p0.x-this.p2.x):t===At.COLUMN?r.abs(this.p0.y-this.p2.y):0}getAngleAt(t){const e=r.max(t-.01,0),i=r.min(t+.01,1),s=this.getPointAt(e),a=this.getPointAt(i);return r.atan2(a.y-s.y,a.x-s.x)}draw(t,e,i,s,a,n){if(t.moveTo(this.p0.x*s+e,this.p0.y*a+i),n>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*a+i,this.p2.x*s+e,this.p2.y*a+i);else if(n>0){const[o]=function(t,e){const{p0:i,p1:s,p2:a}=t,n=It(i,s,a,e),o=r.PointService.pointAtPP(i,s,e),l=r.PointService.pointAtPP(s,a,e);return[new ce(i,o,n),new ce(n,l,a)]}(this,n);t.quadraticCurveTo(o.p1.x*s+e,o.p1.y*a+i,o.p2.x*s+e,o.p2.y*a+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class de{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Lt(new r.Point(this._lastX,this._lastY),new r.Point(t,e))}quadraticCurveTo(t,e,i,s){const a=new ce(new r.Point(this._lastX,this._lastY),new r.Point(t,e),new r.Point(i,s));this.path.addCurve(a),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,a,n){const o=new Rt(new r.Point(this._lastX,this._lastY),new r.Point(t,e),new r.Point(i,s),new r.Point(a,n));this.path.addCurve(o),this._lastX=a,this._lastY=n}arcTo(t,e,i,s,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,r,a,n,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,r,a){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function ue(t,e,i){var s,a;switch(e){case"linear":default:return Gt(t,i);case"basis":return Ht(t,i);case"monotoneX":return Qt(t,i);case"monotoneY":return Jt(t,i);case"step":return ie(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:a}=i;if(t.length<2-Number(!!a))return null;const n=new Ft("step",null!=s?s:r.abs(t[t.length-1].x-t[0].x)>r.abs(t[t.length-1].y-t[0].y)?At.ROW:At.COLUMN);return se(new ee(n,e,a),t),n}(t,.5,i);case"stepBefore":return ie(t,0,i);case"stepAfter":return ie(t,1,i);case"catmullRom":return le(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return he(t,null!==(a=null==i?void 0:i.curveTension)&&void 0!==a?a:.5,i);case"linearClosed":return ae(t,i)}}class pe extends ht{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new lt(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([ut.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([ut.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([ut.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,a){return this.commandList.push([ut.C,t,e,i,s,r,a]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,r,a),this}arcTo(t,e,i,s,r){return this.commandList.push([ut.AT,t,e,i,s,r]),this._ctx&&this._ctx.arcTo(t,e,i,s,r),this}ellipse(t,e,i,s,r,a,n,o){return this.commandList.push([ut.E,t,e,i,s,r,a,n,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,r,a,n,o),this}rect(t,e,i,s){return this.commandList.push([ut.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,r,a){return this.commandList.push([ut.A,t,e,i,s,r,a]),this._ctx&&this._ctx.arc(t,e,i,s,r,a),this}closePath(){return this.commandList.push([ut.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new de(this);Et(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[ut.M]=t=>`M${t[1]} ${t[2]}`,t[ut.L]=t=>`L${t[1]} ${t[2]}`,t[ut.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[ut.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[ut.A]=t=>{const e=[],i=t[1],s=t[2],r=t[3];((t,e,i,s,r,a,n,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e<u;e++){const i=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),d=Math.cos(i),u=Math.sin(i),g=Math.cos(l),m=Math.sin(l),f=d*a+s,v=u*n+r,y=g*a+s,_=m*n+r,b=o?-1:1,S=a*c*b,A=n*c*b;t.push(f-S*u,v+A*d,y+S*m,_-A*g,y,_)}})(e,t[4],t[5],i,s,r,r,t[6]);let a="";for(let t=0;t<e.length;t+=6)a+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return a},t[ut.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[ut.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,r){this.clear();const a=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const r=[];for(let t=0,a=e.length;t<a;t++)if(pt=e[t],gt=pt.slice(1),mt=pt[0],i=[mt],s=gt.match(ct),null!==s){for(let t=0,e=s.length;t<e;t++)ft=s[t],vt=parseFloat(ft),Number.isNaN(vt)||i.push(vt);if(yt=dt[mt],i.length-1>yt){let t,e=mt;for(let s=1,a=i.length;s<a;s+=yt){t=[e];for(let e=s,r=s+yt;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}(t);return this._runCommandStrList(a,e,i,s,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const r=ue(e,i);"x"===s?this.direction=At.ROW:"y"===s?this.direction=At.COLUMN:"auto"===s&&(this.direction=r.direction),this._curves=r.curves}fromCustomPath2D(t,e,i,s,r){return this.clear(),this._runCommandList(t.commandList,e,i,s,r),this._updateBounds(),this}transform(t,e,i,s){const r=this.commandList;if(!this.transformCbList){const t=[];t[ut.M]=this.moveToTransform,t[ut.L]=this.lineToTransform,t[ut.Q]=this.quadraticCurveToTransform,t[ut.C]=this.bezierCurveToTransform,t[ut.AT]=this.arcToTransform,t[ut.E]=this.ellipseTransform,t[ut.R]=this.rectTransform,t[ut.A]=this.arcTransform,t[ut.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*s+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s+e,t[4]=t[4]*r+i,t[5]=t[5]*(s+r)/2}ellipseTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}rectTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*s,t[4]=t[4]*r}arcTransform(t,e,i,s,r){t[1]=t[1]*s+e,t[2]=t[2]*r+i,t[3]=t[3]*(s+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,r=1){let a,n,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m<f;++m){switch(a=t[m],1===s&&1===r||(a=me(a,s,r)),a[0]){case"l":d+=a[1],u+=a[2],this.lineTo(d+e,u+i);break;case"L":d=a[1],u=a[2],this.lineTo(d+e,u+i);break;case"h":d+=a[1],this.lineTo(d+e,u+i);break;case"H":d=a[1],this.lineTo(d+e,u+i);break;case"v":u+=a[1],this.lineTo(d+e,u+i);break;case"V":u=a[1],this.lineTo(d+e,u+i);break;case"m":d+=a[1],u+=a[2],this.moveTo(d+e,u+i);break;case"M":d=a[1],u=a[2],this.moveTo(d+e,u+i);break;case"c":n=d+a[5],o=u+a[6],p=d+a[3],g=u+a[4],this.bezierCurveTo(d+a[1]+e,u+a[2]+i,p+e,g+i,n+e,o+i),d=n,u=o;break;case"C":d=a[5],u=a[6],p=a[3],g=a[4],this.bezierCurveTo(a[1]+e,a[2]+i,p+e,g+i,d+e,u+i);break;case"s":n=d+a[3],o=u+a[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=d+a[1],h=u+a[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,n+e,o+i),p=l,g=h,d=n,u=o;break;case"S":n=a[3],o=a[4],null===c[0].match(/[CcSs]/)?(p=d,g=u):(p=2*d-p,g=2*u-g),l=a[1],h=a[2],this.bezierCurveTo(p+e,g+i,l+e,h+i,n+e,o+i),p=l,g=h,d=n,u=o;break;case"q":n=d+a[3],o=u+a[4],p=d+a[1],g=u+a[2],this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o;break;case"Q":n=a[3],o=a[4],this.quadraticCurveTo(a[1]+e,a[2]+i,n+e,o+i),d=n,u=o,p=a[1],g=a[2];break;case"t":n=d+a[1],o=u+a[2],null===c[0].match(/[QqTt]/)?(p=d,g=u):"t"===c[0]?(p=2*d-l,g=2*u-h):"q"===c[0]&&(p=2*d-p,g=2*u-g),l=p,h=g,this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o,p=d+a[1],g=u+a[2];break;case"T":n=a[1],o=a[2],p=2*d-p,g=2*u-g,this.quadraticCurveTo(p+e,g+i,n+e,o+i),d=n,u=o;break;case"a":kt(this,d+e,u+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+e,a[7]+u+i]),d+=a[6],u+=a[7];break;case"A":kt(this,d+e,u+i,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+i]),d=a[6],u=a[7];break;case"z":case"Z":this.closePath()}c=a}}_runCommandList(t,e=0,i=0,s=1,r=1){if(0!==e||0!==i||1!==s||1!==r)for(let a=0,n=t.length;a<n;++a){const n=t[a].slice();switch(n[0]){case ut.L:this.lineToTransform(n,e,i,s,r);break;case ut.M:this.moveToTransform(n,e,i,s,r);break;case ut.C:this.bezierCurveToTransform(n,e,i,s,r);break;case ut.Q:this.quadraticCurveToTransform(n,e,i,s,r);break;case ut.A:this.arcToTransform(n,e,i,s,r);break;case ut.E:this.ellipseTransform(n,e,i,s,r);break;case ut.R:this.rectTransform(n,e,i,s,r);break;case ut.AT:this.arcToTransform(n,e,i,s,r);break;case ut.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Et(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===At.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return r.abs(t.p0.y-e.p1.y)}if(this.direction===At.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return r.abs(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s<this._curves.length;s++){e=this._curves[s];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,r){this.tryBuildCurves();const a=this.getLength()*r;let n=0;for(let r=0;r<this._curves.length;r++){const o=this._curves[r],l=o.getLength(this.direction);if(!(n+l<=a)){const r=1-(n+l-a)/l;o.draw(t,i,s,e,e,r);break}o.draw(t,i,s,e,e,1),n+=l}}}const ge=["l",0,0,0,0,0,0,0];function me(t,e,i){const s=ge[0]=t[0];if("a"===s||"A"===s)ge[1]=e*t[1],ge[2]=i*t[2],ge[3]=t[3],ge[4]=t[4],ge[5]=t[5],ge[6]=e*t[6],ge[7]=i*t[7];else if("h"===s||"H"===s)ge[1]=e*t[1];else if("v"===s||"V"===s)ge[1]=i*t[1];else for(let s=1,r=t.length;s<r;++s)ge[s]=(s%2==1?e:i)*t[s];return ge}var fe,ve,ye;!function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(fe||(fe={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(ve||(ve={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(ye||(ye={}));const _e={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new r.Matrix},be={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Se=Object.assign({outerBorder:Object.assign(Object.assign({},be),{distance:0}),innerBorder:Object.assign(Object.assign({},be),{distance:0})},be),Ae={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:fe.fontBounding,keepCenterInLine:!1},xe=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,backgroundPosition:"top-left",blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Se),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Te={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Ce=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null,roughStyle:null},{_debug_bounds:!1}),xe),_e),ke=Object.assign(Object.assign({},Ce),{startAngle:0,endAngle:r.pi2,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,clipRange:1,cap:!1,forceShowCap:!1}),Me=Object.assign(Object.assign(Object.assign({},Ce),Te),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),Ee=Object.assign(Object.assign({},Ce),{radius:1,startAngle:0,endAngle:r.pi2}),we=Object.assign(Object.assign({},Ce),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1,cornerType:"round"}),Oe=Object.assign(Object.assign({},Ce),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Pe=Object.assign(Object.assign(Object.assign({},Ce),Te),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),Be=Object.assign(Object.assign({},Ce),{path:new pe,fillStrokeOrder:1,clipRange:1,customPath:()=>{r.Logger.getInstance().warn("空函数")}}),De=Object.assign(Object.assign({},Ce),{points:[],cornerRadius:0,closePath:!0}),Ie=Object.assign(Object.assign({},Ce),{width:100,height:100,spikes:5,thickness:.5}),Re=Object.assign(Object.assign({},Ce),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Ce),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const Le=Object.assign(Object.assign({},Ce),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Fe=Object.assign(Object.assign(Object.assign({},Ce),Ae),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Ne=Object.assign(Object.assign(Object.assign({},Ce),Ae),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),je=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Ce),{fill:!0,cornerRadius:0,cornerType:"round"}),Ue=Object.assign(Object.assign({},je),{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});function Ve(t){return function(){var t,e;const i=null===(t=nt.global)||void 0===t?void 0:t.env,s=i?null===(e=nt.canvasFactory)||void 0===e?void 0:e.call(nt,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Ge=1e-4,Ke=Math.sqrt(3),ze=1/3;function He(t){return t>-ri&&t<ri}function We(t){return t>ri||t<-ri}const $e=[0,0],Ye=[0,0],Xe=[0,0];function qe(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Ze(t,e,i,s){const r=1-s;return r*(r*t+2*s*e)+s*s*i}function Qe(t,e,i,s,r){const a=1-r;return a*a*(a*t+3*r*e)+r*r*(r*s+3*a*i)}function Je(t){return(t%=r.pi2)<0&&(t+=r.pi2),t}function ti(t,e,i,s,r,a,n,o,l){if(0===n)return!1;const h=n;return!(l>e+h&&l>s+h&&l>a+h||l<e-h&&l<s-h&&l<a-h||o>t+h&&o>i+h&&o>r+h||o<t-h&&o<i-h&&o<r-h)&&function(t,e,i,s,r,a,n,o,l){let h=0,c=.005,d=1/0;$e[0]=n,$e[1]=o;for(let n=0;n<1;n+=.05){Ye[0]=Ze(t,i,r,n),Ye[1]=Ze(e,s,a,n);const o=qe($e,Ye);o<d&&(h=n,d=o)}d=1/0;for(let n=0;n<32&&!(c<Ge);n++){const n=h-c,o=h+c;Ye[0]=Ze(t,i,r,n),Ye[1]=Ze(e,s,a,n);const l=qe(Ye,$e);if(n>=0&&l<d)h=n,d=l;else{Xe[0]=Ze(t,i,r,o),Xe[1]=Ze(e,s,a,o);const n=qe(Xe,$e);o<=1&&n<d?(h=o,d=n):c*=.5}}return l&&(l[0]=Ze(t,i,r,h),l[1]=Ze(e,s,a,h)),Math.sqrt(d)}(t,e,i,s,r,a,o,l,null)<=h/2}function ei(t,e,i,s,r,a,n,o,l,h,c){if(0===l)return!1;const d=l;return!(c>e+d&&c>s+d&&c>a+d&&c>o+d||c<e-d&&c<s-d&&c<a-d&&c<o-d||h>t+d&&h>i+d&&h>r+d&&h>n+d||h<t-d&&h<i-d&&h<r-d&&h<n-d)&&function(t,e,i,s,r,a,n,o,l,h,c){let d,u,p,g,m=0,f=.005,v=1/0;$e[0]=l,$e[1]=h;for(let l=0;l<1;l+=.05)Ye[0]=Qe(t,i,r,n,l),Ye[1]=Qe(e,s,a,o,l),p=qe($e,Ye),p<v&&(m=l,v=p);v=1/0;for(let l=0;l<32&&!(f<Ge);l++)d=m-f,u=m+f,Ye[0]=Qe(t,i,r,n,d),Ye[1]=Qe(e,s,a,o,d),p=qe(Ye,$e),d>=0&&p<v?(m=d,v=p):(Xe[0]=Qe(t,i,r,n,u),Xe[1]=Qe(e,s,a,o,u),g=qe(Xe,$e),u<=1&&g<v?(m=u,v=g):f*=.5);return c&&(c[0]=Qe(t,i,r,n,m),c[1]=Qe(e,s,a,o,m)),Math.sqrt(v)}(t,e,i,s,r,a,n,o,h,c,null)<=d/2}function ii(t,e,i,s,a,n,o,l,h){if(0===o)return!1;const c=o;l-=t,h-=e;const d=Math.sqrt(l*l+h*h);if(d-c>i||d+c<i)return!1;if(Math.abs(s-a)%r.pi2<1e-4)return!0;if(n){const t=s;s=Je(a),a=Je(t)}else s=Je(s),a=Je(a);s>a&&(a+=r.pi2);let u=Math.atan2(h,l);return u<0&&(u+=r.pi2),u>=s&&u<=a||u+r.pi2>=s&&u+r.pi2<=a}function si(t,e,i,s,r,a,n){if(0===r)return!1;const o=r,l=r/2;let h=0,c=t;if(n>e+l&&n>s+l||n<e-l&&n<s-l||a>t+l&&a>i+l||a<t-l&&a<i-l)return!1;if(t===i)return Math.abs(a-t)<=o/2;h=(e-s)/(t-i),c=(t*s-i*e)/(t-i);const d=h*a-n+c;return d*d/(h*h+1)<=o/2*o/2}const ri=1e-4;function ai(t,e,i,s,r){const a=6*i-12*e+6*t,n=9*e+3*s-3*t-9*i,o=3*e-3*t;let l=0;if(He(n)){if(We(a)){const t=-o/a;t>=0&&t<=1&&(r[l++]=t)}}else{const t=a*a-4*n*o;if(He(t))r[0]=-a/(2*n);else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*n),s=(-a-e)/(2*n);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}const ni=[-1,-1,-1],oi=[-1,-1];function li(){const t=oi[0];oi[0]=oi[1],oi[1]=t}function hi(t,e,i,s,r,a,n,o,l,h){if(h>e&&h>s&&h>a&&h>o||h<e&&h<s&&h<a&&h<o)return 0;const c=function(t,e,i,s,r,a){const n=s+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-r,c=o*o-3*n*l,d=o*l-9*n*h,u=l*l-3*o*h;let p=0;if(He(c)&&He(d))if(He(o))a[0]=0;else{const t=-l/o;t>=0&&t<=1&&(a[p++]=t)}else{const t=d*d-4*c*u;if(He(t)){const t=d/c,e=-o/n+t,i=-t/2;e>=0&&e<=1&&(a[p++]=e),i>=0&&i<=1&&(a[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*n*(-d+e),s=c*o+1.5*n*(-d-e);i=i<0?-Math.pow(-i,ze):Math.pow(i,ze),s=s<0?-Math.pow(-s,ze):Math.pow(s,ze);const r=(-o-(i+s))/(3*n);r>=0&&r<=1&&(a[p++]=r)}else{const t=(2*c*o-3*n*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),r=(-o-2*i*s)/(3*n),l=(-o+i*(s+Ke*Math.sin(e)))/(3*n),h=(-o+i*(s-Ke*Math.sin(e)))/(3*n);r>=0&&r<=1&&(a[p++]=r),l>=0&&l<=1&&(a[p++]=l),h>=0&&h<=1&&(a[p++]=h)}}return p}(e,s,a,o,h,ni);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h<c;h++){const c=ni[h],m=0===c||1===c?.5:1;Qe(t,i,r,n,c)<l||(u<0&&(u=ai(e,s,a,o,oi),oi[1]<oi[0]&&u>1&&li(),p=Qe(e,s,a,o,oi[0]),u>1&&(g=Qe(e,s,a,o,oi[1]))),2===u?c<oi[0]?d+=p<e?m:-m:c<oi[1]?d+=g<p?m:-m:d+=o<g?m:-m:c<oi[0]?d+=p<e?m:-m:d+=o<p?m:-m)}return d}function ci(t,e,i,s,r,a,n,o){if(o>e&&o>s&&o>a||o<e&&o<s&&o<a)return 0;const l=function(t,e,i,s,r){const a=t-2*e+i,n=2*(e-t),o=t-s;let l=0;if(He(a)){if(We(n)){const t=-o/n;t>=0&&t<=1&&(r[l++]=t)}}else{const t=n*n-4*a*o;if(He(t)){const t=-n/(2*a);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-n+e)/(2*a),s=(-n-e)/(2*a);i>=0&&i<=1&&(r[l++]=i),s>=0&&s<=1&&(r[l++]=s)}}return l}(e,s,a,o,ni);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,a);if(h>=0&&h<=1){let o=0;const c=Ze(e,s,a,h);for(let s=0;s<l;s++){const l=0===ni[s]||1===ni[s]?.5:1;Ze(t,i,r,ni[s])<n||(ni[s]<h?o+=c<e?l:-l:o+=a<c?l:-l)}return o}const c=0===ni[0]||1===ni[0]?.5:1;return Ze(t,i,r,ni[0])<n?0:a<e?c:-c}function di(t,e,i,s,a,n,o,l){if((l-=e)>i||l<-i)return 0;const h=Math.sqrt(i*i-l*l);ni[0]=-h,ni[1]=h;const c=Math.abs(s-a);if(c<1e-4)return 0;if(c>=r.pi2-1e-4){s=0,a=r.pi2;const e=n?1:-1;return o>=ni[0]+t&&o<=ni[1]+t?e:0}if(s>a){const t=s;s=a,a=t}s<0&&(s+=r.pi2,a+=r.pi2);let d=0;for(let e=0;e<2;e++){const i=ni[e];if(i+t>o){let t=Math.atan2(l,i),e=n?1:-1;t<0&&(t=r.pi2+t),(t>=s&&t<=a||t+r.pi2>=s&&t+r.pi2<=a)&&(t>r.pi/2&&t<1.5*r.pi&&(e=-e),d+=e)}}return d}function ui(t){return Math.round(t/r.pi*1e8)/1e8%2*r.pi}function pi(t,e){let i=ui(t[0]);i<0&&(i+=r.pi2);const s=i-t[0];let a=t[1];a+=s,!e&&a-i>=r.pi2?a=i+r.pi2:e&&i-a>=r.pi2?a=i-r.pi2:!e&&i>a?a=i+(r.pi2-ui(i-a)):e&&i<a&&(a=i-(r.pi2-ui(a-i))),t[0]=i,t[1]=a}const gi=[0,0];function mi(t,e,i,s,a){const n=t,o=t.length;let l,h,c=0,d=0,u=0,p=0,g=0;for(let t=0;t<o;t++){const o=n[t],m=0===t;o[0]===ut.M&&t>1&&(i||(c+=r.isPointInLine(d,u,p,g,s,a))),m&&(d=o[1],u=o[2],p=d,g=u);const f=o[0],v=o[1],y=o[2],_=o[3],b=o[4],S=o[5],A=o[6];let x=b,T=S;gi[0]=x,gi[1]=T,pi(gi,Boolean(o[6])),x=gi[0],T=gi[1];const C=x,k=T-x,M=!!(1-(o[6]?0:1)),E=(s-v)*_/_+v;switch(f){case ut.M:p=v,g=y,d=p,u=g;break;case ut.L:if(i){if(si(d,u,v,y,e,s,a))return!0}else c+=r.isPointInLine(d,u,v,y,s,a)||0;d=v,u=y;break;case ut.C:if(i){if(ei(d,u,v,y,_,b,S,A,e,s,a))return!0}else c+=hi(d,u,v,y,_,b,S,A,s,a)||0;d=S,u=A;break;case ut.Q:if(i){if(ti(d,u,v,y,_,b,e,s,a))return!0}else c+=ci(d,u,v,y,_,b,s,a)||0;d=_,u=b;break;case ut.A:if(l=Math.cos(C)*_+v,h=Math.sin(C)*_+y,m?(p=l,g=h):c+=r.isPointInLine(d,u,l,h,s,a),i){if(ii(v,y,_,C,C+k,M,e,E,a))return!0}else c+=di(v,y,_,C,C+k,M,E,a);d=Math.cos(C+k)*_+v,u=Math.sin(C+k)*_+y;break;case ut.R:if(p=d=v,g=u=y,l=p+_,h=g+b,i){if(si(p,g,l,g,e,s,a)||si(l,g,l,h,e,s,a)||si(l,h,p,h,e,s,a)||si(p,h,p,g,e,s,a))return!0}else c+=r.isPointInLine(l,g,l,h,s,a),c+=r.isPointInLine(p,h,p,g,s,a);break;case ut.Z:if(i){if(si(d,u,p,g,e,s,a))return!0}else c+=r.isPointInLine(d,u,p,g,s,a);d=p,u=g}}return i||(m=u,f=g,Math.abs(m-f)<ri)||(c+=r.isPointInLine(d,u,p,g,s,a)||0),0!==c;var m,f}const fi=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Ve(Object.assign({nativeCanvas:nt.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Ve(Object.assign({nativeCanvas:nt.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class vi{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=vi.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&r.isFunction(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&r.isFunction(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class yi extends vi{constructor(t,e){super(),this.type=t,this.detail=e}}const _i={dispatchEvent(t){var e;if(!(t instanceof vi))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),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 yi(t,e))}};var bi,Si=function(t,e,i,s){return new(i||(i=Promise))((function(r,a){function n(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(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(n,o)}l((s=s.apply(t,e||[])).next())}))};class Ai extends r.EventEmitter{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=at.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Si(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&r.Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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 s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<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 s=r.isBoolean(i,!0)&&i||r.isObject(i)&&i.capture,a=r.isObject(i)&&i.once,n=r.isFunction(e)?void 0:e;return t=s?`${t}capture`:t,e=r.isFunction(e)?e:e.handleEvent,a?super.once(t,e,n):super.on(t,e,n),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const s=r.isBoolean(i,!0)&&i||r.isObject(i)&&i.capture,a=r.isFunction(e)?void 0:e;t=s?`${t}capture`:t,e=r.isFunction(e)?e:e.handleEvent;const n=r.isObject(i)&&i.once;return super.off(t,e,a,n),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return r.isObject(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class xi{static GetImage(t,e){var i;const s=xi.cache.get(t);s?"fail"===s.loadState?nt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):xi.loadImage(t,e)}static GetSvg(t,e){var i;let s=xi.cache.get(t);s?"fail"===s.loadState?nt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},xi.cache.set(t,s),s.dataPromise=nt.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=xi.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},xi.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=nt.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=nt.global.loadBlob(t):"json"===e&&(i.dataPromise=nt.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!xi.isLoading&&xi.toLoadAueue.length){xi.isLoading=!0;const t=xi.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,r={type:"image",loadState:"init"};if(xi.cache.set(i,r),r.dataPromise=nt.global.loadImage(i),r.dataPromise){r.waitingMark=s;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{xi.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),xi.loading()})).catch((t=>{console.error(t),xi.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),xi.loading()}))}}),0)}static loadImage(t,e){const i=Ti(t,xi.toLoadAueue);if(-1!==i)return xi.toLoadAueue[i].marks.push(e),void xi.loading();xi.toLoadAueue.push({url:t,marks:[e]}),xi.loading()}static improveImageLoading(t){const e=Ti(t,xi.toLoadAueue);if(-1!==e){const t=xi.toLoadAueue.splice(e,1);xi.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ti(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}xi.cache=new Map,xi.isLoading=!1,xi.toLoadAueue=[],xi.onLoadSuccessCb=[],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"}(bi||(bi={}));const Ci=[0,0,0,0],ki=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Mi=[1,2,3,0,1,2,3,0];function Ei(t,e,i,s){for(;t>=r.pi2;)t-=r.pi2;for(;t<0;)t+=r.pi2;for(;t>e;)e+=r.pi2;ki[0].x=i,ki[1].y=i,ki[2].x=-i,ki[3].y=-i;const a=Math.ceil(t/r.halfPi)%4,n=Math.ceil(e/r.halfPi)%4;if(s.add(r.cos(t)*i,r.sin(t)*i),s.add(r.cos(e)*i,r.sin(e)*i),a!==n||e-t>r.pi){let t=!1;for(let e=0;e<Mi.length;e++)if(t||a!==Mi[e]){if(t&&n===Mi[e])break;if(t){const t=ki[Mi[e]];s.add(t.x,t.y)}}else{t=!0;const e=ki[a];s.add(e.x,e.y)}}}function wi(t,e,i){const{x:s,y:a}=r.pointAt(t.x,t.y,e.x,e.y,i),{x:n,y:o}=r.pointAt(t.x1,t.y1,e.x1,e.y1,i),l=new r.Point(s,a,n,o);return l.defined=e.defined,l}function Oi(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let s=[];if(t.length>e.length){s=e.map((t=>{const e=new r.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)s[r]=wi(t[r],e[r],i)}else{s=e.map((t=>{const e=new r.Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)s[r]=wi(t[r],e[r],i)}return s}class Pi{bounds(t,e){if(r.isNumber(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return r.isNumber(t)?t:Math.min(t[0],t[1])}}function Bi(t,e,i,s,a){return a?t.arc(i,s,e,0,r.tau,!1,a):t.arc(i,s,e,0,r.tau),!1}var Di=new class extends Pi{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,r){return Bi(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,a){return Bi(t,this.parseSize(e)/2+r,i,s,a)}drawToSvgPath(t,e,i,s){const r=this.parseSize(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`}};var Ii=new class extends Pi{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,r){return function(t,e,i,s,r){return t.moveTo(-3*e+i,-e+s,r),t.lineTo(-e+i,-e+s,r),t.lineTo(-e+i,-3*e+s,r),t.lineTo(e+i,-3*e+s,r),t.lineTo(e+i,-e+s,r),t.lineTo(3*e+i,-e+s,r),t.lineTo(3*e+i,e+s,r),t.lineTo(e+i,e+s,r),t.lineTo(e+i,3*e+s,r),t.lineTo(-e+i,3*e+s,r),t.lineTo(-e+i,e+s,r),t.lineTo(-3*e+i,e+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r)}drawOffset(t,e,i,s,r,a){return function(t,e,i,s,r,a){return t.moveTo(-3*e+i-r,-e+s-r,a),t.lineTo(-e+i-r,-e+s-r,a),t.lineTo(-e+i-r,-3*e+s-r,a),t.lineTo(e+i+r,-3*e+s-r,a),t.lineTo(e+i+r,-e+s-r,a),t.lineTo(3*e+i+r,-e+s-r,a),t.lineTo(3*e+i+r,e+s+r,a),t.lineTo(e+i+r,e+s+r,a),t.lineTo(e+i+r,3*e+s+r,a),t.lineTo(-e+i-r,3*e+s+r,a),t.lineTo(-e+i-r,e+s+r,a),t.lineTo(-3*e+i-r,e+s+r,a),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,r,a)}};function Ri(t,e,i,s,r){return t.moveTo(i,s-e,r),t.lineTo(e+i,s,r),t.lineTo(i,s+e,r),t.lineTo(i-e,s,r),t.closePath(),!0}var Li=new class extends Pi{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,r){return Ri(t,this.parseSize(e)/2,i,s,r)}drawFitDir(t,e,i,s,r){return Ri(t,this.parseSize(e)/2,i,s,r)}drawOffset(t,e,i,s,r,a){return Ri(t,this.parseSize(e)/2+r,i,s,a)}};function Fi(t,e,i,s){const r=2*e;return t.rect(i-e,s-e,r,r),!1}var Ni=new class extends Pi{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Fi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Fi(t,this.parseSize(e)/2+r,i,s)}};function ji(t,e,i,s,r=0){return t.moveTo(i+e+2*r,e+s+r),t.lineTo(i-e-2*r,e+s+r),t.lineTo(i,s-e-2*r),t.closePath(),!0}class Ui extends Pi{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return ji(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ji(t,this.parseSize(e)/2,i,s,r)}}var Vi=new Ui;var Gi=new class extends Ui{constructor(){super(...arguments),this.type="triangle"}};const Ki=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zi=Math.sin(r.tau/10)*Ki,Hi=-Math.cos(r.tau/10)*Ki;function Wi(t,e,i,s){const a=zi*e,n=Hi*e;t.moveTo(i,-e+s),t.lineTo(a+i,n+s);for(let o=1;o<5;++o){const l=r.tau*o/5,h=Math.cos(l),c=Math.sin(l);t.lineTo(c*e+i,-h*e+s),t.lineTo(h*a-c*n+i,c*a+h*n+s)}return t.closePath(),!0}var $i=new class extends Pi{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Wi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Wi(t,this.parseSize(e)/2+r,i,s)}};const Yi=r.sqrt(3);function Xi(t,e,i,s){const r=e,a=r/Yi,n=a/5,o=e;return t.moveTo(0+i,-r+s),t.lineTo(a/2+i,s),t.lineTo(n/2+i,s),t.lineTo(n/2+i,o+s),t.lineTo(-n/2+i,o+s),t.lineTo(-n/2+i,s),t.lineTo(-a/2+i,s),t.closePath(),!0}var qi=new class extends Pi{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Xi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Xi(t,this.parseSize(e)/2+r,i,s)}};function Zi(t,e,i,s){const r=2*e;return t.moveTo(i,-e+s),t.lineTo(r/3/2+i,e+s),t.lineTo(-r/3/2+i,e+s),t.closePath(),!0}var Qi=new class extends Pi{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Zi(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Zi(t,this.parseSize(e)/2+r,i,s)}};function Ji(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var ts=new class extends Pi{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ji(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return Ji(t,this.parseSize(e)/2+r,i,s)}};const es=-.5,is=r.sqrt(3)/2,ss=1/r.sqrt(12);function rs(t,e,i,s){const r=e/2,a=e*ss,n=r,o=e*ss+e,l=-n,h=o;return t.moveTo(r+i,a+s),t.lineTo(n+i,o+s),t.lineTo(l+i,h+s),t.lineTo(es*r-is*a+i,is*r+es*a+s),t.lineTo(es*n-is*o+i,is*n+es*o+s),t.lineTo(es*l-is*h+i,is*l+es*h+s),t.lineTo(es*r+is*a+i,es*a-is*r+s),t.lineTo(es*n+is*o+i,es*o-is*n+s),t.lineTo(es*l+is*h+i,es*h-is*l+s),t.closePath(),!1}var as=new class extends Pi{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return rs(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return rs(t,this.parseSize(e)/2+r,i,s)}};function ns(t,e,i,s,r){return t.moveTo(-e+i-2*r,s),t.lineTo(e+i+r,e+s+2*r),t.lineTo(e+i+r,s-e-2*r),t.closePath(),!0}var os=new class extends Pi{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return ns(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,r){return ns(t,this.parseSize(e)/2,i,s,r)}};function ls(t,e,i,s,r=0){return t.moveTo(i-e-r,e+s+2*r),t.lineTo(e+i+2*r,s),t.lineTo(i-e-r,s-e-2*r),t.closePath(),!0}var hs=new class extends Pi{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return ls(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return ls(t,this.parseSize(e)/2,i,s,r)}};function cs(t,e,i,s,r=0){return t.moveTo(i-e-2*r,s-e-r),t.lineTo(i+e+2*r,s-e-r),t.lineTo(i,s+e+2*r),t.closePath(),!0}var ds=new class extends Pi{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return cs(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r){return cs(t,this.parseSize(e)/2,i,s,r)}};const us=r.sqrt(3);function ps(t,e,i,s){const r=e*us;return t.moveTo(i,s+-r/3*2),t.lineTo(e+i,s+r),t.lineTo(i-e,s+r),t.closePath(),!0}var gs=new class extends Pi{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return ps(t,this.parseSize(e)/2/us,i,s)}drawOffset(t,e,i,s,r){return ps(t,this.parseSize(e)/2/us+r,i,s)}};function ms(t,e,i,s){const r=2*e;return t.moveTo(e+i,s-r),t.lineTo(i-e,s),t.lineTo(e+i,r+s),!0}var fs=new class extends Pi{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return ms(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return ms(t,this.parseSize(e)/4+r,i,s)}};function vs(t,e,i,s){const r=2*e;return t.moveTo(i-e,s-r),t.lineTo(i+e,s),t.lineTo(i-e,r+s),!0}var ys=new class extends Pi{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return vs(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return vs(t,this.parseSize(e)/4+r,i,s)}};function _s(t,e,i,s){const r=2*e;return t.moveTo(i-r,s+e),t.lineTo(i,s-e),t.lineTo(i+r,s+e),!0}var bs=new class extends Pi{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return _s(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return _s(t,this.parseSize(e)/4+r,i,s)}};function Ss(t,e,i,s){const r=2*e;return t.moveTo(i-r,s-e),t.lineTo(i,s+e),t.lineTo(i+r,s-e),!0}var As=new class extends Pi{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Ss(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,r){return Ss(t,this.parseSize(e)/4+r,i,s)}};function xs(t,e,i,s,r){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Ts=new class extends Pi{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,r){return xs(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return xs(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function Cs(t,e,i,s,r){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ks=new class extends Pi{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,r){return Cs(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return Cs(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function Ms(t,e,i,s,r){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var Es=new class extends Pi{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,r){return Ms(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,r,a){return Ms(t,this.parseSize(e)/2+r,i,s)}drawToSvgPath(t,e,i,s){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function ws(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Os(t,e,i,s){const r=e,a=e/2;return t.rect(i-r/2,s-a/2,r,a),!1}var Ps=new class extends Pi{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return r.isNumber(e)?Os(t,e,i,s):ws(t,e,i,s)}drawWithClipRange(t,e,i,s,a,n,o){r.isNumber(e)&&(e=[e,e/2]);const l=2*(e[0]+e[1])*a,h=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let c=0,d=h[3];t.moveTo(d.x,d.y);for(let e=0;e<h.length;e++){const i=h[e],s=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(c+s>l){const e=(i.x-d.x)*(l-c)/s,r=(i.y-d.y)*(l-c)/s;t.lineTo(d.x+e,d.y+r);break}t.lineTo(i.x,i.y),d=i,c+=s}return!1}drawOffset(t,e,i,s,a){return r.isNumber(e)?Os(t,e+2*a,i,s):ws(t,[e[0]+2*a,e[1]+2*a],i,s)}};const Bs=new r.AABBBounds;class Ds{constructor(t,e,i=!1){this.pathStr="",this.type=t,r.isArray(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,r,a,n){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Et(r.path.commandList,t,i,s,e,e),n&&n(r.path,r.attribute)})),!1):(Et(this.path.commandList,t,i,s,e+r,e+r),!1)}draw(t,e,i,s,r,a){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,r,a)}parseSize(t){return r.isNumber(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,r,a,n){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((a=>{a.path.drawWithClipRange(t,e,i,s,r),n&&n(a.path,a.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,r),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Bs.x1=i.bounds.x1*t,Bs.y1=i.bounds.y1*t,Bs.x2=i.bounds.x2*t,Bs.y2=i.bounds.y2*t,e.union(Bs)}))}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 Is={};[Di,Ii,Li,Ni,gs,Gi,$i,qi,Qi,ts,as,os,hs,Vi,ds,fs,ys,bs,As,Ps,Ts,ks,Es].forEach((t=>{Is[t.type]=t}));const Rs={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Ls{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Fs(t,e,i,s){const r=t.indexOf(e,i);if(-1===r)throw new Error(s);return r+e.length-1}function Ns(t,e,i,s=">"){const r=function(t,e,i=">"){let s,r="";for(let a=e;a<t.length;a++){let e=t[a];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===i[0]){if(!i[1])return{data:r,index:a};if(t[a+1]===i[1])return{data:r,index:a}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,s);if(!r)return;let a=r.data;const n=r.index,o=a.search(/\s/);let l=a,h=!0;-1!==o&&(l=a.substr(0,o).replace(/\s\s*$/,""),a=a.substr(o+1));const c=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==r.data.substr(t+1))}return{tagName:l,tagExp:a,closeIndex:n,attrExpPresent:h,rawTagName:c}}const js=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Us{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const r=function(t,e){const i=[];let s=e.exec(t);for(;s;){const r=[];r.startIndex=e.lastIndex-s[0].length;const a=s.length;for(let t=0;t<a;t++)r.push(s[t]);i.push(r),s=e.exec(t)}return i}(t,js),a=r.length;for(let t=0;t<a;t++){const e=r[t][1],i=r[t][4];e&&(s[e]=void 0===i||(isNaN(i)?i:Number(i)))}return s}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new Ls("!xml");let i=e,s="",r="";for(let a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){const e=Fs(t,">",a,"Closing Tag is not closed."),n=r.lastIndexOf(".");r=r.substring(0,n),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",a=e}else if("?"===t[a+1])a=Ns(t,a,!1,"?>").closeIndex+1;else if("!--"===t.substr(a+1,3))a=Fs(t,"--\x3e",a+4,"Comment is not closed.");else{const n=Ns(t,a,!1);let o=n.tagName,l=n.tagExp;const h=n.attrExpPresent,c=n.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1);const t=new Ls(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new Ls(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),i=t}s="",a=c}else s+=t[a];return e.child}}function Vs(t,e){return Gs(t)}function Gs(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],a=Ks(r);if(void 0!==a&&r[a]){const t=Gs(r[a]);s=t,Object.keys(s).length,r[":@"]&&zs(t,r[":@"]),void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(t)):i[a]=t}}var s;return i}function Ks(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function zs(t,e,i){if(e){const i=Object.keys(e),s=i.length;for(let r=0;r<s;r++){const s=i[r];t[s]=e[s]}}}class Hs{constructor(t){this.options=Object.assign({},Hs.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Vs(new Us(this.options).parseXml(t),this.options)}}Hs.defaultOptions={};let Ws=0;function $s(){return Ws++}var Ys;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Ys||(Ys={}));const Xs=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Xs.set(t,!0)));const qs=new Map;[""].forEach((t=>qs.set(t,!0)));const Zs=$s(),Qs=$s();$s(),$s(),$s();const Js=$s();$s(),$s(),$s();const tr=$s(),er=$s(),ir=$s(),sr=$s();$s(),$s(),$s(),$s();const rr={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},ar=Object.keys(rr),nr={duration:200,easing:"cubicOut"};function or(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lr(t,e,i){const s=i[0],r=i[1],a=i[2];let n,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*r+e[8]*a+e[12],t[13]=e[1]*s+e[5]*r+e[9]*a+e[13],t[14]=e[2]*s+e[6]*r+e[10]*a+e[14],t[15]=e[3]*s+e[7]*r+e[11]*a+e[15]):(n=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=n,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=n*s+c*r+g*a+e[12],t[13]=o*s+d*r+m*a+e[13],t[14]=l*s+u*r+f*a+e[14],t[15]=h*s+p*r+v*a+e[15]),t}function hr(t,e,i){const s=e[0],r=e[1],a=e[2],n=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],S=i[2],A=i[3];return t[0]=_*s+b*o+S*d+A*m,t[1]=_*r+b*l+S*u+A*f,t[2]=_*a+b*h+S*p+A*v,t[3]=_*n+b*c+S*g+A*y,_=i[4],b=i[5],S=i[6],A=i[7],t[4]=_*s+b*o+S*d+A*m,t[5]=_*r+b*l+S*u+A*f,t[6]=_*a+b*h+S*p+A*v,t[7]=_*n+b*c+S*g+A*y,_=i[8],b=i[9],S=i[10],A=i[11],t[8]=_*s+b*o+S*d+A*m,t[9]=_*r+b*l+S*u+A*f,t[10]=_*a+b*h+S*p+A*v,t[11]=_*n+b*c+S*g+A*y,_=i[12],b=i[13],S=i[14],A=i[15],t[12]=_*s+b*o+S*d+A*m,t[13]=_*r+b*l+S*u+A*f,t[14]=_*a+b*h+S*p+A*v,t[15]=_*n+b*c+S*g+A*y,t}function cr(t,e,i){const s=e[0],r=e[1],a=e[2];let n=i[3]*s+i[7]*r+i[11]*a+i[15];return n=n||1,t[0]=(i[0]*s+i[4]*r+i[8]*a+i[12])/n,t[1]=(i[1]*s+i[5]*r+i[9]*a+i[13])/n,t[2]=(i[2]*s+i[6]*r+i[10]*a+i[14])/n,t}class dr{constructor(){this.pools=[]}static identity(t){return or(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 dr.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(...t){this.pools=[]}}const ur=new class{constructor(){this.pools=[]}allocate(t,e,i,s,a,n){if(!this.pools.length)return new r.Matrix(t,e,i,s,a,n);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=s,o.e=a,o.f=n,o}allocateByObj(t){if(!this.pools.length)return new r.Matrix(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}},pr=new dr,gr=new r.Matrix(1,0,0,1,0,0),mr={x:0,y:0};class fr{get nativeContext(){return this.path}constructor(t,e){this.matrix=new r.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new r.Matrix(1,0,0,1,0,0),this.path=new pe,this._clearMatrix=new r.Matrix(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ur.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new r.Matrix(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ur.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ur.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,r=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,s,r,a,n=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*r,o*a),n&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,r,a,n=!0){this.matrix.multiply(t,e,i,s,r,a),n&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,r,a){this.path.arc(t,e,i,s,r,a)}arcTo(t,e,i,s,r){this.path.arcTo(t,e,i,s,r)}bezierCurveTo(t,e,i,s,r,a){this.path.bezierCurveTo(t,e,i,s,r,a)}closePath(){this.path.closePath()}ellipse(t,e,i,s,r,a,n,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,r,a){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},mr),function(t,e,i){return mi(t,0,!1,e,i)}(this.path.commandList,mr.x,mr.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},mr);const i=function(t,e,i){let s=e;const{a:r,b:a,c:n,d:o}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+a*a),h=Math.sign(o)*Math.sqrt(n*n+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}(this,this.lineWidth,this.dpr);return function(t,e,i,s){return mi(t,e,!0,i,s)}(this.path.commandList,i,mr.x,mr.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,r){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,r){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(gr,t,e)}setClearMatrix(t,e,i,s,r,a){this._clearMatrix.setValue(t,e,i,s,r,a)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ur.free(t))),this.stack.length=0}}var vr;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(vr||(vr={}));class yr{static Get(t,e=vr.Color1,i=[0,0,0,1]){if(e===vr.Color1){const e=yr.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=r.Color.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];yr.store1[t]=e,yr.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=yr.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const a=r.Color.parseColorString(t);return a&&(yr.store1[t]=[a.r/255,a.g/255,a.b/255,a.opacity],yr.store255[t]=[a.r,a.g,a.b,a.opacity],i[0]=a.r,i[1]=a.g,i[2]=a.b,i[3]=a.opacity),i}static Set(t,e,i){if(e===vr.Color1){if(yr.store1[t])return;yr.store1[t]=i,yr.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(yr.store255[t])return;yr.store255[t]=i,yr.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function _r(t,e=!1){return Array.isArray(t)&&r.isNumber(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function br(t,e,i,s,a){return Array.isArray(t)&&!r.isNumber(t[0])||Array.isArray(e)&&!r.isNumber(e[0])?new Array(4).fill(0).map(((a,n)=>{var o,l;return Sr(r.isArray(t)?null!==(o=t[n])&&void 0!==o?o:t[0]:t,r.isArray(e)?null!==(l=e[n])&&void 0!==l?l:e[0]:e,i,s)})):Sr(t,e,i,s,a)}function Sr(t,e,i,s,r){if(!t||!e)return t&&_r(t)||e&&_r(e)||!1;let a,n,o=!1,l=!1;if(Array.isArray(t)?a=t:"string"==typeof t?a=yr.Get(t,vr.Color255):o=!0,Array.isArray(e)?n=e:"string"==typeof e?n=yr.Get(e,vr.Color255):l=!0,o!==l){const a=o?t:e,n=o?e:t,l=Object.assign(Object.assign({},a),{stops:a.stops.map((t=>Object.assign(Object.assign({},t),{color:_r(n)})))});return o?br(a,l,i,s,r):br(l,a,i,s,r)}if(o){if(t.gradient===e.gradient){const s=t,r=e,a=s.stops,n=r.stops;if(a.length!==n.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=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(s.length).fill(0).map(((t,e)=>({color:Cr(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("radial"===s.gradient)return function(t,e,i){const s=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(s.length).fill(0).map(((t,e)=>({color:Cr(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i);if("conical"===s.gradient)return function(t,e,i){const s=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(s.length).fill(0).map(((t,e)=>({color:Cr(s[e].color,r[e].color,i),offset:s[e].offset+(r[e].offset-s[e].offset)*i})))}}(s,r,i)}return!1}return r&&r(a,n),_r(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]}(a,n,i),s)}function Ar(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}yr.store255={},yr.store1={};const xr=[0,0,0,0],Tr=[0,0,0,0];function Cr(t,e,i){return yr.Get(t,vr.Color255,xr),yr.Get(e,vr.Color255,Tr),`rgba(${Math.round(xr[0]+(Tr[0]-xr[0])*i)},${Math.round(xr[1]+(Tr[1]-xr[1])*i)},${Math.round(xr[2]+(Tr[2]-xr[2])*i)},${xr[3]+(Tr[3]-xr[3])*i})`}const kr=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Mr(t){return null==t?void 0:t}class Er{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const r=null!==(i=t.priority)&&void 0!==i?i:0,a=null!==(s=e.priority)&&void 0!==s?s:0;return r!==a?r-a:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const r=new Map;return e.forEach((([,t])=>{var e,i,a,n;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),r.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Mr(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(a=t.exclude)&&void 0!==a?a:[]),suppress:new Set(null!==(n=t.suppress)&&void 0!==n?n:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(r,"exclude"),this.expandRelationClosure(r,"suppress"),r}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>kr.has(t)))){const r=e;return{name:null!==(i=r.name)&&void 0!==i?i:t,priority:null!==(s=r.priority)&&void 0!==s?s:0,patch:Mr(r.patch),resolver:r.resolver,declaredAffectedKeys:r.declaredAffectedKeys,exclude:r.exclude,suppress:r.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const r=new Set,a=(t,e)=>{const n=i.get(t);n&&n.size&&n.forEach((t=>{t===s||e.has(t)||r.has(t)||(r.add(t),e.add(t),a(t,e),e.delete(t))}))};a(s,new Set([s])),t[e]=r}))}}function wr(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Or(t){if(!wr(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Or(t[i])})),e}function Pr(t,e){var i;const s=null!==(i=Or(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];wr(r)&&wr(i)?s[t]=Pr(r,i):s[t]=Or(i)})),s}class Br{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),r=s.active,a=r.filter((t=>!s.suppressedSet.has(t))),n=r.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,r)||!this.sameArray(this._effectiveStates,a)||!this.sameArray(this._suppressed,n);return this._activeStates=r,this._effectiveStates=a,this._suppressed=n,!o&&this.resolverCacheValid||this.recomputePatch(a),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],r=this.compiledDefinitions.get(s);r&&(r.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s<t&&(t-=1))})),r.suppress.forEach((t=>{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const r=this.compiledDefinitions.get(t);if(r&&(r.patch&&this.mergeInto(i,r.patch),r.hasResolver)){const a=s?this.resolverPatchCache.get(t):null===(e=r.resolver)||void 0===e?void 0:e.call(r,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});a&&(s||this.resolverPatchCache.set(t,a),this.mergeInto(i,a))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Or(e[i])})):Object.keys(e).forEach((i=>{var s;const r=e[i],a=t[i],n=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];wr(a)&&wr(r)?t[i]=Pr(a,r):!wr(a)&&wr(n)&&wr(r)?t[i]=Pr(n,r):t[i]=Or(r)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}}var Dr;!function(t){t[t.NONE=0]="NONE",t[t.PAINT=1]="PAINT",t[t.SHAPE=2]="SHAPE",t[t.BOUNDS=4]="BOUNDS",t[t.TRANSFORM=8]="TRANSFORM",t[t.LAYOUT=16]="LAYOUT",t[t.PICK=32]="PICK"}(Dr||(Dr={}));const Ir={fill:Dr.PAINT,opacity:Dr.PAINT,fillOpacity:Dr.PAINT,strokeOpacity:Dr.PAINT,lineDash:Dr.PAINT,lineDashOffset:Dr.PAINT,lineCap:Dr.PAINT,lineJoin:Dr.PAINT,miterLimit:Dr.PAINT,shadowColor:Dr.PAINT,x:Dr.TRANSFORM|Dr.BOUNDS,y:Dr.TRANSFORM|Dr.BOUNDS,scaleX:Dr.TRANSFORM|Dr.BOUNDS,scaleY:Dr.TRANSFORM|Dr.BOUNDS,angle:Dr.TRANSFORM|Dr.BOUNDS,anchor:Dr.TRANSFORM|Dr.BOUNDS,anchor3d:Dr.TRANSFORM|Dr.BOUNDS,postMatrix:Dr.TRANSFORM|Dr.BOUNDS,layout:Dr.LAYOUT,zIndex:Dr.PAINT,visible:Dr.PAINT|Dr.PICK,lineWidth:Dr.SHAPE|Dr.BOUNDS|Dr.PICK,width:Dr.SHAPE|Dr.BOUNDS,height:Dr.SHAPE|Dr.BOUNDS},Rr={stroke:(t,e)=>(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Dr.PAINT|Dr.BOUNDS|Dr.PICK:Dr.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?Dr.PAINT|Dr.BOUNDS:Dr.PAINT}};class Lr{analyzeTransition(t,e,i={}){var s,r;const a={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return a;const n=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(r=i.animateConfig)||void 0===r?void 0:r.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(n[e])a.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;a.animateAttrs[e]=l(e)}else a.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return a}applyTransition(t,e,i,s={}){var r,a,n;if(i){const i=null!==(r=s.animateConfig)&&void 0!==r?r:nr;null===(a=t.applyAnimationState)||void 0===a||a.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),n=e.noAnimateAttrs,Object.keys(n).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:St.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:St.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:St.STATE}),e}applyClearTransition(t,e,i,s={}){var r;const a=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(r=s.shouldSkipDefaultAttribute)&&void 0!==r?r:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,a,i,s)}}const Fr=new Er;function Nr(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,jr(t),!0)}function jr(t,e=t.revision+1){var i;const s=(r=t.parentScope,a=t.localStateDefinitions,n=t.themeStateDefinitions,Object.assign({},r?r.effectiveSourceDefinitions:n,a));var r,a,n;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=Fr.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function Ur(t){if(t)return t.parentScope&&Ur(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&jr(t),t}function Vr(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Gr(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}const Kr=new r.AABBBounds,zr=new r.Matrix,Hr=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Wr=["x","y"],$r=["scaleX","scaleY"],Yr=["angle"],Xr=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),qr=new r.Point,Zr=[],Qr=Dr.PAINT|Dr.SHAPE|Dr.BOUNDS|Dr.TRANSFORM|Dr.LAYOUT;function Jr(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function ta(t){if(!Jr(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Jr(s)?ta(s):s})),i}function ea(t,e){return t===e||!!(Jr(t)||Jr(e)||Array.isArray(t)||Array.isArray(e))&&r.isEqual(t,e)}function ia(t,e){var i;const s=null!==(i=ta(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],r=s[t];Jr(r)&&Jr(i)?s[t]=ia(r,i):s[t]=ta(i)})),s}const sa={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class ra extends Ai{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(ra.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get AABBBounds(){return this.tryUpdateAABBBounds()}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}get baseAttributes(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}set baseAttributes(t){t!==this.attribute?this._baseAttributes=t:this._baseAttributes=void 0}constructor(t={}){var e;super(),this._AABBBounds=new r.AABBBounds,this._updateTag=_t.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background&&this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0),t.texture&&aa(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}get normalAttrs(){return this.baseAttributes}set normalAttrs(t){}getBaseAttributesStorage(){var t;return null!==(t=this._baseAttributes)&&void 0!==t?t:this.attribute}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:nt.graphicService}getAttributes(){return this.attribute}getStateTransitionOrchestrator(){return this.stateTransitionOrchestrator||(this.stateTransitionOrchestrator=new Lr),this.stateTransitionOrchestrator}resolveBoundSharedStateScope(){var t;let e=this.parent;for(;e;){if(e.sharedStateScope)return e.sharedStateScope;e=e.parent}return null===(t=this.stage)||void 0===t?void 0:t.rootSharedStateScope}syncSharedStateScopeBindingFromTree(t=!0){var e;const i=this.resolveBoundSharedStateScope();return this.boundSharedStateScope===i?(this.syncSharedStateActiveRegistrations(),!1):(this.boundSharedStateScope=i,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.syncSharedStateActiveRegistrations(),t&&(null===(e=this.currentStates)||void 0===e?void 0:e.length)&&this.markSharedStateDirty(),!0)}syncSharedStateScopeBindingOnTreeChange(t=!0){var e,i;return!!((null===(e=this.currentStates)||void 0===e?void 0:e.length)||this.boundSharedStateScope||(null===(i=this.registeredActiveScopes)||void 0===i?void 0:i.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingFromTree(t)}syncSharedStateActiveRegistrations(){var t;const e=this.registeredActiveScopes;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.boundSharedStateScope)return(null==e?void 0:e.size)&&(e.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Gr(this.stage,this),Vr(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&Ur(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:St.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(Ur(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Er).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),r=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...r],this.resolvedStatePatch=a,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=ta(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],r=e[t];"deep"===this.stateMergeMode&&Jr(r)&&Jr(s)?e[t]=ia(r,s):e[t]=ta(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),r=s;return Object.keys(e).forEach((e=>{const a=Object.prototype.hasOwnProperty.call(t,e);if(a&&void 0!==t[e])return;const n=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,r)||(i[e]=void 0===t?t:ta(t))};if(a)n(this.getStateTransitionDefaultAttribute(e,r));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];n(void 0===t?this.getStateTransitionDefaultAttribute(e,r):t)}else n(this.getStateTransitionDefaultAttribute(e,r))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((r=>{if(!0===(null==i?void 0:i[r]))return;const a=Object.prototype.hasOwnProperty.call(e,r),n=t[r];if(!a)return void(Object.prototype.hasOwnProperty.call(t,r)&&(s.set(r,{prev:n,next:void 0}),delete t[r]));const o=e[r];ea(n,o)||(s.set(r,{prev:n,next:o}),t[r]=ta(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var r;let a="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const r=Rr[t];return r?r(e,i):null!==(s=Ir[t])&&void 0!==s?s:Dr.PAINT}(e,i,s):null!==(r=Ir[e])&&void 0!==r?r:Dr.PAINT;return a&Dr.PICK&&(a|=Dr.BOUNDS),a===Dr.PAINT&&this.needUpdateTag(e)&&(a=Dr.SHAPE|Dr.BOUNDS),t|a}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&Qr)!==Qr?(t&Dr.SHAPE?this.addUpdateShapeAndBoundsTag():t&Dr.BOUNDS&&this.addUpdateBoundTag(),t&Dr.PAINT&&this.addUpdatePaintTag(),t&Dr.TRANSFORM&&this.addUpdatePositionTag(),t&Dr.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Dr.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,r;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(r=this.stateEngine)||void 0===r||r.invalidateResolverCache(),this.recomputeCurrentStatePatch());const a=this._syncAttribute();this.submitUpdateByDelta(a,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Jr(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=Jr(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,r=this.getBaseAttributesStorage();let a=!1,n=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(a=!0,r[t]=s[t],!n&&this.needUpdateTag(t)&&(n=!0));a&&(this.attribute=r,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(n),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.getBaseAttributesStorage()[s]=t[s]}}_commitAnimationStaticAttributes(t,e){if(!t)return;const i=t,s=this.getBaseAttributesStorage(),r=this.attribute,a=new Map;let n=!1;for(const t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;n=!0;const e=r[t],o=i[t];s[t]=o,r[t]=o,ea(e,o)||a.set(t,{prev:e,next:o})}n&&(this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!0,this.submitUpdateByDelta(a),this.onAttributeUpdate(e))}applyAnimationTransientAttributes(t,e=!1,i){const s=t;let r,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r||(this.detachAttributeFromBaseAttributes(),r=this.attribute),r[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attributeMayContainTransientAttrs=!0,this.valid=this.isValid(),this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}applyTransientAttributes(t,e=!1,i){this.detachAttributeFromBaseAttributes();const s=new Map,r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],a=this.attribute[i],n=t[i];ea(a,n)||(s.set(i,{prev:a,next:n}),this.attribute[i]=n)}s.size&&(this.attributeMayContainTransientAttrs=!0),this.valid=this.isValid(),this.submitUpdateByDelta(s,e),this.onAttributeUpdate(i)}_restoreAttributeFromStaticTruth(t,e){this._syncFinalAttributeFromStaticTruth(e);const i=this._syncAttribute(e);this.submitUpdateByDelta(i),this.onAttributeUpdate(t)}collectStatePatchDeltaKeys(t,e){const i=t?Object.keys(t):[];if(!e)return i;for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(null!=t?t:{},s)&&i.push(s);return i}getStaticTruthValueForStateKey(t,e){var i;const s=null!==(i=this.baseAttributes)&&void 0!==i?i:{},r=e;if(r&&Object.prototype.hasOwnProperty.call(r,t)){const e=r[t],i=s[t];return"deep"===this.stateMergeMode&&Jr(i)&&Jr(e)?{hasValue:!0,value:ia(i,e)}:{hasValue:!0,value:e}}return Object.prototype.hasOwnProperty.call(s,t)?{hasValue:!0,value:s[t]}:{hasValue:!1,value:void 0}}syncStatePatchDeltaToTarget(t,e,i,s=!1){let r=Dr.NONE;for(let a=0;a<e.length;a++){const n=e[a],o=t[n],l=this.getStaticTruthValueForStateKey(n,i);if(!l.hasValue){Object.prototype.hasOwnProperty.call(t,n)&&(delete t[n],s&&(r=this.mergeAttributeDeltaCategory(r,n,o,void 0)));continue}if(ea(o,l.value))continue;const h=ta(l.value);t[n]=h,s&&(r=this.mergeAttributeDeltaCategory(r,n,o,h))}return r}restoreAttributeFromStatePatchDelta(t,e,i){this.detachAttributeFromBaseAttributes();const s=this.collectStatePatchDeltaKeys(t,e),r=this.finalAttribute;r&&this.syncStatePatchDeltaToTarget(r,s,e,!1);const a=this.syncStatePatchDeltaToTarget(this.attribute,s,e,!0);this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitUpdateByCategory(a),this.onAttributeUpdate(i)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,s;const{dx:r=t.dx,dy:a=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;qr.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),qr.y=a+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else qr.x=r,qr.y=a;return qr}onAnimateBind(t){this.detachAttributeFromBaseAttributes(),this._emitCustomEvent("animate-bind",t)}visitTrackedAnimates(t){const e=this.forEachTrackedAnimate;"function"!=typeof e?this.animates&&this.animates.forEach(t):e.call(this,t)}hasAnyTrackedAnimate(){var t;const e=this.hasTrackedAnimate;if("function"==typeof e)return e.call(this);const i=this.getTrackedAnimates;return"function"==typeof i?i.call(this).size>0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&_t.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new r.OBBBounds),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Is[t];if(e)return e;if(e=ra.userSymbolMap[t],e)return e;if(!0===((i=t=Rs[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new Hs,{svg:i}=e.parse(t);if(!i)return null;const s=r.isArray(i.path)?i.path:[i.path];Kr.clear();const a=[];s.forEach((t=>{const e=(new pe).fromString(t.d),i={};ar.forEach((e=>{t[e]&&(i[rr[e]]=t[e])})),a.push({path:e,attribute:i}),Kr.union(e.bounds)}));const n=Kr.width(),o=Kr.height(),l=1/r.max(n,o);a.forEach((t=>t.path.transform(0,0,l,l)));const h=new Ds(t,a,!0);return ra.userSymbolMap[t]=h,h}var i;const s=(new pe).fromString(t),a=s.bounds.width(),n=s.bounds.height(),o=1/r.max(a,n);s.transform(0,0,o,o);const l=new Ds(t,s);return ra.userSymbolMap[t]=l,l}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,a=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:n=i.boundsPadding}=s,o=(l=n)?r.isArray(l)?0===l.length?0:1===l.length?l[0]:2===l.length?(Ci[0]=l[0],Ci[2]=l[0],Ci[1]=l[1],Ci[3]=l[1],Ci):l:l:0;var l;return o&&a.expand(o),this.clearUpdateBoundTag(),a}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new lt(t);return Et(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new r.Matrix),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&_t.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&_t.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&_t.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&_t.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&_t.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&_t.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=_t.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===bt.GLOBAL){const i=new r.Point(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const r=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,r,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(r)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===St.STATE||null!=i&&i>=St.ANIMATE_BIND&&i<=St.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,r=this.setFinalAttributes;s&&"function"==typeof r&&r.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,a;const n=this.context,o=null!==(s=null==n?void 0:n.diffAttrs)&&void 0!==s?s:t,l=null==i?void 0:i.type;if(!e.length||!o||l===St.STATE||null!=l&&l>=St.ANIMATE_BIND&&l<=St.ANIMATE_END)return;const h=this.transientFromAttrsBeforePreventAnimateDiffAttrs===o;let c=h&&null!==(a=this.transientFromAttrsBeforePreventAnimate)&&void 0!==a?a:null;h||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let d=!1;for(let i=0;i<e.length;i++){const s=e[i];if(!Object.prototype.hasOwnProperty.call(o,s))continue;const a=this.attribute[s],n=t[s];r.isEqual(a,n)||(null!=c||(c={}),c[s]=ta(a),d=!0)}d&&(this.transientFromAttrsBeforePreventAnimate=c,this.transientFromAttrsBeforePreventAnimateDiffAttrs=o)}consumeTransientFromAttrsBeforePreventAnimate(t){const e=this.transientFromAttrsBeforePreventAnimate,i=this.transientFromAttrsBeforePreventAnimateDiffAttrs;if(!e||!i)return null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(!Object.prototype.hasOwnProperty.call(i,e)||!r.isEqual(i[e],t[e])))return null;let s=null,a=!1;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?(null!=s||(s={}),s[i]=e[i]):a=!0);if(a){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e[s]);this.transientFromAttrsBeforePreventAnimate=i}else this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null;return s}setAttributes(t,e=!1,i){t&&((t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),t.texture&&aa(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i))}_setAttributes(t,e=!1,i){this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,e,i):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(e,i))}setAttribute(t,e,i,s){const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(r)this._setAttributes(r,i,s);else if(this.canCommitBaseAttributesByTouchedKeys())this.commitBaseAttributeBySingleKey(t,e,!!i,s);else{const r={[t]:e};this.applyBaseAttributes(r),this.commitBaseAttributeMutation(!!i,s)}"background"===t?this.loadImage(e,!0):"texture"===t&&aa(e)?this.loadImage(e,!1):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Hr){for(let i=0;i<e.length;i++){const s=e[i];if(-1!==t.indexOf(s))return!0}return!1}needUpdateTag(t,e=Hr){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:St.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,this._baseAttributes=void 0,this.resolvedStatePatch=void 0,this.attributeMayContainTransientAttrs=!1,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0),t.texture&&aa(t.texture)&&this.loadImage(t.texture,!1),t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=_t.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,s;if(0===t&&0===e)return this;const r={type:St.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Wr,r);a&&(t=a.x,e=a.y,delete a.x,delete a.y);const n=this.baseAttributes,o=n.postMatrix,l=a||{};if(o){const i=o.clone();nt.transformUtil.fromMatrix(i,i).translate(t,e),l.postMatrix=i}else l.x=(null!==(i=n.x)&&void 0!==i?i:_e.x)+t,l.y=(null!==(s=n.y)&&void 0!==s?s:_e.y)+e;return this.commitInternalBaseAttributes(l,r),this}translateTo(t,e){const i=this.baseAttributes;if(i.x===t&&i.y===e)return this;const s={type:St.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Wr,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({x:t,y:e},s),this)}scale(t,e,i){var s,a;if(1===t&&1===e)return this;const n={type:St.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,$r,n);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY);const l=this.baseAttributes,h=o||{};if(i){let{postMatrix:s}=this.baseAttributes;s=s?s.clone():new r.Matrix,nt.transformUtil.fromMatrix(s,s).scale(t,e,i),h.postMatrix=s}else h.scaleX=(null!==(s=l.scaleX)&&void 0!==s?s:_e.scaleX)*t,h.scaleY=(null!==(a=l.scaleY)&&void 0!==a?a:_e.scaleY)*e;return this.commitInternalBaseAttributes(h,n),this}scaleTo(t,e){const i=this.baseAttributes;if(i.scaleX===t&&i.scaleY===e)return this;const s={type:St.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,$r,s);return r?(this.commitInternalBaseAttributes(r,s),this):(this.commitInternalBaseAttributes({scaleX:t,scaleY:e},s),this)}rotate(t,e){var i;if(0===t)return this;const s={type:St.ROTATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,Yr,s);a&&delete a.angle;const n=this.baseAttributes,o=a||{};if(e){let{postMatrix:i}=this.baseAttributes;i=i?i.clone():new r.Matrix,nt.transformUtil.fromMatrix(i,i).rotate(t,e),o.postMatrix=i}else o.angle=(null!==(i=n.angle)&&void 0!==i?i:_e.angle)+t;return this.commitInternalBaseAttributes(o,s),this}rotateTo(t){if(this.baseAttributes.angle===t)return this;const e={type:St.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Yr,e);return i?(this.commitInternalBaseAttributes(i,e),this):(this.commitInternalBaseAttributes({angle:t},e),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!r.isNil(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}getStateResolveBaseAttrs(){var t;return null!==(t=this.baseAttributes)&&void 0!==t?t:this.attribute}syncStateResolveContext(t=this.getStateResolveBaseAttrs()){var e;return null===(e=this.stateEngine)||void 0===e||e.setResolveContext(this,t),t}ensureStateEngine(t=this.getStateResolveBaseAttrs()){const{compiledDefinitions:e}=this.resolveEffectiveCompiledDefinitions();return this.compiledStateDefinitions=e,e?this.stateEngine&&this.stateEngineCompiledDefinitions===e&&this.stateEngineStateSort===this.stateSort&&this.stateEngineMergeMode===this.stateMergeMode||(this.stateEngine=new Br({compiledDefinitions:e,stateSort:this.stateSort,mergeMode:this.stateMergeMode}),this.stateEngineCompiledDefinitions=e,this.stateEngineStateSort=this.stateSort,this.stateEngineMergeMode=this.stateMergeMode):(this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0),this.syncStateResolveContext(t),this.stateEngine&&this.currentStates&&!this.sameStateNames(this.stateEngine.activeStates,this.currentStates)&&this.stateEngine.applyStates(this.currentStates),this.stateEngine}toGraphicStateTransition(t){return{changed:t.changed,states:[...t.activeStates],effectiveStates:[...t.effectiveStates]}}sortLocalStates(t){return this.stateSort?[...t].sort(this.stateSort):[...t]}resolveLocalUseStatesTransition(t){var e;if(!t.length)return this.resolveLocalClearStatesTransition();const i=null!==(e=this.currentStates)&&void 0!==e?e:Zr,s=i.length!==t.length||t.some(((t,e)=>i[e]!==t)),r=this.sortLocalStates(t);return{changed:s,states:s?r:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const r=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(r)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),r=this.ensureStateEngine(s);e&&(null==r||r.invalidateResolverCache());const a=r?this.toGraphicStateTransition(r.applyStates(t)):this.resolveLocalUseStatesTransition(t),n=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:a,effectiveStates:null!==(i=a.effectiveStates)&&void 0!==i?i:a.states,resolvedStateAttrs:n}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},r=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of r){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!ea(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const r=null!==(s=this.currentStates)&&void 0!==s?s:Zr,a=this.resolvedStatePatch,{transition:n,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(a,l);h&&!this.beforeStateUpdate(l,r,n.states,e,!1)||(this.currentStates=n.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,n.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,a))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:St.STATE}):this.restoreAttributeFromStatePatchDelta(a,this.resolvedStatePatch,{type:St.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:nr}applyStateAttrs(t,e,i,s,r,a){const n=i?this.resolveStateAnimateConfig(r):void 0,o=n?{animateConfig:n,extraAnimateAttrs:a,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:n,extraAnimateAttrs:a,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const r=null!==(e=this.currentStates)&&void 0!==e?e:Zr,a=this.resolvedStatePatch,n=this.resolveClearStatesTransition();if(!n.changed&&0===r.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?ta(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};n.changed&&!this.beforeStateUpdate(o,r,n.states,t,!0)||(this.currentStates=n.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,n.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,a))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:St.STATE}):this.restoreAttributeFromStatePatchDelta(a,void 0,{type:St.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,r;const{hasAnimation:a,animateSameStatePatchChange:n,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:Zr,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(r=this.registeredActiveScopes)||void 0===r?void 0:r.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,a,n):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,a)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(a)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:Zr,r=this.resolvedStatePatch,{transition:a,effectiveStates:n,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!a.changed&&this.sameStateNames(s,a.states)||this.beforeStateUpdate(o,s,a.states,e,!1)&&(this.currentStates=a.states,this.effectiveStates=[...n],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:St.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:St.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:St.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==s[t])return!1;return!0}addUpdateBoundTag(){this._updateTag|=_t.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdatePaintTag(){this._updateTag|=_t.UPDATE_PAINT}addUpdateShapeTag(){this._updateTag|=_t.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=_t.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addBroadUpdateTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=_t.UPDATE_SHAPE_AND_BOUNDS|_t.UPDATE_PAINT|_t.UPDATE_GLOBAL_LOCAL_MATRIX|_t.UPDATE_LAYOUT,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&_t.UPDATE_SHAPE_AND_BOUNDS)===_t.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=_t.CLEAR_BOUNDS}clearUpdatePaintTag(){this._updateTag&=_t.CLEAR_PAINT}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=_t.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=_t.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=_t.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=_t.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=_t.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=_t.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&_t.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],r=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=r();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=r();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=_e.x,y:e=_e.y,scaleX:i=_e.scaleX,scaleY:s=_e.scaleY,angle:a=_e.angle,scaleCenter:n,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const c={};if(o&&a&&(h=this.getAnchor(o,c)),!n||1===i&&1===s)r.normalTransform(this._transMatrix,this._transMatrix.reset(),t,e,i,s,a,o&&h);else{const r=this._transMatrix;r.reset(),r.translate(h[0],h[1]),r.rotate(a),r.translate(-h[0],-h[1]),r.translate(t,e),h=this.getAnchor(n,c,!0),nt.transformUtil.fromMatrix(r,r).scale(i,s,{x:h[0],y:h[1]})}const d=this.getOffsetXY(_e);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,l){const t=zr.setValue(l.a,l.b,l.c,l.d,l.e,l.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){var i,s,r,a,n,o,l,h,c,d;const u=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:nt.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(a=this.currentStates)||void 0===a?void 0:a.length)||this.boundSharedStateScope||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:St.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:St.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=nt.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return r.isString(t,!0)?this.pathProxy=(new pe).fromString(t):this.pathProxy=new pe,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("<svg")||r.isValidUrl(t)||t.includes("/")||r.isBase64(t)):!!(t.fill||t.stroke||"string"==typeof t.gradient&&Array.isArray(t.stops))}(t)))return void(this.backgroundImg=!1);if(!t)return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("<svg")?(xi.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(r.isValidUrl(t)||t.includes("/")||r.isBase64(t))&&(xi.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):r.isObject(t)?(s.state="success",s.data=t,this.backgroundImg=this.backgroundImg||e):s.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const s=this.resources.get(t);s&&(s.state="success",s.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(){if(!this.mayHaveTrackedAnimates())return;const t=[];this.visitTrackedAnimates((e=>{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const r=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:nt.graphicService;null===(s=null==r?void 0:r.onRelease)||void 0===s||s.call(r,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const r=new yi(t,e);r.bubbles=!1;const a=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return a?(r.manager=a,this.dispatchEvent(r)):Ai.prototype.dispatchEvent.call(this,r)}return!0}beforeStateUpdate(t,e,i,s,r){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:St.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!r})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:St.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||nt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new fr(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}function aa(t){return!!t&&("string"==typeof t?!Xr.has(t)&&(t.startsWith("<svg")||r.isValidUrl(t)||t.includes("/")||r.isBase64(t)):r.isObject(t))}ra.userSymbolMap={},ra.mixin(_i);const na={arc:ke,area:Me,circle:Ee,line:Pe,path:Be,symbol:Le,text:Fe,rect:Re,polygon:De,star:Ie,richtext:Ne,richtextIcon:Ue,image:je,group:we,glyph:Oe},oa=Object.keys(na);function la(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const ha={arc:Object.assign({},na.arc),area:Object.assign({},na.area),circle:Object.assign({},na.circle),line:Object.assign({},na.line),path:Object.assign({},na.path),symbol:Object.assign({},na.symbol),text:Object.assign({},na.text),rect:Object.assign({},na.rect),polygon:Object.assign({},na.polygon),star:Object.assign({},na.star),richtext:Object.assign({},na.richtext),richtextIcon:Object.assign({},na.richtextIcon),image:Object.assign({},na.image),group:Object.assign({},na.group),glyph:Object.assign({},na.glyph)};class ca{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},oa.forEach((t=>{this._defaultTheme[t]=Object.create(ha[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,r.Logger.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;oa.forEach((s=>{const r=Object.create(ha[s]);t&&t[s]&&la(r,t[s]),i[s]&&la(r,i[s]),e[s]&&la(r,e[s]),this.combinedTheme[s]=r})),e.common&&oa.forEach((t=>{la(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const da=new ca;function ua(t,e){return t.glyphHost?ua(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)):da.getTheme()}return null}(t)||t.attachedThemeGraphic&&ua(t.attachedThemeGraphic)||da.getTheme()}var pa;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(pa||(pa={}));class ga extends ra{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Js,this._childUpdateTag=_t.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;var i,s;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(Nr(this.sharedStateScope,t),i=this.sharedStateScope,s=this.stage,i.subtreeActiveDescendants.size&&(i.subtreeActiveDescendants.forEach((t=>{var e;t.sharedStateDirty=!0,Gr(null!==(e=null!=s?s:t.stage)&&void 0!==e?e:i.ownerStage,t)})),Vr(null!=s?s:i.ownerStage))),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new ca),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new ca)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===bt.GLOBAL){const i=new r.Point(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&_t.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=_e.x,y:e=_e.y,dx:i=_e.dx,dy:s=_e.dy,scaleX:r=_e.scaleX,scaleY:a=_e.scaleY,angle:n=_e.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==r||1!==a||0!==n||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return ua(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:r,height:a,path:n,clip:o=e.clip}=t;if(n&&n.length?n.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return nt.graphicService.updateTempAABBBounds(i),nt.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=_t.CLEAR_BOUNDS,this._childUpdateTag&=_t.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=_t.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&_t.UPDATE_BOUNDS||(this._childUpdateTag|=_t.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,r,a,n,o;const l=null!==(r=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==r?r:nt.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(a=this.currentStates)||void 0===a?void 0:a.length)||this.boundSharedStateScope||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&_t.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=nt.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new ga(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ga.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&Nr(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return jr({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}ga.NOWORK_ANIMATE_ATTR=sa;new class{constructor(){this.time=Tt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:S=l.backgroundOffsetX,backgroundOffsetY:A=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:T=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const r=t.resources.get(function(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}(g));if(!r||"success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=ua(t.parent).group,{scrollX:s=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,r)}x&&e.clip();const a=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,r.data,a,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:S,backgroundOffsetY:A,backgroundPosition:T}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){!function(t,e,i,s){var r,a;const{backgroundMode:n,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),m=function(t){if(!t)return null;const e=_a(t.naturalWidth,t.videoWidth,t.width),i=_a(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}(e),{backgroundRepeatMode:f,backgroundSizing:v}=function({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=va[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:fa({backgroundFit:e,backgroundKeepAspectRatio:i})}}({backgroundMode:n,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===f){let s=null!==(r=null==m?void 0:m.width)&&void 0!==r?r:p,n=null!==(a=null==m?void 0:m.height)&&void 0!==a?a:g;if("cover"!==v&&"contain"!==v||!m)"fill"===v&&(s=p,n=g);else{const t="cover"===v?Math.max(p/m.width,g/m.height):Math.min(p/m.width,g/m.height);s=m.width*t,n=m.height*t}s*=h,n*=h;const{x:o,y:l}=function(t,e,i){const[s,r]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:ma.has(t)?["center",t]:[t,"center"]}let r,a;const n=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?n.push(e):a=e:r=e}return null==r&&n.length&&(r=n.shift()),null==a&&n.length&&(a=n.shift()),[null!=r?r:"left",null!=a?a:"top"]}(t);return{x:ya(s,e,"left","center","right"),y:ya(r,i,"top","center","bottom")}}(u,p-s,g-n);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,n)}if(o&&"repeat"!==f&&m){const i=m.width,s=m.height;"repeat-x"===f?(y=i*(g/s),_=g):"repeat-y"===f&&(_=s*(p/i),y=p);const r=t.dpr,a=fi.allocate({width:y,height:_,dpr:r}),n=a.getContext("2d");n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.clearRect(0,0,y,_),n.drawImage(e,0,0,y,_),e=a.nativeCanvas),fi.free(a)}const b=t.dpr,S=t.createPattern(e,f);S.setTransform&&S.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=S,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}(t,e,i,s)}};const ma=new Set(["top","center","bottom"]);function fa({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const va={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function ya(t,e,i,s,r){if("number"==typeof t&&Number.isFinite(t))return t;const a=`${null!=t?t:""}`.trim().toLowerCase();if(!a||a===i)return 0;if(a===s)return e/2;if(a===r)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(a))return e*parseFloat(a)/100;const n=Number(a);return Number.isFinite(n)?n:0}function _a(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}const ba=new class{constructor(){this.time=Tt.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){var p,g;const{clipConfig:m}=t.attribute;if(!m)return;const f=t.getClipPath();if(!f)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===f.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Sa=new class{constructor(){this.time=Tt.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};const Aa=new class{constructor(){this.registry=new Map}create(t,e){const i=this.registry.get(t);if(!i)throw new Error(`GraphicFactory has no creator registered for type "${t}"`);return new i(e)}register(t,e){if(!t)throw new Error("GraphicFactory requires a non-empty graphic type");this.registry.set(t,e)}};const xa=new class{constructor(){this.store=new Map}registerStore(t,e){this.store.set(t,e),this[t]=e}RegisterGraphicCreator(t,e){Ta(t,e)}CreateGraphic(t,e){return this.store.has(t)?function(t,e){return Aa.create(t,e)}(t,e):null}};function Ta(t,e){if(!t)throw new Error("Graphic registration requires a non-empty graphic type");xa.registerStore(t,e),Aa.register(t,function(t){return class{constructor(e){try{return new t(e)}catch(i){return t(e)}}}}(e))}function Ca(t,e,i){var s;const{x:r=i.x,y:a=i.y,z:n=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=f[1];y[2]=null!==(s=f[2])&&void 0!==s?s:0}if(or(t),lr(t,t,[r+o,a+l,n+h]),lr(t,t,[y[0],y[1],y[2]]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[4],n=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*r+h*s,t[5]=n*r+c*s,t[6]=o*r+d*s,t[7]=l*r+u*s,t[8]=h*r-a*s,t[9]=c*r-n*s,t[10]=d*r-o*s,t[11]=u*r-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[0],n=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*r-h*s,t[1]=n*r-c*s,t[2]=o*r-d*s,t[3]=l*r-u*s,t[8]=a*s+h*r,t[9]=n*s+c*r,t[10]=o*s+d*r,t[11]=l*s+u*r}(t,t,p),lr(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const s=i[0],r=i[1],a=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=pr.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}lr(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),r=Math.cos(i),a=e[0],n=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*r+h*s,t[1]=n*r+c*s,t[2]=o*r+d*s,t[3]=l*r+u*s,t[4]=h*r-a*s,t[5]=c*r-n*s,t[6]=d*r-o*s,t[7]=u*r-l*s}(i,i,m),lr(i,i,[-s[0],-s[1],0]),hr(t,t,i)}}class ka{static registerPlugin(t,e){ka._pluginClasses[t]=e}static getPlugin(t){return ka._pluginClasses[t]}}ka._pluginClasses={};const Ma=(t,e,i)=>{const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:n=t.lineWidth}=s;i.expand(a+(r+n)/2)}return i},Ea=["width","x1","y1","height","cornerRadius",...Hr];class wa extends ra{constructor(t){super(t),this.type="rect",this.numberType=ir}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ua(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:r,y1:a,x:n,y:o}=t;e=null!=e?e:r-n,s=null!=s?s:a-o,(isFinite(e)||isFinite(s)||isFinite(n)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:r}=nt.graphicService.updateTempAABBBounds(i);return Ma(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,nt.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Ea)}needUpdateTag(t){return super.needUpdateTag(t,Ea)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>null!=s[t],a=t=>null==s[t];switch(t){case"width":return a("width")&&r("x")&&r("x1");case"height":return a("height")&&r("y")&&r("y1");case"x1":return a("x1")&&r("x")&&r("width");case"y1":return a("y1")&&r("y")&&r("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,r=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},a=r("x"),n=r("y"),o=r("x1"),l=r("y1"),h=r("width"),c=r("height");switch(t){case"width":if(null==h&&null!=a&&null!=o)return o-a;break;case"height":if(null==c&&null!=n&&null!=l)return l-n;break;case"x1":if(null==o&&null!=a&&null!=h)return a+h;break;case"y1":if(null==l&&null!=n&&null!=c)return n+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:a,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=r.isNil(t.width)?t.x1-t.x:t.width,i=r.isNil(t.height)?t.y1-t.y:t.height,s=0,a=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(a=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:a,width:e,height:i}})(e);return t=new pe,t.moveTo(i,s),t.rect(i,s,a,n),t}clone(){return new wa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wa.NOWORK_ANIMATE_ATTR}}wa.NOWORK_ANIMATE_ATTR=sa;const Oa=[[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 Pa extends wa{constructor(t){super(t),this.type="rect3d",this.numberType=sr}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:a,y:n,length:o=r.min(e.width,e.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=null!=l?l:i-a,h=null!=h?h:s-n;for(let e=0;e<Oa.length;e++){const i=Oa[e];t.vertices.push([i[0]*l,i[1]*h,i[2]*o])}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}getNoWorkAnimateAttr(){return Pa.NOWORK_ANIMATE_ATTR}}function Ba(t){return new Pa(t)}Pa.NOWORK_ANIMATE_ATTR=sa;const Da=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Hr];class Ia extends ra{constructor(t){super(t),this.type="arc",this.numberType=Zs}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:a=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(a+=s,n-=i,0===e||"0%"===e)return 0;const o=Math.abs(a-n),l=t=>Math.min(r.isNumber(t,!0)?t:o*parseFloat(t)/100,o/2);if(r.isArray(e)){const t=e.map((t=>l(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return l(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:a=t.clipRange}=this.attribute,n=i-e>=0?1:-1;let o=i-e;if(o*=Math.max(0,Math.min(a,1)),e=r.clampAngleByRadian(e),i=e+o,s&&r.abs(o)>r.epsilon&&r.abs(o)<r.pi2-r.epsilon){let a=1,o=1;s.length&&(a=Number(s[0]),o=Number(s[1]));let{outerRadius:l=t.outerRadius,innerRadius:h=t.innerRadius}=this.attribute;const{outerPadding:c=t.outerPadding,innerPadding:d=t.innerPadding}=this.attribute;l+=c,h-=d;const u=Math.abs(l-h)/2,p=u/l;if(u>r.epsilon&&l>r.epsilon)return{startAngle:e-n*p*a,endAngle:i+n*p*o,sc:n*p*a,ec:n*p*o}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:a=i.outerPadding,padAngle:n=i.padAngle}=this.attribute;let{outerRadius:o=i.outerRadius,innerRadius:l=i.innerRadius}=this.attribute;o+=a,l-=s;const{padRadius:h=r.sqrt(o*o+l*l)}=this.attribute,c=r.abs(e-t);let d=t,u=e,p=t,g=e;const m=n/2;let f=c,v=c;if(m>r.epsilon&&h>r.epsilon){const i=e>t?1:-1;let s=r.asin(Number(h)/l*r.sin(m)),a=r.asin(Number(h)/o*r.sin(m));return(f-=2*s)>r.epsilon?(s*=i,p+=s,g-=s):(f=0,p=g=(t+e)/2),(v-=2*a)>r.epsilon?(a*=i,d+=a,u-=a):(v=0,d=u=(t+e)/2),{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}return{outerStartAngle:d,outerEndAngle:u,innerStartAngle:p,innerEndAngle:g,innerDeltaAngle:f,outerDeltaAngle:v}}getGraphicTheme(){return ua(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:a}=nt.graphicService.updateTempAABBBounds(i);Ma(t,e,r),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return nt.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:n=e.innerPadding}=t;return s+=a,r-=n,s<r&&(s=r),i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:a=e.innerRadius}=t;const{outerPadding:n=e.outerPadding,innerPadding:o=e.innerPadding}=t;if(s+=n,a-=o,s<a){const t=s;s=a,a=t}let{endAngle:l=e.endAngle,startAngle:h=e.startAngle}=t;if(h>l){const t=h;h=l,l=t}return s<=r.epsilon?i.set(0,0,0,0):Math.abs(l-h)>r.pi2-r.epsilon?i.set(-s,-s,s,s):(Ei(h,l,s,i),Ei(h,l,a,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Da)}needUpdateTag(t){return super.needUpdateTag(t,Da)}toCustomPath(){var t,e,i,s;let a=super.toCustomPath();if(a)return a;const n=this.attribute,{startAngle:o,endAngle:l}=this.getParsedAngle();let h=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),c=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const d=r.abs(l-o),u=l>o;if(c<h){const t=c;c=h,h=t}if(a=new pe,c<=r.epsilon)a.moveTo(0,0);else if(d>=r.pi2-r.epsilon)a.moveTo(0+c*r.cos(o),0+c*r.sin(o)),a.arc(0,0,c,o,l,!u),h>r.epsilon&&(a.moveTo(0+h*r.cos(l),0+h*r.sin(l)),a.arc(0,0,h,l,o,u));else{const t=c*r.cos(o),e=c*r.sin(o),i=h*r.cos(l),s=h*r.sin(l);a.moveTo(0+t,0+e),a.arc(0,0,c,o,l,!u),a.lineTo(0+i,0+s),a.arc(0,0,h,l,o,u),a.closePath()}return a}clone(){return new Ia(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ia.NOWORK_ANIMATE_ATTR}}Ia.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},sa);class Ra extends Ia{constructor(t){super(t),this.type="arc3d",this.numberType=Qs}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,n=r+a;return i.setValue(-n,-n,n,n),nt.graphicService.updateTempAABBBounds(i),nt.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Ra.NOWORK_ANIMATE_ATTR}}function La(t){return new Ra(t)}Ra.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},sa);const Fa=["points","cornerRadius",...Hr];class Na extends ra{constructor(t){super(t),this.type="polygon",this.numberType=tr}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ua(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),nt.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return nt.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,r){"points"===t&&(r.points=Oi(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Fa)}needUpdateTag(t){return super.needUpdateTag(t,Fa)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new pe,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Na(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Na.NOWORK_ANIMATE_ATTR}}Na.NOWORK_ANIMATE_ATTR=sa;class ja extends Na{constructor(t){super(t),this.type="pyramid3d",this.numberType=er}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),nt.graphicService.updateTempAABBBounds(i),nt.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],r=e.x-s.x;return 0===r?0:(e.y-s.y)/r})),i=t.map((t=>({p:t,d:0})));let s=!1,a=0;for(let t=0;t<e.length-1;t++){for(let n=t+1;n<e.length;n++){if(e[t]===e[n]){s=!0;const e=r.PointService.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,a=r.max(a,e);const o=r.PointService.distancePP(i[n].p,i[n+1].p);i[n].d=o,i[n+1].d=o,a=r.max(a,o)}if(s)break}if(s)break}for(let e=t.length-1;e>=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e<t.length;e++){const s=(a-i[e+t.length].d)/2;i[e].d+=s,i[e+t.length].d+=s}const n={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{n.vertices.push([t.p.x,t.p.y,t.d])})),n.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),n.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),n.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),n.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),n.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),n.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),n.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]],n}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return ja.NOWORK_ANIMATE_ATTR}}function Ua(t){return new ja(t)}ja.NOWORK_ANIMATE_ATTR=sa;class Va extends ga{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ga(t){return new Va(t)}function Ka(t,e){return!(!t&&!e)}function za(t,e){let i;return i=r.isArray(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Ha(t,e,i){return i&&t*e>0}function Wa(t,e){return t*e>0}const $a=Symbol.for("Arc3dRender"),Ya=Symbol.for("GraphicRender"),Xa=Symbol.for("Rect3DRender"),qa=Symbol.for("Pyramid3dRender");class Za{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Qa{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Za(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}const Ja=new Qa;function tn(){return Ja}function en(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const sn={x:0,y:0,z:0,lastModelMatrix:null};class rn{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(ba),e(Sa),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Tt.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Tt.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,r,a,n,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,r,a,n,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,r,a,n,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,r,a,n,o){if(!t.pathProxy)return!1;const l=ua(t,null==a?void 0:a.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,y=Ha(d,u,h),_=Wa(d,g),b=Ka(h),S=za(c,p);if(!m)return!0;if(!b&&!S)return!0;if(!(y||_||n||o))return!0;e.beginPath();return Et(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,S,y,_,l,r,n,o),S&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(n?n(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,S,y,_,l,r,n,o),!0}valid(t,e,i,s){const{fill:r=e.fill,background:a,stroke:n=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Ha(o,l,r),p=Wa(o,c),g=Ka(r,a),m=za(n,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||a)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i,s=!1){const{x:r=e.x,y:a=e.y,z:n=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;sn.x=r,sn.y=a,sn.z=n,sn.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=pr.allocate(),r=pr.allocate();Ca(r,t,e),hr(s,d||s,r),sn.x=0,sn.y=0,sn.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),pr.free(r)}if(g&&!d){const s=t.getOffsetXY(e);sn.x+=s.x,sn.y+=s.y,sn.z=n,i.setTransformForCurrent()}else if(p)sn.x=0,sn.y=0,sn.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);sn.x+=s.x,sn.y+=s.y,this.transformWithoutTranslate(i,sn.x,sn.y,sn.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),sn.x=0,sn.y=0,sn.z=0;return sn}transformUseContext2d(t,e,i,s){const r=s.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,a=e.y2-e.y1,n=s.project(0,0,i),o=s.project(r,0,i),l=s.project(r,a,i),h={x:0,y:0},c={x:r,y:0},d={x:r,y:a};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*n.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*n.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*n.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*n.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*n.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*n.y)*u;s.setTransform(p,g,m,f,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,r,a,n){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(r,a,!1),t.rotate(n,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,r,a){const{context:n}=s;if(!n)return;const{renderable:o}=t.attribute;if(!1===o)return;n.highPerformanceSave();const l=this.transform(t,e,n,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,n,h,c,s,r)||(this.drawShape(t,n,h,c,s,r,null,null,a),this.z=0,n.modelMatrix!==u&&pr.free(n.modelMatrix),n.modelMatrix=u),n.highPerformanceRestore()}}class an extends rn{constructor(){super(...arguments),this.numberType=Qs}drawShape(t,e,i,s,a,n,o,l){var h;const c=ua(t,null==n?void 0:n.theme).arc,{fill:d=c.fill}=t.attribute,u=this.valid(t,c,o,l);if(!u)return;const{fVisible:p,sVisible:g,doFill:m,doStroke:f}=u,v=null!==(h=this.z)&&void 0!==h?h:0,{outerPadding:y=c.outerPadding,innerPadding:_=c.innerPadding,height:b=10}=t.attribute;let{outerRadius:S=c.outerRadius,innerRadius:A=c.innerRadius}=t.attribute;S+=y,A-=_;const x=yr.Get(d,vr.Color255),{light:T}=a.stage||{},C=a.hack_pieFace,k={top:v,bottom:v+b},M={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,s,a,n,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=r.abs(h-l),d=h>l;let u=!1;if(n<o){const t=n;n=o,o=t}if(n<=r.epsilon)e.moveTo(i,s,a);else if(c>=r.pi2-r.epsilon)e.moveTo(i+n*r.cos(l),s+n*r.sin(l),a),e.arc(i,s,n,l,h,!d,a),o>r.epsilon&&(e.moveTo(i+o*r.cos(h),s+o*r.sin(h),a),e.arc(i,s,o,h,l,d,a));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:m,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(l,h),y=n*r.cos(g),_=n*r.sin(g),b=o*r.cos(f),S=o*r.sin(f);c<.001?u=!0:(e.moveTo(i+y,s+_,a),e.arc(i,s,n,g,m,!d,a)),!(o>r.epsilon)||p<.001?(e.lineTo(i+b,s+S,a),u=!0):(e.lineTo(i+b,s+S,a),e.arc(i,s,o,f,v,d,a))}e.closePath()}(t,e,i,s,k[C],S,A),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,s,c),e.fillStyle=T?T.computeColor(M[C],x):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,s,c),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,s,A,0,r.pi2,!0,k.top),e.clip()),e.beginPath(),function(t,e,i,s,a,n,o,l){const{startAngle:h,endAngle:c}=t.getParsedAngle(),d=r.abs(c-h),u=c>h;let p=!1;if(o<=r.epsilon)e.moveTo(i,s,a);else if(d>=r.pi2-r.epsilon)e.moveTo(i+o*r.cos(h),s+o*r.sin(h),a),e.arc(i,s,o,h,c,!u,a),e.lineTo(i+o*r.cos(c),s+o*r.sin(c),n),e.arc(i,s,o,c,h,u,n);else{const{innerouterDeltaAngle:t,innerouterStartAngle:d,innerouterEndAngle:g}=l(h,c),m=o*r.cos(d),f=o*r.sin(d),v=o*r.cos(g),y=o*r.sin(g);t<.001?p=!0:(e.moveTo(i+m,s+f,a),e.arc(i,s,o,d,g,!u,a),e.lineTo(i+v,s+y,n),e.arc(i,s,o,g,d,u,n))}e.closePath()}(t,e,i,s,k.top,k.bottom,"outside"===C?S:A,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:r,outerStartAngle:a,outerEndAngle:n,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:s,innerouterEndAngle:n,innerouterStartAngle:a}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),m&&(o?o(e,t.attribute,c):p&&(e.setCommonStyle(t,t.attribute,i,s,c),e.fillStyle=T?T.computeColor(M[C],x):d,e.fill())),f&&(l?l(e,t.attribute,c):g&&(e.setStrokeStyle(t,t.attribute,i,s,c),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,s){const r=ua(t,null==s?void 0:s.theme).arc;this._draw(t,r,!1,i,s)}}const nn=new WeakSet;const on=function({bind:t}){en(nn,t)||(t(an).toDynamicValue((()=>new an)).inSingletonScope(),t($a).toService(an),t(Ya).toService($a))};class ln extends rn{stroke(t,e,i,s,r){const a=s.vertices;s.edges.forEach((s=>{const n=a[s[0]],o={x:t+n[0],y:e+n[1],z:i+n[2]},l=a[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};r.beginPath(),r.moveTo(o.x,o.y,o.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(t,e,i,s,r,a,n,o,l,h,c){const d=yr.Get(a,vr.Color255),u=s.vertices,p=u.map((t=>n.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(r&&!r[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],a=p[i[1]],n=p[i[2]],o=p[i[3]];t.ave_z=s+a+n+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:r,normal:p}=s.polygon,g=u[r[0]],m=u[r[1]],f=u[r[2]],v=u[r[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+m[0],y:e+m[1],z:i+m[2]},b={x:t+f[0],y:e+f[1],z:i+f[2]},S={x:t+v[0],y:e+v[1],z:i+v[2]};n.beginPath(),n.moveTo(y.x,y.y,y.z),n.lineTo(_.x,_.y,_.z),n.lineTo(b.x,b.y,b.z),n.lineTo(S.x,S.y,S.z),n.closePath(),c?c(n,l&&l.attribute,h):(n.fillStyle=o?o.computeColor(p,d):a,n.fill())}))}}class hn extends ln{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=er}drawShape(t,e,i,s,r,a,n,o){var l;const h=ua(t,null==a?void 0:a.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,n,o))return;const{light:g}=r.stage||{},m=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,s,p,m,u,r,e,g,t,h,n)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,m,e))}draw(t,e,i){const s=ua(t).polygon;this._draw(t,s,!1,i)}}const cn=new WeakSet;const dn=function({bind:t}){en(cn,t)||(t(hn).toDynamicValue((()=>new hn)).inSingletonScope(),t(qa).toService(hn),t(Ya).toService(qa))};class un extends ln{constructor(){super(...arguments),this.type="rect3d",this.numberType=sr}drawShape(t,e,i,s,r,a,n,o){var l,h;const c=ua(t,null==a?void 0:a.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:m,y:f,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:S=c.visible,drawStrokeWhenZeroWH:A=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:x,height:T}=t.attribute;x=(null!=x?x:p-m)||0,T=(null!=T?T:g-f)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,k=function(t,e,i,s,r){return r&&t*e>0&&0!==i&&0!==s}(v,y,x,T,d),M=function(t,e,i,s,r){return r?t*e>0:t*e>0&&0!==i&&0!==s}(v,b,x,T,A),E=Ka(d),w=za(u,_);if(!t.valid||!S)return;if(!E&&!w)return;if(!(k||M||n||o))return;const{light:O}=r.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let r=d;"string"!=typeof r&&(r="black"),this.fill(i,s,C,P,null,r,e,O,null,null,n)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=ua(t).rect;this._draw(t,s,!1,i)}}const pn=new WeakSet;const gn=function({bind:t}){en(pn,t)||(t(un).toDynamicValue((()=>new un)).inSingletonScope(),t(Xa).toService(un),t(Ya).toService(Xa))};function mn(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}const fn=Symbol.for("CanvasArc3dPicker"),vn=Symbol.for("CanvasRect3dPicker"),yn=Symbol.for("CanvasPyramid3dPicker"),_n=Symbol.for("CanvasPickerContribution");class bn extends i.BaseRender{contains(t,e,s){const{pickContext:r}=null!=s?s:{};if(!r)return!1;const a=t.getGraphicTheme();r.highPerformanceSave();const n=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=n;let d=e;if(r.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,r,o,l,s,null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u))),this.canvasRenderer.z=0,r.modelMatrix!==c&&i.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),u}}class Sn extends bn{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=i.RECT3D_NUMBER_TYPE,this.themeType="rect"}}let An=!1;function xn(){if(xn.__loaded)return;xn.__loaded=!0;const t=tn();var e,i;Ta("rect3d",Ba),gn({bind:t.bind}),e=t,An||(null===(i=e.isBound)||void 0===i?void 0:i.call(e,Xa))&&(An=!0,e.bind(vn).toDynamicValue((()=>new Sn(mn(e,Xa)))).inSingletonScope(),e.bind(_n).toService(vn))}xn.__loaded=!1;const Tn=xn;function Cn(){Cn.__loaded||(Cn.__loaded=!0,Ta("shadowRoot",Ga))}Cn.__loaded=!1;const kn=Cn;class Mn{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-Mn.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Mn.bounceIn(2*t):.5*Mn.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/r.pi2*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*r.pi2/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/r.pi2*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*r.pi2/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/r.pi2*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*r.pi2/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*r.pi2/e)*.5+1}}static registerFunc(t,e){Mn[t]=e}}function En(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const r=s*t/i;return r>0?r:1+r}Mn.quadIn=Mn.getPowIn(2),Mn.quadOut=Mn.getPowOut(2),Mn.quadInOut=Mn.getPowInOut(2),Mn.cubicIn=Mn.getPowIn(3),Mn.cubicOut=Mn.getPowOut(3),Mn.cubicInOut=Mn.getPowInOut(3),Mn.quartIn=Mn.getPowIn(4),Mn.quartOut=Mn.getPowOut(4),Mn.quartInOut=Mn.getPowInOut(4),Mn.quintIn=Mn.getPowIn(5),Mn.quintOut=Mn.getPowOut(5),Mn.quintInOut=Mn.getPowInOut(5),Mn.backIn=Mn.getBackIn(1.7),Mn.backOut=Mn.getBackOut(1.7),Mn.backInOut=Mn.getBackInOut(1.7),Mn.elasticIn=Mn.getElasticIn(1,.3),Mn.elasticOut=Mn.getElasticOut(1,.3),Mn.elasticInOut=Mn.getElasticInOut(1,.3*1.5),Mn.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Mn.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Mn.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Mn[`flicker${t}`]=e=>En(e,t);for(let t=2;t<10;t++)Mn[`aIn${t}`]=e=>t*e*e+(1-t)*e;function wn(t,e,i){return t+(e-t)*i}const On=new class{constructor(){this.opacity=(t,e,i,s,r,a)=>{a.attribute.opacity=wn(e,i,s)},this.baseOpacity=(t,e,i,s,r,a)=>{a.attribute.baseOpacity=wn(e,i,s)},this.fillOpacity=(t,e,i,s,r,a)=>{a.attribute.fillOpacity=wn(e,i,s)},this.strokeOpacity=(t,e,i,s,r,a)=>{a.attribute.strokeOpacity=wn(e,i,s)},this.zIndex=(t,e,i,s,r,a)=>{a.attribute.zIndex=wn(e,i,s)},this.backgroundOpacity=(t,e,i,s,r,a)=>{a.attribute.backgroundOpacity=wn(e,i,s)},this.shadowOffsetX=(t,e,i,s,r,a)=>{a.attribute.shadowOffsetX=wn(e,i,s)},this.shadowOffsetY=(t,e,i,s,r,a)=>{a.attribute.shadowOffsetY=wn(e,i,s)},this.shadowBlur=(t,e,i,s,r,a)=>{a.attribute.shadowBlur=wn(e,i,s)},this.fill=(t,e,i,s,r,a)=>{a.attribute.fill=br(e,i,s,!1)},this.fillPure=(t,e,i,s,r,a)=>{a.attribute.fill=r.fromParsedProps.fill?Ar(r.fromParsedProps.fill,r.toParsedProps.fill,s):r.toParsedProps.fill},this.stroke=(t,e,i,s,r,a)=>{a.attribute.stroke=br(e,i,s,!1)},this.strokePure=(t,e,i,s,r,a)=>{a.attribute.stroke=r.fromParsedProps.stroke?Ar(r.fromParsedProps.stroke,r.toParsedProps.stroke,s):r.toParsedProps.stroke},this.width=(t,e,i,s,r,a)=>{a.attribute.width=wn(e,i,s),a.addUpdateBoundTag()},this.height=(t,e,i,s,r,a)=>{a.attribute.height=wn(e,i,s),a.addUpdateBoundTag()},this.x=(t,e,i,s,r,a)=>{a.attribute.x=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.y=(t,e,i,s,r,a)=>{a.attribute.y=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.dx=(t,e,i,s,r,a)=>{a.attribute.dx=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.dy=(t,e,i,s,r,a)=>{a.attribute.dy=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.angle=(t,e,i,s,r,a)=>{a.attribute.angle=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.scaleX=(t,e,i,s,r,a)=>{a.attribute.scaleX=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.scaleY=(t,e,i,s,r,a)=>{a.attribute.scaleY=wn(e,i,s),a.addUpdateBoundTag(),a.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,r,a)=>{a.attribute.lineWidth=wn(e,i,s),a.addUpdateBoundTag()},this.startAngle=(t,e,i,s,r,a)=>{a.attribute.startAngle=wn(e,i,s),a.addUpdateBoundTag()},this.endAngle=(t,e,i,s,r,a)=>{a.attribute.endAngle=wn(e,i,s),a.addUpdateBoundTag()},this.radius=(t,e,i,s,r,a)=>{a.attribute.radius=wn(e,i,s),a.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,r,a)=>{a.attribute.outerRadius=wn(e,i,s),a.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,r,a)=>{a.attribute.innerRadius=wn(e,i,s),a.addUpdateBoundTag()},this.size=(t,e,i,s,r,a)=>{a.attribute.size=wn(e,i,s),a.addUpdateBoundTag()},this.points=(t,e,i,s,r,a)=>{a.attribute.points=Oi(e,i,s),a.addUpdateBoundTag()}}};function Pn(t,e,i,s,r,a){if(Number.isFinite(i)&&Number.isFinite(e))return a.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const r=[];let n=!0;for(let t=0;t<i.length;t++){const a=e[t],o=a+(i[t]-a)*s;if(!Number.isFinite(o)){n=!1;break}r.push(o)}return n&&(a.attribute[t]=r),!0}return!1}const Bn={type:St.ANIMATE_UPDATE},Dn={type:St.ANIMATE_BIND},In={type:St.ANIMATE_START};function Rn(t){const e=t;return e.attribute||(e.attribute={}),e.attribute===e.baseAttributes&&e.detachAttributeFromBaseAttributes(),e.attributeMayContainTransientAttrs=!0,e.attribute}function Ln(t){t.onAttributeUpdate(Bn)}function Fn(t,e){if(!e)return;const i=Rn(t);for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);Ln(t)}function Nn(t,e,i,s,r){const a=Rn(t);for(let t=0;t<e.length;t++){const n=e[t];a[n]=i[n]+(s[n]-i[n])*r}Ln(t)}function jn(t,e,i=St.ANIMATE_UPDATE){if(!e)return;const s=function(t){switch(t){case St.ANIMATE_UPDATE:return Bn;case St.ANIMATE_BIND:return Dn;case St.ANIMATE_START:return In;default:return{type:t}}}(i);t.applyAnimationTransientAttributes(e,!1,s)}function Un(t,e){jn(t,e,St.ANIMATE_BIND)}function Vn(){}function Gn(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}class Kn{constructor(t,e,i,s){var r;this._startTime=0,this._hasFirstRun=!1,this._syncAttributeUpdate=()=>{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:St.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(r=Mn[s])&&void 0!==r?r:Mn.linear:Mn.linear,"wait"===t&&(this.onUpdate=Vn),this.id=at.GenAutoIncrementId(),this.syncAttributeUpdate=Vn}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(r.isString(i)&&r.isString(s)){const r=yr.Get(i,vr.Color255),a=yr.Get(s,vr.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=r,this.toParsedProps[e]=a,t.push(On["fill"===e?"fillPure":"strokePure"])}else On[e]?t.push(On[e]):t.push(Pn)}else On[e]?t.push(On[e]):t.push(Pn)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,r=this.propKeys;if(s&&r)for(let a=0;a<s.length;a++){const n=r[a],o=t[n],l=e[n];s[a](n,o,l,i,this,this.target)}}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let r=null;for(let t=0;t<i.length;t++){const e=i[t];null!=s[e]&&(null!=r?r:r=[]).push(e)}r&&e.preventAttrs(r)}))}removeKeysFromRecord(t,e){if(!t)return t;let i=!1;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Gn(e,s)){i=!0;break}if(!i)return t;const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!Gn(e,i)&&(s[i]=t[i]);return s}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;if((null==t?void 0:t.length)&&(this.props=this.removeKeysFromRecord(this.props,t),this.fromProps=this.removeKeysFromRecord(this.fromProps,t),this.fromParsedProps=this.removeKeysFromRecord(this.fromParsedProps,t),this.toParsedProps=this.removeKeysFromRecord(this.toParsedProps,t),null===(e=this.propKeys)||void 0===e?void 0:e.length)){const e=this.interpolateUpdateFunctions;let i=0;for(let s=0;s<this.propKeys.length;s++){const r=this.propKeys[s];Gn(t,r)||(i!==s&&(this.propKeys[i]=r,e&&(e[i]=e[s])),i++)}this.propKeys.length=i,e&&(e.length=i)}}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class zn extends Kn{constructor(t,e,i,s,r){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=r,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}function Hn(t){if(!t||!r.isFunction(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function Wn(t,e,i,s){const r=function(t,e,i,s){var r;const a=t,n=null===(r=a.context)||void 0===r?void 0:r.finalAttrs,o=a.getFinalAttribute();let l=null;for(let t=0;t<e.length;t++){const r=e[t];i&&!i.validAttr(r)||(n&&Object.prototype.hasOwnProperty.call(n,r)?(null!=l||(l={}),l[r]=n[r]):o&&Object.prototype.hasOwnProperty.call(o,r)?(null!=l||(l={}),l[r]=o[r]):s&&Object.prototype.hasOwnProperty.call(s,r)&&(null!=l||(l={}),l[r]=s[r]))}return l}(t,e,i,s);if(!r)return!1;t.setFinalAttributes(r);const a=t._commitAnimationStaticAttributes;return"function"==typeof a?a.call(t,r,{type:St.ANIMATE_END}):t.setAttributes(r,!1,{type:St.ANIMATE_END}),!0}class $n{static registerBuiltInAnimate(t,e){$n.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._activeConfigList=null,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e<this._animates.length;e++){const i=this._animates[e];if(i.status===ye.END)continue;const s=i.getEndProps();if(s)for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&t.indexOf(e)<0&&t.push(e)}return t}hasActiveAttrs(){for(let t=0;t<this._animates.length;t++){const e=this._animates[t];if(e.status===ye.END)continue;const i=e.getEndProps();if(i)for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t))return!0}return!1}preventAttrs(t){if(!(null==t?void 0:t.length))return this.hasActiveAttrs();for(let e=0;e<this._animates.length;e++){const i=this._animates[e];i.status!==ye.END&&i.preventAttrs(t)}return this.hasActiveAttrs()}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,a;const n=this.resolveValue(t.totalTime,i,void 0),o=this.resolveValue(t.startTime,i,0),l=Object.assign({},t);l.oneByOneDelay=0,l.startTime=o,l.totalTime=n;const h=this.resolveValue(t.oneByOne,i,!1);if(e){const t=l.timeSlices;r.isArray(t)||(l.timeSlices=[t]);let e=0;l.timeSlices=l.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),r=this.resolveValue(t.delayAfter,i,0),a=this.resolveValue(t.duration,i,300);return e+=s+a+r,Object.assign(Object.assign({},t),{delay:s,delayAfter:r,duration:a})}));let s=0;h&&(s="number"==typeof h?h:h?e:0),l.oneByOneDelay=s;let a=1;if(n){const t=e+s*(this._target.count-2);a=n?n/t:1}l.timeSlices=l.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*a,delayAfter:t.delayAfter*a,duration:t.duration*a,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:$n.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],r=Hn(s);return Object.assign(Object.assign({},t),{custom:s,customType:r})}))})})),l.oneByOneDelay=s*a,l.startTime=o*a}else{const e=this.resolveValue(t.delay,i,0),c=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;h&&(u="number"==typeof h?h:h?e+c+d:0),l.oneByOneDelay=u,l.custom=null!==(s=t.custom)&&void 0!==s?s:$n.builtInAnimateMap[null!==(a=t.type)&&void 0!==a?a:"fromTo"];const p=Hn(l.custom);l.customType=p;const g=e+c+d+u*(this._target.count-2),m=r.isValidNumber(n)?n/g:1;l.delay=e*m,l.delayAfter=c*m,l.duration=d*m,l.oneByOneDelay=u*m,l.startTime=o}return l}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,r,a,n;return t.sort(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],null===(n=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===n?void 0:n[0],e,i,{})})));const s=e?(i,s,r)=>{const a=this.parseParams(t,e,i),n=this.executeTimelineItem(a,i,s,r);n&&this._trackAnimation(n)}:(i,s,r)=>{const a=this.parseParams(t,e,i),n=this.executeTypeConfigItem(a,i,s,r);n&&this._trackAnimation(n)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var a,n,o,l,h,c,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:m,easing:f="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:S=0,loop:A,bounce:x,priority:T=0,options:C,custom:k,customType:M,controlOptions:E}=t,w=e.animate();w.priority=T;const O=r.isFunction(v)?v(null===(n=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===n?void 0:n[0],e,{}):v,P=null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],B=null===(h=e.context)||void 0===h?void 0:h.indexKey;P&&B&&(i=null!==(c=P[B])&&void 0!==c?c:i),w.startAt(b);const D=i*S+O;D>0&&w.wait(D);let I=null,R=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);R||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),R=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(w,k,M,L,R,_,f,m,E,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(w,e,p,R);let N=0;S&&(N=S*(s-i-1));const j=r.isFunction(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return j>0&&(N+=j),N>0&&w.wait(N),A&&A>0&&w.loop(A),x&&w.bounce(!0),w}_handleRunAnimate(t,e,i,s,a,n,o,l,h,c,d,u){var p,g,m,f,v,y,_,b;if(e&&i){i=Hn(e);let d=this.resolveValue(l,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(m=u.stage)||void 0===m?void 0:m.width)||0,height:(null===(f=u.stage)||void 0===f?void 0:f.height)||0,group:this._target.parent},d);const S=r.isFunction(c)?c.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):c;d.options=S,d.controlOptions=h,1===i?this.createCustomAnimation(t,e,s,a,n,o,d):2===i&&this.createCustomInterpolatorAnimation(t,e,a,n,o,d)}else"to"===d?t.to(a,n,o):"from"===d&&t.from(a,n,o)}executeTimelineItem(t,e,i,s){var r,a,n,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,m=null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],f=null===(n=e.context)||void 0===n?void 0:n.indexKey;m&&f&&(i=null!==(o=m[f])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var a,n,o,l;const{effects:h,duration:c=300,delay:d=0,delayAfter:u=0}=t,p=r.isFunction(d)?d(null===(n=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===n?void 0:n[0],i,{}):d,g=r.isFunction(u)?u(null===(l=null===(o=i.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(h)?h:[h]).forEach((t=>{var r;const{type:a="fromTo",channel:n,customParameters:o,easing:l="linear",options:h}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(a);u||(d||(d=this.createPropsFromChannel(n,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(n,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const m=null!==(r=t.custom)&&void 0!==r?r:$n.builtInAnimateMap[a],f=t.custom?t.customType:Hn(m);this._handleRunAnimate(e,m,f,p,u,c,l,o,s,h,a,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,r,a){const n=i;Object.keys(n).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,r,n,o)=>{e(r,i,s,n,o,t.target,a)},t.to(i,s,r)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const r=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==r?void 0:r.length)&&t.onEnd((()=>{Wn(e,r,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let r=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=r||(r=[]),r.push(t));return r}createCustomAnimation(t,e,i,s,r,a,n){const o=new e(i,s,r,a,n);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var r;const a={};let n=null;if(!t)return{from:n,props:a,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(r=e.context)||void 0===r?void 0:r.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,r,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?a[i]=h.to(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):a[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(a.hasOwnProperty(t)||(null==n?void 0:n.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:n,props:a,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,r;return void 0===t?i:"function"==typeof t&&e?t(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let r=null;for(let e=0;e<i.length;e++)r=this.collectAnimatedDiffKeys(i[e],t,s,r);return r}collectAnimatedDiffKeys(t,e,i,s){if("timeSlices"in t){const r=Array.isArray(t.timeSlices)?t.timeSlices:[t.timeSlices];for(let t=0;t<r.length;t++){const a=Array.isArray(r[t].effects)?r[t].effects:[r[t].effects];for(let t=0;t<a.length;t++)s=this.collectAnimatedDiffKeysFromEffect(a[t],e,i,s)}return s}return this.collectAnimatedDiffKeysFromEffect(t,e,i,s)}collectAnimatedDiffKeysFromEffect(t,e,i,s){var r;if("update"===(null!==(r=t.type)&&void 0!==r?r:"fromTo")){const r=this.resolveValue(t.options,e,void 0),a=null==r?void 0:r.excludeChannels;for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&void 0!==i[t]&&!this.includesChannel(a,t)&&(null!=s||(s={}),s[t]=!0);return s}return s=this.collectExplicitAnimatedKeys(t.to,i,s),s=this.collectExplicitAnimatedKeys(t.from,i,s),this.collectChannelAnimatedKeys(t.channel,i,s)}collectExplicitAnimatedKeys(t,e,i){if(!t)return i;for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]&&(null!=i||(i={}),i[s]=!0);return i}collectChannelAnimatedKeys(t,e,i){if(!t)return i;if(Array.isArray(t)){for(let s=0;s<t.length;s++){const r=t[s];Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[r]&&(null!=i||(i={}),i[r]=!0)}return i}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Object.prototype.hasOwnProperty.call(e,s)&&void 0!==e[s]){const e=t[s];void 0===e.to&&void 0===e.from||(null!=i||(i={}),i[s]=!0)}return i}includesChannel(t,e){if(!(null==t?void 0:t.length))return!1;for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}syncFinalAttrsFromContext(t){var e;const i=null===(e=t.context)||void 0===e?void 0:e.finalAttrs;i&&t.setFinalAttributes(i)}executeItem(t,e,i=0,s=1){if(Array.isArray(t)){const r=this._activeConfigList;this._activeConfigList=t;try{return t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=r}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const r="timeSlices"in t;let a=null;const n=this.parseParams(t,r);return a=r?this.executeTimelineItem(n,e,i,s):this.executeTypeConfigItem(n,e,i,s),a&&this._trackAnimation(a),a}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ye.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}$n.builtInAnimateMap={};const Yn=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=r.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const a=r.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:a,endAngle:a},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Xn extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Fn(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Fn(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qn extends Xn{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=Yn(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=a,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Un(this.target,a),this.determineUpdateFunction()}}class Zn extends Xn{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(a=null==s?void 0:s.overall)&&void 0!==a&&a)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=r.isNumber(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const a=r.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:a,endAngle:a}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,a;const n=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=n?n:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Qn extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:a}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:r.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:r.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,a=s.y,n=s.y1,o=s.height,l={};return r.isValid(i)?(l.x=t+i/2,l.width=0,l.x1=void 0):(l.x=(t+e)/2,l.x1=(t+e)/2,l.width=void 0),r.isValid(o)?(l.y=a+o/2,l.height=0,l.y1=void 0):(l.y=(a+n)/2,l.y1=(a+n)/2,l.height=void 0),{from:l,to:{x:t,y:a,x1:e,y1:n,width:i,height:o}}}}})(this.target,this.params.options,this.params),n=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=a,this.propKeys=Object.keys(a).filter((t=>null!=a[t])),this.from=n,this.to=a,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Un(this.target,n)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Fn(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Jn extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:r.isValid(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:r.isValid(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,a=s.y1,n=s.width,o=s.height,l={};return r.isValid(n)?(l.x=t+n/2,l.width=0,l.x1=void 0):(l.x=(t+i)/2,l.x1=(t+i)/2,l.width=void 0),r.isValid(o)?(l.y=e+o/2,l.height=0,l.y1=void 0):(l.y=(e+a)/2,l.y1=(e+a)/2,l.height=void 0),{to:l}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Fn(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const to=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,a,n;const o=t.getFinalAttribute(),l=o.y,h=o.y1,c=o.height;let d;return e&&"negative"===e.orient?r.isNumber(e.overall)?d=e.overall:i.group?(d=null!==(n=null!==(s=i.groupHeight)&&void 0!==s?s:null===(a=e.layoutRect)||void 0===a?void 0:a.height)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=d):d=i.height:d=r.isNumber(null==e?void 0:e.overall)?e.overall:0,{from:{y:d,y1:r.isNil(h)?void 0:d,height:r.isNil(c)?void 0:0},to:{y:l,y1:h,height:c}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),a=s.y,n=s.y1,o=s.height;if(e&&"negative"===e.orient){const t=r.isValid(o)?Math.max(a,a+o):Math.max(a,n);return{from:{y:t,y1:r.isNil(n)?void 0:t,height:r.isNil(o)?void 0:0},to:{y:a,y1:n,height:o}}}const l=r.isValid(o)?Math.min(a,a+o):Math.min(a,n);return{from:{y:l,y1:r.isNil(n)?void 0:l,height:r.isNil(o)?void 0:0},to:{y:a,y1:n,height:o}}}(t,e)};class eo extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=to(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=a,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Un(this.target,a)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Nn(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class io extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,a=this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?function(t,e,i){var s,a,n;const o=t.getFinalAttribute(),l=o.y1,h=o.height;let c;return e&&"negative"===e.orient?r.isNumber(e.overall)?c=e.overall:i.group?(c=null!==(n=null!==(s=i.groupHeight)&&void 0!==s?s:null===(a=e.layoutRect)||void 0===a?void 0:a.height)&&void 0!==n?n:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=r.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{y:c,y1:r.isNil(l)?void 0:c,height:r.isNil(h)?void 0:0}}}(i,s,a):function(t,e,i){const s=t.getFinalAttribute(),a=s.y,n=s.y1,o=s.height;if(e&&"negative"===e.orient){const t=r.isValid(o)?Math.max(a,a+o):Math.max(a,n);return{to:{y:t,y1:r.isNil(n)?void 0:t,height:r.isNil(o)?void 0:0}}}const l=r.isValid(o)?Math.min(a,a+o):Math.min(a,n);return{to:{y:l,y1:r.isNil(n)?void 0:l,height:r.isNil(o)?void 0:0}}}(i,s));var i,s,a,n;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Nn(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const so=(t,e,i)=>{const s=t.getFinalAttribute().points,a={x:0,y:0};return s.forEach((t=>{a.x+=t.x,a.y+=t.y})),a.x/=s.length,a.y/=s.length,e&&e.center&&(r.isValidNumber(e.center.x)&&(a.x=e.center.x),r.isValidNumber(e.center.y)&&(a.y=e.center.y)),"area"===t.type&&(a.x1=a.x,a.y1=a.y),s.map((t=>Object.assign({},t,a)))};class ro extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,s){var r,a;const n=null===(r=this.from)||void 0===r?void 0:r.points,o=null===(a=this.to)||void 0===a?void 0:a.points;n&&o&&(Fn(this.target,{points:n.map(((t,s)=>i.pointInterpolation(n[s],o[s],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class ao extends ro{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:r}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:so(t,e)}});this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=s||i,this.to=r}else this.valid=!1;var t,e}}const no=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),a=r.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:a,outerRadius:a},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class oo extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Fn(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lo extends oo{onBind(){var t,e,i;super.onBind();const{from:s,to:r}=no(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=a,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Un(this.target,a)}}class ho extends oo{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),a=r.isNumber(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:a,outerRadius:a}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const co=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const a=t.getFinalAttribute(),n=a.x,o=a.x1,l=a.width;let h;return e&&"negative"===e.orient?r.isNumber(e.overall)?h=e.overall:i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=h):h=i.width:h=r.isNumber(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:h,x1:r.isNil(o)?void 0:h,width:r.isNil(l)?void 0:0},to:{x:n,x1:o,width:l}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),a=s.x,n=s.x1,o=s.width;if(e&&"negative"===e.orient){const t=r.isValid(o)?Math.max(a,a+o):Math.max(a,n);return{from:{x:t,x1:r.isNil(n)?void 0:t,width:r.isNil(o)?void 0:0},to:{x:a,x1:n,width:o}}}const l=r.isValid(o)?Math.min(a,a+o):Math.min(a,n);return{from:{x:l,x1:r.isNil(n)?void 0:l,width:r.isNil(o)?void 0:0},to:{x:a,x1:n,width:o}}}(t,e)};class uo extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t,e,i;super.onBind();const{from:s,to:r}=co(this.target,this.params.options,this.params),a=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=r,this.propKeys=Object.keys(r).filter((t=>null!=r[t])),this.from=a,this.to=r,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&Un(this.target,a)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Nn(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class po extends zn{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,a=this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?function(t,e,i){var s;const a=t.getFinalAttribute(),n=a.x1,o=a.width;let l;return e&&"negative"===e.orient?r.isNumber(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=r.isNumber(null==e?void 0:e.overall)?e.overall:0,{to:{x:l,x1:r.isNil(n)?void 0:l,width:r.isNil(o)?void 0:0}}}(i,s,a):function(t,e,i){const s=t.getFinalAttribute(),a=s.x,n=s.x1,o=s.width;if(e&&"negative"===e.orient){const t=r.isValid(o)?Math.max(a,a+o):Math.max(a,n);return{to:{x:t,x1:r.isNil(n)?void 0:t,width:r.isNil(o)?void 0:0}}}const l=r.isValid(o)?Math.min(a,a+o):Math.min(a,n);return{to:{x:l,x1:r.isNil(n)?void 0:l,width:r.isNil(o)?void 0:0}}}(i,s));var i,s,a,n;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){Nn(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}var go,mo;!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(go||(go={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(mo||(mo={}));const fo=(t,e)=>(r.isFunction(yo.warnHandler)&&yo.warnHandler.call(null,t,e),e?r.Logger.getInstance().warn(`[VChart warn]: ${t}`,e):r.Logger.getInstance().warn(`[VChart warn]: ${t}`)),vo=(t,e,i)=>{if(!yo.silent){if(!r.isFunction(yo.errorHandler))throw new Error(t);yo.errorHandler.call(null,t,e)}},yo={silent:!1,warnHandler:!1,errorHandler:!1},_o=i.isBrowserEnv();function bo(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}function So(t){return null!=t&&""!==t&&(!!r.isNumber(t)||+t==+t)}function Ao(t){return!(!t||0===t.length)&&!r.isNil(t[0])&&!r.isNil(t[0].dataId)&&r.isArray(t[0].fields)}function xo(t){return function(e){let i;return i=r.isArray(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var To;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(To||(To={}));const Co={};function ko(t){switch(t){case To.Linear:case To.Log:case To.Pow:case To.Sqrt:case To.Symlog:case To.Time:return!0;default:return!1}}function Mo(t){return!!Co[t]}function Eo(t){switch(t){case To.Ordinal:case To.Point:case To.Band:return!0;default:return!1}}function wo(t){return t}function Oo(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 Po(t,e,i){const s=t[0],r=t[1],a=e[0],n=e[1];let o,l;return r<s?(o=Oo(r,s),l=i(n,a)):(o=Oo(s,r),l=i(a,n)),t=>l(o(t))}function Bo(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Do(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Io(t,e,i){const s=Math.min(t.length,e.length)-1,a=new Array(s),n=new Array(s);let o=-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<s;)a[o]=Oo(t[o],t[o+1]),n[o]=i(e[o],e[o+1]);return function(e){const i=r.bisect(t,e,1,s)-1;return n[i](a[i](e))}}Object.values(To).forEach((t=>{Co[t]=!0}));const Ro=(t,e=!1)=>{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let r;return r=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,r*Math.pow(10,i)};class Lo{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Do(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return r.isNil(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!r.isNil(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return r.isNil(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!r.isNil(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,a=this.range(),n=a[0],o=a[a.length-1],l=Math.min(n,o),h=Math.max(n,o),c=r.clamp(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,l,h),d=r.isNil(s)?(h-l)*i:s;let u=Math.exp(e);u=u/(u-1)*d;const p=e/d;this._fishEyeTransform=t=>{const e=Math.abs(t-c);if(e>=d)return t;if(e<=1e-6)return c;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return c+(t-c)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Fo=Symbol("implicit");class No extends Lo{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=To.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Fo}clone(){const t=(new No).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Fo)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const r=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}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}index(t){var e;return this._index&&null!==(e=this._index.get(`${t}`))&&void 0!==e?e:-1}}function jo(t,e,i,s){const r=[];let a=t;for(;a<=e;)r.push(a),a+=i;return s&&r.reverse(),r}function Uo(t,e,i,s){let a,n;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(a=e<t){const i=t;t=e,e=i}let o=r.clamper(1,e-t+1)(i);if(n=Math.floor((e-t+1)/o),!s)for(;Math.ceil((e-t+1)/n)>i&&o>1;)o-=1,n=Math.floor((e-t)/o);return jo(t,e,n,a)}class Vo extends No{constructor(t){super(),this.type=To.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,a=i[1]<i[0];let n=i[Number(a)-0];const o=i[1-Number(a)],l=Bo(s,this._paddingInner,this._paddingOuter);return this._step=(o-n)/Math.max(1,l||1),this._round&&(this._step=Math.floor(this._step)),n+=(o-n-this._step*(s-this._paddingInner))*this._align,this.isBandwidthFixed()||(this._bandwidth=this._step*(1-this._paddingInner)),this._round&&(n=Math.round(n),this.isBandwidthFixed()||(this._bandwidth=Math.round(this._bandwidth))),this._bandRangeState={reverse:a,start:a?r.clamp(n+this._step*(s-1),i[1],i[0]):r.clamp(n,i[0],i[1]),min:a?i[1]:i[0],max:o,count:s},this.generateFishEyeTransform(),this}scale(t){if(!this._bandRangeState)return;const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Fo)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const{count:a,start:n,reverse:o,min:l,max:h}=this._bandRangeState,c=n+(s-1)%a*(o?-1:1)*this._step;return r.clamp(this._fishEyeTransform?this._fishEyeTransform(c):c,l,h)}_calculateWholeRange(t,e){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let e;if(r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&2===t.length){const i=Do(t,[this._rangeFactorStart,this._rangeFactorEnd]);e=Math.abs(i[1]-i[0])}else e=Math.abs(t[1]-t[0]);const i=function(t,e,i,s,r){const a=Bo(t,i,s);let n=e/Math.max(1,a||1);r&&(n=Math.floor(n));let o=n*(1-i);return r&&(o=Math.round(o)),o}(super.domain().length,e,this._paddingInner,this._paddingOuter,this._round);i<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):i>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const o=(i=super.domain().length,s=this._bandwidth,a=this._paddingInner,n=this._paddingOuter,1===a&&(a=0),Bo(i,a,n)*(s/(1-a))*Math.sign(t[1]-t[0])),l=Math.min((t[1]-t[0])/o,1);if(r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)){const i=this._rangeFactorStart+l<=1,s=this._rangeFactorEnd-l>=0;if("rangeFactorStart"===e&&i?this._rangeFactorEnd=this._rangeFactorStart+l:"rangeFactorEnd"===e&&s?this._rangeFactorStart=this._rangeFactorEnd-l:t[0]<=t[1]?i?this._rangeFactorEnd=this._rangeFactorStart+l:s?this._rangeFactorStart=this._rangeFactorEnd-l:(this._rangeFactorStart=0,this._rangeFactorEnd=l):s?this._rangeFactorStart=this._rangeFactorEnd-l:i?this._rangeFactorEnd=this._rangeFactorStart+l:(this._rangeFactorStart=1-l,this._rangeFactorEnd=1),o>0){const e=t[0]-o*this._rangeFactorStart,i=e+o;this._wholeRange=[e,i]}else{const e=t[1]+o*(1-this._rangeFactorEnd),i=e-o;this._wholeRange=[i,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=l,this._wholeRange=[t[0],t[0]+o];return this._wholeRange}var i,s,a,n;return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[r.toNumber(t[0]),r.toNumber(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[r.toNumber(t[0]),r.toNumber(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:Uo(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Uo(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){let s;if(e=Math.floor(+e),t=Math.floor(+t),i=r.clamper(1,e-t+1)(Math.floor(+i)),s=e<t){const i=t;t=e,e=i}return jo(t,e,i,s)}(0,e.length-1,t).map((t=>e[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,a=this._domain.length,n=this.range(),o=n[0]>n[n.length-1];for(e=0;e<a;e++){const n=this.scale(this._domain[e])+s;if(0===e&&(!o&&!r.isGreater(t,n+i)||o&&!r.isLess(t,n-i)))break;if(e===a-1)break;if(!r.isLess(t,n-i)&&!r.isGreater(t,n+i))break}return e>=0&&e<=a-1?e:a-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return r.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return r.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&r.isNumber(this._userBandwidth)}clone(){var t,e,i;return new Vo(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Go}=r.ColorUtil;function Ko(t,e){const i=typeof e;let s;if(r.isNil(e)||"boolean"===i)return()=>e;if("number"===i)return r.interpolateNumber(t,e);if("string"===i){if(s=r.ColorUtil.Color.parseColorString(e)){const e=Go(r.ColorUtil.Color.parseColorString(t),s);return t=>e(t).formatRgb()}return r.interpolateNumber(Number(t),Number(e))}return e instanceof r.ColorUtil.RGB?Go(t,e):e instanceof r.ColorUtil.Color?Go(t.color,e.color):e instanceof Date?r.interpolateDate(t,e):r.interpolateNumber(Number(t),Number(e))}class zo extends Lo{constructor(t=wo,e=wo){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=wo,this._piecewise=Po,this._interpolate=Ko}calculateVisibleDomain(t){var e;return r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),r.interpolateNumber)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,r.toNumber);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=r.interpolateNumberRound,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,a=this._range.length;let n=Math.min(s,a);if(s&&s<a&&this._forceAlign){const t=a-s+1,e=i[s-1],r=s>=2?(e-i[s-2])/t:0;for(let a=1;a<=t;a++)i[s-2+a]=e-r*(t-a);n=a}return this._autoClamp&&(this._clamp=r.clamper(i[0],i[n-1])),this._piecewise=n>2?Io:Po,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:wo),this.rescale(i)):this._clamp!==wo}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return r.isNil(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return r.isNil(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Ho=Math.sqrt(50),Wo=Math.sqrt(10),$o=Math.sqrt(2),Yo=[1,2,5,10],Xo=(t,e,i)=>{let s=1,a=t;const n=Math.floor((e-1)/2),o=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?a=0:t<0&&t>=-Number.MIN_VALUE?a=-(e-1):!i&&o<1?s=Jo(o).step:(i||o>1)&&(a=Math.floor(t)-n*s),s>0?(t>0?a=Math.max(a,0):t<0&&(a=Math.min(a,-(e-1)*s)),r.range(0,e).map((t=>a+t*s))):t>0?Zo(0,-(e-1)/s,s):Zo((e-1)/s,0,s)},qo=r.memoize(((t,e,i,s)=>{let r,a,n,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((r=e<t)&&(a=t,t=e,e=a),o=tl(t,e,i).step,!isFinite(o))return[];if(o>0){let i=Math.round(t/o),s=Math.round(e/o);for(i*o<t&&++i,s*o>e&&--s,n=new Array(a=s-i+1);++l<a;)n[l]=(i+l)*o}else if(o<0&&(null==s?void 0:s.noDecimals)){o=1;const i=Math.ceil(t),s=Math.floor(e);if(!(i<=s))return[];for(n=new Array(a=s-i+1);++l<a;)n[l]=i+l}else{o=-o;let i=Math.round(t*o),s=Math.round(e*o);for(i/o<t&&++i,s/o>e&&--s,n=new Array(a=s-i+1);++l<a;)n[l]=(i+l)/o}return r&&n.reverse(),n})),Zo=(t,e,i)=>{let s,r,a=-1;if(i>0){let n=Math.floor(t/i),o=Math.ceil(e/i);for((n+1)*i<t&&++n,(o-1)*i>e&&--o,r=new Array(s=o-n+1);++a<s;)r[a]=(n+a)*i}else{i=-i;let n=Math.floor(t*i),o=Math.ceil(e*i);for((n+1)/i<t&&++n,(o-1)/i>e&&--o,r=new Array(s=o-n+1);++a<s;)r[a]=(n+a)/i}return r},Qo=r.memoize(((t,e,i,s)=>{let r,a,n;if(i=+i,(t=+t)==(e=+e))return Xo(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return Xo(t,i,null==s?void 0:s.noDecimals);(r=e<t)&&(n=t,t=e,e=n);const o=tl(t,e,i);let l=o.step;if(!isFinite(l))return[];if(l>0){let s=1;const{power:r,gap:n}=o,h=10===n?2*10**r:1*10**r;for(;s<=5&&(a=Zo(t,e,l),a.length>i+1)&&i>2;)l+=h,s+=1;i>2&&a.length<i-1&&(a=((t,e,i)=>{let s;const r=t[0],a=t[t.length-1],n=e-t.length;if(a<=0){const e=[];for(s=n;s>=1;s--)e.push(r-s*i);return e.concat(t)}if(r>=0){for(s=1;s<=n;s++)t.push(a+s*i);return t}let o=[];const l=[];for(s=1;s<=n;s++)s%2==0?o=[r-Math.floor(s/2)*i].concat(o):l.push(a+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(a,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),a=Zo(t,e,l);return r&&a.reverse(),a})),Jo=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=Yo[0];return i>=Ho?s=Yo[3]:i>=Wo?s=Yo[2]:i>=$o&&(s=Yo[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function tl(t,e,i){const s=(e-t)/Math.max(0,i);return Jo(s)}function el(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const r=new Array(i);for(let e=0;e<i;e++)r[e]=t+e*s;return r}function il(t,e,i){let s,r,a=-1;if(i=+i,(r=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const n=Math.floor((e-t)/i+1),o=new Array(n);for(;++a<n;)o[a]=t+a*i;return r&&o.reverse(),o}function sl(t,e=10){let i,s,r=0,a=t.length-1,n=t[r],o=t[a],l=10;for(o<n&&(s=n,n=o,o=s,s=r,r=a,a=s);l-- >0;){if(s=tl(n,o,e).step,s===i)return t[r]=n,t[a]=o,t;if(s>0)n=Math.floor(n/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;n=Math.ceil(n*s)/s,o=Math.floor(o*s)/s}i=s}}const rl=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i);r.memoize(((t,e,i,s,r,a,n)=>{let o=t,l=e;const h=l<o;h&&([o,l]=[l,o]);let c,d,u=r(o),p=r(l),g=[];if(!(s%1)&&p-u<i){if(u=Math.floor(u),p=Math.ceil(p),o>0){for(;u<=p;++u)for(c=1;c<s;++c)if(d=u<0?c/a(-u):c*a(u),!(d<o)){if(d>l)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/a(-u):c*a(u),!(d<o)){if(d>l)break;g.push(d)}2*g.length<i&&(g=Qo(o,l,i))}else g=Qo(u,p,Math.min(p-u,i)).map(a);return g=g.filter((t=>0!==t)),(null==n?void 0:n.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),r.memoize(((t,e,i,s,r,a)=>{const n=[],o={},l=r(t),h=r(e);let c=[];if(Number.isInteger(s))c=Qo(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e<i;e++)c.push(l+e*t)}return c.forEach((i=>{const r=a(i),l=Number.isInteger(s)?rl(t,e,r):rl(t,e,Ro(r)),h=rl(t,e,((t,e)=>{let i,s;return e[0]<e[1]?(i=e[0],s=e[1]):(i=e[1],s=e[0]),Math.min(Math.max(t,i),s)})(l,[t,e]));!o[h]&&!isNaN(h)&&c.length>1&&(o[h]=1,n.push(h))})),n})),r.memoize(((t,e,i,s,r)=>el(s(t),s(e),i).map((t=>Ro(r(t)))))),r.memoize(((t,e,i,s,r)=>il(s(t),s(e),i).map((t=>Ro(r(t))))));class al extends zo{constructor(){super(...arguments),this.type=To.Linear}clone(){var t;const e=new al;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return qo(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(r.isFunction(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(r.isValid(this._rangeFactorStart)&&r.isValid(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,a=this._domain,n=s[0],o=s[s.length-1];let l=Qo(a[0],a[a.length-1],t,e);if(!l.length)return l;if(this._domainValidator)l=l.filter(this._domainValidator);else if((l[0]!==n||l[l.length-1]!==o)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=l[0],t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&l[0]!==n?(t[0]=l[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&l[l.length-1]!==o&&(t[t.length-1]=l[l.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);l=l.filter((t=>t>=e&&t<=i))}}return l}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return el(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return il(e[0],e[e.length-1],t)}nice(t=10,e){var i,s;const a=this._domain;let n=[];if(e){const t=function(t,e){const i=r.isNumber(e.forceMin),s=r.isNumber(e.forceMax);let a=null;const n=[];let o=null;const l=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?n[0]=e.forceMin:r.isNumber(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(n[0]=e.min),s?n[1]=e.forceMax:r.isNumber(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(n[1]=e.max),r.isNumber(n[0])&&r.isNumber(n[1])?(o=t.slice(),o[0]=n[0],o[o.length-1]=n[1]):a=r.isNumber(n[0])||r.isNumber(n[1])?r.isNumber(n[0])?"max":"min":"all",{niceType:a,niceDomain:o,niceMinMax:n,domainValidator:l}}(a,e);if(n=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=sl(a.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=n[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=n[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(t=10){this._niceType="min";const e=this._domain[this._domain.length-1],i=sl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";const e=this._domain[0],i=sl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class nl{constructor(){this.type=To.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!r.isNil(t)&&r.isValidNumber(+t)?this._range[r.bisect(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new nl).domain(this._domain).range(this._range).unknown(this._unknown)}}var ol,ll;function hl(t){var e,i;const{type:s}=t;return s===ol.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(ol||(ol={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(ll||(ll={}));const cl={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},dl={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function ul(t,e){var i;if(!t)return[];const s=vl(t,e);if(!s||r.isArray(s))return null!==(i=s)&&void 0!==i?i:[];if(r.isObject(s)){const{dataScheme:i}=s;return i?fl(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>ml(i)?gl(t,i,e):i)).filter(r.isValid)}))):i.map((i=>ml(i)?gl(t,i,e):i)).filter(r.isValid):[]}return[]}function pl(t,e){var i,s;return fl(t)?null!==(s=null===(i=t.find((t=>r.isValid(t.isAvailable)?r.isFunction(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!r.isValid(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function gl(t,e,i){var s;const a=vl(t,i);if(!a)return;let n;const{palette:o}=a;if(r.isObject(o)&&(n=null!==(s=function(t,e){const i=cl[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=dl[e];return s?t[s]:void 0}(o,e.key))&&void 0!==s?s:e.default),!n)return;if(r.isNil(e.a)&&r.isNil(e.l)||!r.isString(n))return n;let l=new r.Color(n);if(r.isValid(e.l)){const{r:t,g:i,b:s}=l.color,{h:a,s:n}=r.rgbToHsl(t,i,s),o=r.hslToRgb(a,n,e.l),h=new r.Color(`rgb(${o.r}, ${o.g}, ${o.b})`);h.setOpacity(l.color.opacity),l=h}return r.isValid(e.a)&&l.setOpacity(e.a),l.toRGBA()}function ml(t){return t&&"palette"===t.type&&!!t.key}function fl(t){return!(!r.isArray(t)||0===t.length)&&t.every((t=>r.isValid(t.scheme)))}function vl(t,e){var i,s;const{type:a}=null!=e?e:{};let n;if(!e||r.isNil(a))n=null==t?void 0:t.default;else{const r=hl(e);n=null!==(s=null!==(i=null==t?void 0:t[`${a}_${r}`])&&void 0!==i?i:null==t?void 0:t[a])&&void 0!==s?s:null==t?void 0:t.default}return n}class yl extends No{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!fl(this._range))return void super.range(this._range);const t=pl(this._range,this._domain);super.range(t)}}const _l={linear:al,band:Vo,point:class extends Vo{constructor(t){super(!1),this.type=To.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:No,threshold:nl,colorOrdinal:yl};function bl(t){const e=_l[t];return e?new e:null}function Sl(t){return r.isValid(null==t?void 0:t.field)&&r.isValid(null==t?void 0:t.scale)}function Al(t){return!!r.isString(t)&&!!t.endsWith("%")&&So(t.substring(0,t.length-1))}function xl(t,e,i,s=0){var a,n;return r.isNumber(t)?t:Al(t)?Number(t.substring(0,t.length-1))*e/100:r.isFunction(t)?t(i):r.isObject(t)?e*(null!==(a=t.percent)&&void 0!==a?a:0)+(null!==(n=t.offset)&&void 0!==n?n:0):s}function Tl(t){let e={};return r.isArray(t)?(r.isNil(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),r.isNil(t[1])||(e.left=e.right=t[1]),r.isNil(t[2])||(e.bottom=t[2]),r.isNil(t[3])||(e.left=t[3]),e):r.isNumber(t)||Al(t)||r.isFunction(t)||(i=t,r.isObject(i)&&("percent"in i||"offset"in i))?(e.top=e.left=e.bottom=e.right=t,e):r.isObject(t)?(e=Object.assign({},t),e):e;var i}const Cl=(t,e,i)=>{if(r.isNil(e))return t;const s=e[0];return r.isNil(s)?t:1===e.length?(t[s]=i,t):(r.isNil(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Cl(t[s],e.slice(1),i))};function kl(t,...e){let i=-1;const s=e.length;for(;++i<s;){const s=e[i];r.baseMerge(t,s,!0,!0)}return t}const Ml="__VCHART",El=500,wl=500,Ol=`${Ml}_DEFAULT_DATA_INDEX`,Pl=`${Ml}_DEFAULT_DATA_KEY`,Bl=`${Ml}_DEFAULT_DATA_SERIES_FIELD`,Dl=`${Ml}_DEFAULT_SERIES_STYLE_NAME`,Il=`${Ml}_STACK_START`,Rl=`${Ml}_STACK_END`,Ll=`${Ml}_STACK_START_PERCENT`,Fl=`${Ml}_STACK_END_PERCENT`,Nl=`${Ml}_KEY`;function jl(t,e){for(let i=0;i<e.length;i++){const s=e[i],r=Ul(t,s.key);r?r.operations=[...new Set(r.operations.concat(s.operations))]:t.push(s)}return t}function Ul(t,e){return t.find((t=>t.key===e))}const Vl=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return"line"===(s=i)||"area"===s?e:null==e?void 0:e[0];var s};let Gl=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},r=J.getComposedEvent(t);if(r){const e=new r(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,r,a;const n=null!=i?i:e;if(J.getComposedEvent(t))if(n)null===(s=this._composedEventMap.get(n))||void 0===s||s.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(r=this._composedEventMap.get(e[0]))||void 0===r||r.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i=null!==(a=this._getEventHandler(t,n))&&void 0!==a?a:{callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,n)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var Kl,zl,Hl,Wl;function $l(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Yl(t,e=!1){let i=e;return t.latestData instanceof s.DataView&&(i=!1),i?r.cloneDeep(t.latestData):t.latestData&&t.latestData.slice()}!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(Kl||(Kl={})),function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(zl||(zl={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(Hl||(Hl={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(Wl||(Wl={})),Wl.mark,Wl.model,Wl.chart,Wl.vchart;const Xl=(t,e)=>0===t.length?[]:1===t.length?Yl(t[0],null==e?void 0:e.deep):t.map((t=>Yl(t,null==e?void 0:e.deep)));function ql(t,e,i){$l(e=e instanceof s.DataSet?e:t.dataSet,"copyDataView",Xl);const r=new s.DataView(e,i);return r.parse([t],{type:"dataview"}),r.transform({type:"copyDataView",level:Jl.copyDataView}),r}function Zl(t,e,i=[]){var a;if(t instanceof s.DataView)return t;const{id:n,values:o=[],fromDataIndex:l,fromDataId:h,transforms:c=[]}=t,d=t.parser?r.cloneDeep(t.parser):{clone:!0},u=r.cloneDeep(t.fields);let p;d.clone=!(!1===d.clone);const g=i.find((t=>t.name===n));if(g)p=g;else{const t={name:n};if(u&&(t.fields=u),p=new s.DataView(e,t),"string"==typeof h){const t=i.find((t=>t.name===h));if(!t)return fo(`no data matches fromDataId ${h}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else if("number"==typeof l){const t=i[l];if(!t)return fo(`no data matches fromDataIndex ${l}`),null;p.parse([t],{type:"dataview"}),p.transform({type:"copyDataView"})}else Array.isArray(o)?p.parse(o,d):!r.isString(o)||d&&!["csv","dsv","tsv"].includes(d.type)?(p.parse([]),fo("values should be array")):p.parse(o,null!==(a=d)&&void 0!==a?a:{type:"csv"});c&&c.length&&c.forEach((t=>{e.getTransform(t.type)&&p.transform(t)}))}return p}function Ql(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Jl,th,eh;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(Jl||(Jl={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(th||(th={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(eh||(eh={}));const ih=["line","area","trail"];function sh(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(Nl,i?t.slice().sort(i):t.slice()),{keys:[Nl],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const r=new Set;return t.forEach(((t,i)=>{var a;const n=e(t,i),o=null!==(a=s.get(n))&&void 0!==a?a:[];o.push(t),s.set(n,o),r.add(n)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}const rh=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);class ah extends bn{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=i.ARC3D_NUMBER_TYPE,this.themeType="arc"}}let nh=!1;class oh extends bn{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=i.PYRAMID3D_NUMBER_TYPE,this.themeType="polygon"}}let lh=!1;class hh{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=yr.Get(e,vr.Color1),this.ambient=i;const s=r.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=r.min(r.max((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let a;a=r.isString(e)?yr.Get(e,vr.Color1):e;const n=this.colorRgb;return`rgb(${n[0]*a[0]*s}, ${n[1]*a[1]*s}, ${n[2]*a[2]*s})`}}const ch=()=>{ka.registerPlugin("DirectionalLight",hh)};class dh{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=pr.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=pr.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let a,n,o,l,h,c,d,u,p,g;const m=e[0],f=e[1],v=e[2],y=s[0],_=s[1],b=s[2],S=i[0],A=i[1],x=i[2];Math.abs(m-S)<r.epsilon&&Math.abs(f-A)<r.epsilon&&Math.abs(v-x)<r.epsilon?or(t):(d=m-S,u=f-A,p=v-x,g=1/Math.hypot(d,u,p),d*=g,u*=g,p*=g,a=_*p-b*u,n=b*d-y*p,o=y*u-_*d,g=Math.hypot(a,n,o),g?(g=1/g,a*=g,n*=g,o*=g):(a=0,n=0,o=0),l=u*o-p*n,h=p*a-d*o,c=d*n-u*a,g=Math.hypot(l,h,c),g?(g=1/g,l*=g,h*=g,c*=g):(l=0,h=0,c=0),t[0]=a,t[1]=l,t[2]=d,t[3]=0,t[4]=n,t[5]=h,t[6]=u,t[7]=0,t[8]=o,t[9]=c,t[10]=p,t[11]=0,t[12]=-(a*m+n*f+o*v),t[13]=-(l*m+h*f+c*v),t[14]=-(d*m+u*f+p*v),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=pr.allocate()),this._vp=hr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=pr.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=pr.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return function(t,e,i,s,r,a,n){const o=1/(e-i),l=1/(s-r),h=1/(a-n);t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(r+s)*l,t[14]=(n+a)*h,t[15]=1}(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=pr.allocate()),this._vp=hr(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return cr(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:r}=this._params.viewParams;cr(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const a=this.getProjectionScale(i);return{x:t*a+r[0],y:e*a+r[1]}}}const uh=()=>{ka.registerPlugin("OrthoCamera",dh)};function ph(){if(ph.__loaded)return;ph.__loaded=!0;const t=tn();var e,i;Ta("arc3d",La),ch(),uh(),on({bind:t.bind}),e=t,nh||(null===(i=e.isBound)||void 0===i?void 0:i.call(e,$a))&&(nh=!0,e.bind(fn).toDynamicValue((()=>new ah(mn(e,$a)))).inSingletonScope(),e.bind(_n).toService(fn))}ph.__loaded=!1;const gh=ph;function mh(){if(mh.__loaded)return;mh.__loaded=!0;const t=tn();var e,i;Ta("pyramid3d",Ua),ch(),uh(),dn({bind:t.bind}),e=t,lh||(null===(i=e.isBound)||void 0===i?void 0:i.call(e,qa))&&(lh=!0,e.bind(yn).toDynamicValue((()=>new oh(mn(e,qa)))).inSingletonScope(),e.bind(_n).toService(yn))}mh.__loaded=!1;const fh=mh;function vh(t,e,s){var a;const{width:n,height:o}=t;if(r.isValid(n)&&r.isValid(o))return{width:n,height:o};let l=s.width,h=s.height;const c=e.container,d=e.canvas;if(c){const{width:t,height:e}=r.getContainerSize(c,s.width,s.height);l=t,h=e}else if(d&&(("desktop-browser"===(u=e.mode)||"mobile-browser"===u)&&_o)){let t;t=r.isString(d)?i.vglobal.getElementById(d):d;const{width:e,height:a}=r.getContainerSize(t,s.width,s.height);l=e,h=a}else if(bo(e.mode)&&(null===(a=e.modeParams)||void 0===a?void 0:a.domref)){const t=e.modeParams.domref;l=t.width,h=t.height}var u;return l=null!=n?n:l,h=null!=o?o:h,{width:l,height:h}}const yh=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function _h(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function bh(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;yh.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}var Sh,Ah,xh;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(Sh||(Sh={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Ah||(Ah={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(xh||(xh={}));class Th{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){r.isNil(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,r.merge({},Th.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=r.array(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}Th.defaultMarkInfo={};class Ch{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class kh{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),a=t=>kl({},i,s,t);return r.isArray(t)?{spec:t.map((t=>a(t))),theme:i}:{spec:a(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}var Mh,Eh,wh,Oh=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};class Ph extends Ch{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=kh,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new Th,this._lastLayoutRect=null,this.id=Z(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Gl(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){r.isValid(t)&&r.isValid(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!r.isValid(t)||!r.isValid(e))return;const{style:i,state:s}=e,a=Object.assign({},e);i&&(a.style=this._convertMarkStyle(i)),s&&(a.state={},Object.keys(s).forEach((t=>{a.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(a)}stateKeyToSignalName(t,e){let i=`${Ml}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:r}=t,{parent:a}=e,n=Oh(e,["parent"]),o=J.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},n));return a?a.addMark(o):this.getCompiler().addRootMark(o),o&&(o.created(),i&&o.setMarkConfig(i)),o}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!r.isNil(e))return r.get(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}function Bh(t){const e=[],i=[],s=[];return t.forEach((t=>{r.isNil(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Dh(t,e,i){e?t.forEach((t=>{const e=r.last(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,a=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+a})}))})):t.forEach((t=>{const e=r.last(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,a=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+a,y:t.getLayoutStartPoint().y})}))}))}function Ih(t,e,i,s){let r;t.forEach(((t,a)=>{t.length>1&&(r=i[a],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),a="middle"===t.alignSelf?.5:1,n=e?r-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):r-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*n*a,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*n*a})})))}))}function Rh(t,e,i,s,r,a){if(t.length){let n=0;const o="right"===r,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=jh(t,e,a),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=r,c>i&&u.length?(p.push(n),h+=l*n,n=g,c=e.topCurrent+r,t.setLayoutStartPosition({x:h+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(n=Math.max(n,g),u.push(t))})),p.push(n),d.push(u),Ih(d,!0,p,l),s&&Dh(d,!0,i),o?e.rightCurrent=h+l*n:e.leftCurrent=h+l*n}}function Lh(t,e,i,s,r){if(t.length){let i=0;const a="right"===s,n=a?-1:1;let o=a?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=jh(t,e,r),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=a?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l<u&&c.length?(d.push(i),o+=n*i,i=p,l=e.bottomCurrent,t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),h.push(c),c=[t]):(t.setLayoutStartPosition({x:o+t.layoutOffsetX+g,y:l+t.layoutOffsetY-s.height-t.layoutPaddingBottom}),i=Math.max(i,p),l-=u,c.push(t))})),d.push(i),h.push(c),Ih(h,!0,d,n),a?e.rightCurrent=o+n*i:e.leftCurrent=o+n*i}}function Fh(t,e,i,s,r,a){if(t.length){const n="top"===r,o=n?1:-1;let l=0,h=e.leftCurrent,c=n?e.topCurrent:e.bottomCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=jh(t,e,a),r=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=n?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=r,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+m}),d.push(u),u=[t]):(l=Math.max(l,r),u.push(t))})),p.push(l),d.push(u),Ih(d,!1,p,o),s&&Dh(d,!1,i),n?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Nh(t,e,i,s,r){if(t.length){const i="top"===s,a=i?1:-1;let n=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=jh(t,e,r),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;o<g&&c.length?(o=e.rightCurrent,l+=a*n,n=p,t.setLayoutStartPosition({x:e.rightCurrent+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),h.push(c),c=[t]):(c.push(t),t.setLayoutStartPosition({x:o+t.layoutOffsetX-u.width-t.layoutPaddingRight,y:l+t.layoutOffsetY+m}),n=Math.max(n,p),o-=g)})),d.push(n),h.push(c),Ih(h,!1,d,a),i?e.topCurrent=l+a*n:e.bottomCurrent=l+a*n}}function jh(t,e,i,s=!0){let a,n,o="recomputeHeight",l="recomputeWidth",h="width";"top"!==t.layoutOrient&&"bottom"!==t.layoutOrient||(o="recomputeWidth",l="recomputeHeight",h="height");let c=!(!t.willLayoutTag&&!1===i[o]);if(c){const o=Object.assign({},t.getLayoutRect()),d=t.lastComputeRect;a=e.getItemComputeLayoutRect(t),!t.willLayoutTag&&r.isEqual(a,d)?(c=!1,n=t.getLayoutRect()):(n=t.computeBoundsInRect(a),r.isEqual(o[h],n[h])?c=!1:(s&&t.setLayoutRect(n),i[l]=!0))}else a=t.getLastComputeOutBounds(),n=t.getLayoutRect();return{layoutRect:a,rect:n,layoutTag:c}}class Uh{constructor(t,e){this.leftCurrent=0,this.topCurrent=0,this.rightCurrent=0,this.bottomCurrent=0,this.recomputeWidth=!1,this.recomputeHeight=!1,this._onError=null==e?void 0:e.onError}_layoutInit(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.leftCurrent=i.x,this.topCurrent=i.y,this.rightCurrent=i.x+i.width,this.bottomCurrent=i.height+i.y,this.recomputeWidth=!1,this.recomputeHeight=!1,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),r=i.concat(s),a={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{a[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:r,overlapItems:a}}layoutItems(t,e,i,s){var r,a,n;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(n=null===(a=null===(r=null==t?void 0:t.getSpec())||void 0===r?void 0:r.layout)||void 0===a?void 0:a.secondLayoutLeftRight)&&void 0!==n&&n;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,a,n,o=!1){if(r.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(r,a);(l||h||c||d)&&(this.topCurrent=a.top+l,this.bottomCurrent=a.bottom-h,this.leftCurrent=a.left+c,this.rightCurrent=a.right-d,this.layoutRegionItems(t,e,i,s,n,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=jh(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),r=t.filter((t=>"top"===t.layoutOrient)),a=t.filter((t=>"bottom"===t.layoutOrient)),n=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:r,middleItems:a,endItems:n}=Bh(t);r.length&&Rh(r,e,i,!1,"left",s),a.length&&Rh(a,e,i,!0,"left",s),n.length&&Lh(n,e,0,"left",s)}(i,this,o,e),r.length&&function(t,e,i,s){const{startItems:r,middleItems:a,endItems:n}=Bh(t);r.length&&Fh(r,e,i,!1,"top",s),a.length&&Fh(a,e,i,!0,"top",s),n.length&&Nh(n,e,0,"top",s)}(r,this,n,e),s.length&&function(t,e,i,s){const{startItems:r,middleItems:a,endItems:n}=Bh(t);r.length&&Rh(r,e,i,!1,"right",s),a.length&&Rh(a,e,i,!0,"right",s),n.length&&Lh(n,e,0,"right",s)}(s,this,o,e),a.length&&function(t,e,i,s){const{startItems:r,middleItems:a,endItems:n}=Bh(t);r.length&&Fh(r,e,i,!1,"bottom",s),a.length&&Fh(a,e,i,!0,"bottom",s),n.length&&Nh(n,e,0,"bottom",s)}(a,this,n,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=jh(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{r.isEqual(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=jh(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),r=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=r-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:r,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,a=!1){const n=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("left",s.left,r),this._layoutRelativeOverlap("right",s.right,r),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),this._layoutRelativeOverlap("top",s.top,r),this._layoutRelativeOverlap("bottom",s.bottom,r),h=this.bottomCurrent-this.topCurrent,a&&(this.leftCurrent=n,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,r)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:vo)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds(),a=this._getOutInLayout(r,t,e);s?(i.top=Math.max(i.top,a.top),i.bottom=Math.max(i.bottom,a.bottom)):(i.left=Math.max(i.left,a.left),i.right=Math.max(i.right,a.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:r}=e.getLayoutStartPoint(),{width:a,height:n}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+a+t.x2-i.right,top:i.top-(r-t.y1),bottom:r+n+t.y2-i.bottom}}}Uh.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Mh||(Mh={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(Eh||(Eh={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(wh||(wh={}));const Vh=["linear","radial","conical"],Gh={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Kh={};Object.values(Eh).forEach((t=>{Kh[t]=!0})),Eh.STATE_HOVER,Eh.STATE_HOVER_REVERSE,Eh.STATE_SELECTED,Eh.STATE_SELECTED_REVERSE,Eh.STATE_DIMENSION_HOVER,Eh.STATE_DIMENSION_HOVER_REVERSE;class zh extends Ch{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(r.merge(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Hh extends zh{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;i<this._stateInfoList.length;i++){const s=this._stateInfoList[i].level;if(s&&s>t.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const a=e.fields[i];r.isValid(s.domain)&&(a.domain=s.domain),r.isValid(s.type)&&(a.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||function(t){return ih.includes(t)}(this._mark.type)}checkOneState(t,e,i){var s;let a=!1,n=!1;if(r.isValid(i.datums)&&i.datums.length>0)a=this.checkDatumState(i,e),n=!0;else if(i.items)a=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,n=!0;else if(i.fields)a=this.checkFieldsState(i,e,t),n=!0;else if(!a&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};a=i.filter(null==e?void 0:e[0],s),n=!0}return n?a?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Kh[t])).map((t=>[t,10]));for(let i=0;i<this._stateInfoList.length;i++){const r=this._stateInfoList[i],a=this.checkOneState(t,e,r);"skip"!==a&&"in"===a&&s.push([r.stateValue,r.level])}return s.map((t=>t[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(r.isArray(t.datums)){const e=this._isMultiMark(),a=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Ml)));i=t.datums.some((t=>e&&r.isArray(null==t?void 0:t.items)?a.every((e=>{var i,r;return(null===(r=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===r?void 0:r[e])===(null==s?void 0:s[e])})):a.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(r.isObject(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Ml))),r=this._isMultiMark();i=e.every((e=>{var i,a;return r?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(a=t.datums)||void 0===a?void 0:a[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let r=!0;for(const a in t.fields){const n=t.fields[a],o=n.type,l=n.domain,h=null===(s=e[0])||void 0===s?void 0:s[a];if(ko(o)&&l.length>1){if(this.checkLinearFieldState(l,a,e,i)){r=!1;break}r=!0}else{if(!l.some((t=>t===h))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s){var r;const a=this._isMultiMark()?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return a<t[0]||a>t[t.length-1]}release(){}}class Wh extends Ch{constructor(){super(...arguments),this.id=Z(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=J.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class $h extends Wh{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Yh=1e3,Xh="quadInOut",qh=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Zh=(t,e,s)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*s;else if("fill"===t.key||"stroke"===t.key){const r=i.interpolateColor(t.from,t.to,s,!1);r&&(e[t.key]=r)}}))},Qh=(t,e,i)=>{const s=[],r=[];e.clear();for(let a=0;a<t.length;a++){const n=t[a],o=n.from,l=n.to,h=n.rotation*i,c=n.fromCp,d=n.toCp,u=Math.sin(h),p=Math.cos(h);r[0]=c[0]+(d[0]-c[0])*i,r[1]=c[1]+(d[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],a=o[t+1],n=e*(1-i)+l[t]*i,h=a*(1-i)+l[t+1]*i;s[t]=n*p-h*u+r[0],s[t+1]=n*u+h*p+r[1]}let g=s[0],m=s[1];e.moveTo(g,m);for(let t=2;t<o.length;t+=6){const i=s[t],r=s[t+1],a=s[t+2],n=s[t+3],o=s[t+4],l=s[t+5];g===i&&m===r&&a===o&&n===l?e.lineTo(o,l):e.bezierCurveTo(i,r,a,n,o,l),g=o,m=l}}},Jh=(t,e,s)=>{const r=t?i.pathToBezierCurves(t):[],a=i.pathToBezierCurves(e);s&&r&&(s.fromTransform&&i.applyTransformOnBezierCurves(r,s.fromTransform.clone().getInverse()),i.applyTransformOnBezierCurves(r,s.toTransfrom));const[n,o]=i.alignBezierCurves(r,a);return t?i.findBestMorphingRotation(n,o,10,Math.PI):o.map(((t,e)=>({from:n[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},tc=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ec=(t,e)=>{if(!t||!e)return null;const s=[];let a=!1;return Object.keys(t).forEach((n=>{if(!tc.includes(n))return;const o=e[n];if(!r.isNil(o)&&!r.isNil(t[n])&&o!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?i.ColorStore.Get(t,i.ColorType.Color255):t;s.push({from:r.isArray(t[n])?t[n].map(e):e(t[n]),to:r.isArray(o)?o.map(e):e(o),key:n})}else s.push({from:t[n],to:o,key:n});a=!0}})),a?s:null};class ic extends zn{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,r="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Qh(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&Zh(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):jn(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const sc=(t,e,i,s)=>{var r,a,n;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Jh(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ec(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new ic({morphingData:l,otherAttrs:h},null!==(a=null==i?void 0:i.duration)&&void 0!==a?a:Yh,null!==(n=null==i?void 0:i.easing)&&void 0!==n?n:Xh);return c.play(d),c};class rc extends zn{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Qh(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Zh(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ac=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>qh.includes(t))(i)||(e[i]=t[i])})),e},nc=(t,e,s)=>{const r=ac(t.attribute),a=t.attachShadow();if(e.length)a.setTheme({[e[0].type]:r}),e.forEach((t=>{t.setAttributes({pickable:!1}),a.appendChild(t)}));else{const n=t.AABBBounds,o=n.width(),l=n.height();a.setTheme({rect:r}),new Array(s).fill(0).forEach((t=>{const s=i.application.graphicService.creator.rect({x:0,y:0,width:o,height:l,pickable:!1});a.appendChild(s),e.push(s)}))}},oc=(t,e,s)=>{const r=[],a=s?null:ac(t.attribute),n=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new i.CustomPath2D).fromCustomPath2D(n)};r.push(i.application.graphicService.creator.path(s?t:Object.assign({},a,t)))}return s&&nc(t,r,e),r},lc=(t,e,s)=>{const r=[],a=s?null:ac(t.attribute);if("rect"===t.type)i.splitRect(t,e).forEach((t=>{r.push(i.application.graphicService.creator.rect(s?t:Object.assign({},a,t)))}));else if("arc"===t.type)i.splitArc(t,e).forEach((t=>{r.push(i.application.graphicService.creator.arc(s?t:Object.assign({},a,t)))}));else if("circle"===t.type)i.splitCircle(t,e).forEach((t=>{r.push(i.application.graphicService.creator.arc(s?t:Object.assign({},a,t)))}));else if("line"===t.type){const n=i.splitLine(t,e),o={size:10,symbolType:"circle"};n.forEach((t=>{r.push(i.application.graphicService.creator.symbol(s?Object.assign({},t,o):Object.assign({},a,t,o)))}))}else"polygon"===t.type?i.splitPolygon(t,e).forEach((t=>{r.push(i.application.graphicService.creator.polygon(s?t:Object.assign({},a,t)))})):"area"===t.type?i.splitArea(t,e).forEach((t=>{r.push(i.application.graphicService.creator.polygon(s?t:Object.assign({},a,t)))})):"path"===t.type&&i.splitPath(t,e).forEach((t=>{"path"in t?r.push(i.application.graphicService.creator.path(s?t:Object.assign({},a,t))):r.push(i.application.graphicService.creator.polygon(s?t:Object.assign({},a,t)))}));return s&&nc(t,r,e),r},hc=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,cc=(t,e,s,a,n)=>{var o;const l={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},h={prev:t.slice(),next:e.slice()},c=null!==(o=s.animation)&&void 0!==o?o:{},d=c.easing,u=hc(c.delay,n,l,h),p=hc(c.duration,n,l,h),g=hc(c.oneByOne,n,l,h),m=hc(c.splitPath,n,l,h),f=r.isValidNumber(g)&&g>0?t=>r.isNumber(g)?t*g:!0===g?t*p:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const r=e.filter((t=>t&&t.toCustomPath&&t.valid));r.length||console.error(r," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const a=("clone"===(null==i?void 0:i.splitPath)?oc:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:lc)(t,r.length,!1),n=null==i?void 0:i.onEnd;let o=r.length;const l=()=>{o--,0===o&&n&&n()};r.forEach(((e,s)=>{var n;const o=a[s],h=(null!==(n=null==i?void 0:i.delay)&&void 0!==n?n:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,r.length,o,e):0);sc(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:u,duration:p,easing:d,onEnd:a,individualDelay:f,splitPath:m}):t.length>1&&1===e.length&&((t,e,s)=>{var r,a,n;const o=t.filter((t=>t.toCustomPath&&t.valid));o.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const l=("clone"===(null==s?void 0:s.splitPath)?oc:null!==(r=null==s?void 0:s.splitPath)&&void 0!==r?r:lc)(e,o.length,!0),h=e.attribute;e.setAttribute("visible",!1);const c=o.map(((t,e)=>Jh(t.toCustomPath(),l[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:l[e].globalTransMatrix}))),d=o.map(((t,e)=>ec(t.attribute,h)));if(null==s?void 0:s.individualDelay){const r=s.onEnd;let a=o.length;const n=()=>{a--,0===a&&(e.setAttributes({visible:!0,ratio:null},!1,{type:i.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),r&&r())};l.forEach(((e,i)=>{var r,a,l;const h=(null!==(r=s.delay)&&void 0!==r?r:0)+s.individualDelay(i,o.length,t[i],e),u=e.animate(Object.assign({},s,{onEnd:n}));u.wait(h),u.play(new ic({morphingData:c[i],saveOnEnd:!0,otherAttrs:d[i]},null!==(a=s.duration)&&void 0!==a?a:Yh,null!==(l=s.easing)&&void 0!==l?l:Xh))}))}else{const t=null==s?void 0:s.onEnd,r=s?Object.assign({},s):{};r.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:i.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),t&&t()};const o=e.animate(r);(null==s?void 0:s.delay)&&o.wait(s.delay),o.play(new rc({morphingData:c,otherAttrs:d},null!==(a=null==s?void 0:s.duration)&&void 0!==a?a:Yh,null!==(n=null==s?void 0:s.easing)&&void 0!==n?n:Xh))}})(t,e[0],{delay:u,duration:p,easing:d,onEnd:a,individualDelay:f,splitPath:m}):sc(t[0],e[0],{delay:u,duration:p,easing:d,onEnd:a})},dc=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,r)=>t.slice(i*r,r===e-1?t.length:i*(r+1))))},uc=t=>{const e=t.getMarkConfig();r.isValid(e.morphElementKey)&&t.getGraphics().forEach((t=>{var i,s;const r=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];r&&(t.context.morphKey=r[e.morphElementKey])}))},pc=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const r=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,r)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):r.length?t.useStates(r,i):t.clearStates(i)},gc=(t,e,i=!0,s)=>{var r;if(!e)return;const a=i&&null!==(r=t.currentStates)&&void 0!==r?r:[],n=i?Array.from(new Set([...a,e])):[e];pc(t,n,s)},mc=(t,e,i)=>{var s;const r=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!r.length)return;const a=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!r.includes(t)));pc(t,a,i)};var fc=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const vc=Symbol("statesClearedBeforeReInit");class yc extends Wh{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){r.isValid(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){r.isNil(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var a,n;const o="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&r.isValid(e.context.modelId)){const t=null===(a=e.context.compiler.getChart())||void 0===a?void 0:a.getModelById(e.context.modelId);return Object.assign(Object.assign({},o),{layoutRect:null===(n=null==t?void 0:t.getLayoutRect)||void 0===n?void 0:n.call(t)})}return Object.assign({},o)}})},s={};Object.keys(t).forEach((e=>{const a=t[e];r.isArray(a)?s[e]=a.map(i):r.isValid(a)&&(s[e]=i(a))})),this._animationConfig=s}disableAnimationByState(t){const e=r.array(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=r.array(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new $h(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(r.isValid(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}r.isNil(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else r.isValid(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const s=this.getProductId();this._product=i.createGroup("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=s,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=s}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){r.isNil(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var s;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:Sh.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:s}=this._markConfig;e&&(t.pathProxy=s=>e(t.context.data,s,new i.CustomPath2D)),s&&(r.isFunction(s)?t.name=s(t):t.name=s)},this._setStateOfGraphic=(t,e)=>{var i,s,r;const a=t.context.diffState===Mh.enter||t.context.diffState===Mh.update?t.context.states:void 0,n=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(r=t.registeredActiveScopes)||void 0===r?void 0:r.size));((null==a?void 0:a.length)||n)&&pc(t,a,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Hh(e,this),this._attributeContext=e.attributeContext,null===(s=e.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(r.isValid(t.id)&&(this._userId=t.id),r.isBoolean(t.interactive)&&(this._markConfig.interactive=t.interactive),r.isValid(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),r.isBoolean(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,r.degreeToRadian)}isUserLevel(t){return[xh.User_Mark,xh.User_Series,xh.User_Chart,xh.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(r.isNil(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((a=>{let n=t[a];r.isNil(n)||(n=this._filterAttribute(a,n,e,i,s),this.setAttribute(a,n,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,r){let a=this._styleConvert(e);if(r)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>function(t,e){return"monotone"===t?"horizontal"===e?"monotoneY":"monotoneX":t}(t,this._option.model.direction)))}return a}setReferer(t,e,i){var s;if(t)if(e&&i){const r=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var a;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const n=null===(a=this.stateStyle[i][t])||void 0===a?void 0:a.level;r.isValid(n)&&n<=s&&kl(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Mo(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return r.isString(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=bl(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const a=this._computeStateAttribute(s,t,e),n=r.isFunction(null==s?void 0:s.postProcess),o=t in this._computeExChannel;if(n&&o){const i=this._computeExChannel[t];return r=>{let n=a(r);return n=s.postProcess(n,r,this._attributeContext,this.getDataView()),i(t,r,e,n)}}if(n)return t=>s.postProcess(a(t),t,this._attributeContext,this.getDataView());if(o){const i=this._computeExChannel[t];return s=>i(t,s,e,a(s))}return a}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Vh.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Mo(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",xh.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=r.isFunction(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,xh.User_Mark)}else this.setStyle(i,t,xh.User_Mark)}))}_computeGradientAttr(t){var e,i,s,a,n;const{gradient:o,scale:l,field:h}=t,c=fc(t,["gradient","scale","field"]);let d=l,u=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),u||(u=e)}const p=pl(ul(this.model.getColorScheme(),"series"===this.model.modelType?null===(i=(e=this.model).getSpec)||void 0===i?void 0:i.call(e):void 0),null!==(n=null===(a=null===(s=this.model)||void 0===s?void 0:s.getDefaultColorDomain)||void 0===a?void 0:a.call(s))&&void 0!==n?n:[]),g=Object.assign(Object.assign({},Gh[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(g).forEach((s=>{const a=g[s];"stops"===s?e.stops=a.map((e=>{const{opacity:s,color:a,offset:n}=e;let o=null!=a?a:null==d?void 0:d.scale(t[u]);return r.isFunction(a)&&(o=a(t,this._attributeContext,i)),r.isValid(s)&&(o=r.Color.SetOpacity(o,s)),{offset:r.isFunction(n)?n(t,this._attributeContext,i):n,color:o||p[0]}})):r.isFunction(a)?e[s]=a(t,this._attributeContext,i):e[s]=a})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:e,field:i}=t,s=fc(t,["scale","field"]);return t=>{var a,n,o;const l={};if(Object.keys(s).forEach((e=>{const i=s[e];r.isFunction(i)?l[e]=i(t,this._attributeContext,this.getDataView()):l[e]=i})),"stroke"in l)Vh.includes(null===(o=s.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(s.stroke)(t));else{const s=pl(ul(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(a=this.model).getSpec)||void 0===n?void 0:n.call(a):void 0),this.model.getDefaultColorDomain());let r=e,o=i;if(!(e&&i||"series"!==this.model.modelType)){const{scale:i,field:a}=this.model.getColorAttribute();e||(r=i),o||(o=a),l.stroke=(null==r?void 0:r.scale(t[o]))||s[0]}}return l}}_getDataByKey(t){return sh(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep<this._markConfig.progressiveThreshold,i=this._markConfig.large&&this._markConfig.largeThreshold>0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return J.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=r.isFunction(this.key)?this.key:r.isValid(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[Pl],this._groupKeyGetter=r.isValid(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=sh(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===th.appear))?th.appear:t.every((t=>t===th.disappear))?th.disappear:t[0];return null!=e?e:th.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],r=[];t.forEach((t=>{uc(t),s.push(...t.getGraphics())})),e.forEach((t=>{uc(t),r.push(...t.getGraphics())}));const a=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},n=new Map,o=new Map;if(s.forEach((t=>{const e=a(t);e&&(n.has(e)||n.set(e,[]),n.get(e).push(t))})),r.forEach((t=>{const e=a(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),n.size!==o.size||!Array.from(n.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...n.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!n.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);cc([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=n.get(t),s=o.get(t),r=Math.min(e.length,s.length);if(r>0){const t=dc(e,r),a=dc(s,r);for(let e=0;e<r;e++)cc(t[e],a[e],i,d,{}),c+=1}})),0===c&&d(),!0})([this._lastMark],[this],{});return this._lastMark=null,e}return!1}_runStateAnimation(t){var e,i;if(!this._animationConfig||0===t.length)return;if(this.tryRunMorphing(t))return;const s=this.getAnimationConfig();if(null!==(e=this._markConfig.useSequentialAnimation)&&void 0!==e&&e&&this._runSequentialAnimations)return void this._runSequentialAnimations(t);const r=t.every((t=>"appear"===t.context.animationState)),a=this.createAnimationStateList("appear",s);if(r&&this._product){const t=a?["appear"]:[],e=a?[{name:"appear",animation:a}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let n=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const r=[e];t.applyAnimationState(r,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(n=!0)})),n&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const r=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===th.exit?th.exit:i===th.update?th.update:th.appear}),a=r(t);t.context.animationState=null!=a?a:t.context.diffState,t.context.animationState===Mh.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],a=new Set(this._graphics.filter((t=>t.context.diffState===Mh.enter))),n=(t,e,i)=>{var n,o,l,h,c,d,u,p,g;let m,f;return r.isNil(e)?(m=this._graphicMap.get(t),m&&(f=Mh.exit)):r.isNil(i)?(m=this._graphicMap.has(t)?this._graphicMap.get(t):{},f=Mh.enter,m.isExiting=!1,this._graphicMap.set(t,m),s.push(m)):(m=this._graphicMap.get(t),m&&(f=Mh.update,s.push(m))),m&&(a.delete(m),m.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:f,reusing:null===(n=m.context)||void 0===n?void 0:n.reusing,originalFieldX:null===(o=m.context)||void 0===o?void 0:o.originalFieldX,originalFieldY:null===(l=m.context)||void 0===l?void 0:l.originalFieldY,fieldX:null===(h=m.context)||void 0===h?void 0:h.fieldX,fieldY:null===(c=m.context)||void 0===c?void 0:c.fieldY,data:null!=e?e:null===(d=m.context)||void 0===d?void 0:d.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=m.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=m.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(m)),m};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{n(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&n(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=n(t,e.data.get(t),null);i&&(i.context.animationState=th.appear)})):i&&i.keys.forEach((t=>{n(t,null,i.data.get(t)).context.animationState=th.disappear}));a.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const o=s.length;s.forEach(((t,e)=>{t.context.graphicCount=o,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return rh(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=rh(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const a=null===(s=e[t])||void 0===s?void 0:s.style;return!!function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,a)||!!r.isFunction(a)||!(!(null==a?void 0:a.scale)||a.field===i)}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const a=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!a||a.referer||r.isFunction(a.postProcess)||e in this._computeExChannel)return!1;const n=a.style;return!(r.isFunction(n)||Vh.includes(null==n?void 0:n.gradient)||["outerBorder","innerBorder"].includes(e)||Mo(null===(s=null==n?void 0:n.scale)||void 0===s?void 0:s.type))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const r={},a=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],n={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(n[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=n),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),r[t]=c,a.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(n[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!a.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const n=a.sort().join("||");n===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=n,this._sharedStateDefinitionsCache=r,this._product.sharedStateDefinitions=r)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);r.isNil(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const r=t;null===(i=r.setFinalAttributes)||void 0===i||i.call(r,e),r._commitAnimationStaticAttributes?r._commitAnimationStaticAttributes(e):null===(s=r.commitInternalBaseAttributes)||void 0===s||s.call(r,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var r,a;const n=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,((t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s})(i,n));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(n),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(n)).context=e.context,i.context.diffAttrs=n,i.stateSort=this._stateSort;const a=this._graphics===t?s:s+this._graphics.length-t.length;if(a>=0&&(this._graphics[a]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===Eh.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:a}=this._markConfig;if(r.isNil(e)||(t.zIndex=e),r.isNil(i)||(t.clip=i),!r.isNil(s)){const e=r.isArray(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return r.isNil(a)||(t.overflow=a),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=J.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=J.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],a=this._runBeforeTransform(s);let n;if(null==a?void 0:a.progressive){this.renderContext={beforeTransformProgressive:a.progressive};const t=a.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();n=t.output()}else n=r.array(a),this._runGroupData(n),this.renderContext=this._parseProgressiveContext(n);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(n),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===eh.before||(this._product||this._initProduct(),((t,...e)=>{yo.silent||r.Logger.getInstance().info(`[VChart log]: ${t}`,...e)})(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,r=s[vc],a=null==r?void 0:r.includes(t),n=!a&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?gc(i,t,!0,n):mc(i,t,n),a){const e=r.filter((e=>e!==t));e.length?s[vc]=e:delete s[vc]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===Mh.exit&&!e.isExiting)if(e.context.animationState===Mh.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const r=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===r.length?r[0]:r],(()=>{e.context.diffState===Mh.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex<this.renderContext.progressive.totalStep||this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.unfinished())}clearProgressive(){this.renderContext&&this.renderContext.progressive&&(this._graphics=[],this._product.children.forEach((t=>{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const r=this.renderContext.progressive.groupedData.get(s),a=this.renderContext.progressive.step,n=r.slice(t*a,(t+1)*a),o=[];n.forEach(((i,r)=>{const n=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:Mh.enter,data:[i],uniqueKey:`${s}_${null!=n?n:t*a+r}`,key:n,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=i.createGroup({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const r=t.parent;r&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&r.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||r.isObject(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[vc]=t.currentStates.slice())}))}}const _c=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};Eh.STATE_HIGHLIGHT,Eh.STATE_BLUR;const bc=(t,e,i,s)=>{if(r.isNil(t[e]))return;const a=r.isArray(t[e]),n=a?t[e]:[t[e]],o=[];return n.forEach(((t,r)=>{!t||s&&!s(t)||o.push({spec:t,specPath:a?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),o},Sc={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}};class Ac extends yc{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}setDataLabelType(){return"rect"}constructor(t,e){super(t,e),this.type=Ac.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Ac.type="rect3d";const xc=()=>{J.registerMark(Ac.type,Ac),kn(),Tn(),$n.registerBuiltInAnimate("growHeightIn",eo),$n.registerBuiltInAnimate("growHeightOut",io),$n.registerBuiltInAnimate("growWidthIn",uo),$n.registerBuiltInAnimate("growWidthOut",po),$n.registerBuiltInAnimate("growCenterIn",Qn),$n.registerBuiltInAnimate("growCenterOut",Jn),J.registerGraphicComponent("rect3d",i.createRect3d)};class Tc extends e.BarSeries{constructor(){super(...arguments),this.type=$.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=rt}}Tc.type=$.bar3d,Tc.mark=st,Tc.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},Tc.transformerConstructor=rt;const Cc=()=>{e.Factory.registerAnimation("bar3d",((t,i)=>({appear:e.barPresetAnimation(t,i),enter:e.barGrowIn(t,!1),exit:e.barGrowOut(t,!1),disappear:e.barGrowOut(t)}))),xc(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Tc.type,Tc)};class kc extends Uh{layoutItems(t,e,i,s){this._layoutInit(t,e,i,s);const r={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,r);const a={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},n=e.filter((t=>"absolute"===t.layoutType)),o=n.filter((t=>"z"===t.layoutOrient));let l={width:0,height:0};if(o.length){l=o[0].getLayoutRect()}this.leftCurrent+=l.width/8,this.rightCurrent-=l.width/8,this.topCurrent+=l.height/8,this.bottomCurrent-=l.height/8;const{regionItems:h,relativeItems:c,relativeOverlapItems:d,allRelatives:u,overlapItems:p}=this._groupItems(e);this.layoutRegionItems(h,c,d,p,r),this._processAutoIndent(h,c,d,p,u,a,r);const g=n.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(g);const m=c.filter((t=>{return"axes"===t.model.specKey&&("bottom"===(e=t.layoutOrient)||"top"===e);var e}))[0],f=c.filter((t=>{return"axes"===t.model.specKey&&("left"===(e=t.layoutOrient)||"right"===e);var e}))[0];if(m&&o.length){const t=m.getLayoutStartPoint(),e=m.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};o[0].model.directionStr="left"===f.layoutOrient?"r2l":"l2r";const s=m.getLayoutRect(),r=f.getLayoutRect(),a={length:o[0].getLayoutRect().width,width:s.width,height:r.height};m.model.setLayout3dBox&&m.model.setLayout3dBox(a),f.model.setLayout3dBox&&f.model.setLayout3dBox(a),o[0].model.setLayout3dBox&&o[0].model.setLayout3dBox(a),this.layoutZAxisItems(o,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this.rightCurrent,s=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const r="left"===t.layoutOrient||"right"===t.layoutOrient,a=t.getLastComputeOutBounds();r?(e.top=Math.max(e.top,a.y1-this.topCurrent),e.bottom=Math.max(e.bottom,a.y2-s)):(e.left=Math.max(e.left,a.x1-this.leftCurrent),e.right=Math.max(e.right,a.x2-i))})),e}}kc.type="layout3d";const Mc=()=>{J.registerLayout(kc.type,kc)};class Ec extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=z,this.type="bar3d",this.seriesType=$.bar3d}}Ec.type="bar3d",Ec.seriesType=$.bar3d,Ec.transformerConstructor=z;const wc=Object.assign(Object.assign({},e.baseSeriesMark),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class Oc extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class Pc extends yc{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class Bc extends Pc{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=Bc.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Bc.type="pyramid3d";const Dc=()=>{J.registerMark(Bc.type,Bc),kn(),fh(),$n.registerBuiltInAnimate("growPointsOut",ao),J.registerGraphicComponent("pyramid3d",i.createPyramid3d)},Ic=e.getFunnelTheme(!0);class Rc extends e.FunnelSeries{constructor(){super(...arguments),this.type=$.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=Oc}initMark(){var t,e,i,s,r,a,n,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Rc.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Rc.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(r=this._spec.outerLabel)&&void 0!==r?r:{},{line:e}=null!==(n=null===(a=this._theme)||void 0===a?void 0:a.outerLabel)&&void 0!==n?n:{};this._funnelOuterLabelMark.label=this._createMark(Rc.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(Rc.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series)}initLabelMarkStyle(t){var i,s;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",e.AttributeLevel.Series),this._labelMark=t,null===(i=this._funnelOuterLabelMark)||void 0===i||i.label,null===(s=this._funnelOuterLabelMark)||void 0===s||s.line}}Rc.type=$.funnel3d,Rc.mark=wc,Rc.builtInTheme={funnel3d:Ic},Rc.transformerConstructor=Oc;const Lc=()=>{Dc(),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(Rc.type,Rc)};class Fc extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=$.funnel3d}}Fc.type="funnel3d",Fc.seriesType=$.funnel3d,Fc.transformerConstructor=e.FunnelChartSpecTransformer;class Nc extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=$.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Nc.type="histogram3d",Nc.seriesType=$.bar3d,Nc.transformerConstructor=e.HistogramChartSpecTransformer;class jc{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=r.array(t);for(let t=0;t<e.length;t++)this._dataArr.push(Zl(e[t],this._dataSet,this._dataArr))}updateData(t,e=!1,i=!0){const s=r.array(t);return!(e&&s.length!==this._dataArr.length||(this._dataValueForEach(s,((t,e)=>{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Ql(e,t,i)})),0))}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof s.DataView)return;const r=this.getSeriesData(t.id,i);r&&e(t,r,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];fo(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];fo(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Uc{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{Ao(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{jl(e,[{key:t,operations:ko(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const r=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&jl(e,[{key:i.field,operations:ko(r.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?bl("colorOrdinal"):bl(t.type)),e?(r.isArray(t.range)&&e.range(t.range),r.isArray(t.domain)&&(Ao(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(r.isEqual(t,this._spec))return e;e.change=!0;for(let i=0;i<t.length;i++){const s=t[i],a=this._scaleMap.get(s.id);if(!a)return e.reMake=!0,e;const n=this._spec.find((t=>t.id===s.id));if(!n.id)return e.reMake=!0,e;if(n.type!==s.type)return e.reMake=!0,e;if(!r.isEqual(n.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=a;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!r.isEqual(s.range,a.range())&&(a.range(s.range),e.reRender=!0),Ao(s.domain)?e.reRender=!0:r.isEqual(s.domain,a.domain())||(a.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.getRawData().name===t)return s}return null}_getSeriesBySeriesId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}return null}updateScaleDomain(t){this._scaleSpecMap.forEach(((e,i)=>{const s=this._scaleMap.get(i);if(!s)return;if(!Ao(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let a;a=ko(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ko(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(r.isNil(a[0])?a[0]=e.min:a[0]=Math.min(e.min,a[0]),r.isNil(a[1])?a[1]=e.max:a[1]=Math.max(e.max,a[1])):e.values.forEach((t=>{a.add(t)})))}))}));const n=a;ko(e.type)||(a=Array.from(a)),s.domain(a),this._updateMarkScale(i,s,n)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(r.isNil(t.changeDomain)||"none"===t.changeDomain||r.isNil(t.seriesId))return void(ko(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),a=ko(e.type),n=s.getRawDataStatisticsByField(t.field,a);if(!r.isEmpty(n))return"expand"===t.changeDomain?(a?(i[0]=Math.min(i[0],n.min),i[1]=Math.max(i[1],n.max)):(n.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(a?t.markScale.domain([n.min,n.max]):t.markScale.domain(n.values)));ko(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let a=i;return(r.isNil(t.field)||!r.isNil(t.changeDomain)&&"none"!==t.changeDomain&&!r.isNil(e))&&(a=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:a})),a}}var Vc;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Vc||(Vc={}));class Gc{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){t&&[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,r){return this._disableTriggerEvent?[]:e&&e.length?(s&&r?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,r),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,r):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");gc(t,s,!0,r)}})),e.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");mc(t,s,r)}}))}toggleStateOfGraphics(t,e,i,s){const r=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");mc(t,s,r)}})),e.forEach((t=>{var e;if(s&&r[s]&&r[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,r=i.hasAnimationByState&&i.hasAnimationByState("state");gc(t,s,!0,r)}}))}addBothStateOfGraphics(t,e,i,s){const r=t.getMarks(),a=t.getMarkIdByState();r.forEach((t=>{var r;const n=s&&a[s]&&a[s].includes(t.id),o=i&&a[i]&&a[i].includes(t.id);if(!n&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(r=t.getGraphics())||void 0===r||r.forEach((t=>{e&&e.includes(t)?o&&gc(t,i,!0,l):n&&gc(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const a=i&&r[i]&&r[i].includes(t.id);if(!a)return;const n=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&a&&gc(t,i,!0,n)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const r=t.getMarks(),a=t.getMarkIdByState();r.forEach((t=>{if(t){const r=t.getGraphics(),n=t.hasAnimationByState&&t.hasAnimationByState("state");r&&r.length&&(i&&a[i]&&a[i].includes(t.id)&&r.forEach((t=>{mc(t,i,n)})),e&&a[e]&&a[e].includes(t.id)&&r.forEach((t=>{s.includes(t)&&mc(t,e,n)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const Kc=[...Object.keys(Sc),"normal"];function zc(t={},e,i){const s={};for(let a=0;a<Kc.length;a++){const n=Kc[a],o=e?e[n]:void 0;if(!1===o)continue;if("normal"===n){o&&(s.normal=o);continue}if("state"===n){!1!==o&&(s.state=null!=o?o:Sc.state);continue}if("update"!==n&&!o&&!t[n])continue;let l,h;l=r.isArray(t[n])?t[n]:[Object.assign(Object.assign({},Sc[n]),t[n])],"exit"===n&&l.forEach((t=>{t.controlOptions={stopWhenStateChange:!0}})),o?(h=r.isArray(o)?o.map(((t,e)=>{var s;let r=t;return Xc(r)&&delete r.type,r.oneByOne&&(r=Wc(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:$c,null==i?void 0:i.dataCount)),r})):l.map(((t,e)=>{var s;let r=kl({},l[e],o);return Xc(r)&&delete r.type,r.oneByOne&&(r=Wc(r,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:$c,null==i?void 0:i.dataCount)),r})),s[n]=h):s[n]=l}return s}function Hc(t,e,i){var s,a,n,o,l,h;const c={};return r.isValid(e.animationAppear)&&(c.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),r.isValid(e.animationDisappear)&&(c.disappear=null!==(a=e.animationDisappear[t])&&void 0!==a?a:e.animationDisappear),r.isValid(e.animationEnter)&&(c.enter=null!==(n=e.animationEnter[t])&&void 0!==n?n:e.animationEnter),r.isValid(e.animationExit)&&(c.exit=null!==(o=e.animationExit[t])&&void 0!==o?o:e.animationExit),r.isValid(e.animationUpdate)&&(c.update=null!==(l=e.animationUpdate[t])&&void 0!==l?l:e.animationUpdate),r.isValid(e.animationState)&&(c.state=null!==(h=e.animationState[t])&&void 0!==h?h:e.animationState),e.animationNormal&&e.animationNormal[t]&&(c.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return qc(t=r.cloneDeep(t,null,i),(t=>{var i;return r.isFunction(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t?(...i)=>t(...i,e):t}),i),t}(c,i)}function Wc(t,e,i){const{oneByOne:s,duration:a,delay:n,delayAfter:o}=t;return t.delay=(t,i,o)=>{const l=e(t,o),h=r.isFunction(a)?a(t,i,o):r.isValidNumber(a)?a:0,c=r.isFunction(n)?n(t,i,o):r.isValidNumber(n)?n:0;let d=r.isFunction(s)?s(t,i,o):s;return!1===d?c:(d=!0===d?0:d,c+l*(h+d))},t.delayAfter=(t,n,l)=>{const h=e(t,l),c=r.isFunction(a)?a(t,n,l):r.isValidNumber(a)?a:0,d=r.isFunction(o)?o(t,n,l):r.isValidNumber(o)?o:0;let u=r.isFunction(s)?s(t,n,l):s;return!1===u?d:(u=!0===u?0:u,d+((i?i():n.parent.count-1)-h)*(c+u))},delete t.oneByOne,t}function $c(t,e){var i;return null!==(i=null==t?void 0:t[Ol])&&void 0!==i?i:e.context.graphicIndex}function Yc(t,e){var i,s,r,a,n;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(r=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==r?r:t.animationAppear),l=!1!==(null!==(n=null===(a=t.animationUpdate)||void 0===a?void 0:a[e])&&void 0!==n?n:t.animationUpdate);return!(!o||!l)}function Xc(t){return!function(t){return r.isValid(t.timeSlices)}(t)&&r.isValid(t.channel)}function qc(t,e,i=[]){if(r.isArray(t))t.forEach(((s,r)=>{t[r]=e(t[r],r),qc(t[r],e,i)}));else if(r.isObject(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),qc(t[s],e,i))}function Zc(t){var e,i,s,r,a,n;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(r=t.getMarks())||void 0===r||r.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(n=null===(a=t.getRawData())||void 0===a?void 0:a.latestData)||void 0===n?void 0:n.length)>=l)}var Qc=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const Jc={[mo.markPoint]:!0,[mo.markLine]:!0,[mo.markArea]:!0},td={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class ed extends Ch{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,a,n;super(e),this.type="chart",this.id=Z(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:El,height:wl},this._viewRect={width:El,height:wl},this._viewBox={x1:0,y1:0,x2:El,y2:wl},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>r.array(t).some((t=>r.isValid(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(td).some((t=>!r.isNil(e[t])))},this._paddingSpec=Tl(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new Gl(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new jc(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(a=this._option)||void 0===a?void 0:a.disableTriggerEvent),componentShowContent:null===(n=this._option)||void 0===n?void 0:n.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Gc;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const a=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const n=i.find((e=>e.regionId===a&&r.isEqual(e.config,t)));if(n)n.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:a,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=J.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(zc({},Hc("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||r.isValid(t.gradient))return;const e=r.pickWithout(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=J.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:Sh.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,e){if(!t)return;const{spec:i}=e,s=Qc(e,["spec"]),r=new t(i,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,e){if(!t)return;const{spec:i}=e,s=Qc(e,["spec"]);let a;if(r.isValid(i.regionId)?a=this.getRegionsInUserId(i.regionId):r.isValid(i.regionIndex)&&(a=this.getRegionsInIndex([i.regionIndex])[0]),!a&&!(a=this._regions[0]))return;const n=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:i.type,region:a,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));n&&(n.created(),this._series.push(n),a.addSeries(n))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(r.isString(t))return this.getAllModels().find((e=>e.userId===t));if(r.isFunction(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=J.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(zl.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(zl.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(zl.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof Ph)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;return this.getComponentByUserId(t)||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof yc))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof yc)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const r=this._dataSet.getDataView(t);r&&(r.markRunning(),r.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){r.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),r.array(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Ql(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=vh(this._spec,this._option,{width:El,height:wl})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(r.isArray(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=ul(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Uc(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){bh(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=ul(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),r=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return r.length>0&&r.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=this._getSpecKeys(this._spec),n=this._getSpecKeys(t);if(!r.isEqual(a,n)&&!this._canChangeSpecKeysWithoutRemake(a,n))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const o=Array.from(new Set([...a,...n])).sort();for(let e=0;e<o.length;e++){const i=o[e],a=this._spec[i],n=t[i];if(r.isArray(a)&&a.length!==r.array(n).length&&!this._canChangeMarkerComponentsWithoutRemake(i,a,n))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s}const l=this._spec,h=this._isOnlyMarkerComponentsRemoved(this._spec,t,o),c=this._isOnlyComponentSpecsChanged(this._spec,t,o),d=this._isOnlySeriesSpecsChanged(this._spec,t,o),u=!(!c&&!d)||this._isOnlyComponentOrSeriesSpecsChanged(this._spec,t,o);if(this._spec=t,h)return this._removeMarkerComponentsForEmptySpecs(s),s;if(this.updateChartConfig(s,l),s.reMake)return this.setLayoutTag(!0,null,!1),s;if(this.updateGlobalScale(s),s.reMake)return this.setLayoutTag(!0,null,!1),s;if(this.updateRegionSpec(s),s.reMake)return this.setLayoutTag(!0,null,!1),s;const p=this.updateComponentSpec(s);return s.reMake?(this.setLayoutTag(!0,null,!1),s):(!c&&(null===(e=s.effects)||void 0===e?void 0:e.localOnly)&&delete s.effects.localOnly,function(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}(s)?s:c&&!p.hasNonComponentOnlyUpdate&&(_h(s)||this._isComponentScaleDomainOnlyUpdate(s))?(p.componentOnlyUpdatedComponents.forEach((t=>{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),u&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=Tl(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{bh(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},a={[mo.title]:!0,[mo.brush]:!0,[mo.indicator]:!0},n=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===mo.label||l.type===mo.totalLabel)return void(l.getSpecInfo()||(n.push(l),o=!0,i=!0));a[l.type]&&(a[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(r.isArray(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void n.push(l);s[d].componentCount++;const a=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},o=l.getSpec(),h=l.updateSpec(a,u);_h(h)||this._isComponentScaleDomainOnlyUpdate(h)?e.push(l):r.isEqual(o,a)||(i=!0),bh(t,h)}else{const s=l.getSpec(),a=l.updateSpec(u);_h(a)||this._isComponentScaleDomainOnlyUpdate(a)?e.push(l):r.isEqual(s,u)||(i=!0),bh(t,a)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}n.length&&(n.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(a).forEach((e=>{if(a[e]){const i=this._spec[e];(r.isArray(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(Jc[t]&&r.isArray(e)&&r.isArray(i))&&!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake)}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return Jc[t]&&r.isArray(e)&&e.length>0&&r.isArray(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const a=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):r.isEqual(t[i],e[i])));return s&&a}_isComponentSpecKey(t){return!!Jc[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const a=t,n=e,o=i.every((t=>!!r.isEqual(a[t],n[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&o}_isOnlySeriesSpecsChanged(t,e,i){var s,a;let n=!1;const o=t,l=e,h=null!==(a=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==a?a:{},c=i.every((t=>!!r.isEqual(o[t],l[t])||!!h[t]&&(n=!0,!0)));return n&&c}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,a;let n=!1;const o=t,l=e,h=null!==(a=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==a?a:{},c=i.every((t=>!!r.isEqual(o[t],l[t])||!(!this._isComponentSpecKey(t)&&!h[t])&&(n=!0,!0)));return n&&c}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,r=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,a)=>{if(t.reMake)return;const n=i.specKey||i.type;Jc[n]&&!this._hasComponentForSpecInfo(n,a)&&(this._isMarkerAdditionSpecSafeWithoutRemake(a.spec)?(this._createComponent(i,a),e[n]&&e[n].componentCount++,s++,r=r||this._isAutoRangeMarkerSpec(a.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),r?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];bh(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:r,y2:a}=t;e={width:r-i,height:a-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=function(t,e,i){var s,a,n,o;const l={top:0,bottom:0,left:0,right:0};return Object.values(t).every((t=>r.isNumber(t)))?(l.top=null!==(s=t.top)&&void 0!==s?s:0,l.right=null!==(a=t.right)&&void 0!==a?a:0,l.bottom=null!==(n=t.bottom)&&void 0!==n?n:0,l.left=null!==(o=t.left)&&void 0!==o?o:0,l):([{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{l[s]=xl(t[s],e.size,i)}))})),l)}(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(zl.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(r.isEmpty(t[s]))continue;const a=t[s];let n={stateValue:s};n=r.isFunction(a.filter)?Object.assign({filter:a.filter},n):Object.assign(Object.assign({},a.filter),n),a.level&&(n.level=a.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(n),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(Eh.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Eh.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(Eh.STATE_SELECTED)}clearHovered(){this.clearState(Eh.STATE_HOVER)}_initEvent(){[zl.dataZoomChange,zl.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(Kl.AFTER_MARK_RENDER_END,e)};this._event.on(Kl.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?r.array(t):null)?Object.keys(t[0]):null,a=[],n=null!==(i=e.getDatum)&&void 0!==i?i:Vl;return this.getRegionsInQuerier(e.region).forEach((i=>{const o=[];t&&i.getSeries().forEach((l=>{l.getMarks().forEach((h=>{const c=h.getGraphics();if(c&&c.length&&(!e.filter||r.isFunction(e.filter)&&e.filter(l,h)))if((t=>"line"===t||"area"===t)(h.type))c.filter((r=>{const c=n(r,h,l,i);c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))))&&(o.push(r),a.push(r),e.callback&&e.callback(r,h,l,i))}));else if(t.length>1){const r=t.slice();c.forEach((t=>{const c=n(t,h,l,i),d=c&&r.findIndex((t=>s.every((e=>t[e]==c[e]))));d>=0&&(r.splice(d,1),o.push(t),a.push(t),e.callback&&e.callback(t,h,l,i))}))}else{const r=c.find((e=>{const r=n(e,h,l,i);return r&&s.every((e=>t[0][e]==r[e]))}));r&&(o.push(r),a.push(r),e.callback&&e.callback(r,h,l,i))}}))})),e.regionCallback&&e.regionCallback(o,i)})),a}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const r=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,r)}setDimensionIndex(t,e){var i,s;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Vc.dimensionHover||s===Vc.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const n=r.isNil(t)||!a||a.every((t=>Eo(t.axis.getScale().type)&&r.isNil(t.index))),o=n||a.every((t=>Eo(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(mo.tooltip)[0];if(null==t?void 0:t.getVisible())if(n||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:s,data:r}=t,a="left"===e.getOrient()||"right"===e.getOrient();r.forEach((t=>{var e,r,n;const o=a?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(n=null===(r=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===r?void 0:r[o])&&void 0!==n?n:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(mo.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(n?t.hideCrosshair():t.showCrosshair(a))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(mo.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(mo.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const id=(t,e)=>{var i;const s=t.spec,{regionId:a,regionIndex:n}=s;if(r.isValid(a)){const t=r.array(a);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(r.isValid(n))return r.array(n).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(r.isValid)},sd={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class rd{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},sd),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),r.isValid(t.stackInverse)&&t.region.forEach((e=>{!r.isValid(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),r.isValid(t.stackSort)&&t.region.forEach((e=>{!r.isValid(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,r)=>{const{spec:a,specPath:n,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(a,t,r),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(a,t):Cl(t,n,c.spec),Cl(r,null!=o?o:n,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const a={};return this.forEachRegionInSpec(t,e,a),this.forEachSeriesInSpec(t,e,a),null===(i=a.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=id(t,a))&&void 0!==i?i:a.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,a),Object.values(null!==(s=a.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,n;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=id(t,a))&&void 0!==i?i:a.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:a,seriesIndex:n}=s;if(r.isValid(a)){const t=r.array(a);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(r.isValid(n))return r.array(n).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(r.isValid)})(t,a);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(n=t.regionIndexes)&&void 0!==n?n:[]).forEach((t=>{var i,s;const r=null===(i=a.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),a}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,r,a,n,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(r=this._option.globalInstance)||void 0===r?void 0:r.isAnimationEnable(),animationThreshold:null!==(a=t.animationThreshold)&&void 0!==a?a:null===(o=(n=this._option).getTheme)||void 0===o?void 0:o.call(n,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(J.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(J.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const n=[],o=J.getComponents();let l,h,c,d;const u=[];for(let e=0;e<o.length;e++){const{cmp:i,alwaysCheck:r}=o[e];i.type.startsWith(mo.cartesianAxis)?l=i:i.type.startsWith(mo.polarAxis)?h=i:i.type===mo.geoCoordinate?c=i:(r||t[null!==(s=i.specKey)&&void 0!==s?s:i.type])&&(i.type===mo.tooltip?d=i:u.push(o[e]))}let p=!1;if(l){const s=l.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=J.getComponentInKey(t.type);n.push(e(s,t,i))})))}if(h&&!p){const s=h.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(p=!0,s.forEach((t=>{const s=J.getComponentInKey(t.type);n.push(e(s,t,i))})))}return c&&!p&&(null===(r=c.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{n.push(e(c,t,i))}))),u.sort(((t,e)=>t.createOrder-e.createOrder)),u.forEach((({cmp:s})=>{var r;null===(r=s.getSpecInfo?s.getSpecInfo(t,i):bc(t,s.specKey,s.type))||void 0===r||r.forEach((t=>{n.push(e(s,t,i))}))})),d&&(null===(a=bc(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{n.push(e(d,t,i))}))),n}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(r.isValid(i.seriesId)){if(r.array(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(r.isValid(i.seriesIndex)){if(r.array(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:a,barWidth:n,barGapInGroup:o}=i;let l=!1;r.isNumber(a)?(t.minBandSize=a,l=!0):r.isNumber(n)?(t.minBandSize=n,l=!0):r.isNumber(s)&&(t.minBandSize=s,l=!0),l&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:r.isArray(o)?o[o.length-1]:o})}}class ad extends rd{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const a=r.array(t.indicator),n=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return r.isValid(n)&&a.forEach((t=>{r.isNil(t.limitRatio)&&(t.limitRatio=n)})),a}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),r.isArray(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),r.isValid(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class nd extends ad{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class od extends nd{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class ld extends ed{constructor(){super(...arguments),this.transformerConstructor=nd}}ld.transformerConstructor=nd;const hd=(t,e,i,s)=>{let a;if(a=r.isFunction(t)?t(e,i):r.isPlainObject(t)&&r.isValid(t.field)?r.get(e,t.field):t,s){const{formatFunc:i,args:r}=function(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const r=J.getFormatter();return e&&r?{formatFunc:r,args:[i,s,e]}:{}}(void 0,s,t,e);i&&r&&(a=i(...r))}return a};var cd=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]])}return i};const dd=(t,e)=>!(e&&(!1===e.visible||e[t]&&!1===e[t].visible||e.activeType&&!(r.isArray(e.activeType)?e.activeType.includes(t):e.activeType===t)));function ud(t,e,i,s,a,n){const o=e=>{if(e){const o={datum:a},l=r.isNil(e.key)&&r.isNil(e.value)&&!r.isEmpty(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:u,value:p,valueFormatter:g,valueTimeFormat:m,valueTimeFormatMode:f}=l,v=cd(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=gd(hd(h,a,n,c),d,u),o.value=gd(hd(p,a,n,g),m,f),Object.keys(v).forEach((t=>{o[t]=hd(l[t],a,n)})),!1!==o.visible&&(r.isValid(o.key)||r.isValid(o.value))&&t.push(o)}};r.isArray(e)?e.forEach((t=>{o(t)})):o(e)}function pd(t,e,i,s,a,n,o){r.isFunction(e)?ud(t,e(a,o),i,s,n,o):e&&ud(t,e,i,s,n,o)}const gd=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=r.TimeUtil.getInstance();return e=e||"%Y%m%d",("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},md=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],fd=(t,e,i,s,a)=>{var n,o,l;const h={activeType:t};switch(t){case"mark":case"group":if(i){const l=null===(n=i.getSpec())||void 0===n?void 0:n.tooltip;return h.visible=!0,(null==l?void 0:l.handler)&&(h.handler=l.handler),(null===(o=h.handler)||void 0===o?void 0:o.showTooltip)?h:((null==l?void 0:l[t])&&md.forEach((e=>{r.isValid(l[t][e])&&(h[e]=l[t][e])})),Object.assign(Object.assign({},h),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,a)))}break;case"dimension":if(null==s?void 0:s.length){if(vd(s).every((t=>{var e;return!dd("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?h.visible=!1:h.visible=!0,h.handler=e.handler,null===(l=h.handler)||void 0===l?void 0:l.showTooltip)return h;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:n}=r,o=n.tooltipHelper.getTooltipData(t,e,s,r.datum,a);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},vd=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{r.isValid(t.series)&&e.push(t.series)}))})),e},yd={key:"其他",value:"..."};var _d;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(_d||(_d={}));class bd{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,a;if(r.isNil(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const n=this._cacheActiveSpec;if(r.isNil(n)||!1===n.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=n;const{title:o,content:l}=n,h=r.isNil(null==o?void 0:o.key)&&r.isNil(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(zl.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:h,tooltipData:t,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(i=n.handler)||void 0===i?void 0:i.showTooltip)?c=n.handler.showTooltip.bind(n.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(a=c(this.activeType,t,e))&&void 0!==a?a:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,a,n,o,l,h,c,d;const{changePositionOnly:u,model:p}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=fd(this.activeType,this.component.getSpec(),p,t,e),this._cacheActiveSpec){r.isNil(this._cacheActiveSpec.handler)&&r.isValid(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const p=null!==(i=u[this.activeType])&&void 0!==i?i:{},g=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:p.updateTitle,m=null!==(a=this._cacheActiveSpec.updateContent)&&void 0!==a?a:p.updateContent,f=null!==(o=null!==(n=this._cacheActiveSpec.maxLineCount)&&void 0!==n?n:p.maxLineCount)&&void 0!==o?o:20;if(g&&(this._cacheActiveSpec.title=null!==(l=g(this._cacheActiveSpec.title,t,e))&&void 0!==l?l:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(h=m(this._cacheActiveSpec.content,t,e))&&void 0!==h?h:this._cacheActiveSpec.content;else if(f>=1&&(null===(c=this._cacheActiveSpec.content)||void 0===c?void 0:c.length)>f){const t=null!==(d=this._cacheActiveSpec.othersLine)&&void 0!==d?d:p.othersLine,e=t?Object.assign(Object.assign({},yd),t):yd;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,f-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[f-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&!r.isNil(e)&&dd(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class Sd extends bd{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,s){var r,a,n;const{datum:o,series:l}=t,h=this.component.getSpec(),c=[{datum:[o],series:l}],d=l.tooltipHelper,u=null===(r=l.getSpec())||void 0===r?void 0:r.tooltip,p=null===(a=null==u?void 0:u.mark)||void 0===a?void 0:a.checkOverlap;let g=!1;if(!0===p||!0===(null===(n=h.mark)||void 0===n?void 0:n.checkOverlap)&&!1!==p){const t=null==d?void 0:d.activeTriggerSet.mark;if(t){g=!0;const s=this.component.getChart().getCompiler().getStage().getLayer(void 0),r={x:e.event.viewX,y:e.event.viewY};s.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},r),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(r.x,r.y,i.IContainPointMode.GLOBAL,t.stage.getPickerService())&&c[0].datum.push(Vl(t))}))}))}}const m=Object.assign(Object.assign({},e),{model:l,changePositionOnly:s,tooltip:this.component});if(s&&g){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===c[0].series&&t[0].datum.length===c[0].datum.length&&!t[0].datum.some(((t,e)=>t!==c[0].datum[e]))||(m.changePositionOnly=!1)}return this._showTooltipByHandler(c,m)}getMouseEventData(t){var e;let i,s;const r=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===r){const e=t.model,r=e.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,n=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==n?void 0:n.has(t.mark))&&(s=!0)}else if("component"===r){const e=t.model,r=t.node;if("label"===e.name&&r){const t=e.getLabelInfoByTextGraphic(r),{baseMark:a,series:n,labelMark:o}=null!=t?t:{},l=n.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:a,datum:r.attribute.data,series:n}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const Ad=`${Ml}_ARC_TRANSFORM_VALUE`,xd=`${Ml}_ARC_RATIO`,Td=`${Ml}_ARC_START_ANGLE`,Cd=`${Ml}_ARC_END_ANGLE`,kd=`${Ml}_ARC_K`,Md=`${Ml}_ARC_MIDDLE_ANGLE`,Ed=`${Ml}_ARC_QUADRANT`,wd=`${Ml}_ARC_RADIAN`,Od=-Math.PI/2,Pd=3*Math.PI/2;class Bd extends yc{constructor(t,e){super(t,e),this.type=Dd.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var r;return s+(null!==(r=this.getAttribute("radiusOffset",e,i))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s)=>r.polarToCartesian({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Md])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Dd extends Bd{constructor(){super(...arguments),this.type=Dd.type}}Dd.type="arc";class Id extends Bd{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=Id.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Id.type="arc3d";const Rd=()=>{$n.registerBuiltInAnimate("growRadiusIn",lo),$n.registerBuiltInAnimate("growRadiusOut",ho),$n.registerBuiltInAnimate("growAngleIn",qn),$n.registerBuiltInAnimate("growAngleOut",Zn),kn(),gh(),J.registerGraphicComponent("arc3d",i.createArc3d),J.registerMark("arc3d",Id)},Ld={label:{name:"label",type:"text"}},Fd={data:!0},Nd={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},jd=Object.assign(Object.assign({},Ld),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),Ud=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};class Vd{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,a=s.getSeriesField();return{seriesFields:r.isValid(a)?r.array(a):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(r.isValid(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of r.array(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(r.isValid(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,r,a,n,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(r=null==i?void 0:i[t])||void 0===r?void 0:r[m]),null===(a=this.spec)||void 0===a?void 0:a[t]),null===(o=null===(n=this.spec)||void 0===n?void 0:n[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,a,n){var o;return function(t,e,i,s,a,n){if(a&&a.length){const o=[];return a.forEach((a=>{r.isArray(t)?t.forEach((t=>{pd(o,t,e,i,s,a,n)})):r.isFunction(t)?pd(o,t,e,i,s,a,n):t&&ud(o,t,e,i,a,n)})),o}return null}(null!==(o=null==e?void 0:e.content)&&void 0!==o?o:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,a,n)}getTitleResult(t,e,i,s,a){let n=r.isFunction(e)?e(s,a):e;if(n?r.isNil(n.value)&&(n=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),n)):n=this.getDefaultTitlePattern(t),n&&!1!==n.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:hd(n.visible,t,a),value:gd(hd(n.value,t,a,n.valueFormatter),n.valueTimeFormat,n.valueTimeFormatMode),valueStyle:hd(n.valueStyle,t,a),hasShape:n.hasShape};return Object.keys(i).forEach((s=>{e[s]=hd(i[s],t,a)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,r){var a,n;if(!(this.enableByType(t)&&dd(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(n=null===(a=this.spec)||void 0===a?void 0:a[t])&&void 0!==n?n:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;return"dimension"===t?(c=[],this.getContentList(t,o,l,i,s,r).forEach((t=>{c.push(t)}))):c=this.getContentList(t,o,l,i,s,r),{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,r),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const Gd={min:t=>t.length?r.minInArray(t.map((t=>1*t))):0,max:t=>t.length?r.maxInArray(t.map((t=>1*t))):0,"array-min":t=>t.length?r.minInArray(t.map((t=>1*t))):0,"array-max":t=>t.length?r.maxInArray(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},Kd=(t,e)=>{var i,s;let a=e.fields;if(r.isFunction(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return{};a=jl([],a);const n="parser"===e.target?"parserData":"latestData",o=t[0][n]?t[0][n]:t||[],l=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return zd(o,a,l)},zd=(t,e,i)=>{const s={};let a=[],n=[];return e.forEach((e=>{const o=e.key;s[o]={};const l=null==i?void 0:i[o],h=e.operations,c=h.some((t=>"min"===t||"max"===t||"allValid"===t));let d=!0;a.length=0,t&&t.forEach((t=>{t&&a.push(t[o])}));const u=a.length;if(c){n.length=0,a.forEach(((t,e)=>{So(t)&&n.push(t)}));const t=a;a=n,n=t,d=a.length===u}else a=h.some((t=>"array-min"===t||"array-max"===t))?a.reduce(((t,e)=>(e&&e.forEach((e=>{So(e)&&t.push(e)})),t)),[]):a.filter((t=>void 0!==t));e.filter&&(a=a.filter(e.filter)),h.forEach((t=>{if(e.customize)s[o][t]=e.customize;else{if(l&&!0===l.lockStatisticsByDomain&&!r.isNil(l.domain)){if("values"===t)return void(s[o][t]=l.domain.slice())}else if("allValid"===t)return;s[o][t]=Gd[t](a),"array-max"===t&&(s[o].max=s[o][t]),"array-min"===t&&(s[o].min=s[o][t])}})),c&&(s[o].allValid=d)})),s},Hd=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:r}=i();return"zero"!==s||r&&r.length&&t.forEach((t=>{r.forEach((e=>{So(t[e])||(t[e]=0)}))})),t};function Wd(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function $d(t,e,i){t&&(i.needDefaultSeriesField&&(t[Bl]=i.defaultSeriesField),t[Ol]=e,t[Pl]=i.getKey(t,e,i))}class Yd extends kh{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=r.array(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,a;const n=hl(t),o=null===(i=this._option)||void 0===i?void 0:i.getTheme,l=this._option.type,h=J.getSeriesMarkMap(l)?function(t,e,i){const s=J.getSeriesMarkMap(e);if(!s)return t;const a={};return Object.values(s).forEach((({type:e,name:s})=>{a[s]=kl({},i("mark",r.array(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),a)}(o("series",l),l,o):{},c=o("series",`${l}_${n}`);return kl({},h,c,(null!==(a=null!==(s=this.stack)&&void 0!==s?s:null==c?void 0:c.stack)&&void 0!==a?a:null==h?void 0:h.stack)?o("series",`${l}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){r.isBoolean(t.stack)&&(this.stack=t.stack),r.isBoolean(t.percent)&&(this.stack=t.percent||this.stack),r.isNil(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",a=!0,n){t&&r.array(t[i]).forEach((i=>{var o,l,h;if(i&&i.visible){const{animation:c=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:m=!0,animationExit:f=!0}=t,v=!!(null!==(h=null!==(l=null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&void 0!==l?l:t.animation)&&void 0!==h?h:i.animation)&&!!a;this.addLabelSpec(r.isFunction(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&c,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&m&&u)&&m,animationExit:!!(v&&m&&p)&&f,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),n)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:a,direction:n}=t;return r.isValid(s)&&(i.outerRadius=s),r.isValid(a)&&(i.innerRadius=a),r.isValid(n)&&(i.direction=n),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),a=t=>{const e=kl({},i,s,t),a=i.label;return a&&r.isObject(a)&&r.isArray(e.label)&&(e.label=e.label.map((t=>kl({},a,t)))),e};return r.isArray(t)?{spec:t.map((t=>a(t))),theme:i}:{spec:a(t),theme:i}}return{spec:t,theme:i}}}function Xd(t){return t===go["desktop-browser"]||t===go["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:function(t){return bo(t)||"mobile-browser"===t}(t)||bo(t)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null}const qd=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(Nd[e]||(t[e]=!0),t)),{}),Zd={compileOnlyKeys:Nd,dataRelatedKeys:qd,seriesOnlyKeys:{tooltip:!0}},Qd={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Jd=t=>(t=>r.isObject(t)&&!r.isArray(t)&&!r.isFunction(t))(t)?t:r.isNil(t)?{}:null,tu=(t,e,i)=>{const s=Jd(t),a=Jd(e);if(!s||!a)return!1;let n=!1;const o=Array.from(new Set([...Object.keys(a),...Object.keys(s)]));for(const t of o)if(!r.isEqual(s[t],a[t])){if(!i[t])return!1;n=!0}return n};function eu(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class iu extends Ph{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){r.isValid(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Ml}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Yd,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=Sh.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(zl.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Zc(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(zl.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return r.isNil(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),r.isValid(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($l(this._rawData.dataSet,"invalidTravel",Hd),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=Zl(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=ql(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=ql(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new $h(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,a;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(r.isNil(this._rawStatisticsCache[t].min)||r.isNil(this._rawStatisticsCache[t].max))||!e&&r.isNil(this._rawStatisticsCache[t].values))if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=r.minInArray(i.domain),this._rawStatisticsCache[t].max=r.maxInArray(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=zd(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=r.merge(null!==(a=this._rawStatisticsCache[t])&&void 0!==a?a:{},i)}}return this._rawStatisticsCache[t]}_statisticViewData(){$l(this._dataSet,"dimensionStatistics",Kd);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new s.DataView(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&jl(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){$l(this._dataSet,"dimensionStatistics",Kd);const r=new s.DataView(this._dataSet,{name:t});return r.parse([e],{type:"dataview"}),r.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=jl(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&jl(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),r}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new s.DataView(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return r.isNil(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,r=this._getSeriesDataKey(t);return void 0===s.get(r)?(s.set(r,0),r):(s.set(r,s.get(r)+1),`${r}_${s.get(r)}`)}:r.isString(t)?e=>e[t]:r.isArray(t)&&t.every((t=>r.isString(t)))?e=>t.map((t=>e[t])).join("-"):r.isFunction(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($l(this._rawData.dataSet,"addVChartProperty",Ud),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Wd.bind(this),call:$d}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(zl.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(zl.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(zl.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(zl.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||r.isNil(e)?null:t[e]}getDatumPositionValues(t,e){return!t||r.isNil(e)?[]:r.isString(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,a){var n;const o=this._createMark({type:t.type,name:r.isValid(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(o){if(r.isValid(t.id)&&o.setUserId(t.id),a.hasAnimation&&!1!==t.animation){const e=zc({},Hc(t.type,t,this._markAttributeContext));o.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(n=t.children)||void 0===n||n.forEach(((t,e)=>{this._createExtensionMark(t,o,i,e,a)}))),!r.isNil(t.dataId)||!r.isNil(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?o.setData(this._data):(o.setDataView(e),e.target.addListener("change",(()=>{o.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:r.isValid(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=Xd(this._option.mode);let i=Object.assign({},null==e?void 0:e.hover),s=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;r.isBoolean(a)?i.enable=a:r.isObject(a)&&(i.enable=!0,i=kl(i,a));const n=this._spec.select;r.isBoolean(n)?s.enable=n:r.isObject(n)&&(s.enable=!0,s=kl(s,n));const o=[{trigger:{type:"dimension-hover"},marks:t}];if(i.enable){const e=_c(i,t);e.length&&o.push({trigger:this._defaultHoverConfig(i),marks:e})}if(s.enable){const e=_c(s,t);e.length&&o.push({trigger:this._defaultSelectConfig(s),marks:e})}return o}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:Eh.STATE_HOVER_REVERSE,highlightState:Eh.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=r.isValid(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:Eh.STATE_SELECTED_REVERSE,state:Eh.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=_c(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Bl;this.getMarksWithoutRoot().forEach((t=>{const s={},a={},n={};e.forEach((e=>{var i;const r=null===(i=e[t.name])||void 0===i?void 0:i.style;r&&(s[e.name]=!0,n[e.name]=n[e.name]||{},Object.keys(r).forEach((t=>{a[t]=!0,n[e.name][t]=r[t]})))})),t.state.addStateInfo({stateValue:Dl,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const o={};Object.keys(a).forEach((e=>{o[e]=s=>{var a,o;let l;if(Array.isArray(s)){if(0===s.length)return;l=null===(a=n[s[0][i]])||void 0===a?void 0:a[e]}return l=null===(o=n[s[i]])||void 0===o?void 0:o[e],r.isValid(l)?l:t.getAttribute(e,s)}})),this.setMarkStyle(t,o,Dl,xh.User_SeriesStyle)}))}afterInitMark(){this.event.emit(zl.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",xh.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(J.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new Vd(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!r.isEqual(e,t[i]))))&&(i.reCompile=!0,eu(i))}_getSpecUpdatePolicy(){return Zd}_compareSpec(t,e,i){var s,a,n,o,l;const h=super._compareSpec(t,e),c=Object.keys(e||{}).sort(),d=Object.keys(t||{}).sort();if(!r.isEqual(c,d))return h.reMake=!0,h;const u=this._getSpecUpdatePolicy(),p=null!==(s=u.compileOnlyKeys)&&void 0!==s?s:{},g=null!==(a=u.dataRelatedKeys)&&void 0!==a?a:{},m=null!==(n=u.compileOnlySubKeys)&&void 0!==n?n:{},f=null!==(o=u.seriesOnlyKeys)&&void 0!==o?o:{},v=Object.assign(Object.assign({},p),g),y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Fd),v),f),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(r.array(t.extensionMark),r.array(e.extensionMark),h),!h.reMake&&this._compareLabelSpec(r.array(t.label),r.array(e.label),h),!h.reMake&&this._compareLabelSpec(r.array(t.totalLabel),r.array(e.totalLabel),h),h.reMake)return h;const _=this._getMarkSpecNamesForCompare().filter((i=>tu(t[i],e[i],Qd)));_.forEach((t=>{y[t]=!0})),!h.reCompile&&_.length&&(h.reCompile=!0);const b=c.filter((i=>v[i]&&!r.isEqual(t[i],e[i]))),S=c.filter((i=>f[i]&&!r.isEqual(t[i],e[i]))),A=c.filter((i=>m[i]&&tu(t[i],e[i],m[i])));return A.forEach((t=>{y[t]=!0})),h.reCompile||!b.length&&!A.length||(h.reCompile=!0),b.some((t=>g[t]))?eu(h,!0):h.reCompile&&!(null===(l=h.effects)||void 0===l?void 0:l.series)&&(b.length||A.length||_.length)&&eu(h),S.length&&((x=h).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),c.some((i=>!y[i]&&!r.isEqual(t[i],e[i])))?(h.reMake=!0,h):h;var x}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof s.DataView||Ql(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec(),Zc(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){r.isValidNumber(t.x)&&(this._layoutStartPoint.x=t.x),r.isValidNumber(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){r.isValidNumber(t)&&(this._layoutRect.width=t),r.isValidNumber(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),r=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,a=new Map;return null==r||r.forEach((e=>{const i=this.getSeriesFieldValue(e,t);a.has(i)||a.set(i,e)})),e.map((e=>{var i;const r=null!==(i=a.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:r,style:this.getSeriesStyle(r),shapeType:s}}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Bl,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new yl).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return ul(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Bl}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,a,n,o,l;const{key:h,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,parent:m,isSeriesMark:f,noSeparateStyle:v=!1}=e,y=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:v,parent:!1!==m?null!=m?m:this._rootMark:null});if(r.isValid(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),f&&(this._seriesMark=y),r.isNil(g)?y.setData(this._data):!1!==g&&y.setDataView(g),y.setSkipBeforeLayouted(!1!==d),r.isNil(c)||y.setGroupKey(c);const h=null!==(s=i.morph)&&void 0!==s&&s,m=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(h?1:0),v=(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||(h?`${this.getSpecIndex()}_${m}`:void 0),_=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:h,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:v,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});y.setMarkConfig(_),this.initMarkStyleWithSpec(y,kl({},u,p||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Pl}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),a=i?t[i]:void 0;let n,o=!1;for(let a=0;a<s.length;a++){const l=s[a],h=t[l];e+=`${a>0?"_":""}${r.isNil(h)?"":h}`,o||(o=l===i),n=h}return!i||o||s.length>1&&n===a||(e+=`_${a}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Rl&&t!==Fl&&t!==Il&&t!==Ll||(t=this.getStackValueField()),null!==(e=function(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>So(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Bl]}}iu.mark=Ld,iu.transformerConstructor=Yd;class su extends iu{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=r.isValid(t)?r.array(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=r.isValid(t)?r.array(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=r.array(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(r.isNil(t)||r.isNil(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(r.array(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(r.array(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ko(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ko(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),r.isValid(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),r.isValid(this._spec.radius)&&(this._outerRadius=this._spec.radius),r.isValid(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),r.isValid(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(zl.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&function(t,e,i){const s=t.getScale(0),r="isInverse"in t&&t.isInverse();ko(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(r?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(r?-1:1)))}(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function ru(t){return So(t)?Number.parseFloat(t):0}const au=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:a,asRadian:n,asRatio:o,asQuadrant:l,asK:h,showAllZero:c,supportNegative:d,showEmptyCircle:u}=e,p=e.angleField(),g=e.startAngle(),m=e.endAngle(),f=e.minAngle(),v=t.map((t=>Object.assign({},t)));if(!v||0===v.length)return v;if(!c&&u&&nu(v,p,d))return[];const y=(t,e,o)=>{t[i]=e,t[s]=e+o,t[a]=e+o/2,t[n]=o,t[l]=r.computeQuadrant(e+o/2)};let _=0,b=-1/0,S=!0;for(let t=0;t<v.length;t++){const e=d?Math.abs(ru(v[t][p])):ru(v[t][p]);_+=e,b=Math.max(e,b),S&&0!==e&&(S=!1),v[t][Ad]=e}const A=v.map((t=>Number(t[p]))),x=m-g;let T=g,C=x,k=0;const M=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),r=t.map((t=>(isNaN(t)?0:t)/i*s*100)),a=100*s,n=r.map((t=>Math.floor(t)));let o=n.reduce(((t,e)=>t+e),0);const l=r.map(((t,e)=>t-n[e]));for(;o<a;){let t=Number.NEGATIVE_INFINITY,e=null;for(let i=0;i<l.length;i++)l[i]>t&&(t=l[i],e=i);++n[e],l[e]=0,++o}return n.map((t=>t/s))}(A);if(v.forEach(((t,e)=>{const i=t[Ad],s=_?i/_:0;let r=s*x;r<f?(r=f,C-=f):k+=i;const a=T,n=T+r;t[o]=s,t[h]=b?i/b:0,t._percent_=M[e],y(t,a,r),T=n})),C<x)if(C<=.001){const t=x/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}else{const t=C/k;T=g,v.forEach((e=>{const i=e[n]===f?f:e[Ad]*t;y(e,T,i),T+=i}))}if(0!==_&&(v[v.length-1][s]=m),S&&c){const t=x/v.length;v.forEach(((e,i)=>{y(e,g+i*t,t)}))}return v},nu=(t,e,i)=>!!r.isNil(t)||0===t.length||!!t.every((t=>0===ru(t[e])))||!i&&0===t.reduce(((t,i)=>t+ru(i[e])),0);function ou(t,e,i){return(s,r,a)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,r,i)}:{overall:!1}}const lu=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:ou(t,!0,th.appear)}),hu={type:"fadeIn"},cu=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:ou(t,!0,th.enter)}),du=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:ou(t,!0,th.exit)}),uu=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:ou(t,!0,th.exit)});function pu(t,e){if(!1===e)return{};switch(e){case"fadeIn":return hu;case"growRadius":return lu(Object.assign(Object.assign({},t),{growField:"radius"}));default:return lu(Object.assign(Object.assign({},t),{growField:"angle"}))}}const gu=Object.assign(Object.assign({},Ld),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class mu extends Yd{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=kl({},this._theme,i,t);const a=(t,e)=>kl({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);r.isArray(s.label)?s.label=s.label.map((t=>a(t.position,t))):s.label=a(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:a}=t;return r.isValid(s)&&(i.centerX=s),r.isValid(a)&&(i.centerY=a),Object.keys(i).length>0?i:void 0}}const fu=`${Ml}_LABEL_VISIBLE`,vu={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},yu={outerRadius:!0};class _u extends su{constructor(){super(...arguments),this.transformerConstructor=mu,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:xl(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:xl(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Od,this._endAngle=Pd,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Md];if(r.isNil(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t),a=this.computeCenter(t);return r.polarToCartesian(a,(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,a,n;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const o=function(t,e){let i=0,s=2*Math.PI;const a=r.isValid(t),n=r.isValid(e);for(a||n?n?a?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(r.isValid(this._spec.startAngle)?r.degreeToRadian(this._spec.startAngle):this._startAngle,r.isValid(this._spec.endAngle)?r.degreeToRadian(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=r.isValid(this._spec.padAngle)?r.degreeToRadian(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(a=this._spec.showAllZero)&&void 0!==a&&a,this._supportNegative=null!==(n=this._spec.supportNegative)&&void 0!==n&&n}initData(){super.initData();const t=this.getViewData();if(!t)return;$l(this._dataSet,"pie",au),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>r.isValid(this._spec.minAngle)?r.degreeToRadian(this._spec.minAngle):0,asStartAngle:Td,asEndAngle:Cd,asRatio:xd,asMiddleAngle:Md,asRadian:wd,asQuadrant:Ed,asK:kd,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new s.DataView(this._dataSet,{name:`${Ml}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new $h(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},_u.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Pl,groupKey:this._seriesField,isSeriesMark:!0},{morph:Yc(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return xo(Td)(t)}endAngleScale(t){return xo(Cd)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const a=t();if(r.isNumber(a))return a;if(r.isFunction(a))return a(e(),i());const n=e();if("auto"===a&&n.width>0&&n.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return r.calculateMaxRadius(n,i(),t,e)}return Math.min(n.width/2,n.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Sl(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Sl(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",xh.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",xh.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,xh.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",xh.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:xo(fu).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(zl.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,r,a,n,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(n=null===(a=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===a?void 0:a.state)||void 0===n?void 0:n[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,r,a,n,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(n=null===(a=this.getSpec()[(null===(r=this._pieMark)||void 0===r?void 0:r.name)||"pie"])||void 0===a?void 0:a.state)||void 0===n?void 0:n[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(r.isNil(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),yu),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),vu)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const r=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(r.reRender=!0,r.change=!0),r}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Md];if(r.isNil(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t),a=this.computeCenter(t);return r.polarToCartesian(a,s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,r;if(i===th.appear)return this._startAngle;if(i===th.disappear)return this._endAngle;const a=[th.disappear,th.exit],n=this._pieMark.getGraphics(),o=null==t?void 0:t[Ol];if(void 0===n.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Ol])<o})))return this._startAngle;if(void 0===n.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Ol])>o})))return this._endAngle;const l=[...n].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Ol])<o}));return a.includes(i)?null===(s=null==l?void 0:l.getFinalAttribute())||void 0===s?void 0:s.endAngle:null===(r=null==l?void 0:l.attribute)||void 0===r?void 0:r.endAngle}},a=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._pieMark){const t=zc(null===(e=J.getAnimationInKey("pie"))||void 0===e?void 0:e(s,a),Hc("pie",this._spec,this._markAttributeContext));t.normal&&t.normal.type&&(t.normal=function(t,e){var i,s,a,n;const o=null!==(s=null===(i=e.options)||void 0===i?void 0:i.distance)&&void 0!==s?s:10,l=r.isValidNumber(e.duration)?e.duration/2:1e3,h=null!==(a=e.options.easing)&&void 0!==a?a:"cubicOut";return{oneByOne:e.oneByOne,loop:null!==(n=e.loop)&&void 0!==n&&n,timeSlices:[{duration:l,effects:{easing:h,channel:{x:{from:e=>t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+r.polarToCartesian({x:0,y:0},o,e[Md]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+r.polarToCartesian({x:0,y:0},o,e[Md]).y}}}},{duration:l,effects:{easing:h,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+r.polarToCartesian({x:0,y:0},o,e[Md]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+r.polarToCartesian({x:0,y:0},o,e[Md]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=zc(null===(i=J.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=a?a:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}_u.transformerConstructor=mu,_u.mark=gu,_u.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};(class extends _u{constructor(){super(...arguments),this.type=ol.pie}}).type=ol.pie;class bu extends mu{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class Su extends _u{constructor(){super(...arguments),this.type=$.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=bu}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",xh.Series)}initLabelMarkStyle(t,e={}){t&&(super.initLabelMarkStyle(t),this.setMarkStyle(t,{support3d:!0},void 0,xh.Mark))}}Su.type=$.pie3d,Su.mark=jd,Su.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},Su.transformerConstructor=bu;const Au=()=>{J.registerAnimation("pie3d",((t,e)=>({appear:pu(t,e),enter:cu(t),exit:du(t),disappear:uu(t)}))),Rd(),J.registerSeries(Su.type,Su)};class xu extends ld{constructor(){super(...arguments),this.transformerConstructor=od,this.type="pie3d",this.seriesType=$.pie3d}}xu.type="pie3d",xu.seriesType=$.pie3d,xu.transformerConstructor=od;const Tu="combinationCandlestick";class Cu extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){const e=[t.openField,t.highField,t.lowField,t.closeField],i=super._getDefaultSeriesSpec(t,["candlestick","openField","highField","lowField","closeField","rising","falling","doji"]);return i.yField=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),e.setDefaultCrosshairForCartesianChart(t)}}class ku extends e.GlyphMark{constructor(){super(...arguments),this.type=ku.type}setGlyphConfig(t){super.setGlyphConfig(t),this._subMarks={line:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"}},this._positionChannels=["x","boxWidth","open","close","high","low"],this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{const{x:s=i.attribute.x,boxWidth:r=i.attribute.boxWidth,open:a=i.attribute.open,close:n=i.attribute.close,low:o=i.attribute.low,high:l=i.attribute.high}=t,h={};return h.line={points:[{x:s,y:o},{x:s,y:l}]},h.box={x:s-r/2,x1:s+r/2,y:Math.min(a,n),y1:Math.max(a,n),drawStrokeWhenZeroWH:!0},h}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}ku.type="candlestick";class Mu extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:a,high:n,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(a)&&e.isValidNumber(l)&&(a>l?(h.from.open=o,h.to.open=a,h.from.close=o,h.to.close=l,e.isValidNumber(n)&&(h.from.high=o,h.to.high=n)):(h.from.open=n,h.to.open=a,h.from.close=n,h.to.close=l,e.isValidNumber(o)&&(h.from.low=n,h.to.low=o))),h})(this.target,this.params,this.params.options);return t}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Eu extends e.ACustomAnimate{constructor(t,e,i,s,r){super(t,e,i,s,r)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){const t=(t=>{const i=t.getFinalAttribute(),{x:s,y:r,open:a,high:n,low:o,close:l}=i,h={from:{x:s,y:r},to:{x:s,y:r}};return e.isValidNumber(a)&&e.isValidNumber(l)&&(a>l?(h.from.open=a,h.to.open=o,h.from.close=l,h.to.close=o,e.isValidNumber(n)&&(h.from.high=n,h.to.high=o)):(h.from.open=a,h.to.open=n,h.from.close=l,h.to.close=n,e.isValidNumber(o)&&(h.from.low=o,h.to.low=n))),h})(this.target,this.params,this.params.options);return t}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const wu="candlestick";var Ou,Pu;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(Ou||(Ou={})),function(t){t.candlestick="candlestick"}(Pu||(Pu={}));const Bu=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class Du extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case Ou.OPEN:return this.series.getOpenField();case Ou.HIGH:return this.series.getHighField();case Ou.LOW:return this.series.getLowField();case Ou.CLOSE:return this.series.getCloseField();case Ou.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case Ou.OPEN:return e[this.series.getOpenField()];case Ou.HIGH:return e[this.series.getHighField()];case Ou.LOW:return e[this.series.getLowField()];case Ou.CLOSE:return e[this.series.getCloseField()];case Ou.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>this.series.getMarkInName("candlestick").getAttribute("stroke",t)}getDefaultContentList(t){return[{key:this.getContentKey(Ou.OPEN),value:this.getContentValue(Ou.OPEN)},{key:this.getContentKey(Ou.HIGH),value:this.getContentValue(Ou.HIGH)},{key:this.getContentKey(Ou.LOW),value:this.getContentValue(Ou.LOW)},{key:this.getContentKey(Ou.CLOSE),value:this.getContentValue(Ou.CLOSE)},{key:this.getContentKey(Ou.SERIES_FIELD),value:this.getContentValue(Ou.SERIES_FIELD)}]}}const Iu={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class Ru extends e.CartesianSeries{constructor(){super(...arguments),this.type=wu,this._mergedStyles={rising:{},falling:{},doji:{}}}getOpenField(){return this._openField}getHighField(){return this._highField}getLowField(){return this._lowField}getCloseField(){return this._closeField}getBoxFill(){return this._boxFill}getStrokeColor(){return this._strokeColor}setAttrFromSpec(){var t,e,i,s,r,a,n,o;super.setAttrFromSpec();const l=this._spec,h=null!==(e=null===(t=l.candlestick)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._openField=l.openField,this._highField=l.highField,this._lowField=l.lowField,this._closeField=l.closeField,this._boxWidth=h.boxWidth,this._boxFill=h.boxFill,this._strokeColor=h.strokeColor,this._buildMergedStyles(h,null!==(s=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==s?s:{},null!==(a=null===(r=l.falling)||void 0===r?void 0:r.style)&&void 0!==a?a:{},null!==(o=null===(n=l.doji)||void 0===n?void 0:n.style)&&void 0!==o?o:{})}initMark(){this._candlestickMark=this._createMark(Ru.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const s={fill:t=>this.mergeStyle(t).boxFill,stroke:t=>this.mergeStyle(t).stroke,lineWidth:t=>this.mergeStyle(t).lineWidth,boxWidth:null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth.bind(this),x:this.dataToPositionX.bind(this)};i.setGlyphConfig({}),this.setMarkStyle(i,s,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,s=this._yAxisHelper;if(i&&s){const{dataToPosition:r}=s,a=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),a),high:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),a),low:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),a),close:t=>e.valueInScaleRange(r(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),a)},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}init(t){super.init(t),this.initCandlestickMarkStyle()}_initAnimationSpec(t={}){const i=e.merge({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{i[t]&&"scaleIn"===i[t].type?i[t].type="candlestickScaleIn":i[t]&&"scaleOut"===i[t].type&&(i[t].type="candlestickScaleOut")})),i}initAnimation(){var t;const i=e.getGroupAnimationParams(this);if(this._candlestickMark){const s=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),r=this._initAnimationSpec(e.userAnimationConfig(wu,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(s,r,i))}}initTooltip(){this._tooltipHelper=new Du(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,s,r){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,s),this._mergedStyles.doji=e.merge({},t,r)}mergeStyle(t){const e=this.getDatumPositionValues(t,this._openField)[0],i=this.getDatumPositionValues(t,this._closeField)[0];return e<i?this._mergedStyles.rising:e>i?this._mergedStyles.falling:this._mergedStyles.doji}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._xAxisHelper,e=this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}getActiveMarks(){return[this._candlestickMark]}}Ru.type=wu,Ru.builtInTheme={candlestick:Iu},Ru.mark=Bu;const Lu=()=>{e.registerGlyphMark(),e.registerLine(),e.registerRect(),e.Factory.registerGraphicComponent("line",(t=>e.createLine(t))),e.Factory.registerGraphicComponent("rect",(t=>e.createRect(t))),e.Factory.registerMark(ku.type,ku),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Mu),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",Eu),e.Factory.registerSeries(Ru.type,Ru)};class Fu extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Fu.type="candlestick",Fu.seriesType=wu,Fu.transformerConstructor=Cu;function Nu(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class ju extends e.CartesianChartSpecTransformer{needAxes(){return!0}transformSpec(t){this.transformRegion(t),void 0===t.tooltip&&(t.tooltip={}),this.transformSeriesSpec(t),this._transformAxisSpec(t),this._transformLayout(t)}transformRegion(t){var e,i;const s=t;s.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&s.region.push(null!==(i=t.previewRegion)&&void 0!==i?i:{})}transformSeriesSpec(t){var i;t.series=null!==(i=t.series)&&void 0!==i?i:[],t.series.forEach((e=>{this._transformSeriesData(t,e),e.regionIndex=0}));const s=t.series.find((e=>e.id===t.candlestickSeries.id));let r;s?(e.merge(s,t.candlestickSeries),r=s):(t.series.push(t.candlestickSeries),r=t.candlestickSeries),Nu(r),this._transformSeriesData(t,r),r.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const s=t.series.find((t=>t.id===i.id));let r;s?(e.merge(s,i),r=s):(t.series.push(i),r=i),r.regionIndex=1,this._transformSeriesData(t,r)}))}_transformSeriesData(t,i){var s;i.data&&(t.data=e.array(null!==(s=t.data)&&void 0!==s?s:[]),e.array(i.data).forEach(((e,s)=>{t.data.push(e),0===s&&(i.dataIndex=t.data.length-1,"id"in e?i.dataId=e.id:"name"in e&&(i.dataId=e.name))})),delete i.data)}_transformAxisSpec(t){super._transformAxisSpec(t),t.previewSeries&&(t.previewAxes||(t.previewAxes={type:"linear",orient:"left",visible:!1}),t.previewAxes.regionIndex=[1],t.axes.push(t.previewAxes),t.axes.forEach((e=>{e!==t.previewAxes&&("left"!==e.orient&&"right"!==e.orient||(e.regionIndex=[0]))})))}_transformDataZoomSpec(t){t.dataZoom&&e.array(t.dataZoom).forEach((t=>{"left"!==t.orient&&"right"!==t.orient||(t.regionIndex=[0])}))}_transformLayout(t){var i,s;const r={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let a=0,n=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&a++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?a++:n++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?a++:n++)})),t.axes){const i={top:!1,bottom:!1,left:!1,right:!1,z:!1};e.array(t.axes).forEach((t=>{i[t.orient]||(i[t.orient]=!0,"top"===t.orient||"bottom"===t.orient?a++:n++)}))}a++,n++,t.previewSeries&&a++,r.row=a,r.col=n;const o={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(s=t.title)||void 0===s?void 0:s.visible)&&this._layoutOrientItem(r,t.title,o,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(r,i,o,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(r,t,o,{specKey:"dataZoom",index:e},"one")})),t.axes){const e={left:!1,right:!1};t.axes.forEach(((t,i)=>{"left"!==t.orient&&"right"!==t.orient||e[t.orient]||(e[t.orient]=!0,this._layoutOrientItem(r,t,o,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(r,{orient:"top"},o,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(r,{orient:"bottom"},o,{specKey:"region",index:1},"one"),s=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==s){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:s};r.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;r.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else r.rowHeight.push({index:i.row,size:t.previewHeight})}const h=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(r,t.axes[h],o,{specKey:"axes",index:h},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const s=r.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));s&&("top"===e.orient||"bottom"===e.orient?s.col=l.col:s.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=r.elements.find((t=>"modelKey"in t&&"dataZoom"===t.modelKey&&t.modelIndex===e));i&&("top"===t.orient||"bottom"===t.orient?i.col=l.col:i.row=l.row)})),t.layout=r}_layoutOrientItem(t,e,i,s,r){var a;const n={modelKey:s.specKey,modelIndex:s.index,col:0,row:0},o=null!==(a=e.orient)&&void 0!==a?a:"top",{span:l,index:h}=this._getLayoutElementCommon(t,i,r,o);return t.elements.push(n),"top"===o?(n.row=i.top,n.rowSpan=1,n.colSpan=l,n.col=h,i.top++):"bottom"===o?(n.row=t.row-i.bottom-1,n.rowSpan=1,n.colSpan=l,n.col=h,i.bottom++):"left"===o?(n.col=i.left,n.colSpan=1,n.rowSpan=l,n.row=h,i.left++):"right"===o&&(n.col=t.col-i.right-1,n.colSpan=1,n.rowSpan=l,n.row=h,i.right++),n}_getLayoutElementCommon(t,e,i,s){return"top"===s||"bottom"===s?{span:"total"===i?t.col:"one"===i?1:t.col-e.left-e.right,index:"total"===i?0:e.left}:{span:"total"===i?t.row:"one"===i?1:t.row-e.top-e.bottom,index:"total"===i?0:e.top}}}class Uu extends e.BaseChart{constructor(){super(...arguments),this.type=Tu,this.transformerConstructor=ju}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,s)=>{var r;return[...null!==(r=e.getCartesianDimensionInfo(t,i,s))&&void 0!==r?r:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Uu.type=Tu,Uu.transformerConstructor=ju,e.mixin(Uu,e.StackChartMixin);const Vu=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class Gu extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=$.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(e.BaseWordCloudSeries.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",e.AttributeLevel.Series)}initAnimation(){var t,i;const s=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(e.animationConfig(null===(i=e.Factory.getAnimationInKey("wordCloud3d"))||void 0===i?void 0:i((()=>{var t;const e=this.getCompiler().getStage(),i=e.width-s.left||0-s.right||0,r=e.height-s.top||0-s.bottom||0,a=Math.max(i,r)/2;return{center:{x:a,y:a,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:a},r:a}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}Gu.type=$.wordCloud3d,Gu.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const Ku=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:Vu(t)}))),e.Factory.registerSeries(Gu.type,Gu)},zu=()=>{Ku()};class Hu extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class Wu extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=Hu,this.type="wordCloud3d",this.seriesType=$.wordCloud3d}}Wu.type="wordCloud3d",Wu.seriesType=$.wordCloud3d,Wu.transformerConstructor=Hu;const $u=()=>{it(),Ku(),e.Factory.registerChart(Wu.type,Wu)},Yu={label:{space:0}};class Xu{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const s=e.isZAxis(this._orient),r=e.isXAxis(this._orient),a=e.isYAxis(this._orient);let n=0,o=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let a=1;a<t.length;a++){const n=t[a],{x:o,y:l}=n.getLayoutStartPoint(),{width:h,height:c}=n.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}n=Math.abs(r-i),o=Math.abs(s-e)}let l=0,h=0;const{width:c,height:d}=this.getLayoutRect();let u={x:0,y:0};r?(u={x:c,y:0},l=n,h=c):a&&(u={x:0,y:d},l=o,h=d);const p=this.layout3dBox?this.layout3dBox.length:0;if(!s){const e=this.getLabelItems(h);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(r),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:p,length:l},t}return((t,i)=>{var s;const r=e.getCombinedSizeOfRegions(t.getRegions()),{width:a}=t.getLayoutRect(),n=a,o=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,h={x:o,y:0},c=t.getLabelItems(n),d={start:{x:0,y:0},end:h,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(s=t.directionStr)&&void 0!==s?s:"r2l";let p=[0,0],g=-Math.PI/2,m=0;return"l2r"===u&&(m=t.layout3dBox.length,p=[0,0,0],g=Math.PI/2),d.z=m,d.alpha=g,d.anchor3d=p,i||(d.grid={type:"line",start:{x:0,y:0},end:h,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:r.height,alpha:g,z:m,anchor3d:p}),d})(this,i)}}const qu=Object.assign(Object.assign({},st),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Zu extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=$.rangeColumn3d,this._barMarkType="rect3d",this._barName=$.bar3d}}Zu.type=$.rangeColumn3d,Zu.mark=qu;const Qu=()=>{xc(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Zu.type,Zu)};class Ju extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class tp extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class ep extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=tp,this.type="rangeColumn3d",this.seriesType=$.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}ep.type="rangeColumn3d",ep.seriesType=$.rangeColumn3d,ep.transformerConstructor=tp;const ip="pictogram",sp="pictogram";var rp;!function(t){t.pictogram="pictogram"}(rp||(rp={}));const ap=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class np extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===sp}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","svg","pictogram","defaultFillColor"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}const op=new Map,lp="_vchartViewportRect";let hp;const cp=/-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;function dp(t,i){op.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),hp||(hp=new e.DataSet,e.registerDataSetInstanceParser(hp,"svg",e.svgParser));const s=new e.DataView(hp);s.parse(i,{type:"svg"});const r=s.latestData,a=function(t){var e,i,s,r;const a=null===(e=t.match(/<svg\b[\s\S]*?>/i))||void 0===e?void 0:e[0],n=null===(i=null==a?void 0:a.match(/\benable-background\s*=\s*(['"])(.*?)\1/i))||void 0===i?void 0:i[2];if(!n||!/^\s*new\b/i.test(n))return null;const o=null!==(r=null===(s=n.match(cp))||void 0===s?void 0:s.map(Number))&&void 0!==r?r:[],[l,h,c,d]=o;return!Number.isFinite(l)||!Number.isFinite(h)||!Number.isFinite(c)||!Number.isFinite(d)||c<=0||d<=0?null:{x:l,y:h,width:c,height:d}}(i);r&&a&&!r.viewBoxRect&&!function(t){return Number.isFinite(t.width)&&Number.isFinite(t.height)&&t.width>0&&t.height>0}(r)&&(r[lp]=a),op.set(t,s)}function up(t){op.has(t)?op.delete(t):e.warn(`map type of '${t}' does not exists.`)}function pp(t){return op.get(t)}class gp extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,s,r;const a=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},n=t.svg,o=null===(r=null===(s=op.get(n))||void 0===s?void 0:s.latestData)||void 0===r?void 0:r.elements;if(o&&o.length){o.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(a[e]=t[e])}))}return a}}class mp extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)},this.markTooltipValueCallback=(t,e)=>{const{measureFields:i}=this._seriesCacheInfo;if(i[0]&&t.data)return t.data[i[0]]},this.markTooltipKeyCallback=t=>{var e;return null===(e=t.data)||void 0===e?void 0:e[this.series.getDimensionField()[0]]}}}const fp="element-highlight-by-graphic-name";class vp extends e.ElementHighlight{constructor(){super(...arguments),this.type=fp,this.handleStart=t=>{if(t&&t.item&&this.isGraphicInMark(t.item)){if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}}},this.handleReset=t=>{t&&t.item&&this.isGraphicInMark(t.item)&&this.reset()}}_filterByName(t){var e;return!!(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)}_parseTargetKey(t){return t.node.name}start(t){if(e.isNil(t))return;const{interaction:i,highlightState:s,blurState:r}=this.options,a=i.getStatedGraphics(this),n=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&n.push(e)}))})),i.updateStates(this,n,a,s,r),i.setStatedGraphics(this,n)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}vp.type=fp;const yp="element-select-by-graphic-name";class _p extends e.ElementSelect{constructor(){super(...arguments),this.type=yp}start(t){const e=null==t?void 0:t.name;e&&this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{t.name===e&&super.start(t)}))}))}}_p.type=yp;function bp(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const Sp=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&bp(i)?1:0},Ap=(t,e)=>{var i;const s=null!==(i=t.fill)&&void 0!==i?i:e;return s&&bp(s)?s:void 0},xp=(t,e)=>{var i;const s=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!s||!bp(s))&&s},Tp=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:Ap(t),lineWidth:Sp(t),stroke:xp(t)}),Cp={group:t=>{const e=Tp(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},Tp(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},Tp(t)),{fill:Ap(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},Tp(t)),{fill:Ap(t,"#000"),points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),line:t=>Object.assign(Object.assign({},Tp(t)),{points:t.points.trim().split(/\s+/).map((t=>{const[e,i]=t.split(",").map(Number);return{x:e,y:i}}))}),path:t=>Object.assign(Object.assign({},Tp(t)),{path:t.d,fillStrokeOrder:!1,fill:Ap(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},Tp(t)),{outerRadius:null!==(e=t.r)&&void 0!==e?e:t.ry,x:parseFloat(t.cx),y:parseFloat(t.cy),startAngle:0,endAngle:2*Math.PI,scaleX:parseFloat(t.rx)/parseFloat(t.ry)||1,fill:Ap(t,"#000")})},text:(t,e)=>{var i,s;return Object.assign(Object.assign({},Tp(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(s=t.textAnchor)&&void 0!==s?s:"middle",anchor:[0,0],fill:Ap(t,"#000")})}},kp=t=>{var i,s;if(!t||!t[0])return{};const{elements:r}=t[0].latestData;if(r&&r.length){r.forEach(((t,i)=>{var s;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:r,transform:a}=t,n={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(n,t._inheritStyle,null===(s=t.parent)||void 0===s?void 0:s._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(n,t._inheritStyle,t.attributes),Cp[r]?t._finalAttributes=Cp[r](n,t.value):t._finalAttributes=n,a&&(t._finalAttributes.postMatrix=Object.assign({},a))}));const t=r.filter((t=>"text"===t.tagName));for(let a=0;a<t.length;a++){const n=t[a]._uniqueId,o=r.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===n){e=!0;break}i=i.parent}return e}));if(o&&o.length){const r=null!==(s=null===(i=t[a]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==s?s:0;let n=r;for(let t=0;t<o.length;t++){const i=o[t];if("group"===i.graphicType)n=r;else if(i.value&&void 0===i.parent._textGroupStyle.x){const s=o.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(s){n+=e.measureText(s.value,s._finalAttributes).width}i._finalAttributes.x=n}}}}}return r};class Mp extends e.GeoSeries{constructor(){super(...arguments),this.type=sp,this._idToMark=new Map}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.svg=this._spec.svg,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this.svg||null===(t=this._option)||void 0===t||t.onError("svg source is not specified !"),this._parsedSvgResult=null===(e=pp(this.svg))||void 0===e?void 0:e.latestData,this._parsedSvgResult||null===(i=this._option)||void 0===i||i.onError(`'${this.svg}' is not registered !`)}getDatumCenter(t){return[Number.NaN,Number.NaN]}getDatumName(t){return t.name||t._nameFromParent}getMarksWithoutRoot(){return this.getMarks().filter((t=>t.name&&!t.name.includes("seriesGroup")&&!t.name.includes("root")&&t!==this._pictogramMark))}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getTransformMatrix=this.getRootMatrix.bind(this),this._markAttributeContext.coordToPosition=this.coordToPosition.bind(this),this._markAttributeContext.dataToPosition=this.dataToPosition.bind(this)}_defaultHoverConfig(t){return{type:"element-highlight-by-graphic-name",trigger:t.trigger,triggerOff:"pointerout",blurState:e.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:e.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(t){const i="multiple"===t.mode,s=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:s,reverseState:e.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:e.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}initMark(){var t;if(this._pictogramMark=this._createMark(Mp.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,Mp.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(Mp.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:s,name:r,parent:a,id:n,_nameFromParent:o,_uniqueId:l}=i,h=this._createMark({type:s,name:null!=r?r:o},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==a?void 0:a._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,Mp.mark.pictogram.name)});h&&(h.setData(this._mapViewData),h.setUserId(l),this._idToMark.set(l,h),"group"!==h.type&&h.setMarkConfig({graphicName:h.name}),h.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(Mp.mark.label,{isSeriesMark:!1,parent:this._pictogramMark,groupKey:"_uniqueId",skipBeforeLayouted:!0});t&&(this._labelMark=t,this._labelMark.setData(this._mapViewData))}initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:t=>!!this._validElement(t),x:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t,!0))||void 0===e?void 0:e.y},text:t=>t[this.nameField],textAlign:"center",textBaseline:"middle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}initMarkStyle(){const{root:t}=this._parsedSvgResult,i=this._getSvgViewportRect(),s=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,Cp.group(t.attributes),"normal",e.AttributeLevel.Built_In),this.setMarkStyle(this._pictogramMark,{postMatrix:()=>this._getFittedSvgRootMatrix()},"normal",e.AttributeLevel.Built_In),i&&this._pictogramMark.setMarkConfig({clip:!0,clipPath:[e.createRect(Object.assign(Object.assign({},i),{fill:!0}))]}));for(const t of s){const{_uniqueId:i,_finalAttributes:s}=t,r=this._idToMark.get(i),a=this._validElement(t);r&&(this.setMarkStyle(r,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),a?(this.initMarkStyleWithSpec(r,e.merge({},this._spec.pictogram,this._spec[r.name])),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Series),r.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(r.setMarkConfig({interactive:!1}),this.setMarkStyle(r,s,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new mp(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const s=t[this.nameField];if(!s)return null;const r=this.getMarksWithoutRoot().filter((t=>t.name===s));if(!r||0===r.length)return null;let a=new e.Bounds;i?r.forEach((t=>{a=a.union(t.getGraphics()[0].globalAABBBounds)})):r.forEach((t=>{a=a.union(t.getProduct().AABBBounds)}));const n={x:(a.x1+a.x2)/2,y:(a.y1+a.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();n.x-=t,n.y-=e}return n}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,s=this.getRootMatrix();if(!s)return null;const r={};return s.getInverse().transformPoint({x:e,y:i},r),r}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}_getSvgRootMatrix(){var t,i;const s=null===(i=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.root)||void 0===i?void 0:i.transform;return s?new e.Matrix(s.a,s.b,s.c,s.d,s.e,s.f):new e.Matrix}_getSvgViewportRect(){var t,e,i,s;const r=null===(t=this._parsedSvgResult)||void 0===t?void 0:t.viewBoxRect;if(r)return r;const{width:a,height:n}=null!==(e=this._parsedSvgResult)&&void 0!==e?e:{};return Number.isFinite(a)&&Number.isFinite(n)&&a>0&&n>0?{x:0,y:0,width:a,height:n}:null!==(s=null===(i=this._parsedSvgResult)||void 0===i?void 0:i[lp])&&void 0!==s?s:null}_getSvgRootBounds(t){const i=this._getSvgViewportRect();if(!i)return null;const s=(new e.Bounds).setValue(i.x,i.y,i.x+i.width,i.y+i.height);return s.transformWithMatrix(t),s}_appendMatrixScale(t,i,s){const r=new e.Matrix;return r.translate(s.x,s.y),r.scale(i,i),r.translate(-s.x,-s.y),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_appendMatrixTranslate(t,i,s){const r=new e.Matrix;return r.translate(i,s),r.multiply(t.a,t.b,t.c,t.d,t.e,t.f),r}_getFittedSvgRootMatrix(){const t=this._getSvgRootMatrix(),e=this._getSvgRootBounds(t);if(!e)return t;const i=e.width(),s=e.height();if(!Number.isFinite(i)||!Number.isFinite(s)||i<=0||s<=0)return t;const{width:r,height:a}=this.getLayoutRect(),n=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,l=Math.min(r/i,a/s),h=this._appendMatrixScale(t,l,{x:n,y:o});return this._appendMatrixTranslate(h,r/2-n,a/2-o)}initData(){var t,i;super.initData();const s=op.get(this.svg);s||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const r=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",kp),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),r.parse([s],{type:"dataview"}).transform({type:"pictogram"}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"name",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}).transform({type:"lookup",options:{from:()=>this.getViewData().latestData,key:"_nameFromParent",fields:this._nameField,set:(t,e)=>{e&&(t.data=e)}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",r.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,r)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const t=this.getPictogramRootGraphic();t&&t.setAttributes({postMatrix:this._getFittedSvgRootMatrix()})}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this))}handleZoom(t){const{scale:i,scaleCenter:s}=t;if(1===i)return;const r=this.getPictogramRootGraphic();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new e.Matrix}),r.scale(i,i,s))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getPictogramRootGraphic();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new e.Matrix}),s.translate(i[0],i[1]))}getMarkData(t){var e;return null!==(e=t.data)&&void 0!==e?e:{}}getMeasureField(){return[this.valueField]}getDimensionField(){return[this.nameField]}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({data:{[t]:e}}),shapeType:i})))}release(){this._parsedSvgResult=null,this._idToMark.clear(),this._idToMark=null}}Mp.type=sp,Mp.mark=ap,Mp.transformerConstructor=gp;const Ep=()=>{e.Factory.registerSeries(Mp.type,Mp),e.Factory.registerImplement("registerSVG",dp),e.Factory.registerImplement("unregisterSVG",up),e.Factory.registerInteractionTrigger(vp.type,vp),e.Factory.registerInteractionTrigger(_p.type,_p)};class wp extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=np,this.type=ip,this.seriesType=sp}}wp.type=sp,wp.seriesType=ip,wp.transformerConstructor=np;class Op extends e.BaseChartSpecTransformer{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["urlField","nameField","valueField","imageSize","imageSizeRange","ratio","maskShape","imageMask","layoutConfig","image"])}}const Pp="imageCloud",Bp="imageCloud";var Dp;!function(t){t.image="image",t.imageMask="imageMask"}(Dp||(Dp={}));const Ip=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class Rp extends e.ACustomAnimate{constructor(t,e,i,s,r){var a;super(t,e,i,s,r),this._rotations=null!==(a=null==r?void 0:r.rotation)&&void 0!==a?a:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var s;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const r=360*this._rotations*e*Math.PI/180,a=Math.abs(Math.cos(r))*(null!==(s=this._scaleX)&&void 0!==s?s:1);this.target.attribute.scaleX=a,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function Lp(t,i){switch(i){case"axialRotate":return[{custom:Rp,customParameters:{rotation:1},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration},{channel:{y:{from:(e,i)=>t.height()+i.getFinalAttribute().y},fillOpacity:{from:0,to:1}},easing:"sineInOut"}];case"growIn":return{channel:{scaleX:{from:0,to:1},scaleY:{from:0,to:1},x:{from:()=>t.center().x},y:{from:()=>t.center().y}},duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};case"scaleIn":return{type:"scaleIn",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration};default:return{type:"fadeIn",easing:"linear",duration:e.DEFAULT_ANIMATION_CONFIG.appear.duration}}}class Fp extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,r=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&r)return null!==(i=r[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}class Np extends e.BaseSeries{constructor(){super(...arguments),this.type=Bp}setValueField(t){e.isValid(t)&&(this._valueField=t)}setAttrFromSpec(){super.setAttrFromSpec(),this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._urlField=this._spec.urlField}initMark(){var t;(null===(t=this._spec.imageMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(Ip.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(Ip.image,{key:t=>`${t[e.DEFAULT_DATA_KEY]}-${t.frequency}`,isSeriesMark:!0,skipBeforeLayouted:!0})}initMarkStyle(){this._initImageMarkStyle(),this._initMaskMarkStyle()}_initImageMarkStyle(){var t,i;if(!this._imageMark)return;this._imageMark.setTransform([Object.assign({type:"imagecloud"},this._imageCloudTransformOption())]),this.setMarkStyle(this._imageMark,{x:t=>t.x,y:t=>t.y,width:t=>t.width,height:t=>t.height,visible:t=>t.visible,angle:t=>t.angle,clipConfig:t=>t.clipConfig,image:t=>t[this._urlField],scaleCenter:["50%","50%"]},"normal",e.AttributeLevel.Series);"masked"===(null===(t=this._spec.layoutConfig)||void 0===t?void 0:t.placement)&&(this.setMarkStyle(this._imageMark,{globalCompositeOperation:"source-atop"},"normal",e.AttributeLevel.Series),this.setMarkStyle(this._rootMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,globalCompositeOperation:"destination-in",clip:!0,drawMode:1},"normal",e.AttributeLevel.Series)),"stack"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.layoutMode)&&this.setMarkStyle(this._imageMark,{stroke:"white",lineWidth:2,shadowBlur:6,shadowColor:"grey"},"normal",e.AttributeLevel.Series)}isFillingImage(t){return t._frequency>1}_initMaskMarkStyle(){this._maskMark&&(this._maskMark.setMarkConfig({interactive:!1}),this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height},"normal",e.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Fp(this),this._imageMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._imageMark)}_imageCloudTransformOption(){var t;return{size:()=>{const{width:t,height:e}=this._region.getLayoutRect();return[t,e]},image:{field:this._urlField},weight:{field:this._valueField},imageConfig:{imageSize:this._spec.imageSize,imageSizeRange:this._spec.imageSizeRange,padding:null===(t=this._spec.image)||void 0===t?void 0:t.padding},ratio:this._spec.ratio,mask:this._spec.maskShape,maskConfig:this._spec.imageMask,layoutConfig:this._spec.layoutConfig,createCanvas:e.vglobal.createCanvas.bind(e.vglobal),createImage:e.createImage,onUpdateMaskCanvas:((t,e)=>{var i;t&&this._maskMark&&this._maskMark.getProduct().getChildren().forEach((e=>{e.setAttribute("background",t)})),e&&"masked"===(null===(i=this._spec.layoutConfig)||void 0===i?void 0:i.placement)&&this._rootMark.getProduct().setAttribute("background",e)}).bind(this),onLayoutFinished:()=>{var t,e;return null===(e=null===(t=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===t?void 0:t.afterWordcloudShapeDraw)||void 0===e?void 0:e.call(t,this._option.globalInstance)}}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.isFillingImage=this.isFillingImage.bind(this)}initAnimation(){[this._imageMark].forEach((t=>{var i,s;if(t){const r=null===(s=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===s?void 0:s.preset,a={center:()=>{const{width:t,height:e}=this._region.getLayoutRect();return{x:t/2,y:e/2}},height:()=>{const{height:t}=this._region.getLayoutRect();return t}};t.setAnimationConfig(e.animationConfig(e.Factory.getAnimationInKey("imageCloud")(a,r),e.userAnimationConfig("image",this._spec,this._markAttributeContext)))}}))}getDimensionField(){var t;return[null!==(t=this._nameField)&&void 0!==t?t:this._spec.urlField]}getMeasureField(){return[this._valueField]}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getActiveMarks(){return[this._imageMark]}getMarkData(t){var e;return null!==(e=null==t?void 0:t.datum)&&void 0!==e?e:t}getGroupFields(){return[]}dataToPosition(t){return null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}valueToPosition(t,e){return null}getStackGroupFields(){return[]}getStackValueField(){return""}}Np.type=Bp,Np.mark=Ip;const jp=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:Lp(t,e),enter:Lp(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries(Np.type,Np),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class Up extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Up.transformerConstructor,this.type=Pp,this.seriesType=Bp}}Up.type=Pp,Up.seriesType=Bp,Up.transformerConstructor=Op;class Vp extends e.BaseChartSpecTransformer{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["timeField","eventField","seriesField","titleField","subTitleField","iconField","dot","title","subTitle","icon","line","arrow","labelPosition","sortDataByAxis"])}_setDefaultXAxisSpec(t){return{type:"band",orient:"bottom",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_setDefaultYAxisSpec(t){return{type:"band",inverse:!0,orient:"left",label:{visible:!1},tick:{visible:!1},grid:{visible:!1},domainLine:{visible:!1},paddingInner:0,paddingOuter:0}}_transformAxisSpec(t){t.axes||(t.axes=[]);const e={x:!1,y:!1};t.axes.forEach((i=>{const{orient:s}=i;let a=null;"top"!==s&&"bottom"!==s||(e.x=!0,a=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,a=this._setDefaultYAxisSpec(t)),a&&Object.keys(a).forEach((t=>{i[t]=r.isObject(i[t])?r.merge(a[t],i[t]):r.isNil(i[t])?a[t]:i[t]}))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t))}transformSpec(t){var e,i;super.transformSpec(t),this.transformSeriesSpec(t),this._transformAxisSpec(t);const s=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===s?(t.timeField&&!t.yField&&(t.yField=t.timeField),t.xField||(t.xField=t.seriesField||"__vchart_timeline_dummy__")):(t.timeField&&!t.xField&&(t.xField=t.timeField),t.yField||(t.yField=t.seriesField||"__vchart_timeline_dummy__"))}))}}const Gp="event",Kp=Object.assign(Object.assign({},e.baseSeriesMark),{line:{name:"line",type:"line"},dot:{name:"dot",type:"symbol"},icon:{name:"icon",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},arrow:{name:"arrow",type:"path"}});class zp extends e.CartesianSeries{constructor(){super(...arguments),this.type=Gp,this.transformerConstructor=e.BaseSeriesSpecTransformer,this.coordinate="cartesian"}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),this._timeField=this._spec.timeField,this._eventField=this._spec.eventField,this._subTitleField=this._spec.subTitleField,this._iconField=this._spec.iconField,this._labelPosition=this._spec.labelPosition}getDimensionField(){return this._timeField?[this._timeField]:[]}getMeasureField(){const t=[];return this._eventField&&t.push(this._eventField),this._subTitleField&&t.push(this._subTitleField),t}initMark(){this._axisLineMark=this._createMark(zp.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark(zp.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark(zp.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark(zp.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark(zp.mark.title),this._subTitleMark=this._createMark(zp.mark.subTitle)}initTooltip(){super.initTooltip(),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark),this._titleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._titleMark),this._subTitleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._subTitleMark),this._iconMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._iconMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}initMarkStyle(){var t,i,s,a,n,o,l,h,c,d,u;this._axisLineMark&&this.setMarkStyle(this._axisLineMark,{points:this._getAxisPoints.bind(this),visible:this._isFirstDataInGroup.bind(this),stroke:"#c0c3c7",lineWidth:1},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const p=this._spec.dot,g="number"==typeof(null===(t=null==p?void 0:p.style)||void 0===t?void 0:t.size)?p.style.size:8,m=this._spec.title,f=null!==(i=null==m?void 0:m.style)&&void 0!==i?i:{},v=this._spec.subTitle,y=null!==(s=null==v?void 0:v.style)&&void 0!==s?s:{},_="number"==typeof f.fontSize?f.fontSize:14,b=g/2+(null!==(a=null==m?void 0:m.offset)&&void 0!==a?a:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:g,fill:null!==(o=null===(n=null==p?void 0:p.style)||void 0===n?void 0:n.fill)&&void 0!==o?o:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(h=null===(l=null==p?void 0:p.style)||void 0===l?void 0:l.fill)&&void 0!==h?h:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},f),{x:t=>this._getTitlePosition(t,b).x,y:t=>this._getTitlePosition(t,b).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!0),text:t=>this._getDatumString(t,this._eventField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._subTitleMark&&this.setMarkStyle(this._subTitleMark,Object.assign(Object.assign({},y),{x:t=>this._getSubTitlePosition(t,b,_).x,y:t=>this._getSubTitlePosition(t,b,_).y,textAlign:t=>this._getLabelTextAlign(t),textBaseline:t=>this._getLabelTextBaseline(t,!1),text:t=>this._getDatumString(t,this._subTitleField)}),e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series);const S=this._spec.icon,A="number"==typeof(null===(c=null==S?void 0:S.style)||void 0===c?void 0:c.size)?S.style.size:20,x=(r.isValid(null==S?void 0:S.offset)?S.offset+g/2:b)+A/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,x).x,y:t=>this._getIconPosition(t,x).y,size:A,fill:null!==(u=null===(d=null==S?void 0:S.style)||void 0===d?void 0:d.fill)&&void 0!==u?u:this.getColorAttribute(),shape:t=>this._getDatumString(t,this._iconField)||"circle"},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}_getLabelSide(t){const e=this._getViewDataList().indexOf(t),i=this._labelPosition;if("vertical"===this.direction)switch(i){case"left":default:return"primary";case"right":return"secondary";case"left-right":return e%2==0?"primary":"secondary";case"right-left":return e%2==0?"secondary":"primary"}else switch(i){case"top":default:return"primary";case"bottom":return"secondary";case"top-bottom":return e%2==0?"primary":"secondary";case"bottom-top":return e%2==0?"secondary":"primary"}}_getLabelTextAlign(t){if("vertical"===this.direction){return"primary"===this._getLabelSide(t)?"right":"left"}return"center"}_getLabelTextBaseline(t,e){if("vertical"===this.direction)return"middle";return"primary"===this._getLabelSide(t)?"bottom":"top"}_getTitlePosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===s?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var s,r,a,n;const o=this._getPoint(t),l=this._getLabelSide(t),h=null!==(r=null===(s=this._spec.title)||void 0===s?void 0:s.subTitleGap)&&void 0!==r?r:4;if("vertical"===this.direction){const t=null!==(n=null===(a=this._spec.title)||void 0===a?void 0:a.style)&&void 0!==n?n:{},s="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?o.x-e:o.x+e,y:o.y+s+h}}return{x:o.x,y:"primary"===l?o.y-(e+i+h):o.y+(e+i+h)}}_getIconPosition(t,e){const i=this._getPoint(t),s=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===s?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===s?i.y+e:i.y-e}}_getViewDataList(){var t,e;return null!==(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)&&void 0!==e?e:[]}_getPoint(t){if("vertical"===this.direction){return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._timeField)}}return{x:this._getPositionFromAxis(t,this.getXAxisHelper(),this._timeField),y:this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField)}}_getPositionFromAxis(t,e,i){var s,r,a,n,o,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const h=t[i];return"band"!==(null===(r=null===(s=e.getSpec)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.type)&&e.isContinuous?null!==(l=null===(o=e.valueToPosition)||void 0===o?void 0:o.call(e,h))&&void 0!==l?l:this._getDefaultPosition(i):null!==(n=null===(a=e.dataToPosition)||void 0===a?void 0:a.call(e,[h],{bandPosition:.5}))&&void 0!==n?n:this._getDefaultPosition(i)}onXAxisHelperUpdate(){var t;null===(t=super.onXAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}onYAxisHelperUpdate(){var t;null===(t=super.onYAxisHelperUpdate)||void 0===t||t.call(this),this.onMarkPositionUpdate()}_getDefaultPosition(t){const e=this._region.getLayoutRect();if(!this._seriesField||t===this._seriesField){return"vertical"!==this.direction?.5*e.height:.5*e.width}return 0}_getAxisPoints(t){const e=this._region.getLayoutRect();if("vertical"===this.direction){const i=this._getPositionFromAxis(t,this.getXAxisHelper(),this._seriesField);return[{x:i,y:0},{x:i,y:e.height}]}const i=this._getPositionFromAxis(t,this.getYAxisHelper(),this._seriesField);return[{x:0,y:i},{x:e.width,y:i}]}_isFirstDataInGroup(t){if(!this._seriesField){return 0===this._getViewDataList().indexOf(t)}const e=this._getViewDataList(),i=t[this._seriesField];return t===e.find((t=>this._seriesField&&t[this._seriesField]===i))}_getNextDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||i===e.length-1)return null;if(!this._seriesField)return e[i+1];const s=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getPreviousDatum(t){const e=this._getViewDataList(),i=e.indexOf(t);if(-1===i||0===i)return null;if(!this._seriesField)return e[i-1];const s=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===s)return i}return null}_getArrowPath(t){var e,i;const s=this._getPoint(t),r=this._getNextDatum(t),a=this._getPreviousDatum(t),n=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,o=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=a?{x:s.x,y:(this._getPoint(a).y+s.y)/2}:{x:s.x,y:t?0:o.height},i=r?{x:s.x,y:(this._getPoint(r).y+s.y)/2}:{x:s.x,y:t?o.height:0},l=t?1:-1,h=n/3,c=n/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*h} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*h} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*h} Z`}const l=this.getXAxisHelper().isInverse(),h=a?{x:(this._getPoint(a).x+s.x)/2,y:s.y}:{x:l?o.width:0,y:s.y},c=r?{x:(this._getPoint(r).x+s.x)/2,y:s.y}:{x:l?0:o.width,y:s.y},d=l?-1:1,u=n/2,p=n/3;return`M ${h.x} ${h.y-u} L ${h.x+d*p} ${h.y} L ${h.x} ${h.y+u} \n L ${c.x-d*p} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-d*p} ${c.y-u} Z`}_getDatumString(t,e){if(!t||!e)return"";const i=t[e];return"string"==typeof i?i:null==i?"":String(i)}valueToPosition(t,e){if(t&&"object"==typeof t)return this.dataToPosition(t);const i={};return this._timeField&&(i[this._timeField]=t),this._eventField&&void 0!==e&&(i[this._eventField]=e),this._getPoint(i)}getActiveMarks(){return[this._axisLineMark,this._dotMark,this._iconMark,this._arrowMark,this._titleMark,this._subTitleMark].filter(Boolean)}}zp.type=Gp,zp.mark=Kp,zp.builtInTheme={event:{dot:{style:{size:8}},icon:{visible:!1,style:{size:20}},line:{visible:!0,style:{stroke:"#c0c3c7",lineWidth:1}},title:{visible:!0,offset:6,subTitleGap:4,style:{fontSize:14}},subTitle:{visible:!0,style:{fontSize:12}},arrow:{visible:!1,thickness:16}}},zp.transformerConstructor=e.BaseSeriesSpecTransformer;const Hp=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries(zp.type,zp)};class Wp extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Vp,this.type="timeline",this.seriesType="event"}}Wp.type="timeline",Wp.seriesType="event",Wp.transformerConstructor=Vp;const $p="seriesBreak";function Yp(t,e,i,s,r=!1){const a=[],{x:n,y:o}=t,{x:l,y:h}=e,c=r?Math.floor((h-o)/(2*i)):Math.floor((l-n)/(2*i)),d=Math.PI/180*s,u=i*Math.cos(d),p=i*Math.sin(d);a.push(`M ${n} ${o}`);for(let t=0;t<=c;t++){const e=r?n+(t%2==0?u:-u):n+t*i*2,s=r?o+t*i*2:t%2==0?o-p:o+p;a.push(`L ${e} ${s}`)}return a.push(`L ${r?n:l} ${r?h:o}`),a.join(" ")}class Xp extends e.AbstractComponent{constructor(){super(...arguments),this.name=$p}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],s=[];t.forEach((t=>{const{start:r,end:a}=t;((t,i)=>{const{start:s,end:r}=i,a=s.x===r.x,n=a?"x":"y",o=a?"y":"x";let l=!0;const h=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[n],s[n])){const e=Math.min(s[o],r[o]),i=Math.max(s[o],r[o]),a=Math.min(t.start[o],t.end[o]),n=Math.max(t.start[o],t.end[o]);if(!(i<a-h||e>n+h))return t.start[o]=Math.min(a,e),t.end[o]=Math.max(n,i),void(l=!1)}})),l&&t.push(i)})(r.x===a.x?i:s,t)})),[...i,...s].forEach(((t,i)=>{var s;const{start:r,end:a,size:n=4,gap:o=5,style:l={}}=t,h=v(t,["start","end","size","gap","style"]),c=e.createGroup({}),d=r.x===a.x;let u,p,g,m;d?(u={x:r.x-o/2,y:r.y},p={x:a.x-o/2,y:a.y},g={x:r.x+o/2,y:r.y},m={x:a.x+o/2,y:a.y}):(u={x:r.x,y:r.y-o/2},p={x:a.x,y:a.y-o/2},g={x:r.x,y:r.y+o/2},m={x:a.x,y:a.y+o/2});const f=Yp(u,p,n,d?75:15,d),y=Yp(r,a,n,d?75:15,d),_=Yp(g,m,n,d?75:15,d);c.add(e.createPath(Object.assign(Object.assign({path:f,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:_,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:y,stroke:"#fff",lineWidth:o,pickable:!1,zIndex:0})),c.name="series-break",c.data=h,e.isValid(h.axisId)&&(c.id=`${null!==(s=h.axisId)&&void 0!==s?s:""}_${i}`),this.add(c)}))}}function qp(t,e,i=1){return Math.abs(t-e)<i}function Zp(t,i){return{type:"component",componentType:$p,interactive:!0,zIndex:500,style:{data:(s,r)=>{const a=[],n=r.vchart.getChart(),o="horizontal"===n.getAllSeries()[0].direction;return t.forEach(((t,s)=>{var r,l;const h=t.id,c=e.isValid(h)?n.getComponentByUserId(h):i&&e.isValid(i[s])?n.getComponentByIndex("axes",i[s]):null===(r=n.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===r?void 0:r[0];if(!c)return;const d=null!=h?h:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,r=i+t[0].getLayoutRect().height;for(let a=1;a<t.length;a++){const n=t[a],{x:o,y:l}=n.getLayoutStartPoint(),{width:h,height:c}=n.getLayoutRect();e=Math.min(e,o),s=Math.max(s,h+o),i=Math.min(i,l),r=Math.max(r,c+l)}return{x1:e,y1:i,x2:s,y2:r}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:s=5}=t,r=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),h=(r+l)/2+(o?u.x1:u.y1);n.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const n=t.AABBBounds;let c,p,g,m,f=!1;o?(f=n.x1<(r+l-s)/2&&n.x2>(r+l+s)/2,c=h,p=Math.max(n.y1+u.y1-2,u.y1),g=h,m=Math.min(n.y2+u.y1+2,u.y2)):(f=n.y1<(r+l-s)/2&&n.y2>(r+l+s)/2,c=Math.max(n.x1+u.x1-2,u.x1),p=h,g=Math.min(n.x2+u.x1+2,u.x2),m=h),f&&a.push({start:{x:c,y:p},end:{x:g,y:m},gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{Jp(t,"line").forEach((t=>{Qp(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t).forEach((t=>{let r,n;o?(r={x:h,y:Math.max(t[1]+u.y1-10,u.y1)},n={x:h,y:Math.min(t[1]+u.y1+10,u.y2)}):(r={x:Math.max(t[0]+u.x1-10,u.x1),y:h},n={x:Math.min(t[0]+u.x1+10,u.x2),y:h}),a.push({start:r,end:n,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{Jp(t,"area").forEach((t=>{const n=Qp(o?{start:{x:(r+l)/2,y:0},end:{x:(r+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(r+l)/2},end:{x:u.x2-u.x1,y:(r+l)/2}},t);n.sort(((t,e)=>t[0]-e[0]));for(let r=0;r<n.length-1;r++){const l={x:n[r][0],y:n[r][1]},h={x:n[r+1][0],y:n[r+1][1]};if(tg(o?{x:l.x,y:(l.y+h.y)/2}:{x:(l.x+h.x)/2,y:l.y},t)){let t,r;o?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},r={x:h.x+u.x1,y:Math.min(h.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},r={x:Math.min(h.x+u.x1+0,u.x2),y:h.y+u.y1}),a.push({start:t,end:r,gap:s,style:null==i?void 0:i.style,axisId:d,data:e})}}}))}))}}))}))})),a}}}}function Qp(t,i){const s=[];for(let r=1;r<i.length;r++){const a=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[r].x,i[r].y],[i[r-1].x,i[r-1].y]);a&&!s.find((t=>qp(e.PointService.distancePP({x:t[0],y:t[1]},{x:a[0],y:a[1]}),0)))&&s.push(a)}return s}function Jp(t,e){const{points:i,segments:s}=t.attribute,r=[];let a=[];const n=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var s,n;if(!1===t.defined){if(r.push(a),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)a.push({x:i[t].x,y:i[t].y});a.push(a[0])}a=[],i=[]}else a.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(s=t.x1)&&void 0!==s?s:t.x,y:null!==(n=t.y1)&&void 0!==n?n:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)a.push({x:i[t].x,y:i[t].y});a.push(a[0])}r.push(a)}};return i&&i.length?n(i):s&&s.length&&s.forEach((t=>{n(t.points)})),r}function tg(t,e){const{x:i,y:s}=t;let r=!1;for(let t=0,a=e.length-1;t<e.length;a=t++){const{x:n,y:o}=e[t],{x:l,y:h}=e[a];o>s!=h>s&&i<(l-n)*(s-o)/(h-o)+n&&(r=!r)}return r}const eg="barLink";class ig extends e.AbstractComponent{constructor(){super(...arguments),this.name=eg}render(){const{data:t,linkStyle:i,areaStyle:s,styleMap:r,label:a,linkType:n="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,o)=>{var l,h,c,d,u;const{linePoints:p,areaPoints:g,id:m=o,color:f,data:v}=t;if(g&&!1!==(null===(l=null==r?void 0:r[`area-${m}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:g,fillOpacity:.3,fill:f,zIndex:0},s),null==r?void 0:r[`area-${m}`]));t.name="bar-link-area",t.id=`area-${m}`,this.add(t)}if(p&&!1!==(null===(h=null==r?void 0:r[`line-${m}`])||void 0===h?void 0:h.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(d=null==r?void 0:r[`line-${m}`])||void 0===d?void 0:d.lineWidth)){const{startSymbol:t={},endSymbol:s={},lineStyle:a}=i||{},n=e.cloneDeep(t),o=e.cloneDeep(s);(null==r?void 0:r[`line-${m}`])&&r[`line-${m}`].stroke&&(n.style=Object.assign(Object.assign({},n.style),{color:r[`line-${m}`].stroke}),o.style=Object.assign(Object.assign({},o.style),{color:r[`line-${m}`].stroke})),n.symbolType||n.originSymbolType||(n.originSymbolType="solidArrow"),o.symbolType||o.originSymbolType||(o.originSymbolType="solidArrow");const l=new e.Segment({points:p,startSymbol:Object.assign({size:8},n),endSymbol:Object.assign({size:8},o),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},a),null==r?void 0:r[`line-${m}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${m}`,this.add(l)}if((null==a?void 0:a.visible)&&!1!==(null===(u=null==r?void 0:r[`label-${m}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=a,[s,o]=v;let l=s[e.STACK_FIELD_END],h=o[e.STACK_FIELD_END];"value"===n&&(l=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START],h=o[e.STACK_FIELD_END]-o[e.STACK_FIELD_START]);const c=h-l,d=(h-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(p[0].x+p[1].x),y:.5*(p[0].y+p[1].y),text:i?i(c,d,v):`${c} ${d}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==r?void 0:r[`label-${m}`]));u.name="bar-link-label",u.id=`label-${m}`,this.add(u)}})))}}function sg(t,i,s){const{isHorizontal:r,isXAxisInverse:a,isYAxisInverse:n,linkType:o,doFill:l,regionStartX:h,regionStartY:c}=s,d=t.AABBBounds,u=i.AABBBounds;let p,g;return r?(p=[{x:(d.x1+d.x2)/2+h,y:d.y1+c},{x:(u.x1+u.x2)/2+h,y:u.y2+c}],a?("total"===o&&(p=[{x:d.x1+h,y:d.y1+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x1+h,x1:d.x2+h,y:d.y1+c},{x:u.x1+h,x1:u.x2+h,y:u.y2+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x2+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,x1:d.x1+h,y:d.y1+c},{x:u.x2+h,x1:u.x1+h,y:u.y2+c}]))):(p=[{x:d.x2+h,y:(d.y1+d.y2)/2+c},{x:u.x1+h,y:(u.y1+u.y2)/2+c}],n?("total"===o&&(p=[{x:d.x2+h,y:d.y2+c},{x:u.x1+h,y:u.y2+c}]),l&&(g=[{x:d.x2+h,y:d.y2+c,y1:d.y1+c},{x:u.x1+h,y:u.y2+c,y1:u.y1+c}])):("total"===o&&(p=[{x:d.x2+h,y:d.y1+c},{x:u.x1+h,y:u.y1+c}]),l&&(g=[{x:d.x2+h,y:d.y1+c,y1:d.y2+c},{x:u.x1+h,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:g,linePoints:p,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function rg(t={},i){const{linkType:s="total",doFill:r}=t,a=v(t,["linkType","doFill"]);return{type:"component",componentType:eg,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:a}=i,n=a.getChart().getAllRegions(),o=[];return n.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:a,y:n}=t.getLayoutStartPoint();if(i.length){const t=i[0].getGroupFields(),l=[];i.forEach((t=>{var e;(null===(e=t.getMarkInName("bar"))||void 0===e?void 0:e.getGraphics()).forEach((t=>{l.push(t)}))}));const h=function(t,i){const s={};for(let r=0;r<t.length;r++){const a=t[r],n=e.getDatumOfGraphic(a),o=i.map((t=>n[t])).join("-");s[o]||(s[o]=[]),s[o].push(a)}return s}(l,t);Object.values(h).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],d="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),p=c.getXAxisHelper().isInverse(),g=Object.values(h);if(g.length)if(d){g[0][0].AABBBounds.y1<g[g.length-1][0].AABBBounds.y1&&g.reverse()}else{g[0][0].AABBBounds.x1>g[g.length-1][0].AABBBounds.x1&&g.reverse()}for(let t=0;t<g.length-1;t++){const e=g[t],i=g[t+1];if(e.forEach(((t,e)=>{var l;const h=sg(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:a,regionStartY:n});o.push(h)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=sg(t,i[l],{isHorizontal:d,isXAxisInverse:p,isYAxisInverse:u,doFill:r,linkType:s,regionStartX:a,regionStartY:n});o.push(e)}}}}})),o},linkType:s},a),i)}}const ag="seriesLabel";function ng(t,e=10,i=10,s=.1){const r=t.length;if(!t.every(isFinite))return t;if(!(r>1))return t;const a=function(t,e,i){t=+t,e=+e;let s=arguments.length;i=s<2?(e=t,t=0,1):s<3?1:+i;let r=-1;s=0|Math.max(0,Math.ceil((e-t)/i));const a=new Array(s);for(;++r<s;)a[r]=t+r*i;return a}(t.length);for(let n=0;n<i;++n){a.sort(((e,i)=>{return s=t[e],r=t[i],null==s||null==r?NaN:s<r?-1:s>r?1:s>=r?0:NaN;var s,r}));let i=0;for(let s=1;s<r;++s){let r=t[a[s]]-t[a[s-1]];r<e&&(r=(e-r)/2,i=Math.max(i,r),t[a[s-1]]-=r,t[a[s]]+=r)}if(i<s)break}return t}function og(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function lg(t,e=10,i=10){const s=t.length;let r,a=0;do{r=!1;for(let i=0;i<s;++i)for(let a=i+1;a<s;++a){const s=t[i].AABBBounds,n=t[a].AABBBounds;if(og(s,n)){const i=e-(n.x1-s.x2);i>0&&(t[a].attribute.x+=i,n.x1+=i,n.x2+=i,r=!0)}}a++}while(r&&a<i)}function hg(t,i){const{label:s,line:r}=i;return{type:"component",componentType:ag,interactive:!1,style:{position:t,layout:(t,e)=>{var i;return null!==(i=e.vchart.getChart().getAllSeries()[0].getSpec().direction)&&void 0!==i?i:"vertical"},data:(i,s)=>{var r;const a=s.vchart.getChart(),n=a.getAllSeries()[0],o="horizontal"===n.direction,l=o?n.getYAxisHelper():n.getXAxisHelper(),h=null===(r=l.getScale)||void 0===r?void 0:r.call(l,0),c=l.isInverse(),d=n.getDimensionField()[0],u=n.getSeriesField(),p=a.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),g=[];if(1===p.length&&["bar","area","line","waterfall"].includes(p[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(h.domain()):h.domain()[0],s=n.getRegion(),{x:r,y:l}=s.getLayoutStartPoint();let m=0;a.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===p[0]?"bar":p[0]).getGraphics().forEach((s=>{var a;const n=s.context.data.find((t=>t[d]===i));if(n){const i=s.AABBBounds;let h,f,v,y;"bar"===p[0]||"waterfall"===p[0]?(h="end"===t?{x:o?(i.x1+i.x2)/2:c?i.x1:i.x2,y:o?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:o?(i.x1+i.x2)/2:c?i.x2:i.x1,y:o?c?i.y1:i.y2:(i.y1+i.y2)/2},f=s.attribute.fill):(h=e.dataToPosition(n),f=s.attribute.stroke||s.attribute.fill),"end"===t?(v=o?"center":c?"end":"start",y=o?c?"top":"bottom":"middle"):(v=o?"center":c?"start":"end",y=o?c?"bottom":"top":"middle");const _=null!==(a=n[u])&&void 0!==a?a:n[d];g.push({point:{x:h.x+r,y:h.y+l},label:_,color:f,textAlign:v,textBaseline:y,series:e,datum:n,id:`${t}-${m}`,position:t}),m++}}))}))}))}return g},line:r,label:Object.assign({space:12},s)}}}class cg extends e.AbstractComponent{constructor(){super(...arguments),this.name=ag}render(){var t,i,s,r;this.removeAllChild();const{data:a,layout:n,label:o,line:l={}}=this.attribute;if(e.isEmpty(a))return;const h=null!==(t=null==o?void 0:o.styleMap)&&void 0!==t?t:{},c={},d=a.filter((t=>{var e;return!1!==(null===(e=h[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===n){const t=1.5*(null!==(s=null===(i=null==o?void 0:o.style)||void 0===i?void 0:i.fontSize)&&void 0!==s?s:12),r=(t,i,s)=>{var r,a,n,o,l,h,c,d;const{label:u,color:p,textAlign:g,textBaseline:m,id:f}=t,v=null!==(a=null===(r=s[f])||void 0===r?void 0:r.formatMethod)&&void 0!==a?a:null===(n=this.attribute.label)||void 0===n?void 0:n.formatMethod,y=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:v?v(u,t.datum,{series:t.series}):u},null===(o=this.attribute.label)||void 0===o?void 0:o.style),i),{textAlign:g,textBaseline:m,fill:null!==(c=null===(h=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fill)&&void 0!==c?c:p}),null===(d=s[f])||void 0===d?void 0:d.style));return y.name="series-label-text",y.id=f,this.add(y),y};["start","end"].forEach((e=>{const i=d.filter((t=>t.position===e)),s=ng(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const a={x:t.point.x+(null!==(i=null==o?void 0:o.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:s[e]};r(t,a,h),c[t.id]=a}))}))}else{const t=[],i=[];d.forEach((s=>{var r,a,n,l,c;const{point:d,label:u,color:p,textAlign:g,textBaseline:m,id:f,position:v}=s,y={x:d.x,y:d.y},_=null!==(a=null===(r=h[f])||void 0===r?void 0:r.formatMethod)&&void 0!==a?a:null==o?void 0:o.formatMethod,b=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:_?_(u,s.datum,{series:s.series}):u},null==o?void 0:o.style),y),{textAlign:g,textBaseline:m,fill:null!==(l=null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.fill)&&void 0!==l?l:p}),null===(c=h[f])||void 0===c?void 0:c.style));b.id=f,b.name="series-label-text",this.add(b),"start"===v?t.push(b):"end"===v&&i.push(b)})),t.length&&lg(t,4,10),i.length&&lg(i,4,10);const s=null!==(r=null==o?void 0:o.space)&&void 0!==r?r:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+s*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&d.forEach((t=>{var i,s,r,a,o,d;const{point:u,color:p,id:g}=t,m={x:c[g].x+(null!==(r=null===(s=null===(i=h[g])||void 0===i?void 0:i.style)||void 0===s?void 0:s.dx)&&void 0!==r?r:0),y:c[g].y+(null!==(d=null===(o=null===(a=h[g])||void 0===a?void 0:a.style)||void 0===o?void 0:o.dy)&&void 0!==d?d:0)};if(!1!==l.autoVisible){if("vertical"===n&&u.y!==m.y||"horizontal"===n&&u.x!==m.x){const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,m],lineWidth:1,stroke:p},l.style));t.name="series-label-line",this.add(t)}}))}}function dg(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function ug(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function pg(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:ug(t.rect),anchorCandidates:_g(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const r=i[t],a=r.bound;let n=s.some((t=>dg(t,a)));if(r.anchorCandidates)if(n&&(null===(e=r.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<r.anchorCandidates.length;t++){const e=r.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+a.x2-a.x1,y2:e.y+a.y2-a.y1,anchor:e};if(!s.some((t=>dg(t,i)))){s.push(i),n=!1;break}}n&&s.push(r.bound)}else s.push(r.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function gg(t,i,s){const r=t.map((t=>t.pointCoord)),{x1:a,x2:n,y1:o,y2:l}=e.getAABBFromPoints(r),h=s([(a+n)/2,(o+l)/2]);if(!h)return[];const c=t.map((t=>{const r=t.rect,a=vg(i,t.pointCoord)?s(function(t,i,s,r=200){const a=5621/r;let n=i;for(let i=1;i<=a;i++){const i=e.destination(n,r,s);if(!vg(t,i))return[i.x,i.y];n=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],mg(fg(t.point,h)))):t.point;a&&(r.x=a.x,r.y=a.y);const n=mg(fg(t.point,h));let o;const l=[];return n>=-45&&n<45?(o="top",l.push("left","right")):n>=45&&n<135?o="right":n>=-135&&n<-45?(o="left",l.push("left")):(o="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=yg(t.rect,o,0),t}));return pg(c)}function mg(t){return t>180?t-360:t}function fg(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function vg(t,i){for(let s=0;s<t.length;s++){if(e.isPointInPolygon(i,t[s]))return!0}return!1}function yg(t,e,i=0){const s=Object.assign({},t);return"top"===e?(s.x-=t.width/2,s.y-=i+t.height/2):"bottom"===e?(s.x-=t.width/2,s.y+=i-t.height/2):"left"===e?(s.x-=i+t.width,s.y-=t.height/2):"right"===e&&(s.x+=i,s.y-=t.height/2),s}function _g(t,e,i,s=0){const r=[];return t.forEach((t=>{const{x:a,y:n}=yg(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);r.push({x:a,y:n})})),r}const bg={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:10}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"black"}}};class Sg extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return bg}}class Ag extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Sg,this.layoutType="none",this.layoutZIndex=e.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return e.getSpecInfo(t,this.specKey,this.type,(t=>t.visible&&e.isValid(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,r,a,n,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(r=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===r?void 0:r.longitudeField,this._latitudeField=null===(o=null===(n=(a=this._regions[0]).getSpec)||void 0===n?void 0:n.call(a))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const i=t.getViewData();if(i){const t=new e.DataView(this._option.dataSet,{name:`${this.name}_data`});t.parse([i],{type:"dataview"}),t.transform({type:"copyDataView",level:e.TransformLevel.copyDataView},!1),this._data=new e.CompilableData(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(()=>(this.handleZoom(),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("element-highlight:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this._updateDatum(null)}))):"click"===t&&(this.event.on("element-select:start",(t=>{const i=t.graphics[0];this._isRelativeSeries(i)&&this._updateDatum(e.getDatumOfGraphic(i))})),this.event.on("elementSelectReset",(t=>{this._activeDatum&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const i=[],s=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var s;const r=new e.MarkPoint({position:void 0,animation:!1});return r&&(r.name=`${this.name}_marker_${i}`,r.id=null!==(s=this._spec.id)&&void 0!==s?s:`${this.name}_marker_${this.id}`,r.setAttribute("zIndex",this.layoutZIndex)),r})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:r,contentMarks:a}=this._evaluateMarker(this._data.getLatestData()[e],e);r&&i.push(r),a&&s.push(a)}));const r=this._layoutLabels(i);this._layoutMarkers(r,s),this._renderMarkers()}_evaluateMarker(t,i){var s,r,a,n,o,l,h,c,d,u,p,g,m,f;let v=0,y=0,_=0,b=0,S=0;const A=this._spec.position||"top",x=this._spec.offset,T=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),C=this._spec.space||0;y+=((null==T?void 0:T.left)||0)+((null==T?void 0:T.right)||0),_+=((null==T?void 0:T.top)||0)+((null==T?void 0:T.bottom)||0);const k={},M=this.dataToPosition(t),E=e.graphicCreator.group({});if(E.name=`${this.name}_marker_itemContainer_${i}`,k.container=E,null===(r=this._spec.background)||void 0===r?void 0:r.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,E.appendChild(t)}if(null===(a=this._spec.icon)||void 0===a?void 0:a.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null!==(o=null===(n=this._spec.icon.style)||void 0===n?void 0:n.symbolType)&&void 0!==o?o:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,r=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.icon=t,E.appendChild(t),S=s,b+=r,v++}if(null===(d=this._spec.nameLabel)||void 0===d?void 0:d.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(M),i.setAttribute("text",t[this.nameField]);const s=i.AABBBounds,r=null!==(u=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==u?u:0,a=null!==(p=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==p?p:0;k.nameLabel=i,E.appendChild(i),S=Math.max(S,r),b+=a,v++}if((null===(g=this._spec.valueLabel)||void 0===g?void 0:g.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(M),i.setAttribute("text",t[this.valueField]);const s=i.AABBBounds,r=null!==(m=(null==s?void 0:s.y2)-(null==s?void 0:s.y1))&&void 0!==m?m:0,a=null!==(f=(null==s?void 0:s.x2)-(null==s?void 0:s.x1))&&void 0!==f?f:0;k.valueLabel=i,E.appendChild(i),S=Math.max(S,r),b+=a,v++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),O={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},P={x:O.x,y:O.y,width:0,height:0};P.width=y+b+(v-1)*C,P.height=_+S;const B={rect:P,point:O,index:i};if("outer"!==A){const t=["top","right","left","bottom"].filter((t=>t!==A));B.rect=yg(P,A,x),B.anchors=t,B.offset=x}else B.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:B,contentMarks:k}}_layoutMarkers(t,i){var s,r,a;for(let n=0;n<i.length;n++){if(!t[n]||!i[n])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:c,container:d}=i[n],u=t[n],p=e.normalizeLayoutPaddingSpec(null===(s=this._spec.background)||void 0===s?void 0:s.padding),g=this._spec.space||0,m=u.height/2;let f=(null==p?void 0:p.left)||0;[o,l,h].forEach(((t,e)=>{var i,s;if(t){const r=t.AABBBounds;let a=0;"symbol"===t.type&&(a+=(null!==(i=r.x2-r.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+a,y:m}),f+=null!==(s=r.x2-r.x1)&&void 0!==s?s:0,2!==e&&(f+=g)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==d||d.setAttributes({dx:-u.width/2,dy:-u.height/2});const v=this._data.getLatestData()[n],y=this.dataToPosition(v),_=this.getRegions()[0].getLayoutStartPoint(),b=!(!(null===(r=this._spec.leader)||void 0===r?void 0:r.visible)||!(o||l||h));this._markerComponents[n].setAttributes({x:_.x,y:_.y,position:y,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>d,autoRotate:!1,offsetX:u.x+u.width/2-y.x,offsetY:u.y+u.height/2-y.y},itemLine:{visible:b,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(a=this._spec.leader)||void 0===a?void 0:a.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;t<this._markerComponents.length;t++)this.getContainer().add(this._markerComponents[t])}_layoutLabels(t){return"outer"===this._spec.position&&this._map?gg(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):pg(t)}_isRelativeModel(t){var e,i,s;const r=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===r}_isRelativeSeries(t){var e;return(null===(e=t.context)||void 0===e?void 0:e.modelId)===this._series.id}_getNeedClearVRenderComponents(){return this._markerComponents}getVRenderComponents(){return this._markerComponents}}Ag.type="mapLabel",Ag.specKey="mapLabel",Ag.transformerConstructor=Sg;const xg="regressionLine";class Tg extends e.AbstractComponent{constructor(){super(...arguments),this.name=xg}render(){this.removeAllChild();const{data:t,line:i={},label:s,name:r="regression-line",confidenceInterval:a}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:n}=t;if(t.area&&!1!==(null==a?void 0:a.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(n)?{fill:n,fillOpacity:.12}:null),null==a?void 0:a.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const s=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(n)?{stroke:n}:null),null==i?void 0:i.style));s.name=`${r}-curve`,this.add(s)}const o=e.last(t.line);if(s&&!1!==s.visible&&s.text&&o){const t=e.createText(Object.assign(Object.assign(Object.assign({},o),{text:s.text,textAlign:"end",textBaseline:"middle"}),s.style));t.name=`${r}-label`,this.add(t)}}))}}const Cg=(t,i,s=(t=>t.x),r=(t=>t.y),a)=>{switch(t){case"logisitc":return e.regressionLogistic(i,s,r);case"lowess":return e.regressionLowess(i,s,r);case"polynomial":return e.regressionPolynomial(i,s,r,{degree:a});default:return e.regressionLinear(i,s,r)}};function kg(t,i){const{color:s,line:r,confidenceInterval:a,label:n}=i;return{type:"component",componentType:xg,interactive:!1,style:{data:(r,a)=>{const n=a.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),o=[];return n&&n.length&&n.forEach((r=>{var a,n;const l=r.getRegion().getLayoutStartPoint(),h=r.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+h.height),d=r.getColorAttribute(),u=r.getSeriesKeys(),p=r.getViewData().latestData,g=null===(a=r.fieldX)||void 0===a?void 0:a[0],m=null===(n=r.fieldY)||void 0===n?void 0:n[0];g&&m&&p&&!(p.length<=2)&&u.forEach((e=>{var a;const n=p.filter((t=>t[null==d?void 0:d.field]===e));if(!n.length)return;const{evaluateGrid:u,confidenceInterval:f}=Cg(t,n,(t=>null==t?void 0:t[g]),(t=>null==t?void 0:t[m]),i.polynomialDegree),v=Math.max(3,Math.floor(n.length/4)),y=u(v),_=f(v);o.push({color:null!=s?s:null===(a=null==d?void 0:d.scale)||void 0===a?void 0:a.scale(e),line:y.map((e=>{const i={[g]:e.x,[m]:e.y};return{x:r.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+h.height*(1-e.y):r.dataToPositionY(i)+l.y)}})),area:_.map((t=>{const e={[g]:t.x,[m]:t.lower};return{x:r.dataToPositionX(e)+l.x,y:c(r.dataToPositionY(e)+l.y),y1:c(r.dataToPositionY({[m]:t.upper})+l.y)}}))})}))})),o},line:r,confidenceInterval:a,label:n}}}function Mg(t){const{color:i,line:s,confidenceInterval:r,label:a}=t;return{type:"component",componentType:xg,interactive:!1,zIndex:500,style:{data:(s,r)=>{const a=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),n=[];return a&&a.length&&a.forEach((s=>{var r,a,o;const l=s.getRegion().getLayoutStartPoint(),h=s.getRegion().getLayoutStartPoint(),c=s.getRegion().getLayoutRect(),d=e.clamper(h.y,h.y+c.height),u=s.getViewData().latestData,p=null===(r=s.fieldX)||void 0===r?void 0:r[0],g=null===(a=s.fieldY)||void 0===a?void 0:a[0],m="horizontal"===s.direction,f=s.getRawDataStatisticsByField(p).values;if(m||!p||!g||!u||u.length<=2||f.length<=2)return;const{evaluateGrid:v,confidenceInterval:y}=e.regressionPolynomial(u,(t=>f.indexOf(null==t?void 0:t[p])),(t=>null==t?void 0:t[g]),{degree:t.degree}),_=f.length,b=v(_),S=y(_),A=s.getXAxisHelper().getBandwidth(0)/2;n.push({color:null!=i?i:null===(o=s.getOption().globalScale.getScale("color"))||void 0===o?void 0:o.scale(s.getSeriesKeys()[0]),line:b.map((t=>{const e={[p]:f[t.x],[g]:t.y};return{x:s.dataToPositionX(e)+l.x+A,y:d(s.dataToPositionY(e)+l.y)}})),area:S.map((t=>{const e={[p]:f[t.x],[g]:t.lower};return{x:s.dataToPositionX(e)+l.x+A,y:d(s.dataToPositionY(e)+l.y),y1:d(s.dataToPositionY({[g]:t.upper})+l.y)}}))})})),n},line:s,confidenceInterval:r,label:a}}}const Eg=(t,i,s)=>{switch(t){case"kde":return e.kde(i,s);case"ecdf":return e.ecdf(i)}};function wg(t,i){const{line:s,label:r,color:a}=i;return{type:"component",componentType:xg,interactive:!1,zIndex:500,style:{data:(i,s)=>{const r=s.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),n=[];return r&&r.length&&r.forEach((i=>{var s,r,o,l,h,c,d,u;const p=i.getRegion().getLayoutStartPoint(),g=i._rawData,m=null==g?void 0:g.rawData,f=null===(r=null===(s=g.transformsArr)||void 0===s?void 0:s.find((t=>"bin"===t.type)))||void 0===r?void 0:r.options,v=null===(o=i.fieldX)||void 0===o?void 0:o[0],y=i.getYAxisHelper().getScale(0),_=i.getViewData().latestData;if(!(m&&m.length&&(null==f?void 0:f.field)&&y&&_&&_.length))return;const b=m.map((t=>t[f.field])),S=Eg(t,b,"kde"===t?{bandwidth:_[0][null!==(h=null===(l=f.outputNames)||void 0===l?void 0:l.x1)&&void 0!==h?h:"x1"]-_[0][null!==(d=null===(c=f.outputNames)||void 0===c?void 0:c.x0)&&void 0!==d?d:"x0"]}:null),A=Math.max(3,Math.floor(b.length/4)),x=S.evaluateGrid(A),T=y.range(),C=T[0],k=e.last(T),M="kde"===t?t=>y.scale(t*m.length*S.bandwidth):t=>C+(k-C)*t;n.push({color:null!=a?a:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:x.map((t=>{const e={[v]:t.x};return{x:i.dataToPositionX(e)+p.x,y:M(t.y)+p.y}}))})})),n},line:s,label:r}}}const Og="ExtensionMarkSyncStatePlugin";class Pg extends e.BasePlugin{constructor(){super(Og),this.type=Og}onAfterInitChart(t,i){var s;if(!this._detectSyncState(i))return;const r=t.globalInstance.getChart();if(!r)return;const a=r.getEvent();if(this._subscribedEvent===a)return;null===(s=this._unsubscribeAfterRender)||void 0===s||s.call(this);const n=()=>this._syncStates();a.on(e.ChartEvent.afterRender,n),this._subscribedEvent=a,this._unsubscribeAfterRender=()=>{a.off(e.ChartEvent.afterRender,n),this._subscribedEvent=void 0}}release(){var t;null===(t=this._unsubscribeAfterRender)||void 0===t||t.call(this),super.release()}_detectSyncState(t){const e=null==t?void 0:t.series;return!!(null==e?void 0:e.some((t=>this._hasExtensionMarkWithSyncState(t.extensionMark))))||this._hasExtensionMarkWithSyncState(null==t?void 0:t.extensionMark)}_hasExtensionMarkWithSyncState(t){return!!(null==t?void 0:t.some((t=>"group"!==t.type&&t.syncState)))}_syncStates(){var t;const e=null===(t=this.service)||void 0===t?void 0:t.globalInstance.getChart();e&&e.getAllSeries().forEach((t=>{var e,i;const s=null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.extensionMark)||void 0===i?void 0:i.filter((t=>"group"!==t.type&&t.syncState));(null==s?void 0:s.length)&&this._syncSeriesStates(t,s)}))}_syncSeriesStates(t,i){const s=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(r)&&s.set(String(r),t)}))})),0===s.size)return;const r=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,a)=>{const n=e.isValid(i.name)?`${i.name}`:`${r}_${a}`,o=t.getMarkInName(n);o&&o.getGraphics().forEach((t=>{var i;const r=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(r))return;const a=s.get(String(r));if(!a)return;const n=a.currentStates;(null==n?void 0:n.length)?t.useStates(n):t.clearStates()}))}))}}Pg.pluginType="chart",Pg.type=Og;t.BAR_LINK=eg,t.Bar3dChart=Ec,t.Bar3dChartSpecTransformer=z,t.Bar3dSeries=Tc,t.Bar3dSeriesSpecTransformer=rt,t.BarLinkComponent=ig,t.CandlestickChart=Fu,t.CandlestickChartSpecTransformer=Cu,t.CandlestickSeries=Ru,t.CombinationCandlestickChart=Uu,t.CombinationCandlestickChart_TYPE=Tu,t.ConversionFunnelChart=O,t.ConversionFunnelSeries=P,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=Pg,t.Funnel3dChart=Fc,t.Funnel3dSeries=Rc,t.Funnel3dSeriesSpecTransformer=Oc,t.Histogram3dChart=Nc,t.ImageCloudChart=Up,t.MapLabelComponent=Ag,t.PictogramChart=wp,t.PictogramChartSpecTransformer=np,t.PictogramSeries=Mp,t.Pie3dChart=xu,t.Pie3dChartSpecTransformer=od,t.Pie3dSeries=Su,t.Pie3dSeriesSpecTransformer=bu,t.REGRESSION_LINE=xg,t.RangeColumn3dChart=ep,t.RangeColumn3dChartSpecTransformer=tp,t.RangeColumn3dSeries=Zu,t.RangeColumn3dSeriesSpecTransformer=Ju,t.RankingBar=l,t.RankingList=f,t.RegressionLine=Tg,t.SERIES_BREAK=$p,t.SVG_VIEWPORT_RECT_KEY=lp,t.SequenceScatterKDE=j,t.SequenceScatterLink=I,t.SequenceScatterPixel=K,t.SeriesBreakComponent=Xp,t.SeriesLabelComponent=cg,t.TimelineChart=Wp,t.WordCloud3dChart=Wu,t.WordCloud3dChartSpecTransformer=Hu,t.WordCloud3dSeries=Gu,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==eg)),t.customMark.push(rg(i))},t.appendBarRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,xg))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),xg)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=v(e,["visible"]);t.customMark.push(Mg(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,xg))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.bar)),xg)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(wg(i,s))}}))},t.appendScatterRegressionLineConfig=function(t,i){var s;if(!i){const r=Array.isArray(t.series)?t.series:t.series?[t.series]:[];i=null!==(s=e.get(t,xg))&&void 0!==s?s:e.get(r.find((t=>t.type===e.SeriesTypeEnum.scatter)),xg)}e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,s=v(e,["type"]);t.customMark.push(kg(i,s))}}))},t.appendSeriesBreakConfig=t=>{var i;if(null===(i=t.axes)||void 0===i?void 0:i.length){const i=t.axes.filter((t=>t.breaks&&t.breaks.length&&!1!==t.visible));if(i.length)return t.customMark=e.array(t.customMark).filter((t=>t.componentType!==$p)),t.customMark.push(Zp(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var s,r,a;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==ag)),i||(i=null!==(a=null!==(s=e.get(t,ag))&&void 0!==s?s:e.get(null===(r=t.series)||void 0===r?void 0:r[0],ag))&&void 0!==a?a:{}),i.visible){const{position:e="end"}=i,s=v(i,["position"]);t.customMark.push(hg(e,s))}},t.clearSVGSource=function(){op.clear(),hp=null},t.getBarLinkConfig=rg,t.getBarRegressionLineConfig=Mg,t.getHistogramRegressionLineConfig=wg,t.getSVGSource=pp,t.getScatterRegressionLineConfig=kg,t.getSeriesBreakConfig=Zp,t.getSeriesLabelConfig=hg,t.register3DPlugin=it,t.registerAxis3dPlugin=()=>{it(),Mc(),(()=>{e.registerCartesianBandAxis();const t=e.Factory.getComponentInKey(e.CartesianBandAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianBandAxis.builtInTheme.axisX),Yu)}),e.mixin(t,Xu)})(),(()=>{e.registerCartesianLinearAxis();const t=e.Factory.getComponentInKey(e.CartesianLinearAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLinearAxis.builtInTheme.axisX),Yu)}),e.mixin(t,Xu)})(),(()=>{e.registerCartesianTimeAxis();const t=e.Factory.getComponentInKey(e.CartesianTimeAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),Yu)}),e.mixin(t,Xu)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianSymlogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},t.builtInTheme.axisX),Yu)}),e.mixin(t,Xu)})(),(()=>{e.registerCartesianLogAxis();const t=e.Factory.getComponentInKey(e.CartesianLogAxis.type);t.builtInTheme=Object.assign(Object.assign({},t.builtInTheme),{axisZ:Object.assign(Object.assign({},e.CartesianLogAxis.builtInTheme.axisX),Yu)}),e.mixin(t,Xu)})()},t.registerBar3dChart=()=>{it(),Mc(),Cc(),e.Factory.registerChart(Ec.type,Ec)},t.registerBar3dSeries=Cc,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(eg,(t=>new ig(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Lu(),e.Factory.registerChart(Fu.type,Fu)},t.registerCandlestickSeries=Lu,t.registerCombinationCandlestickChart=()=>{Lu(),e.Factory.registerChart(Uu.type,Uu)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([O]),i.useSeries([P]))},t.registerEventSeries=Hp,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(Pg)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),it(),Mc(),Lc(),e.Factory.registerChart(Fc.type,Fc)},t.registerFunnel3dSeries=Lc,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),it(),Mc(),Cc(),e.Factory.registerChart(Nc.type,Nc)},t.registerImageCloudChart=()=>{jp(),e.Factory.registerChart(Up.type,Up)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([Ag])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),Ep(),e.Factory.registerChart(wp.type,wp)},t.registerPictogramSeries=Ep,t.registerPie3dChart=()=>{J.registerTooltipProcessor("mark",Sd),it(),Mc(),Au(),J.registerChart(xu.type,xu)},t.registerPie3dSeries=Au,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),it(),Mc(),Qu(),e.Factory.registerChart(ep.type,ep)},t.registerRangeColumn3dSeries=Qu,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([l])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([f,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(xg,(t=>new Tg(t)))},t.registerSVGSource=dp,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([j,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([I,e.ScatterChart])},t.registerSequenceScatterPixel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([K,e.ScatterChart])},t.registerSeriesBreak=()=>{e.Factory.registerGraphicComponent("seriesBreak",(t=>new Xp(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new cg(t)))},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),Hp(),e.Factory.registerChart(Wp.type,Wp)},t.registerWordCloud3dChart=$u,t.registerWordCloud3dSeries=Ku,t.registerWordCloudShape3dChart=()=>{it(),zu(),$u()},t.registerWordCloudShape3dSeries=zu,t.svgSourceMap=op,t.transformCandlestickSeriesSpec=Nu,t.unregisterSVGSource=up}));
|