@visactor/vchart-extension 2.1.0-alpha.17 → 2.1.0-alpha.19

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.
@@ -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 y(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}const m={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},v={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},x={fill:"#606773",fontSize:12},f={fill:"#eff1f9"};class b extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:n}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=y(t,["arrows"]),n=e.filter((t=>"left"===t.position)),o=k(e.filter((t=>"right"===t.position)),i),r=k(n,i),a=[];o&&(o.name="arrowRight",a.push(o));r&&(r.name="arrowLeft",a.push(r));return a}(e);t&&t.length&&i.push(...t)}if(n&&n.visible){const t=function(t){const{style:e={}}=t,i=y(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},f),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:n}=i.getLayoutRect();return n},height:(t,e)=>{const i=e.getPoints(t),n=i[0];return i[3].y-n.y}})})}(n);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 k(t,i){if(0===(null==t?void 0:t.length))return null;const{line:n,symbol:o,text:r,margin:a}=i,s=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},d=function(t={},e){const{style:i={}}=t,n=y(t,["style"]),o=(t,e)=>{var i,n;const{from:o,to:r}=t,{vchart:a}=e,s=null===(n=null===(i=null==a?void 0:a.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===n?void 0:n.latestData;return!(r>s.length-1||o>s.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},n),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},m),i),{renderable:o,points:(t,i)=>{if(!o(t,i))return[];let n=t.layout.points;return n=_(t,i,e),n}})})}(n,a);d&&s.push(d);const c=function(t={},e){const{style:i={}}=t,n=y(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},n),{style:Object.assign(Object.assign(Object.assign({},v),i),{x:(t,i)=>{var n,o;let r=t.layout.points;return r=_(t,i,e),null!==(o=null===(n=r[(null==r?void 0:r.length)-1])||void 0===n?void 0:n.x)&&void 0!==o?o:NaN},y:(t,i)=>{var n,o;let r=t.layout.points;return r=_(t,i,e),null!==(o=null===(n=r[(null==r?void 0:r.length)-1])||void 0===n?void 0:n.y)&&void 0!==o?o:NaN},angle:t=>"left"===t.position?90:-90})})}(o,a);c&&s.push(c);const h=function(t={},i){const{style:n={},formatMethod:o,textMargin:r=4}=t,a=y(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},a),{style:Object.assign(Object.assign(Object.assign({},x),{text:(t,i)=>{var n,r,a,s,l,d,c;const{text:h}=t;let u=h;if(e.isFunction(o)){const{vchart:e}=i,{from:g,to:p}=t,{field:y}=t.context,m=null!==(a=null===(r=null===(n=null==e?void 0:e.getChart())||void 0===n?void 0:n.getSeriesData())||void 0===r?void 0:r.latestData)&&void 0!==a?a:[],v=null!==(c=null===(d=null===(l=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===d?void 0:d.latestData)&&void 0!==c?c:[],x=v.find((t=>t[y]===m[g][y])),f=v.find((t=>t[y]===m[p][y]));u=o(h,{arrow:t,from:x,to:f})}return u},x:(t,e)=>{var n,o;let a=t.layout.points;return a=_(t,e,i),null!==(o=(null===(n=a[1])||void 0===n?void 0:n.x)+("left"===t.position?-r:r))&&void 0!==o?o:NaN},y:(t,e)=>{var n,o,r;let a=t.layout.points;return a=_(t,e,i),null!==(r=((null===(n=a[1])||void 0===n?void 0:n.y)+(null===(o=a[2])||void 0===o?void 0:o.y))/2)&&void 0!==r?r:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),n)})}(r,a);return h&&s.push(h),l.children=s,l}function _(t,e,i){var n,o,r,a,s;const{vchart:l}=e,{from:d,to:c}=t,{field:h}=t.context,u=null===(o=null===(n=null==l?void 0:l.getChart())||void 0===n?void 0:n.getSeriesData())||void 0===o?void 0:o.latestData,g=null===(s=null===(a=null===(r=null==l?void 0:l.getChart())||void 0===r?void 0:r.getAllSeries()[0])||void 0===a?void 0:a.getViewData())||void 0===s?void 0:s.latestData;let p=[];if(u&&u.length){const n=g.find((t=>t[h]===u[d][h])),o=g.find((t=>t[h]===u[c][h])),r=g[0];if(n&&o&&r){p=function(t,e,i,n,o=12){const{layout:r,distance:a,position:s}=t,{level:l,fromIndex:d,toIndex:c,fromTotal:h,toTotal:u}=r,g="right"===s,p=g?e[1]:e[0],y=g?e[2]:e[3],m=Math.abs(p.y-y.y),v=g?i[1]:i[0],x=g?i[2]:i[3],f=Math.abs(v.y-x.y),b=g?n[1]:n[0],k=m/(h+1),_=f/(u+1),S=p.y+k*(d+1),M=v.y+_*(c+1),A=g?-1:1,w=[{x:p.x-o*A,y:S},{x:b.x-(o+(l+1)*a)*A,y:S},{x:b.x-(o+(l+1)*a)*A,y:M},{x:v.x-o*A,y:M}];return w}(t,e.getPoints(n),e.getPoints(o),e.getPoints(r),i),t.layout.points=p}}return p}function S(t,e){const{from:i,to:n}=t,{from:o,to:r}=e;return n>o&&r>i}function M(t,e){const{from:i,to:n}=t,{from:o,to:r}=e;return i===o&&n===r}const A=(t,i)=>{var n,o,r;if(!t||!(null===(n=t.arrows)||void 0===n?void 0:n.length))return[];const{arrows:a}=t,s=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:n,to:o,position:r="right"}=t;return Object.assign(Object.assign({},t),{position:r,distance:t.distance||40,from:Math.min(n,o),to:Math.max(n,o),span:Math.abs(n-o),isLayout:!1,context:{field:i},layout:{level:0},id:`${n}-${o}-${r}-${e}`})}))}(a,i.categoryField),l=s.filter((t=>"left"===t.position)),d=s.filter((t=>"right"===t.position));return[...null!==(o=w(l))&&void 0!==o?o:[],...null!==(r=w(d))&&void 0!==r?r:[]]};function w(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const n=i.get(t.from);if(e.isValid(n)){const e=n.fromArrows.find((e=>M(e,t)));e?t.layout.duplicateNode=e:n.degree+=1,n.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const o=i.get(t.to);if(e.isValid(o)){const e=o.toArrows.find((e=>M(e,t)));e?t.layout.duplicateNode=e:o.degree+=1,o.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((n=>{var o;const r=t.filter((t=>t.layout.isLayout)),a=e.maxInArray(r,((t,e)=>t.layout.level-e.layout.level));let s=null!==(o=null==a?void 0:a.layout.level)&&void 0!==o?o:0;for(;s>=0;){if(r.some((t=>t.layout.level===s&&S(t,n)))){s+=1;break}--s}n.layout.level=Math.max(0,s),n.layout.fromTotal=i.get(n.from).degree,n.layout.toTotal=i.get(n.to).degree;const l=n.layout.duplicateNode;l?(n.layout.fromIndex=l.layout.fromIndex,n.layout.toIndex=l.layout.toIndex):(n.layout.fromIndex=C(n,i.get(n.from).totalArrows),n.layout.toIndex=C(n,i.get(n.to).totalArrows)),n.layout.isLayout=!0})),t}function C(t,e){let i=0,n=0;for(let o=0;o<e.length;o++){const r=e[o];if(r===t){i=o-n;break}r.layout.duplicateNode&&n++}return i}class L extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=b}}L.type="conversionFunnel",L.transformerConstructor=b;class F 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",A),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 O="dataKey";class T extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r;super.transformSpec(t);const a=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const n=t.data[i].nodes;e.push({data:[{id:"nodes",values:n.map(((t,e)=>Object.assign(Object.assign({},t),{[O]: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),s="neighborhood"!==t.taskType;t.type="common",t.dataKey=O,t.data=a[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:a}),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!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o: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===(r=t.infoLabel)||void 0===r?void 0:r.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:s,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 B extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=T}init(){this.isValid()&&super.init()}isValid(){var t,e,i,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}B.type="sequenceScatterLink",B.view="singleDefault",B.transformerConstructor=T;const I=.2;function D(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const E="dataKey";class j extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r,a;super.transformSpec(t);const s=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const n=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[E]:e}))),o=function(t,e=100,i){const n=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),o=[];return Object.entries(n).forEach((([t,n])=>{const r=i||function(t){return t.length**(-1/6)}(n),a=n.map((t=>t.x)),s=n.map((t=>t.y)),l=Math.min(...a),d=Math.max(...a),c=Math.min(...s),h=Math.max(...s),u=l-(d-l)*I,g=c-(h-c)*I;for(let i=0;i<e;i++)for(let a=0;a<e;a++){const e=u+.1*i,s=g+.1*a;let l=0;for(const t of n)l+=D(Math.sqrt((e-t.x)**2+(s-t.y)**2)/r);l/=n.length*r*r,o.push({x:e,y:s,kde:l,label:t})}})),o}(n,150);e.push({data:[{id:"nodes",values:n},{id:"iter",values:[{iter:i}]},{id:"kde",values:o}]})})),e}(t);t.type="common",t.dataKey=E,t.data=s[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:s}),t.animationAppear={duration:null!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o:2e3,easing:"linear"},t.animationUpdate={duration:null!==(a=null===(r=t.player)||void 0===r?void 0:r.duration)&&void 0!==a?a:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class P extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=j}init(){this.isValid()&&super.init()}isValid(){var t,e,i,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}P.type="sequenceScatterKDE",P.view="singleDefault",P.transformerConstructor=j;const R="dataKey";function $(t){const e=[];return Object.keys(t.data).forEach((i=>{let n=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 n=document.createElement("canvas");n.width=e.width,n.height=e.height;const o=n.getContext("2d");if(!o)throw new Error("Failed to get 2D rendering context from canvas");const r=o.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let n=0;n<300;n++){const o=(null===(i=t[e])||void 0===i?void 0:i[n])||[0,0,0],a=4*(300*e+n);r.data[a]=Math.round(255*o[0]),r.data[a+1]=Math.round(255*o[1]),r.data[a+2]=Math.round(255*o[2]),r.data[a+3]=255}return o.putImageData(r,0,0),n.toDataURL("image/png")}(t.backgroundColors[i],t);n={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[R]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:n?[n]:[]}]})})),e}class z extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r;super.transformSpec(t);const a=$(t);t.type="common",t.dataKey=R,t.data=a[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:a}),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!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o: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===(r=t.infoLabel)||void 0===r?void 0:r.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,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.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 N 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,G,U,K;!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"}(G||(G={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(U||(U={})),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"}(K||(K={}));const Y=t=>t.zField||t.series&&t.series.some((t=>t.zField));class X extends e.BasePlugin{constructor(){super(X.type),this.type="VChart3dPlugin"}onInit(t,e){var i,n;if(this._is3d=!!(n=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(n.type)||Y(n),!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&&Y(e)&&(e.layout={type:"layout3d"})}}X.pluginType="chart",X.type="VChart3dPlugin";const Z=()=>{e.registerChartPlugin(X),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 Q 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=Q.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Q.type="rect3d";const tt=()=>{e.Factory.registerMark(Q.type,Q),e.registerShadowRoot(),e.registerRect3d(),e.registerRectAnimation(),e.Factory.registerGraphicComponent("rect3d",e.createRect3d)};class et extends e.BarSeries{constructor(){super(...arguments),this.type=G.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=J}}et.type=G.bar3d,et.mark=q,et.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},et.transformerConstructor=J;const it=()=>{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)}))),tt(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(et.type,et)};class nt extends e.Layout{layoutItems(t,i,n,o){this._layoutInit(t,i,n,o);const r={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(i,r);const a={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},s=i.filter((t=>"absolute"===t.layoutType)),l=s.filter((t=>"z"===t.layoutOrient));let d={width:0,height:0};if(l.length){d=l[0].getLayoutRect()}this.leftCurrent+=d.width/8,this.rightCurrent-=d.width/8,this.topCurrent+=d.height/8,this.bottomCurrent-=d.height/8;const{regionItems:c,relativeItems:h,relativeOverlapItems:u,allRelatives:g,overlapItems:p}=this._groupItems(i);this.layoutRegionItems(c,h,u,p,r),this._processAutoIndent(c,h,u,p,g,a,r);const y=s.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(y);const m=h.filter((t=>"axes"===t.model.specKey&&e.isXAxis(t.layoutOrient)))[0],v=h.filter((t=>"axes"===t.model.specKey&&e.isYAxis(t.layoutOrient)))[0];if(m&&l.length){const t=m.getLayoutStartPoint(),e=m.getLayoutRect(),i={x:"left"===v.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};l[0].model.directionStr="left"===v.layoutOrient?"r2l":"l2r";const n=m.getLayoutRect(),o=v.getLayoutRect(),r={length:l[0].getLayoutRect().width,width:n.width,height:o.height};m.model.setLayout3dBox&&m.model.setLayout3dBox(r),v.model.setLayout3dBox&&v.model.setLayout3dBox(r),l[0].model.setLayout3dBox&&l[0].model.setLayout3dBox(r),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,n=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const o="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();o?(e.top=Math.max(e.top,r.y1-this.topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this.leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}nt.type="layout3d";const ot=()=>{e.Factory.registerLayout(nt.type,nt)};class rt extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=N,this.type="bar3d",this.seriesType=G.bar3d}}rt.type="bar3d",rt.seriesType=G.bar3d,rt.transformerConstructor=N;const at=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 st extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class lt extends e.BasePolygonMark{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=lt.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}lt.type="pyramid3d";const dt=e.getFunnelTheme(!0);class ct extends e.FunnelSeries{constructor(){super(...arguments),this.type=G.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=st}initMark(){var t,e,i,n,o,r,a,s;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ct.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({},ct.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===(n=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===n?void 0:n.visible){const{line:t}=null!==(o=this._spec.outerLabel)&&void 0!==o?o:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ct.mark.outerLabel,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ct.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,n;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===(n=this._funnelOuterLabelMark)||void 0===n||n.line}}ct.type=G.funnel3d,ct.mark=at,ct.builtInTheme={funnel3d:dt},ct.transformerConstructor=st;const ht=()=>{e.Factory.registerMark(lt.type,lt),e.registerShadowRoot(),e.registerPyramid3d(),e.registerPolygonAnimation(),e.Factory.registerGraphicComponent("pyramid3d",e.createPyramid3d),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(ct.type,ct)};class ut extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=G.funnel3d}}ut.type="funnel3d",ut.seriesType=G.funnel3d,ut.transformerConstructor=e.FunnelChartSpecTransformer;class gt extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=G.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}gt.type="histogram3d",gt.seriesType=G.bar3d,gt.transformerConstructor=e.HistogramChartSpecTransformer;class pt extends e.BasePieChartSpecTransformer{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class yt extends e.BaseArcMark{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=yt.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}yt.type="arc3d";const mt=Object.assign(Object.assign({},e.baseSeriesMark),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class vt extends e.PieSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class xt extends e.BasePieSeries{constructor(){super(...arguments),this.type=G.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=vt}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))}}xt.type=G.pie3d,xt.mark=mt,xt.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},xt.transformerConstructor=vt;const ft=()=>{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(),e.registerArc3d(),e.Factory.registerGraphicComponent("arc3d",e.createArc3d),e.Factory.registerMark("arc3d",yt),e.Factory.registerSeries(xt.type,xt)};class bt extends e.BasePieChart{constructor(){super(...arguments),this.transformerConstructor=pt,this.type="pie3d",this.seriesType=G.pie3d}}bt.type="pie3d",bt.seriesType=G.pie3d,bt.transformerConstructor=pt;const kt="combinationCandlestick";class _t 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 St extends e.GlyphMark{constructor(){super(...arguments),this.type=St.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:n=i.attribute.x,boxWidth:o=i.attribute.boxWidth,open:r=i.attribute.open,close:a=i.attribute.close,low:s=i.attribute.low,high:l=i.attribute.high}=t,d={};return d.line={points:[{x:n,y:s},{x:n,y:l}]},d.box={x:n-o/2,x1:n+o/2,y:Math.min(r,a),y1:Math.max(r,a),drawStrokeWhenZeroWH:!0},d}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}St.type="candlestick";class Mt extends e.ACustomAnimate{constructor(t,e,i,n,o){super(t,e,i,n,o)}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(){return(t=>{const i=t.getFinalAttribute(),{x:n,y:o,open:r,high:a,low:s,close:l}=i,d={from:{x:n,y:o},to:{x:n,y:o}};return e.isValidNumber(r)&&e.isValidNumber(l)&&(r>l?(d.from.open=s,d.to.open=r,d.from.close=s,d.to.close=l,e.isValidNumber(a)&&(d.from.high=s,d.to.high=a)):(d.from.open=a,d.to.open=r,d.from.close=a,d.to.close=l,e.isValidNumber(s)&&(d.from.low=a,d.to.low=s))),d})(this.target,this.params,this.params.options)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(n)}}class At extends e.ACustomAnimate{constructor(t,e,i,n,o){super(t,e,i,n,o)}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(){return(t=>{const i=t.getFinalAttribute(),{x:n,y:o,open:r,high:a,low:s,close:l}=i,d={from:{x:n,y:o},to:{x:n,y:o}};return e.isValidNumber(r)&&e.isValidNumber(l)&&(r>l?(d.from.open=r,d.to.open=s,d.from.close=l,d.to.close=s,e.isValidNumber(a)&&(d.from.high=a,d.to.high=s)):(d.from.open=r,d.to.open=a,d.from.close=l,d.to.close=a,e.isValidNumber(s)&&(d.from.low=s,d.to.low=a))),d})(this.target,this.params,this.params.options)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(n)}}const wt="candlestick";var Ct,Lt;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(Ct||(Ct={})),function(t){t.candlestick="candlestick"}(Lt||(Lt={}));const Ft=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class Ot extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case Ct.OPEN:return this.series.getOpenField();case Ct.HIGH:return this.series.getHighField();case Ct.LOW:return this.series.getLowField();case Ct.CLOSE:return this.series.getCloseField();case Ct.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case Ct.OPEN:return e[this.series.getOpenField()];case Ct.HIGH:return e[this.series.getHighField()];case Ct.LOW:return e[this.series.getLowField()];case Ct.CLOSE:return e[this.series.getCloseField()];case Ct.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(Ct.OPEN),value:this.getContentValue(Ct.OPEN)},{key:this.getContentKey(Ct.HIGH),value:this.getContentValue(Ct.HIGH)},{key:this.getContentKey(Ct.LOW),value:this.getContentValue(Ct.LOW)},{key:this.getContentKey(Ct.CLOSE),value:this.getContentValue(Ct.CLOSE)},{key:this.getContentKey(Ct.SERIES_FIELD),value:this.getContentValue(Ct.SERIES_FIELD)}]}}const Tt={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class Bt extends e.CartesianSeries{constructor(){super(...arguments),this.type=wt,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,n,o,r,a,s;super.setAttrFromSpec();const l=this._spec,d=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=d.boxWidth,this._boxFill=d.boxFill,this._strokeColor=d.strokeColor,this._buildMergedStyles(d,null!==(n=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==n?n:{},null!==(r=null===(o=l.falling)||void 0===o?void 0:o.style)&&void 0!==r?r:{},null!==(s=null===(a=l.doji)||void 0===a?void 0:a.style)&&void 0!==s?s:{})}initMark(){this._candlestickMark=this._createMark(Bt.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const n={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,n,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,n=this._yAxisHelper;if(i&&n){const{dataToPosition:o}=n,r=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),r),high:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),r),low:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),r),close:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),r)},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 n=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),o=this._initAnimationSpec(e.userAnimationConfig(wt,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(n,o,i))}}initTooltip(){this._tooltipHelper=new Ot(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,n,o){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,n),this._mergedStyles.doji=e.merge({},t,o)}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]}}Bt.type=wt,Bt.builtInTheme={candlestick:Tt},Bt.mark=Ft;const It=()=>{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(St.type,St),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Mt),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",At),e.Factory.registerSeries(Bt.type,Bt)};class Dt extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Dt.type="candlestick",Dt.seriesType=wt,Dt.transformerConstructor=_t;function Et(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class jt 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 n=t;n.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&n.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 n=t.series.find((e=>e.id===t.candlestickSeries.id));let o;n?(e.merge(n,t.candlestickSeries),o=n):(t.series.push(t.candlestickSeries),o=t.candlestickSeries),Et(o),this._transformSeriesData(t,o),o.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const n=t.series.find((t=>t.id===i.id));let o;n?(e.merge(n,i),o=n):(t.series.push(i),o=i),o.regionIndex=1,this._transformSeriesData(t,o)}))}_transformSeriesData(t,i){var n;i.data&&(t.data=e.array(null!==(n=t.data)&&void 0!==n?n:[]),e.array(i.data).forEach(((e,n)=>{t.data.push(e),0===n&&(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,n;const o={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let r=0,a=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&r++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?r++:a++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?r++:a++)})),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?r++:a++)}))}r++,a++,t.previewSeries&&r++,o.row=r,o.col=a;const s={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(n=t.title)||void 0===n?void 0:n.visible)&&this._layoutOrientItem(o,t.title,s,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(o,i,s,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(o,t,s,{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(o,t,s,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(o,{orient:"top"},s,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(o,{orient:"bottom"},s,{specKey:"region",index:1},"one"),n=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==n){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:n};o.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;o.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else o.rowHeight.push({index:i.row,size:t.previewHeight})}const d=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(o,t.axes[d],s,{specKey:"axes",index:d},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const n=o.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));n&&("top"===e.orient||"bottom"===e.orient?n.col=l.col:n.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=o.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=o}_layoutOrientItem(t,e,i,n,o){var r;const a={modelKey:n.specKey,modelIndex:n.index,col:0,row:0},s=null!==(r=e.orient)&&void 0!==r?r:"top",{span:l,index:d}=this._getLayoutElementCommon(t,i,o,s);return t.elements.push(a),"top"===s?(a.row=i.top,a.rowSpan=1,a.colSpan=l,a.col=d,i.top++):"bottom"===s?(a.row=t.row-i.bottom-1,a.rowSpan=1,a.colSpan=l,a.col=d,i.bottom++):"left"===s?(a.col=i.left,a.colSpan=1,a.rowSpan=l,a.row=d,i.left++):"right"===s&&(a.col=t.col-i.right-1,a.colSpan=1,a.rowSpan=l,a.row=d,i.right++),a}_getLayoutElementCommon(t,e,i,n){return"top"===n||"bottom"===n?{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 Pt extends e.BaseChart{constructor(){super(...arguments),this.type=kt,this.transformerConstructor=jt}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,n)=>{var o;return[...null!==(o=e.getCartesianDimensionInfo(t,i,n))&&void 0!==o?o:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Pt.type=kt,Pt.transformerConstructor=jt,e.mixin(Pt,e.StackChartMixin);const Rt=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class $t extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=G.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 n=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-n.left||0-n.right||0,o=e.height-n.top||0-n.bottom||0,r=Math.max(i,o)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}$t.type=G.wordCloud3d,$t.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const zt=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:Rt(t)}))),e.Factory.registerSeries($t.type,$t)},Vt=()=>{zt()};class Nt extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class Wt extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=Nt,this.type="wordCloud3d",this.seriesType=G.wordCloud3d}}Wt.type="wordCloud3d",Wt.seriesType=G.wordCloud3d,Wt.transformerConstructor=Nt;const Ht=()=>{Z(),zt(),e.Factory.registerChart(Wt.type,Wt)},Gt={label:{space:0}};class Ut{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const n=e.isZAxis(this._orient),o=e.isXAxis(this._orient),r=e.isYAxis(this._orient);let a=0,s=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,o=i+t[0].getLayoutRect().height;for(let r=1;r<t.length;r++){const a=t[r],{x:s,y:l}=a.getLayoutStartPoint(),{width:d,height:c}=a.getLayoutRect();e=Math.min(e,s),n=Math.max(n,d+s),i=Math.min(i,l),o=Math.max(o,c+l)}a=Math.abs(o-i),s=Math.abs(n-e)}let l=0,d=0;const{width:c,height:h}=this.getLayoutRect();let u={x:0,y:0};o?(u={x:c,y:0},l=a,d=c):r&&(u={x:0,y:h},l=s,d=h);const g=this.layout3dBox?this.layout3dBox.length:0;if(!n){const e=this.getLabelItems(d);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(o),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:g,length:l},t}return((t,i)=>{var n;const o=e.getCombinedSizeOfRegions(t.getRegions()),{width:r}=t.getLayoutRect(),a=r,s=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,d={x:s,y:0},c=t.getLabelItems(a),h={start:{x:0,y:0},end:d,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(n=t.directionStr)&&void 0!==n?n:"r2l";let g=[0,0],p=-Math.PI/2,y=0;return"l2r"===u&&(y=t.layout3dBox.length,g=[0,0,0],p=Math.PI/2),h.z=y,h.alpha=p,h.anchor3d=g,i||(h.grid={type:"line",start:{x:0,y:0},end:d,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:o.height,alpha:p,z:y,anchor3d:g}),h})(this,i)}}const Kt=Object.assign(Object.assign({},q),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Yt extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=G.rangeColumn3d,this._barMarkType="rect3d",this._barName=G.bar3d}}Yt.type=G.rangeColumn3d,Yt.mark=Kt;const Xt=()=>{tt(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Yt.type,Yt)};class Zt extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class qt extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);return"horizontal"===t.direction?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}class Jt extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=qt,this.type="rangeColumn3d",this.seriesType=G.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Jt.type="rangeColumn3d",Jt.seriesType=G.rangeColumn3d,Jt.transformerConstructor=qt;const Qt="pictogram",te="pictogram";var ee;!function(t){t.pictogram="pictogram"}(ee||(ee={}));const ie=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class ne extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===te}_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 oe=new Map;let re;function ae(t,i){oe.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),re||(re=new e.DataSet,e.registerDataSetInstanceParser(re,"svg",e.svgParser));const n=new e.DataView(re);n.parse(i,{type:"svg"}),oe.set(t,n)}function se(t){oe.has(t)?oe.delete(t):e.warn(`map type of '${t}' does not exists.`)}function le(t){return oe.get(t)}class de extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,n,o;const r=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},a=t.svg,s=null===(o=null===(n=oe.get(a))||void 0===n?void 0:n.latestData)||void 0===o?void 0:o.elements;if(s&&s.length){s.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(r[e]=t[e])}))}return r}}class ce 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 he="element-highlight-by-graphic-name";class ue extends e.ElementHighlight{constructor(){super(...arguments),this.type=he,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:n,blurState:o}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&a.push(e)}))})),i.updateStates(this,a,r,n,o),i.setStatedGraphics(this,a)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}ue.type=he;const ge="element-select-by-graphic-name";class pe extends e.ElementSelect{constructor(){super(...arguments),this.type=ge}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)}))}))}}pe.type=ge;function ye(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const me=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&ye(i)?1:0},ve=(t,e)=>{var i;const n=null!==(i=t.fill)&&void 0!==i?i:e;return n&&ye(n)?n:void 0},xe=(t,e)=>{var i;const n=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!n||!ye(n))&&n},fe=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:ve(t),lineWidth:me(t),stroke:xe(t)}),be={group:t=>{const e=fe(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},fe(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},fe(t)),{fill:ve(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},fe(t)),{fill:ve(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({},fe(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({},fe(t)),{path:t.d,fillStrokeOrder:!1,fill:ve(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},fe(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:ve(t,"#000")})},text:(t,e)=>{var i,n;return Object.assign(Object.assign({},fe(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(n=t.textAnchor)&&void 0!==n?n:"middle",anchor:[0,0],fill:ve(t,"#000")})}},ke=t=>{var i,n;if(!t||!t[0])return{};const{elements:o}=t[0].latestData;if(o&&o.length){o.forEach(((t,i)=>{var n;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:o,transform:r}=t,a={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(a,t._inheritStyle,null===(n=t.parent)||void 0===n?void 0:n._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(a,t._inheritStyle,t.attributes),be[o]?t._finalAttributes=be[o](a,t.value):t._finalAttributes=a,r&&(t._finalAttributes.postMatrix=Object.assign({},r))}));const t=o.filter((t=>"text"===t.tagName));for(let r=0;r<t.length;r++){const a=t[r]._uniqueId,s=o.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===a){e=!0;break}i=i.parent}return e}));if(s&&s.length){const o=null!==(n=null===(i=t[r]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==n?n:0;let a=o;for(let t=0;t<s.length;t++){const i=s[t];if("group"===i.graphicType)a=o;else if(i.value&&void 0===i.parent._textGroupStyle.x){const n=s.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(n){a+=e.measureText(n.value,n._finalAttributes).width}i._finalAttributes.x=a}}}}}return o};class _e extends e.GeoSeries{constructor(){super(...arguments),this.type=te,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=le(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,n=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:n,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(_e.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,_e.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(_e.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:n,name:o,parent:r,id:a,_nameFromParent:s,_uniqueId:l}=i,d=this._createMark({type:n,name:null!=o?o:s},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==r?void 0:r._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,_e.mark.pictogram.name)});d&&(d.setData(this._mapViewData),d.setUserId(l),this._idToMark.set(l,d),"group"!==d.type&&d.setMarkConfig({graphicName:d.name}),d.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(_e.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,viewBoxRect:i}=this._parsedSvgResult,n=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,be.group(t.attributes),"normal",e.AttributeLevel.Built_In),t.transform&&this.setMarkStyle(this._pictogramMark,{postMatrix:()=>t.transform},"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 n){const{_uniqueId:i,_finalAttributes:n}=t,o=this._idToMark.get(i),r=this._validElement(t);o&&(this.setMarkStyle(o,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),r?(this.initMarkStyleWithSpec(o,e.merge({},this._spec.pictogram,this._spec[o.name])),this.setMarkStyle(o,n,"normal",e.AttributeLevel.Series),o.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(o.setMarkConfig({interactive:!1}),this.setMarkStyle(o,n,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new ce(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const n=t[this.nameField];if(!n)return null;const o=this.getMarksWithoutRoot().filter((t=>t.name===n));if(!o||0===o.length)return null;let r=new e.Bounds;i?o.forEach((t=>{r=r.union(t.getGraphics()[0].globalAABBBounds)})):o.forEach((t=>{r=r.union(t.getProduct().AABBBounds)}));const a={x:(r.x1+r.x2)/2,y:(r.y1+r.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();a.x-=t,a.y-=e}return a}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,n=this.getRootMatrix();if(!n)return null;const o={};return n.getInverse().transformPoint({x:e,y:i},o),o}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}initData(){var t,i;super.initData();const n=oe.get(this.svg);n||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const o=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",ke),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),o.parse([n],{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",o.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,o)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const{width:t,height:e}=this.getLayoutRect(),i=t/2,n=e/2,o=this.getPictogramRootGraphic();if(o){const r=o.AABBBounds,{x1:a,x2:s,y1:l,y2:d}=o.AABBBounds,c=(a+s)/2,h=(l+d)/2,u=t/r.width(),g=e/r.height(),p=Math.min(u,g);o.scale(p,p,{x:c,y:h}),o.translate(i-c,n-h)}}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this)),this.event.on(e.ChartEvent.afterMarkLayoutEnd,this.updateSVGSize.bind(this))}handleZoom(t){const{scale:i,scaleCenter:n}=t;if(1===i)return;const o=this.getPictogramRootGraphic();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new e.Matrix}),o.scale(i,i,n))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const n=this.getPictogramRootGraphic();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new e.Matrix}),n.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}}_e.type=te,_e.mark=ie,_e.transformerConstructor=de;const Se=()=>{e.Factory.registerSeries(_e.type,_e),e.Factory.registerImplement("registerSVG",ae),e.Factory.registerImplement("unregisterSVG",se),e.Factory.registerInteractionTrigger(ue.type,ue),e.Factory.registerInteractionTrigger(pe.type,pe)};class Me extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=ne,this.type=Qt,this.seriesType=te}}Me.type=te,Me.seriesType=Qt,Me.transformerConstructor=ne;class Ae 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 we="imageCloud",Ce="imageCloud";var Le;!function(t){t.image="image",t.imageMask="imageMask"}(Le||(Le={}));const Fe=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class Oe extends e.ACustomAnimate{constructor(t,e,i,n,o){var r;super(t,e,i,n,o),this._rotations=null!==(r=null==o?void 0:o.rotation)&&void 0!==r?r:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var n;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const o=360*this._rotations*e*Math.PI/180,r=Math.abs(Math.cos(o))*(null!==(n=this._scaleX)&&void 0!==n?n:1);this.target.attribute.scaleX=r,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function Te(t,i){switch(i){case"axialRotate":return[{custom:Oe,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 Be 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:n}=this._seriesCacheInfo,o=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(n[0]&&o)return null!==(i=o[n[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&n)return n[i[0]]}}get defaultShapeType(){return"square"}}class Ie extends e.BaseSeries{constructor(){super(...arguments),this.type=Ce}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(Fe.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(Fe.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 Be(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,n;if(t){const o=null===(n=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===n?void 0:n.preset,r={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")(r,o),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""}}Ie.type=Ce,Ie.mark=Fe;const De=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:Te(t,e),enter:Te(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries(Ie.type,Ie),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class Ee extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Ee.transformerConstructor,this.type=we,this.seriesType=Ce}}Ee.type=we,Ee.seriesType=Ce,Ee.transformerConstructor=Ae;class je 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((n=>{const{orient:o}=n;let r=null;"top"!==o&&"bottom"!==o||(e.x=!0,r=this._setDefaultXAxisSpec(t)),"left"!==o&&"right"!==o||(e.y=!0,r=this._setDefaultYAxisSpec(t)),r&&Object.keys(r).forEach((t=>{n[t]=i.isObject(n[t])?i.merge(r[t],n[t]):i.isNil(n[t])?r[t]:n[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 n=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===n?(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 Pe="event",Re=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 $e extends e.CartesianSeries{constructor(){super(...arguments),this.type=Pe,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($e.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark($e.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark($e.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark($e.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark($e.mark.title),this._subTitleMark=this._createMark($e.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,n,o,r,a,s,l,d,c,h,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 g=this._spec.dot,p="number"==typeof(null===(t=null==g?void 0:g.style)||void 0===t?void 0:t.size)?g.style.size:8,y=this._spec.title,m=null!==(n=null==y?void 0:y.style)&&void 0!==n?n:{},v=this._spec.subTitle,x=null!==(o=null==v?void 0:v.style)&&void 0!==o?o:{},f="number"==typeof m.fontSize?m.fontSize:14,b=p/2+(null!==(r=null==y?void 0:y.offset)&&void 0!==r?r:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:p,fill:null!==(s=null===(a=null==g?void 0:g.style)||void 0===a?void 0:a.fill)&&void 0!==s?s:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(d=null===(l=null==g?void 0:g.style)||void 0===l?void 0:l.fill)&&void 0!==d?d:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},m),{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({},x),{x:t=>this._getSubTitlePosition(t,b,f).x,y:t=>this._getSubTitlePosition(t,b,f).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 k=this._spec.icon,_="number"==typeof(null===(c=null==k?void 0:k.style)||void 0===c?void 0:c.size)?k.style.size:20,S=(i.isValid(null==k?void 0:k.offset)?k.offset+p/2:b)+_/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,S).x,y:t=>this._getIconPosition(t,S).y,size:_,fill:null!==(u=null===(h=null==k?void 0:k.style)||void 0===h?void 0:h.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),n=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===n?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===n?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var n,o,r,a;const s=this._getPoint(t),l=this._getLabelSide(t),d=null!==(o=null===(n=this._spec.title)||void 0===n?void 0:n.subTitleGap)&&void 0!==o?o:4;if("vertical"===this.direction){const t=null!==(a=null===(r=this._spec.title)||void 0===r?void 0:r.style)&&void 0!==a?a:{},n="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?s.x-e:s.x+e,y:s.y+n+d}}return{x:s.x,y:"primary"===l?s.y-(e+i+d):s.y+(e+i+d)}}_getIconPosition(t,e){const i=this._getPoint(t),n=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===n?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===n?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 n,o,r,a,s,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const d=t[i];return"band"!==(null===(o=null===(n=e.getSpec)||void 0===n?void 0:n.call(e))||void 0===o?void 0:o.type)&&e.isContinuous?null!==(l=null===(s=e.valueToPosition)||void 0===s?void 0:s.call(e,d))&&void 0!==l?l:this._getDefaultPosition(i):null!==(a=null===(r=e.dataToPosition)||void 0===r?void 0:r.call(e,[d],{bandPosition:.5}))&&void 0!==a?a: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 n=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===n)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 n=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===n)return i}return null}_getArrowPath(t){var e,i;const n=this._getPoint(t),o=this._getNextDatum(t),r=this._getPreviousDatum(t),a=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,s=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=r?{x:n.x,y:(this._getPoint(r).y+n.y)/2}:{x:n.x,y:t?0:s.height},i=o?{x:n.x,y:(this._getPoint(o).y+n.y)/2}:{x:n.x,y:t?s.height:0},l=t?1:-1,d=a/3,c=a/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*d} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*d} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*d} Z`}const l=this.getXAxisHelper().isInverse(),d=r?{x:(this._getPoint(r).x+n.x)/2,y:n.y}:{x:l?s.width:0,y:n.y},c=o?{x:(this._getPoint(o).x+n.x)/2,y:n.y}:{x:l?0:s.width,y:n.y},h=l?-1:1,u=a/2,g=a/3;return`M ${d.x} ${d.y-u} L ${d.x+h*g} ${d.y} L ${d.x} ${d.y+u} \n L ${c.x-h*g} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-h*g} ${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)}}$e.type=Pe,$e.mark=Re,$e.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}}},$e.transformerConstructor=e.BaseSeriesSpecTransformer;const ze=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries($e.type,$e)};class Ve extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=je,this.type="timeline",this.seriesType="event"}}Ve.type="timeline",Ve.seriesType="event",Ve.transformerConstructor=je;const Ne=t=>{var e,i,n,o;if(Array.isArray(t))return{top:null!==(e=t[0])&&void 0!==e?e:0,right:null!==(i=t[1])&&void 0!==i?i:0,bottom:null!==(n=t[2])&&void 0!==n?n:0,left:null!==(o=t[3])&&void 0!==o?o:0};const r=null!=t?t:24;return{top:r,right:r,bottom:r,left:r}},We=t=>t?"string"==typeof t?{type:t}:t:{type:"landscape"},He=(t,e)=>{var i,n,o;const r=We(e.layout),a=Ne(null!==(i=r.padding)&&void 0!==i?i:e.padding),s=null!==(n=e.gap)&&void 0!==n?n:40,l=null!==(o=e.lineDistance)&&void 0!==o?o:8,d=Ge(t,r,e.viewBox,e.block,a,s),c="clock"===r.type?Xe(e.viewBox,e.block,a,r):void 0;return{blocks:d,links:Qe(d,l),circleGuide:c}},Ge=(t,e,i,n,o,r)=>{const a=t.length;if(!a)return[];const s={x:o.left,y:o.top,width:Math.max(i.width-o.left-o.right,n.width),height:Math.max(i.height-o.top-o.bottom,n.height)},l={x:s.x+s.width/2,y:s.y+s.height/2};let d;switch(e.type){case"portrait":d=Ue(a,l.x,s.y+n.height/2,l.x,s.y+s.height-n.height/2);break;case"ladder":{const t="down"===e.direction,i=s.x+n.width/2,o=s.x+s.width-n.width/2,r=s.y+n.height/2,l=s.y+s.height-n.height/2,c=t?r:l,h=t?l:r,u=Ue(a,i,c,o,h),g=o-i,p=h-c,y=Math.hypot(g,p)||1,m=-p/y,v=g/y,x=1.2*Math.max(80,Math.min(240,Math.round(.42*s.height)));d=u.map(((t,e)=>{const i=e%2==0?1:-1;return{x:t.x+m*x*i,y:t.y+v*x*i}}));break}case"spiral":d=Ke(a,s,n,r);break;case"clock":d=Ye(a,i,n,o,e);break;case"arc":{const t="down"===e.direction,[i,o]=t?[20,160]:[200,340];d=Ze(a,s,n,e,i,o);break}case"wing":{const t="right"===e.direction?"right":"left",[i,o]="right"===t?[110,250]:[-70,70];d=Ze(a,s,n,e,i,o);break}default:d=Ue(a,s.x+n.width/2,l.y,s.x+s.width-n.width/2,l.y)}return d.map(((e,i)=>{var o,r;return{id:null!==(r=null===(o=t[i])||void 0===o?void 0:o.id)&&void 0!==r?r:i,index:i,datum:t[i],width:n.width,height:n.height,x:e.x-n.width/2,y:e.y-n.height/2,center:e}}))},Ue=(t,e,i,n,o)=>1===t?[{x:(e+n)/2,y:(i+o)/2}]:Array.from({length:t},((r,a)=>{const s=a/(t-1);return{x:e+(n-e)*s,y:i+(o-i)*s}})),Ke=(t,e,i,n)=>{const o=e.x+e.width/2,r=Math.min(Math.max(.65*i.width+n/2,0),Math.max((e.width-i.width)/2,0));return Ue(t,o,e.y+i.height/2,o,e.y+e.height-i.height/2).map(((t,e)=>({x:t.x+(e%2==0?-r:r),y:t.y})))},Ye=(t,e,i,n,o)=>{var r;const a=Xe(e,i,n,o),s=null!==(r=o.startAngle)&&void 0!==r?r:-90;if(1===t){const t=Je(s);return[{x:a.center.x+Math.cos(t)*a.radius,y:a.center.y+Math.sin(t)*a.radius}]}return Array.from({length:t},((e,i)=>{const n=Je(s+360*i/t);return{x:a.center.x+Math.cos(n)*a.radius,y:a.center.y+Math.sin(n)*a.radius}}))},Xe=(t,e,i,n)=>{var o;const r=Math.max(t.width-i.left-i.right,1),a=Math.max(t.height-i.top-i.bottom,1),s={x:i.left+r/2,y:i.top+a/2},l=null!==(o=n.radiusRatio)&&void 0!==o?o:.7,d=Math.max(Math.min(r-e.width,a-e.height)/2,1);return{center:s,radius:Math.max(1,d*l)}},Ze=(t,e,i,n,o,r,a=.88)=>{var s,l,d,c,h;const u=null!==(l=null!==(s=n.startAngle)&&void 0!==s?s:o)&&void 0!==l?l:-90,g=null!==(c=null!==(d=n.endAngle)&&void 0!==d?d:r)&&void 0!==c?c:270,p=null!==(h=n.radiusRatio)&&void 0!==h?h:a,y=Math.max((e.width-i.width)/2,1)*p,m=Math.max((e.height-i.height)/2,1)*p,v=e.x+e.width/2,x=e.y+e.height/2;if(1===t){const t=Je((u+g)/2);return[{x:v+Math.cos(t)*y,y:x+Math.sin(t)*m}]}return Array.from({length:t},((e,i)=>{const n=i/(t-1),o=Je(u+qe(u,g)*n);return{x:v+Math.cos(o)*y,y:x+Math.sin(o)*m}}))},qe=(t,e)=>{const i=e-t;return Math.abs(i)>=360?360:i},Je=t=>t/180*Math.PI,Qe=(t,e)=>{const i=[];for(let n=0;n<t.length-1;n++){const o=t[n],r=t[n+1],a=ti(o,r.center,e),s=ti(r,o.center,e);i.push({from:o,to:r,start:a,end:s,points:[a,s]})}return i},ti=(t,e,i)=>{const n=e.x-t.center.x,o=e.y-t.center.y;if(0===n&&0===o)return{x:t.center.x,y:t.center.y};const r=0===n?Number.POSITIVE_INFINITY:t.width/2/Math.abs(n),a=0===o?Number.POSITIVE_INFINITY:t.height/2/Math.abs(o),s=Math.min(r,a),l=Math.sqrt(n*n+o*o)||1;return{x:t.center.x+n*s+n/l*i,y:t.center.y+o*s+o/l*i}},ei=112,ii=t=>"landscape"===We(t.layout).type,ni=t=>"portrait"===We(t.layout).type,oi=t=>"clock"===We(t.layout).type,ri=t=>"arc"===We(t.layout).type,ai=t=>"wing"===We(t.layout).type,si=t=>"ladder"===We(t.layout).type,li=t=>{var e;return null!==(e=t.themeColor)&&void 0!==e?e:"#e8543d"},di=(t,e)=>{const i=Math.max(0,Math.min(1,e));if(!t)return`rgba(0, 0, 0, ${i})`;const n=t.trim();if(n.startsWith("#")){let t=n.slice(1);if(3!==t.length&&4!==t.length||(t=t.split("").map((t=>t+t)).join("")),6===t.length||8===t.length){return`rgba(${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}, ${i})`}}const o=n.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return o?`rgba(${o[1]}, ${o[2]}, ${o[3]}, ${i})`:n},ci=(t,e)=>{var i,n,o,r,a,s,l;if(null===(i=t.block)||void 0===i?void 0:i.width)return t.block.width;const d=null!==(o=null===(n=t.block)||void 0===n?void 0:n.widthRatio)&&void 0!==o?o:.24,c=null!==(a=null===(r=t.block)||void 0===r?void 0:r.minWidth)&&void 0!==a?a:180,h=null!==(l=null===(s=t.block)||void 0===s?void 0:s.maxWidth)&&void 0!==l?l:Math.max(c,320);return Math.max(c,Math.min(h,Math.round(e*d)))},hi=t=>{var e,i,n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x;const f=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getAllRegions)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n[0],b=null===(o=null==f?void 0:f.getLayoutRect)||void 0===o?void 0:o.call(f),k=null===(r=null==f?void 0:f.getLayoutStartPoint)||void 0===r?void 0:r.call(f),_=null===(s=null===(a=t.chart)||void 0===a?void 0:a.getLayoutRect)||void 0===s?void 0:s.call(a),S=null===(l=t.getLayoutBounds)||void 0===l?void 0:l.call(t);return{width:Math.max(null!==(u=null!==(c=null!==(d=null==b?void 0:b.width)&&void 0!==d?d:null==_?void 0:_.width)&&void 0!==c?c:null===(h=null==S?void 0:S.width)||void 0===h?void 0:h.call(S))&&void 0!==u?u:0,1),height:Math.max(null!==(m=null!==(p=null!==(g=null==b?void 0:b.height)&&void 0!==g?g:null==_?void 0:_.height)&&void 0!==p?p:null===(y=null==S?void 0:S.height)||void 0===y?void 0:y.call(S))&&void 0!==m?m:0,1),startX:null!==(v=null==k?void 0:k.x)&&void 0!==v?v:0,startY:null!==(x=null==k?void 0:k.y)&&void 0!==x?x:0}},ui=(t,e)=>{var i,n,o,r,a,s,l,d,c,h,u,g,p,y,m;const{width:v,height:x,startX:f,startY:b}=hi(e);let k=ci(t,v),_=null!==(n=null===(i=t.block)||void 0===i?void 0:i.height)&&void 0!==n?n:ei;if(ii(t)&&!(null===(o=t.block)||void 0===o?void 0:o.width)){const e=null!==(a=null===(r=t.data)||void 0===r?void 0:r.length)&&void 0!==a?a:0;if(e>0){const i=Ne(null===(s=t.block)||void 0===s?void 0:s.padding),n=80,o=(Math.max(v-i.left-i.right,1)-40*Math.max(e-1,0))/e;k=Math.max(n,Math.floor(o))}}if(ni(t)&&!(null===(l=t.block)||void 0===l?void 0:l.height)){const e=null!==(c=null===(d=t.data)||void 0===d?void 0:d.length)&&void 0!==c?c:0;if(e>0){const i=Ne(null===(h=t.block)||void 0===h?void 0:h.padding),n=Math.max(x-i.top-i.bottom,1);_=Math.max(160,Math.floor(n/e))}}const S=He(null!==(u=t.data)&&void 0!==u?u:[],{layout:t.layout,viewBox:{width:v,height:x},block:{width:k,height:_},gap:null!==(p=null===(g=t.block)||void 0===g?void 0:g.gap)&&void 0!==p?p:36,padding:null===(y=t.block)||void 0===y?void 0:y.padding,lineDistance:null===(m=t.line)||void 0===m?void 0:m.distance});return f||b?Object.assign(Object.assign({},S),{blocks:S.blocks.map((t=>Object.assign(Object.assign({},t),{x:t.x+f,y:t.y+b,center:{x:t.center.x+f,y:t.center.y+b}}))),links:S.links.map((t=>Object.assign(Object.assign({},t),{start:{x:t.start.x+f,y:t.start.y+b},end:{x:t.end.x+f,y:t.end.y+b},points:t.points.map((t=>({x:t.x+f,y:t.y+b})))})))}):S},gi=(t,e)=>{var i,n,o,r,a,s,l,d,c;const h=Number(null!==(o=null===(n=null===(i=e.content)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fontSize)&&void 0!==o?o:12),u=Number(null!==(s=null===(a=null===(r=e.content)||void 0===r?void 0:r.style)||void 0===a?void 0:a.lineHeight)&&void 0!==s?s:18),g=null!==(c=null===(d=null===(l=e.content)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fill)&&void 0!==c?c:"#596173";return{type:"rich",text:t.reduce(((e,i,n)=>{const o=n===t.length-1?"":"\n";return e.push({text:`${i}${o}`,fontSize:h,lineHeight:u,fill:g}),e}),[])}},pi=t=>{if(!t)return{};return y(t,["width","height","position","gap"])},yi=(t,e,i,n,o,r,a,s)=>{if(!s)return{x:n.left,y:n.top,width:0,height:0};switch(t){case"left":return{x:n.left,y:(i-r)/2,width:o,height:r};case"right":return{x:e-n.right-o,y:(i-r)/2,width:o,height:r};case"bottom":return{x:(e-o)/2,y:i-n.bottom-r,width:o,height:r};default:return{x:(e-o)/2,y:n.top,width:o,height:r}}},mi=(t,e,i,n,o,r,a,s)=>{if(!s)return{x:n.left,y:n.top,width:e-n.left-n.right,height:i-n.top-n.bottom};switch(t){case"left":return{x:n.left+o+a,y:n.top,width:e-n.left-n.right-o-a,height:i-n.top-n.bottom};case"right":return{x:n.left,y:n.top,width:e-n.left-n.right-o-a,height:i-n.top-n.bottom};case"bottom":return{x:n.left,y:n.top,width:e-n.left-n.right,height:i-n.top-n.bottom-r-a};default:return{x:n.left,y:n.top+r+a,width:e-n.left-n.right,height:i-n.top-n.bottom-r-a}}},vi=.5,xi=.86,fi=[4,4],bi=(t,e)=>{var i,n,o;const{width:r,height:a,startX:s,startY:l}=hi(e),d=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),c=Math.max(r-d.left-d.right,1),h=Math.max(a-d.top-d.bottom,1),u=s+d.left+c/2,g=l+d.top+h/2,p=Math.max(Math.min(c,h)/2,1),y=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;return{cx:u,cy:g,R:p,count:y,step:y>0?2*Math.PI/y:0}},ki=(t,e)=>-Math.PI/2+t.step*(e+.5),_i=(t,e,i,n)=>({x:t+Math.cos(n)*i,y:e+Math.sin(n)*i}),Si=(t,e,i)=>{const n=bi(t,e),o=ki(n,i),r=.58*n.R;return Object.assign(Object.assign({},_i(n.cx,n.cy,r,o)),{diameter:.24*n.R,angle:o})},Mi=(t,e,i)=>{var n;const o=bi(t,e),{width:r,startX:a}=hi(e),s=Ne(null===(n=t.block)||void 0===n?void 0:n.padding),l=ki(o,i),d=(t=>Math.cos(t)<0)(l),c=.7*o.R,h=_i(o.cx,o.cy,c,l),u=a+s.left,g=a+r-s.right,p=d?Math.min(Math.max(h.x-u,80),200):Math.min(Math.max(g-h.x,80),200);return{x:h.x,y:h.y,width:p,onLeft:d,anchorY:h.y}},Ai=(t,i,n)=>{var o,r,a;const s=!!i.image,l=li(t),d=Array.isArray(i.content)?i.content:i.content?[i.content]:[],c=[{type:"path",name:`storyline-clock-lead-${n}`,interactive:!1,style:{path:(e,i)=>{const{start:o,end:r}=((t,e,i)=>{const n=bi(t,e),o=ki(n,i),r=.24*n.R/2;return{start:_i(n.cx,n.cy,.58*n.R+r+6,o),end:_i(n.cx,n.cy,.7*n.R-8,o)}})(t,i,n);return`M ${o.x.toFixed(2)} ${o.y.toFixed(2)} L ${r.x.toFixed(2)} ${r.y.toFixed(2)}`},stroke:di(l,.7),lineWidth:1,lineDash:[3,3],fill:"transparent",fillOpacity:0}},s?{type:"image",name:`storyline-clock-dot-${n}`,interactive:!1,style:{x:(e,i)=>{const o=Si(t,i,n);return o.x-o.diameter/2},y:(e,i)=>{const o=Si(t,i,n);return o.y-o.diameter/2},width:(e,i)=>Si(t,i,n).diameter,height:(e,i)=>Si(t,i,n).diameter,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"}}:{type:"symbol",name:`storyline-clock-dot-${n}`,interactive:!1,style:{x:(e,i)=>Si(t,i,n).x,y:(e,i)=>Si(t,i,n).y,size:(e,i)=>Si(t,i,n).diameter,symbolType:"circle",fill:l,stroke:"#ffffff",lineWidth:1.5}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-clock-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(e,i)=>Mi(t,i,n).x,y:(e,i)=>Mi(t,i,n).anchorY-24,text:i.title,maxLineWidth:(e,i)=>Mi(t,i,n).width,fontSize:18,lineHeight:24,fontWeight:"bold",fill:l,stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:(e,i)=>Mi(t,i,n).onLeft?"right":"left",textBaseline:"top"},null===(o=t.title)||void 0===o?void 0:o.style)}):null,d.length?Object.assign(Object.assign({type:"text",name:`storyline-clock-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(e,i)=>Mi(t,i,n).x,y:(e,i)=>Mi(t,i,n).anchorY+4,width:(e,i)=>Mi(t,i,n).width,maxLineWidth:(e,i)=>Mi(t,i,n).width,text:gi(d,t),fontSize:11,lineHeight:15,fill:"#3a3f4d",textAlign:(e,i)=>Mi(t,i,n).onLeft?"right":"left",textBaseline:"top",wordBreak:"break-word"},null===(r=t.content)||void 0===r?void 0:r.style)}):null];return{type:"group",id:`storyline-block-${null!==(a=i.id)&&void 0!==a?a:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,children:c.filter(Boolean)}},wi=(t,e,i)=>{var n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b,k,_,S,M,A,w,C,L;const F=ui(t,e).blocks[i],O=Ne(null!==(o=null===(n=t.block)||void 0===n?void 0:n.padding)&&void 0!==o?o:12),T=null!==(a=null===(r=t.image)||void 0===r?void 0:r.position)&&void 0!==a?a:"top",B=null!==(l=null===(s=t.image)||void 0===s?void 0:s.width)&&void 0!==l?l:48,I=null!==(c=null===(d=t.image)||void 0===d?void 0:d.height)&&void 0!==c?c:48,D=null!==(u=null===(h=t.image)||void 0===h?void 0:h.gap)&&void 0!==u?u:10,E=!!(null===(p=null===(g=t.data)||void 0===g?void 0:g[i])||void 0===p?void 0:p.image),j=Number(null!==(v=null===(m=null===(y=t.title)||void 0===y?void 0:y.style)||void 0===m?void 0:m.fontSize)&&void 0!==v?v:18),P=Number(null!==(b=null===(f=null===(x=t.title)||void 0===x?void 0:x.style)||void 0===f?void 0:f.lineHeight)&&void 0!==b?b:Math.round(1.35*j)),R=(null===(_=null===(k=t.data)||void 0===k?void 0:k[i])||void 0===_?void 0:_.title)?P:0,$=null!==(S=null==F?void 0:F.width)&&void 0!==S?S:ci(t,0),z=null!==(w=null!==(M=null==F?void 0:F.height)&&void 0!==M?M:null===(A=t.block)||void 0===A?void 0:A.height)&&void 0!==w?w:ei,V=yi(T,$,z,O,B,I,0,E),N=mi(T,$,z,O,B,I,D,E),W=(null===(L=null===(C=t.data)||void 0===C?void 0:C[i])||void 0===L?void 0:L.title)?8:0;return{block:{width:$,height:z},imageBox:V,textBox:N,contentBox:{y:N.y+R+W,height:Math.max(0,N.height-R-W)}}},Ci=(t,e,i,n)=>{const o=t[0],r=t[t.length-1];if(!o||!r)return"";let a;if("curve"===e){const t=r.x-o.x,e=r.y-o.y,i=Math.max(Math.min(.22*Math.sqrt(t*t+e*e),80),24);a=`M ${o.x} ${o.y} C ${o.x+t/2} ${o.y-i} ${r.x-t/2} ${r.y+i} ${r.x} ${r.y}`}else if("polyline"===e){const t={x:(o.x+r.x)/2,y:(o.y+r.y)/2};a=`M ${o.x} ${o.y} L ${t.x} ${o.y} L ${t.x} ${r.y} L ${r.x} ${r.y}`}else a=`M ${o.x} ${o.y} L ${r.x} ${r.y}`;return i?`${a} ${Li(o,r,n)}`:a},Li=(t,e,i)=>{const n=Math.atan2(e.y-t.y,e.x-t.x),o=e.x-Math.cos(n-Math.PI/6)*i,r=e.y-Math.sin(n-Math.PI/6)*i,a=e.x-Math.cos(n+Math.PI/6)*i,s=e.y-Math.sin(n+Math.PI/6)*i;return`M ${o} ${r} L ${e.x} ${e.y} L ${a} ${s}`},Fi=(t,e,i)=>{var n,o,r,a;const s=ui(t,e).blocks[i];if(!s)return null;return{x:null!==(o=null===(n=s.center)||void 0===n?void 0:n.x)&&void 0!==o?o:s.x+s.width/2,y:(null!==(a=null===(r=s.center)||void 0===r?void 0:r.y)&&void 0!==a?a:s.y+s.height/2)+(i%2==0?-1:1)*s.height*.1}},Oi=(t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b;const k=!!i.image,_=Array.isArray(i.content)?i.content:i.content?[i.content]:[],S=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),M=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(1.35*S)),A=e=>{var i,o,r,a;const s=ui(t,e).blocks[n],l=null!==(i=null==s?void 0:s.width)&&void 0!==i?i:ci(t,0),d=null!==(a=null!==(o=null==s?void 0:s.height)&&void 0!==o?o:null===(r=t.block)||void 0===r?void 0:r.height)&&void 0!==a?a:ei;return((t,e,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f;const b=Ne(null!==(r=null===(o=t.block)||void 0===o?void 0:o.padding)&&void 0!==r?r:12),k=Number(null!==(l=null===(s=null===(a=t.title)||void 0===a?void 0:a.style)||void 0===s?void 0:s.fontSize)&&void 0!==l?l:18),_=Number(null!==(h=null===(c=null===(d=t.title)||void 0===d?void 0:d.style)||void 0===c?void 0:c.lineHeight)&&void 0!==h?h:Math.max(19,Math.round(1.35*k))),S=Number(null!==(p=null===(g=null===(u=t.content)||void 0===u?void 0:u.style)||void 0===g?void 0:g.fontSize)&&void 0!==p?p:12),M=Number(null!==(v=null===(m=null===(y=t.content)||void 0===y?void 0:y.style)||void 0===m?void 0:m.lineHeight)&&void 0!==v?v:18),A=Math.max(null!==(f=null===(x=t.image)||void 0===x?void 0:x.height)&&void 0!==f?f:Math.round(.42*i),_+b.top+b.bottom),w=4*M,C=_+4+w,L=n%2==0;let F,O,T,B,I,D;const E=0+.2*e,j=E+12,P=Math.max(e-(j-0),0);if(L){const t=0,i=t-64-C;T={x:0,y:t,width:e,height:A},F={x:j,y:i,width:P,height:C},O={x:j,y:i+_+4,width:P,height:w},B={x1:E,y1:t,x2:E,y2:i+_/2},I=i,D=A-I}else{const t=0,i=t+A+64;T={x:0,y:t,width:e,height:A},F={x:j,y:i,width:P,height:C},O={x:j,y:i+_+4,width:P,height:w},B={x1:E,y1:t+A,x2:E,y2:i+C},I=t,D=i+C-t}return{padding:b,titleFontSize:k,titleLineHeight:_,contentFontSize:S,contentLineHeight:M,contentHeight:w,blockWidth:e,imageBox:T,textBox:F,contentBox:O,connector:B,textOnTop:L,groupTop:I,groupHeight:D}})(t,l,d,n)},w=null!==(h=null===(c=t.block)||void 0===c?void 0:c.style)&&void 0!==h?h:{},C=null!==(g=null===(u=t.line)||void 0===u?void 0:u.style)&&void 0!==g?g:{},L=li(t),F=null!==(p=C.stroke)&&void 0!==p?p:L,O=null!==(y=C.lineWidth)&&void 0!==y?y:2,T=null!==(m=C.lineDash)&&void 0!==m?m:[4,4];return{type:"group",id:`storyline-block-${null!==(v=i.id)&&void 0!==v?v:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o;const r=ui(t,i).blocks[n];return null!==(o=null==r?void 0:r.x)&&void 0!==o?o:0},y:(e,i)=>{var o,r,a,s,l,d,c;const h=ui(t,i).blocks[n],u=A(i),g=null!==(r=null===(o=null==h?void 0:h.center)||void 0===o?void 0:o.y)&&void 0!==r?r:(null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0)+(null!==(s=null==h?void 0:h.height)&&void 0!==s?s:0)/2,p=null!==(c=null!==(l=null==h?void 0:h.height)&&void 0!==l?l:null===(d=t.block)||void 0===d?void 0:d.height)&&void 0!==c?c:ei,y=(n%2==0?-1:1)*p*.1;return g-u.imageBox.height/2+y},width:(t,e)=>A(e).blockWidth,height:(t,e)=>A(e).groupHeight},children:[{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:Object.assign({x:(t,e)=>A(e).imageBox.x,y:(t,e)=>A(e).imageBox.y,width:(t,e)=>A(e).imageBox.width,height:(t,e)=>A(e).imageBox.height,cornerRadius:8,fill:"#ffffff",stroke:L,lineWidth:2},w)},k?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(t,e)=>A(e).imageBox.x,y:(t,e)=>A(e).imageBox.y,width:(t,e)=>A(e).imageBox.width,height:(t,e)=>A(e).imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(x=t.image)||void 0===x?void 0:x.style)}):null,{type:"path",name:`storyline-block-connector-${n}`,interactive:!1,style:{stroke:F,lineWidth:O,lineDash:T,fill:F,path:(t,e)=>{const i=A(e),n=i.connector.x1,o=i.connector.y1,r=i.connector.y2,a=r-9*(r<o?-1:1);return`${`M ${n} ${o} L ${n} ${a}`} ${`M ${n-4.5} ${a} L ${n+4.5} ${a} L ${n} ${r} Z`}`}}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(t,e)=>A(e).textBox.x,y:(t,e)=>A(e).textBox.y,text:i.title,maxLineWidth:(t,e)=>A(e).textBox.width,fontSize:S,lineHeight:M,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(f=t.title)||void 0===f?void 0:f.style)}):null,_.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(t,e)=>A(e).contentBox.x,y:(t,e)=>A(e).contentBox.y,width:(t,e)=>A(e).contentBox.width,height:(t,e)=>A(e).contentBox.height,maxLineWidth:(t,e)=>A(e).contentBox.width,heightLimit:(t,e)=>A(e).contentBox.height,text:gi(_,t),fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(b=t.content)||void 0===b?void 0:b.style)}):null].filter(Boolean)}},Ti=(t,e)=>{const i=ui(t,e).blocks;if(!i.length)return{x:0,y:0,width:0,height:0};const n=i[0].center.y,o=i[i.length-1].center.y,r=Math.min(n,o),a=Math.max(n,o);return{x:i[0].center.x-32,y:r-50,width:64,height:a-r+100}},Bi=(t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m;const v=!!i.image,x=!!i.subImage,f=Array.isArray(i.content)?i.content:i.content?[i.content]:[],b=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),k=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.max(19,Math.round(1.35*b))),_=!0===(null===(c=t.image)||void 0===c?void 0:c.showBackground),S=e=>{var i,o,r,a;const s=ui(t,e).blocks[n],l=null!==(i=null==s?void 0:s.width)&&void 0!==i?i:ci(t,0);a=null!==(o=null==s?void 0:s.height)&&void 0!==o?o:null===(r=t.block)||void 0===r?void 0:r.height;return((t,e,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f;const b=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),k=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.max(19,Math.round(1.35*b))),_=Number(null!==(u=null===(h=null===(c=t.content)||void 0===c?void 0:c.style)||void 0===h?void 0:h.fontSize)&&void 0!==u?u:12),S=Number(null!==(y=null===(p=null===(g=t.content)||void 0===g?void 0:g.style)||void 0===p?void 0:p.lineHeight)&&void 0!==y?y:18),M=3*S,A=k+4+M,w=null!==(v=null===(m=t.image)||void 0===m?void 0:m.width)&&void 0!==v?v:180,C=null!==(f=null===(x=t.image)||void 0===x?void 0:x.height)&&void 0!==f?f:110,L=n%2==0,F=L?-56-w:56,O=-C/2,T=O+C+8,B=1*w,I=1*C;return{onLeft:L,titleFontSize:b,titleLineHeight:k,contentFontSize:_,contentLineHeight:S,blockWidth:e,imageBox:{x:F,y:O,width:w,height:C},shadowBox:{x:F-(B-w)/2+(L?-24:24),y:O-(I-C)/2+16,width:B,height:I},textBox:{x:F,y:T,width:w,height:A},contentBox:{x:F,y:T+k+4,width:w,height:M}}})(t,l,0,n)},M=li(t),A=null!==(u=null===(h=t.block)||void 0===h?void 0:h.style)&&void 0!==u?u:{};return{type:"group",id:`storyline-block-${null!==(g=i.id)&&void 0!==g?g:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;const a=ui(t,i).blocks[n];return null!==(r=null===(o=null==a?void 0:a.center)||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;const a=ui(t,i).blocks[n];return null!==(r=null===(o=null==a?void 0:a.center)||void 0===o?void 0:o.y)&&void 0!==r?r:0}},children:[x&&_?{type:"image",name:`storyline-block-shadow-image-${n}`,interactive:!1,style:{x:(t,e)=>S(e).shadowBox.x,y:(t,e)=>S(e).shadowBox.y,width:(t,e)=>S(e).shadowBox.width,height:(t,e)=>S(e).shadowBox.height,image:i.subImage,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"}}:null,{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:Object.assign({x:(t,e)=>S(e).imageBox.x,y:(t,e)=>S(e).imageBox.y,width:(t,e)=>S(e).imageBox.width,height:(t,e)=>S(e).imageBox.height,cornerRadius:8,fill:"#ffffff",stroke:M,lineWidth:2},A)},v?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(t,e)=>S(e).imageBox.x,y:(t,e)=>S(e).imageBox.y,width:(t,e)=>S(e).imageBox.width,height:(t,e)=>S(e).imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(p=t.image)||void 0===p?void 0:p.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(t,e)=>S(e).textBox.x,y:(t,e)=>S(e).textBox.y,text:i.title,maxLineWidth:(t,e)=>S(e).textBox.width,fontSize:b,lineHeight:k,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(y=t.title)||void 0===y?void 0:y.style)}):null,f.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(t,e)=>S(e).contentBox.x,y:(t,e)=>S(e).contentBox.y,width:(t,e)=>S(e).contentBox.width,height:(t,e)=>S(e).contentBox.height,maxLineWidth:(t,e)=>S(e).contentBox.width,heightLimit:(t,e)=>S(e).contentBox.height,text:gi(f,t),fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(m=t.content)||void 0===m?void 0:m.style)}):null].filter(Boolean)}},Ii=t=>"down"===We(t.layout).direction,Di=(t,e)=>{var i,n,o,r,a;const{width:s,height:l,startX:d,startY:c}=hi(e),h=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),u=Math.max(s-h.left-h.right,1),g=Math.max(l-h.top-h.bottom,1),p=.4*Math.min(u,g),y=Math.max(null!==(o=null===(n=t.centerImage)||void 0===n?void 0:n.width)&&void 0!==o?o:p,80),m=Math.max(null!==(a=null===(r=t.centerImage)||void 0===r?void 0:r.height)&&void 0!==a?a:p,80);return{x:d+h.left+u/2-y/2,y:Ii(t)?c+h.top:c+h.top+g-m,width:y,height:m}},Ei=(t,e)=>{var i,n,o,r;const{width:a,startX:s}=hi(e),l=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),d=Math.max(a-l.left-l.right,1),c=ci(t,a),h=We(t.layout),u="down"===h.direction,g=null!==(n=h.startAngle)&&void 0!==n?n:u?20:200,p=null!==(o=h.endAngle)&&void 0!==o?o:u?160:340,y=null!==(r=h.radiusRatio)&&void 0!==r?r:.88,m=Math.max((d-c)/2,1)*y,v=Di(t,e),x=v.y,f=v.y+v.height,b=Math.sin(g/180*Math.PI);let k,_;if(u){const t=Math.max(1-b,.05);_=(v.height+200)/t,k=x-_*b}else{const t=Math.max(1+b,.05);_=(v.height+200)/t,k=f-_*b}return{cx:s+l.left+d/2,cy:k,rx:m,ry:_,startAngle:g,endAngle:p,centerTop:x,centerBottom:f}},ji=(t,e,i)=>{var n,o,r,a;const s=Ei(t,e),l=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;if(l<=0)return{x:s.cx,y:s.cy};const d=1===l?.5:i/(l-1),c=(s.startAngle+(s.endAngle-s.startAngle)*d)/180*Math.PI,h=s.cx+Math.cos(c)*s.rx,u=s.cy+Math.sin(c)*s.ry,g=Math.cos(c)/s.rx,p=Math.sin(c)/s.ry,y=Math.hypot(g,p)||1,m=g/y,v=p/y,x=(null!==(a=null===(r=t.image)||void 0===r?void 0:r.height)&&void 0!==a?a:140)/2;return{x:h+m*x,y:u+v*x}},Pi=(t,i,n)=>{var o,r,a,s;const l=!!i.image,d=Array.isArray(i.content)?i.content:i.content?[i.content]:[],c=li(t),h=(t=>{var e,i,n,o,r,a,s,l,d,c,h,u,g,p,y,m;const v=Number(null!==(n=null===(i=null===(e=t.title)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fontSize)&&void 0!==n?n:18),x=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.lineHeight)&&void 0!==a?a:Math.max(19,Math.round(1.35*v))),f=Number(null!==(d=null===(l=null===(s=t.content)||void 0===s?void 0:s.style)||void 0===l?void 0:l.fontSize)&&void 0!==d?d:12),b=Number(null!==(u=null===(h=null===(c=t.content)||void 0===c?void 0:c.style)||void 0===h?void 0:h.lineHeight)&&void 0!==u?u:17),k=Math.max(240-x-4,b),_=null!==(p=null===(g=t.image)||void 0===g?void 0:g.width)&&void 0!==p?p:140,S=null!==(m=null===(y=t.image)||void 0===y?void 0:y.height)&&void 0!==m?m:140,M=Ii(t),A={x:-_/2,y:-S/2,width:_,height:S},w=Math.max(_-20,200),C={x:-_/2+20,y:M?A.y+S+10:A.y-10-240,width:w,height:240};return{titleFontSize:v,titleLineHeight:x,contentFontSize:f,contentLineHeight:b,imageBox:A,textBox:C,contentBox:{x:C.x,y:C.y+x+4,width:C.width,height:k},isDown:M}})(t),u=h.isDown?h.imageBox.y+h.imageBox.height:h.textBox.y,g=h.isDown?Math.max(h.textBox.y+h.textBox.height-(h.imageBox.y+h.imageBox.height),0):Math.max(h.imageBox.y-h.textBox.y,0);return{type:"group",id:`storyline-block-${null!==(o=i.id)&&void 0!==o?o:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>ji(t,i,n).x,y:(e,i)=>ji(t,i,n).y},children:[{type:"rect",name:`storyline-block-connector-${n}`,interactive:!1,style:{x:h.imageBox.x,y:u,width:2,height:g,fill:c,fillOpacity:.6}},l?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:h.imageBox.x,y:h.imageBox.y,width:h.imageBox.width,height:h.imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(r=t.image)||void 0===r?void 0:r.style)}):{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:{x:h.imageBox.x,y:h.imageBox.y,width:h.imageBox.width,height:h.imageBox.height,cornerRadius:Math.min(h.imageBox.width,h.imageBox.height)/2,fill:"#ffffff",stroke:c,lineWidth:2}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:h.textBox.x,y:h.textBox.y,text:i.title,maxLineWidth:h.textBox.width,fontSize:h.titleFontSize,lineHeight:h.titleLineHeight,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(a=t.title)||void 0===a?void 0:a.style)}):null,d.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:h.contentBox.x,y:h.contentBox.y,width:h.contentBox.width,height:h.contentBox.height,maxLineWidth:h.contentBox.width,heightLimit:h.contentBox.height,text:gi(d,t),fontSize:12,lineHeight:17,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(s=t.content)||void 0===s?void 0:s.style)}):null].filter(Boolean)}},Ri=t=>{var e;return null!==(e=We(t.layout).direction)&&void 0!==e?e:"left"},$i=(t,e)=>{var i,n,o,r;const{width:a,height:s,startX:l,startY:d}=hi(e),c=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),h=Math.max(a-c.left-c.right,1),u=Math.max(s-c.top-c.bottom,1),g=We(t.layout),p=Ri(t),y="right"===p?110:-70,m="right"===p?250:70,v=null!==(n=g.startAngle)&&void 0!==n?n:y,x=null!==(o=g.endAngle)&&void 0!==o?o:m,f=null!==(r=g.radiusRatio)&&void 0!==r?r:.92,b=u/2*f,k=.6*h*f;return{cx:"right"===p?l+c.left+h-.1*k:l+c.left+.1*k,cy:d+c.top+u/2,rx:k,ry:b,startAngle:v,endAngle:x}},zi=(t,e,i)=>{var n,o;const r=$i(t,e),a=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;if(a<=0)return{x:r.cx,y:r.cy};const s=1===a?.5:i/(a-1),l=(r.startAngle+(r.endAngle-r.startAngle)*s)/180*Math.PI;return{x:r.cx+Math.cos(l)*r.rx,y:r.cy+Math.sin(l)*r.ry}},Vi=(t,e)=>{var i,n,o,r,a,s,l,d,c,h,u,g,p,y,m,v;const x=Number(null!==(o=null===(n=null===(i=t.title)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fontSize)&&void 0!==o?o:22),f=Number(null!==(s=null===(a=null===(r=t.title)||void 0===r?void 0:r.style)||void 0===a?void 0:a.lineHeight)&&void 0!==s?s:Math.max(30,Math.round(1.3*x))),b=Number(null!==(c=null===(d=null===(l=t.content)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fontSize)&&void 0!==c?c:12),k=Number(null!==(g=null===(u=null===(h=t.content)||void 0===h?void 0:h.style)||void 0===u?void 0:u.lineHeight)&&void 0!==g?g:17),_=Math.max(110-f-4,k),S=null!==(y=null===(p=t.image)||void 0===p?void 0:p.width)&&void 0!==y?y:96,M=null!==(v=null===(m=t.image)||void 0===m?void 0:m.height)&&void 0!==v?v:96,A={x:-S/2,y:-M/2,width:S,height:M},w=((t,e)=>"right"===Ri(t)?e%2==1:e%2==0)(t,e),C=w?-S/2-14-240:S/2+14;return{onLeft:w,titleFontSize:x,titleLineHeight:f,contentFontSize:b,contentLineHeight:k,imageBox:A,textBox:{x:C,y:-55,width:240,height:110},contentBox:{x:C,y:-55+f+4,width:240,height:_}}},Ni=[12,8],Wi=(t,e)=>{var i;const{width:n,height:o,startX:r,startY:a}=hi(e),s=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),l=r+s.left,d=a+s.top,c=Math.max(n-s.left-s.right,1),h=Math.max(o-s.top-s.bottom,1),u=(t=>"down"===We(t.layout).direction)(t),g=l+c,p=u?d:d+h,y=u?d+h:d,m=g-l,v=y-p;return{x0:l,y0:p,x1:g,y1:y,cx:(l+g)/2,cy:(p+y)/2,angleRad:Math.atan2(v,m)/Math.PI*180,fontSize:Math.max(80,Math.min(240,Math.round(.42*h)))}},Hi=t=>{const i=(t=>{var e,i;const n=We(t.layout);if("string"==typeof n.headline&&n.headline.length>0)return n.headline;const o=null===(i=null===(e=t.title)||void 0===e?void 0:e.style)||void 0===i?void 0:i.text;return"string"==typeof o&&o.length>0?o:"storyline"})(t);if(!i)return null;const n=li(t);return{type:"group",name:"storyline-ladder-headline",zIndex:e.LayoutZIndex.Mark,style:{x:(e,i)=>Wi(t,i).cx,y:(e,i)=>Wi(t,i).cy,angle:(e,i)=>Wi(t,i).angleRad},children:[{type:"text",name:"storyline-ladder-headline-text",interactive:!1,style:{x:0,y:0,text:i,fontSize:(e,i)=>Wi(t,i).fontSize,fontWeight:900,fontFamily:'Impact, "Arial Black", sans-serif',fill:di(n,.92),textAlign:"center",textBaseline:"middle"}}]}},Gi=t=>t%2==1,Ui=(t,e,i)=>{var n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b,k,_,S,M,A,w;const C=ui(t,e).blocks[i],L=Ne(null!==(o=null===(n=t.block)||void 0===n?void 0:n.padding)&&void 0!==o?o:12),F=Gi(i)?"right":"left",O=null!==(a=null===(r=t.image)||void 0===r?void 0:r.width)&&void 0!==a?a:96,T=null!==(l=null===(s=t.image)||void 0===s?void 0:s.height)&&void 0!==l?l:96,B=null!==(c=null===(d=t.image)||void 0===d?void 0:d.gap)&&void 0!==c?c:10,I=!!(null===(u=null===(h=t.data)||void 0===h?void 0:h[i])||void 0===u?void 0:u.image),D=Number(null!==(y=null===(p=null===(g=t.title)||void 0===g?void 0:g.style)||void 0===p?void 0:p.fontSize)&&void 0!==y?y:28),E=Number(null!==(x=null===(v=null===(m=t.title)||void 0===m?void 0:m.style)||void 0===v?void 0:v.lineHeight)&&void 0!==x?x:Math.round(D*(36/28))),j=(null===(b=null===(f=t.data)||void 0===f?void 0:f[i])||void 0===b?void 0:b.title)?E:0,P=null!==(k=null==C?void 0:C.width)&&void 0!==k?k:ci(t,0),R=null!==(M=null!==(_=null==C?void 0:C.height)&&void 0!==_?_:null===(S=t.block)||void 0===S?void 0:S.height)&&void 0!==M?M:ei,$=yi(F,P,R,L,O,T,0,I),z=mi(F,P,R,L,O,T,B,I),V=(null===(w=null===(A=t.data)||void 0===A?void 0:A[i])||void 0===w?void 0:w.title)?8:0;return{block:{width:P,height:R},imageBox:$,textBox:z,contentBox:{y:z.y+j+V,height:Math.max(0,z.height-j-V)}}};class Ki extends e.CommonChartSpecTransformer{transformSpec(t){var e;Yi(t);const i=Object.assign(Object.assign({},t),{data:[...null!==(e=t.data)&&void 0!==e?e:[]]});t.type="common",t.data=[],t.series=[],t.axes=[],t.customMark=Xi(i),delete t.layout,delete t.title,super.transformSpec(t)}}const Yi=t=>{var e,i,n,o;const r=ri(t),a=r&&"down"===We(t.layout).direction,s=r&&!a,l=ni(t),d=si(t),c=(()=>{var e,i,n,o,r,a;if(!d)return 0;const s=null!==(i=null===(e=t.block)||void 0===e?void 0:e.minWidth)&&void 0!==i?i:ci(t,0),l=null!==(o=null===(n=t.image)||void 0===n?void 0:n.width)&&void 0!==o?o:96,c=null!==(a=null===(r=t.image)||void 0===r?void 0:r.gap)&&void 0!==a?a:10,h=Math.max(s-l-c-24,90);return Math.round(2*h)})(),h=(()=>{var e,i;if(!d)return 0;const n=null!==(i=null===(e=t.block)||void 0===e?void 0:e.height)&&void 0!==i?i:132;return Math.round(3*n)})(),u=d?h:a?100:s?280:20,g=d?h:a?280:l?160:100,p=d?c:20,y=d?c:20,m=t.padding;if(null!=m)if("number"!=typeof m)if(Array.isArray(m)){const[e,i=y,n,o=p]=m;t.padding=[null!=e?e:u,i,null!=n?n:g,o]}else"object"==typeof m&&(t.padding={top:null!==(e=m.top)&&void 0!==e?e:u,right:null!==(i=m.right)&&void 0!==i?i:y,bottom:null!==(n=m.bottom)&&void 0!==n?n:g,left:null!==(o=m.left)&&void 0!==o?o:p});else t.padding=[Math.max(m,u),Math.max(m,y),Math.max(m,g),Math.max(m,p)];else t.padding=[u,y,g,p]},Xi=t=>{var i;const n=Zi(t),o=(null!==(i=t.data)&&void 0!==i?i:[]).map(((e,i)=>qi(t,e,i)));if(ii(t))return[...o,n].filter(Boolean);if(ni(t))return[n,...o].filter(Boolean);if(ri(t)){const i=(t=>{var i,n,o,r;if(!1===(null===(i=t.centerImage)||void 0===i?void 0:i.visible))return null;const a=li(t),s=!!(null===(n=t.centerImage)||void 0===n?void 0:n.image),l={gradient:"linear",x0:.5,y0:0,x1:.5,y1:1,stops:[{offset:0,color:di(a,.15)},{offset:1,color:a}]};return{type:"group",name:"storyline-arc-center",zIndex:e.LayoutZIndex.Mark,children:[{type:"symbol",name:"storyline-arc-center-symbol",interactive:!1,style:{x:(e,i)=>{const n=Di(t,i);return n.x+n.width/2},y:(e,i)=>{const n=Di(t,i);return n.y+n.height/2},size:(e,i)=>{const n=Di(t,i);return 1.1*Math.max(n.width,n.height)},symbolType:"circle",fill:l,stroke:a,lineWidth:2}},s?Object.assign(Object.assign({type:"image",name:"storyline-arc-center-image",interactive:!1},t.centerImage),{style:Object.assign({x:(e,i)=>Di(t,i).x,y:(e,i)=>Di(t,i).y,width:(e,i)=>Di(t,i).width,height:(e,i)=>Di(t,i).height,image:null===(o=t.centerImage)||void 0===o?void 0:o.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center",anchor:(e,i)=>{const n=Di(t,i);return[n.x+n.width/2,n.y+n.height/2]},dx:(e,i)=>{var n,o;const r=Di(t,i),a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.width,s="number"==typeof a?a:r.width;return(r.width-s)/2},dy:(e,i)=>{var n,o;const r=Di(t,i),a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.height,s="number"==typeof a?a:r.height;return(r.height-s)/2}},null===(r=t.centerImage)||void 0===r?void 0:r.style)}):null].filter(Boolean)}})(t),n=(t=>{var i;if(!0!==(null===(i=t.line)||void 0===i?void 0:i.visible))return null;const n=li(t);return{type:"group",name:"storyline-arc",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-arc-path",interactive:!1,style:{stroke:n,lineWidth:2,lineCap:"round",fill:"transparent",fillOpacity:0,path:(e,i)=>{const n=Ei(t,i),o=n.endAngle-n.startAngle,r=[];for(let t=0;t<=64;t++){const e=t/64,i=(n.startAngle+o*e)/180*Math.PI,a=n.cx+Math.cos(i)*n.rx,s=n.cy+Math.sin(i)*n.ry;r.push(`${0===t?"M":"L"} ${a.toFixed(2)} ${s.toFixed(2)}`)}return r.join(" ")}}}]}})(t);return[i,n,...o].filter(Boolean)}if(oi(t)){const i=(t=>{const i=li(t);return{type:"group",name:"storyline-clock-orbit",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-clock-orbit-path",interactive:!1,style:{path:(e,i)=>{const n=bi(t,i),o=.58*n.R;return[`M ${(n.cx+o).toFixed(2)} ${n.cy.toFixed(2)}`,`A ${o.toFixed(2)} ${o.toFixed(2)} 0 1 1 ${(n.cx-o).toFixed(2)} ${n.cy.toFixed(2)}`,`A ${o.toFixed(2)} ${o.toFixed(2)} 0 1 1 ${(n.cx+o).toFixed(2)} ${n.cy.toFixed(2)}`].join(" ")},stroke:di(i,.7),lineWidth:1,lineDash:fi,fill:"transparent",fillOpacity:0}}]}})(t),n=(t=>{var i,n,o,r;if(!1===(null===(i=t.centerImage)||void 0===i?void 0:i.visible))return null;const a=li(t),s=!!(null===(n=t.centerImage)||void 0===n?void 0:n.image);return{type:"group",name:"storyline-clock-center",zIndex:e.LayoutZIndex.Mark+2,children:[{type:"symbol",name:"storyline-clock-center-halo",interactive:!1,style:{x:(e,i)=>bi(t,i).cx,y:(e,i)=>bi(t,i).cy,size:(e,i)=>bi(t,i).R*vi*2.16,symbolType:"circle",fill:di(a,.28),stroke:"transparent"}},s?{type:"image",name:"storyline-clock-center-image",interactive:!1,style:Object.assign({x:(e,i)=>{const n=bi(t,i);return n.cx-n.R*vi*xi},y:(e,i)=>{const n=bi(t,i);return n.cy-n.R*vi*xi},width:(e,i)=>bi(t,i).R*vi*xi*2,height:(e,i)=>bi(t,i).R*vi*xi*2,image:null===(o=t.centerImage)||void 0===o?void 0:o.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center",anchor:(e,i)=>{const n=bi(t,i);return[n.cx,n.cy]},dx:(e,i)=>{var n,o;const r=bi(t,i).R*vi*xi*2,a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.width;return(r-("number"==typeof a?a:r))/2},dy:(e,i)=>{var n,o;const r=bi(t,i).R*vi*xi*2,a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.height;return(r-("number"==typeof a?a:r))/2}},null===(r=t.centerImage)||void 0===r?void 0:r.style)}:{type:"symbol",name:"storyline-clock-center-placeholder",interactive:!1,style:{x:(e,i)=>bi(t,i).cx,y:(e,i)=>bi(t,i).cy,size:(e,i)=>bi(t,i).R*vi*2,symbolType:"circle",fill:"#ffffff",stroke:a,lineWidth:2}}].filter(Boolean)}})(t);return[i,...o,n].filter(Boolean)}if(ai(t)){const i=(t=>{var i,n,o,r,a,s,l,d;if(!1===(null===(i=t.line)||void 0===i?void 0:i.visible))return null;const c=li(t),h=null!==(o=null===(n=t.line)||void 0===n?void 0:n.style)&&void 0!==o?o:{},u=Math.max(Number(null!==(r=h.startWidth)&&void 0!==r?r:2),.5),g=Math.max(Number(null!==(s=null!==(a=h.endWidth)&&void 0!==a?a:h.lineWidth)&&void 0!==s?s:18),u);return{type:"group",name:"storyline-wing-arc",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-wing-arc-path",interactive:!1,style:{stroke:!1,lineWidth:0,fill:null!==(d=null!==(l=h.fill)&&void 0!==l?l:h.stroke)&&void 0!==d?d:c,opacity:.95,path:(e,i)=>{const n=$i(t,i),o=n.endAngle-n.startAngle,r=[];for(let t=0;t<=96;t++){const e=t/96,i=(n.startAngle+o*e)/180*Math.PI,a=n.cx+Math.cos(i)*n.rx,s=n.cy+Math.sin(i)*n.ry,l=Math.cos(i)/n.rx,d=Math.sin(i)/n.ry,c=Math.hypot(l,d)||1;r.push({x:a,y:s,nx:l/c,ny:d/c,w:u+(g-u)*e})}const a=[];for(let t=0;t<r.length;t++){const e=r[t],i=e.x+e.nx*(e.w/2),n=e.y+e.ny*(e.w/2);a.push(`${0===t?"M":"L"} ${i.toFixed(2)} ${n.toFixed(2)}`)}for(let t=r.length-1;t>=0;t--){const e=r[t],i=e.x-e.nx*(e.w/2),n=e.y-e.ny*(e.w/2);a.push(`L ${i.toFixed(2)} ${n.toFixed(2)}`)}return a.push("Z"),a.join(" ")}}}]}})(t);return[i,...o].filter(Boolean)}if(si(t)){const i=(t=>{const i=li(t);return{type:"group",name:"storyline-ladder-diagonal",zIndex:e.LayoutZIndex.Mark-1,children:[{type:"path",name:"storyline-ladder-diagonal-line",interactive:!1,style:{path:(e,i)=>{const n=Wi(t,i);return`M ${n.x0} ${n.y0} L ${n.x1} ${n.y1}`},stroke:di(i,.85),lineWidth:2,lineDash:Ni,fill:"transparent"}}]}})(t);return[i,Hi(t),...o].filter(Boolean)}return[n,...o].filter(Boolean)},Zi=t=>{var i,n,o;return!1===(null===(i=t.line)||void 0===i?void 0:i.visible)||(null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0)<=1?null:ii(t)?(t=>{var i,n,o,r,a,s,l;const d=li(t),c=null!==(n=null===(i=t.line)||void 0===i?void 0:i.style)&&void 0!==n?n:{},h=null!==(r=null===(o=t.data)||void 0===o?void 0:o.length)&&void 0!==r?r:0,u=[];for(let e=0;e<h;e++){const i=e;u.push({type:"symbol",name:`storyline-landscape-curve-symbol-${i}`,interactive:!1,style:{symbolType:"circle",size:14,fill:d,x:(e,n)=>{var o,r;return null!==(r=null===(o=Fi(t,n,i))||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,n)=>{var o,r;return null!==(r=null===(o=Fi(t,n,i))||void 0===o?void 0:o.y)&&void 0!==r?r:0}}})}return{type:"group",name:"storyline-landscape-curve",zIndex:e.LayoutZIndex.Mark+2,children:[{type:"path",name:"storyline-landscape-curve-path",interactive:!1,style:{stroke:null!==(a=c.stroke)&&void 0!==a?a:d,lineWidth:null!==(s=c.lineWidth)&&void 0!==s?s:4,lineDash:null!==(l=c.lineDash)&&void 0!==l?l:[6,5],lineCap:"round",fill:"transparent",fillOpacity:0,path:(e,i)=>{const n=[];for(let e=0;e<h;e++){const o=Fi(t,i,e);o&&n.push(o)}return(t=>{var e,i;if(t.length<2)return"";if(2===t.length)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;let n=`M ${t[0].x} ${t[0].y}`;for(let o=0;o<t.length-1;o++){const r=null!==(e=t[o-1])&&void 0!==e?e:t[o],a=t[o],s=t[o+1],l=null!==(i=t[o+2])&&void 0!==i?i:s;n+=` C ${a.x+(s.x-r.x)/6} ${a.y+(s.y-r.y)/6}, ${s.x-(l.x-a.x)/6} ${s.y-(l.y-a.y)/6}, ${s.x} ${s.y}`}return n})(n)}}},...u]}})(t):ni(t)?(t=>{var i,n,o,r,a,s;const l=li(t),d=null!==(n=null===(i=t.line)||void 0===i?void 0:i.style)&&void 0!==n?n:{},c={gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:[{offset:0,color:di(l,.2)},{offset:1,color:di(l,1)}]};return{type:"group",name:"storyline-portrait-axis",zIndex:e.LayoutZIndex.Mark,children:[{type:"rect",name:"storyline-portrait-axis-rect",interactive:!1,style:{fill:null!==(o=d.fill)&&void 0!==o?o:c,stroke:null!==(r=d.stroke)&&void 0!==r&&r,lineWidth:null!==(a=d.lineWidth)&&void 0!==a?a:0,cornerRadius:null!==(s=d.cornerRadius)&&void 0!==s?s:0,x:(e,i)=>Ti(t,i).x,y:(e,i)=>Ti(t,i).y,width:(e,i)=>Ti(t,i).width,height:(e,i)=>Ti(t,i).height}}]}})(t):(t=>{var i,n,o,r;return!1===(null===(i=t.line)||void 0===i?void 0:i.visible)||(null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0)<=1?null:{type:"group",name:"storyline-links",zIndex:e.LayoutZIndex.Mark,children:(null!==(r=t.data)&&void 0!==r?r:[]).slice(1).map(((e,i)=>{var n;const o=null!==(n=t.line)&&void 0!==n?n:{},{style:r={},type:a="line",showArrow:s=!1,arrowSize:l=8}=o,d=y(o,["style","type","showArrow","arrowSize"]);return Object.assign(Object.assign({type:"path",name:`storyline-link-${i}`,interactive:!1},d),{style:Object.assign(Object.assign({stroke:"#8a94a6",lineWidth:1.5,fill:"transparent",fillOpacity:0},r),{path:(e,n)=>{const o=ui(t,n).links[i];return o?Ci(o.points,a,s,l):""}})})}))}})(t)},qi=(t,i,n)=>ii(t)?Oi(t,i,n):ni(t)?Bi(t,i,n):ri(t)?Pi(t,i,n):oi(t)?Ai(t,i,n):ai(t)?((t,i,n)=>{var o,r,a,s,l;const d=!!i.image,c=Array.isArray(i.content)?i.content:i.content?[i.content]:[],h=li(t),u=Vi(t,n),g=!0===(null===(o=t.image)||void 0===o?void 0:o.showBackground);return{type:"group",id:`storyline-block-${null!==(r=i.id)&&void 0!==r?r:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>zi(t,i,n).x,y:(e,i)=>zi(t,i,n).y},children:[g?{type:"symbol",name:`storyline-block-image-halo-${n}`,interactive:!1,style:{x:0,y:0,size:Math.max(u.imageBox.width,u.imageBox.height)+12,symbolType:"circle",fill:di(h,.18),stroke:h,lineWidth:1.5}}:null,d?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:u.imageBox.x,y:u.imageBox.y,width:u.imageBox.width,height:u.imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(a=t.image)||void 0===a?void 0:a.style)}):{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:{x:u.imageBox.x,y:u.imageBox.y,width:u.imageBox.width,height:u.imageBox.height,cornerRadius:Math.min(u.imageBox.width,u.imageBox.height)/2,fill:"#ffffff",stroke:h,lineWidth:2}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1,zIndex:e.LayoutZIndex.Mark+10},t.title),{style:Object.assign({x:u.onLeft?u.textBox.x+u.textBox.width:u.textBox.x,y:u.textBox.y,text:i.title,maxLineWidth:u.textBox.width,fontSize:u.titleFontSize,lineHeight:u.titleLineHeight,fontWeight:"bold",fill:h,stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:u.onLeft?"right":"left",textBaseline:"top"},null===(s=t.title)||void 0===s?void 0:s.style)}):null,c.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1,zIndex:e.LayoutZIndex.Mark+10},t.content),{textType:"rich",style:Object.assign({x:u.onLeft?u.contentBox.x+u.contentBox.width:u.contentBox.x,y:u.contentBox.y,width:u.contentBox.width,height:u.contentBox.height,maxLineWidth:u.contentBox.width,heightLimit:u.contentBox.height,text:gi(c,t),fontSize:12,lineHeight:17,textAlign:u.onLeft?"right":"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#1f2430"},null===(l=t.content)||void 0===l?void 0:l.style)}):null].filter(Boolean)}})(t,i,n):si(t)?((t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y;const m=!!i.image,v=Gi(n)?"right":"left",x=Array.isArray(i.content)?i.content:i.content?[i.content]:[],f=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:28),b=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(f*(36/28))),k=!0===(null===(c=t.block)||void 0===c?void 0:c.showBackground),_=e=>{const i=Ui(t,e,n);return"right"===v?i.textBox.x+i.textBox.width:i.textBox.x};return{type:"group",id:`storyline-block-${null!==(h=i.id)&&void 0!==h?h:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.y)&&void 0!==r?r:0},width:(e,i)=>Ui(t,i,n).block.width,height:(e,i)=>Ui(t,i,n).block.height},children:[k?{type:"rect",name:`storyline-block-bg-${n}`,interactive:!1,style:Object.assign({x:0,y:0,width:(e,i)=>Ui(t,i,n).block.width,height:(e,i)=>Ui(t,i,n).block.height,cornerRadius:8,fill:"#ffffff",stroke:"#d7dce5",lineWidth:1,shadowBlur:6,shadowColor:"rgba(0, 0, 0, 0.08)"},null===(u=t.block)||void 0===u?void 0:u.style)}:null,m?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(e,i)=>Ui(t,i,n).imageBox.x,y:(e,i)=>Ui(t,i,n).imageBox.y,width:(e,i)=>Ui(t,i,n).imageBox.width,height:(e,i)=>Ui(t,i,n).imageBox.height,image:i.image},null===(g=t.image)||void 0===g?void 0:g.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign(Object.assign({x:(t,e)=>_(e),y:(e,i)=>Ui(t,i,n).textBox.y,text:i.title,maxLineWidth:(e,i)=>Ui(t,i,n).textBox.width,fontSize:f,lineHeight:b,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textBaseline:"top"},null===(p=t.title)||void 0===p?void 0:p.style),{textAlign:v})}):null,x.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign(Object.assign({x:(t,e)=>_(e),y:(e,i)=>Ui(t,i,n).contentBox.y,width:(e,i)=>Ui(t,i,n).textBox.width,text:gi(x,t),maxLineWidth:(e,i)=>Ui(t,i,n).textBox.width,fontSize:16,lineHeight:24,heightLimit:(e,i)=>Ui(t,i,n).contentBox.height,textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(y=t.content)||void 0===y?void 0:y.style),{textAlign:v})}):null].filter(Boolean)}})(t,i,n):((t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p;const y=!!i.image,m=Array.isArray(i.content)?i.content:i.content?[i.content]:[],v=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),x=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(1.35*v));return{type:"group",id:`storyline-block-${null!==(c=i.id)&&void 0!==c?c:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.y)&&void 0!==r?r:0},width:(e,i)=>wi(t,i,n).block.width,height:(e,i)=>wi(t,i,n).block.height},children:[{type:"rect",name:`storyline-block-bg-${n}`,interactive:!1,style:Object.assign({x:0,y:0,width:(e,i)=>wi(t,i,n).block.width,height:(e,i)=>wi(t,i,n).block.height,cornerRadius:8,fill:"#ffffff",stroke:"#d7dce5",lineWidth:1,shadowBlur:6,shadowColor:"rgba(0, 0, 0, 0.08)"},null===(h=t.block)||void 0===h?void 0:h.style)},y?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(e,i)=>wi(t,i,n).imageBox.x,y:(e,i)=>wi(t,i,n).imageBox.y,width:(e,i)=>wi(t,i,n).imageBox.width,height:(e,i)=>wi(t,i,n).imageBox.height,image:i.image},null===(u=t.image)||void 0===u?void 0:u.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(e,i)=>wi(t,i,n).textBox.x,y:(e,i)=>wi(t,i,n).textBox.y,text:i.title,maxLineWidth:(e,i)=>wi(t,i,n).textBox.width,fontSize:v,lineHeight:x,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(g=t.title)||void 0===g?void 0:g.style)}):null,m.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(e,i)=>wi(t,i,n).textBox.x,y:(e,i)=>wi(t,i,n).contentBox.y,width:(e,i)=>wi(t,i,n).textBox.width,text:gi(m,t),maxLineWidth:(e,i)=>wi(t,i,n).textBox.width,fontSize:12,lineHeight:18,heightLimit:(e,i)=>wi(t,i,n).contentBox.height,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(p=t.content)||void 0===p?void 0:p.style)}):null].filter(Boolean)}})(t,i,n);class Ji extends e.BaseChart{constructor(){super(...arguments),this.type="storyline",this.transformerConstructor=Ki}init(){this.isValid()&&super.init()}isValid(){var t,e;const{data:i}=this._spec;return!!Array.isArray(i)||(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Data is required and should be an array for storyline chart"),!1)}}Ji.type="storyline",Ji.view="singleDefault",Ji.transformerConstructor=Ki;const Qi="seriesBreak";function tn(t,e,i,n,o=!1){const r=[],{x:a,y:s}=t,{x:l,y:d}=e,c=o?Math.floor((d-s)/(2*i)):Math.floor((l-a)/(2*i)),h=Math.PI/180*n,u=i*Math.cos(h),g=i*Math.sin(h);r.push(`M ${a} ${s}`);for(let t=0;t<=c;t++){const e=o?a+(t%2==0?u:-u):a+t*i*2,n=o?s+t*i*2:t%2==0?s-g:s+g;r.push(`L ${e} ${n}`)}return r.push(`L ${o?a:l} ${o?d:s}`),r.join(" ")}class en extends e.AbstractComponent{constructor(){super(...arguments),this.name=Qi}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],n=[];t.forEach((t=>{const{start:o,end:r}=t;((t,i)=>{const{start:n,end:o}=i,r=n.x===o.x,a=r?"x":"y",s=r?"y":"x";let l=!0;const d=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[a],n[a])){const e=Math.min(n[s],o[s]),i=Math.max(n[s],o[s]),r=Math.min(t.start[s],t.end[s]),a=Math.max(t.start[s],t.end[s]);if(!(i<r-d||e>a+d))return t.start[s]=Math.min(r,e),t.end[s]=Math.max(a,i),void(l=!1)}})),l&&t.push(i)})(o.x===r.x?i:n,t)})),[...i,...n].forEach(((t,i)=>{var n;const{start:o,end:r,size:a=4,gap:s=5,style:l={}}=t,d=y(t,["start","end","size","gap","style"]),c=e.createGroup({}),h=o.x===r.x;let u,g,p,m;h?(u={x:o.x-s/2,y:o.y},g={x:r.x-s/2,y:r.y},p={x:o.x+s/2,y:o.y},m={x:r.x+s/2,y:r.y}):(u={x:o.x,y:o.y-s/2},g={x:r.x,y:r.y-s/2},p={x:o.x,y:o.y+s/2},m={x:r.x,y:r.y+s/2});const v=tn(u,g,a,h?75:15,h),x=tn(o,r,a,h?75:15,h),f=tn(p,m,a,h?75:15,h);c.add(e.createPath(Object.assign(Object.assign({path:v,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:f,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:x,stroke:"#fff",lineWidth:s,pickable:!1,zIndex:0})),c.name="series-break",c.data=d,e.isValid(d.axisId)&&(c.id=`${null!==(n=d.axisId)&&void 0!==n?n:""}_${i}`),this.add(c)}))}}function nn(t,e,i=1){return Math.abs(t-e)<i}function on(t,i){return{type:"component",componentType:Qi,interactive:!0,zIndex:500,style:{data:(n,o)=>{const r=[],a=o.vchart.getChart(),s="horizontal"===a.getAllSeries()[0].direction;return t.forEach(((t,n)=>{var o,l;const d=t.id,c=e.isValid(d)?a.getComponentByUserId(d):i&&e.isValid(i[n])?a.getComponentByIndex("axes",i[n]):null===(o=a.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===o?void 0:o[0];if(!c)return;const h=null!=d?d:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,o=i+t[0].getLayoutRect().height;for(let r=1;r<t.length;r++){const a=t[r],{x:s,y:l}=a.getLayoutStartPoint(),{width:d,height:c}=a.getLayoutRect();e=Math.min(e,s),n=Math.max(n,d+s),i=Math.min(i,l),o=Math.max(o,c+l)}return{x1:e,y1:i,x2:n,y2:o}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:n=5}=t,o=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),d=(o+l)/2+(s?u.x1:u.y1);a.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const a=t.AABBBounds;let c,g,p,y,m=!1;s?(m=a.x1<(o+l-n)/2&&a.x2>(o+l+n)/2,c=d,g=Math.max(a.y1+u.y1-2,u.y1),p=d,y=Math.min(a.y2+u.y1+2,u.y2)):(m=a.y1<(o+l-n)/2&&a.y2>(o+l+n)/2,c=Math.max(a.x1+u.x1-2,u.x1),g=d,p=Math.min(a.x2+u.x1+2,u.x2),y=d),m&&r.push({start:{x:c,y:g},end:{x:p,y:y},gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{an(t,"line").forEach((t=>{rn(s?{start:{x:(o+l)/2,y:0},end:{x:(o+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(o+l)/2},end:{x:u.x2-u.x1,y:(o+l)/2}},t).forEach((t=>{let o,a;s?(o={x:d,y:Math.max(t[1]+u.y1-10,u.y1)},a={x:d,y:Math.min(t[1]+u.y1+10,u.y2)}):(o={x:Math.max(t[0]+u.x1-10,u.x1),y:d},a={x:Math.min(t[0]+u.x1+10,u.x2),y:d}),r.push({start:o,end:a,gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{an(t,"area").forEach((t=>{const a=rn(s?{start:{x:(o+l)/2,y:0},end:{x:(o+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(o+l)/2},end:{x:u.x2-u.x1,y:(o+l)/2}},t);a.sort(((t,e)=>t[0]-e[0]));for(let o=0;o<a.length-1;o++){const l={x:a[o][0],y:a[o][1]},d={x:a[o+1][0],y:a[o+1][1]};if(sn(s?{x:l.x,y:(l.y+d.y)/2}:{x:(l.x+d.x)/2,y:l.y},t)){let t,o;s?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},o={x:d.x+u.x1,y:Math.min(d.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},o={x:Math.min(d.x+u.x1+0,u.x2),y:d.y+u.y1}),r.push({start:t,end:o,gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}}}))}))}}))}))})),r}}}}function rn(t,i){const n=[];for(let o=1;o<i.length;o++){const r=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[o].x,i[o].y],[i[o-1].x,i[o-1].y]);r&&!n.find((t=>nn(e.PointService.distancePP({x:t[0],y:t[1]},{x:r[0],y:r[1]}),0)))&&n.push(r)}return n}function an(t,e){const{points:i,segments:n}=t.attribute,o=[];let r=[];const a=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var n,a;if(!1===t.defined){if(o.push(r),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)r.push({x:i[t].x,y:i[t].y});r.push(r[0])}r=[],i=[]}else r.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(n=t.x1)&&void 0!==n?n:t.x,y:null!==(a=t.y1)&&void 0!==a?a:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)r.push({x:i[t].x,y:i[t].y});r.push(r[0])}o.push(r)}};return i&&i.length?a(i):n&&n.length&&n.forEach((t=>{a(t.points)})),o}function sn(t,e){const{x:i,y:n}=t;let o=!1;for(let t=0,r=e.length-1;t<e.length;r=t++){const{x:a,y:s}=e[t],{x:l,y:d}=e[r];s>n!=d>n&&i<(l-a)*(n-s)/(d-s)+a&&(o=!o)}return o}const ln="barLink";class dn extends e.AbstractComponent{constructor(){super(...arguments),this.name=ln}render(){const{data:t,linkStyle:i,areaStyle:n,styleMap:o,label:r,linkType:a="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,s)=>{var l,d,c,h,u;const{linePoints:g,areaPoints:p,id:y=s,color:m,data:v}=t;if(p&&!1!==(null===(l=null==o?void 0:o[`area-${y}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:p,fillOpacity:.3,fill:m,zIndex:0},n),null==o?void 0:o[`area-${y}`]));t.name="bar-link-area",t.id=`area-${y}`,this.add(t)}if(g&&!1!==(null===(d=null==o?void 0:o[`line-${y}`])||void 0===d?void 0:d.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(h=null==o?void 0:o[`line-${y}`])||void 0===h?void 0:h.lineWidth)){const{startSymbol:t={},endSymbol:n={},lineStyle:r}=i||{},a=e.cloneDeep(t),s=e.cloneDeep(n);(null==o?void 0:o[`line-${y}`])&&o[`line-${y}`].stroke&&(a.style=Object.assign(Object.assign({},a.style),{color:o[`line-${y}`].stroke}),s.style=Object.assign(Object.assign({},s.style),{color:o[`line-${y}`].stroke})),a.symbolType||a.originSymbolType||(a.originSymbolType="solidArrow"),s.symbolType||s.originSymbolType||(s.originSymbolType="solidArrow");const l=new e.Segment({points:g,startSymbol:Object.assign({size:8},a),endSymbol:Object.assign({size:8},s),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},r),null==o?void 0:o[`line-${y}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${y}`,this.add(l)}if((null==r?void 0:r.visible)&&!1!==(null===(u=null==o?void 0:o[`label-${y}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=r,[n,s]=v;let l=n[e.STACK_FIELD_END],d=s[e.STACK_FIELD_END];"value"===a&&(l=n[e.STACK_FIELD_END]-n[e.STACK_FIELD_START],d=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START]);const c=d-l,h=(d-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(g[0].x+g[1].x),y:.5*(g[0].y+g[1].y),text:i?i(c,h,v):`${c} ${h}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==o?void 0:o[`label-${y}`]));u.name="bar-link-label",u.id=`label-${y}`,this.add(u)}})))}}function cn(t,i,n){const{isHorizontal:o,isXAxisInverse:r,isYAxisInverse:a,linkType:s,doFill:l,regionStartX:d,regionStartY:c}=n,h=t.AABBBounds,u=i.AABBBounds;let g,p;return o?(g=[{x:(h.x1+h.x2)/2+d,y:h.y1+c},{x:(u.x1+u.x2)/2+d,y:u.y2+c}],r?("total"===s&&(g=[{x:h.x1+d,y:h.y1+c},{x:u.x1+d,y:u.y2+c}]),l&&(p=[{x:h.x1+d,x1:h.x2+d,y:h.y1+c},{x:u.x1+d,x1:u.x2+d,y:u.y2+c}])):("total"===s&&(g=[{x:h.x2+d,y:h.y1+c},{x:u.x2+d,y:u.y2+c}]),l&&(p=[{x:h.x2+d,x1:h.x1+d,y:h.y1+c},{x:u.x2+d,x1:u.x1+d,y:u.y2+c}]))):(g=[{x:h.x2+d,y:(h.y1+h.y2)/2+c},{x:u.x1+d,y:(u.y1+u.y2)/2+c}],a?("total"===s&&(g=[{x:h.x2+d,y:h.y2+c},{x:u.x1+d,y:u.y2+c}]),l&&(p=[{x:h.x2+d,y:h.y2+c,y1:h.y1+c},{x:u.x1+d,y:u.y2+c,y1:u.y1+c}])):("total"===s&&(g=[{x:h.x2+d,y:h.y1+c},{x:u.x1+d,y:u.y1+c}]),l&&(p=[{x:h.x2+d,y:h.y1+c,y1:h.y2+c},{x:u.x1+d,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:p,linePoints:g,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function hn(t={},i){const{linkType:n="total",doFill:o}=t,r=y(t,["linkType","doFill"]);return{type:"component",componentType:ln,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:r}=i,a=r.getChart().getAllRegions(),s=[];return a.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:r,y:a}=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 d=function(t,i){const n={};for(let o=0;o<t.length;o++){const r=t[o],a=e.getDatumOfGraphic(r),s=i.map((t=>a[t])).join("-");n[s]||(n[s]=[]),n[s].push(r)}return n}(l,t);Object.values(d).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],h="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),g=c.getXAxisHelper().isInverse(),p=Object.values(d);if(p.length)if(h){p[0][0].AABBBounds.y1<p[p.length-1][0].AABBBounds.y1&&p.reverse()}else{p[0][0].AABBBounds.x1>p[p.length-1][0].AABBBounds.x1&&p.reverse()}for(let t=0;t<p.length-1;t++){const e=p[t],i=p[t+1];if(e.forEach(((t,e)=>{var l;const d=cn(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:h,isXAxisInverse:g,isYAxisInverse:u,doFill:o,linkType:n,regionStartX:r,regionStartY:a});s.push(d)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=cn(t,i[l],{isHorizontal:h,isXAxisInverse:g,isYAxisInverse:u,doFill:o,linkType:n,regionStartX:r,regionStartY:a});s.push(e)}}}}})),s},linkType:n},r),i)}}const un="seriesLabel";function gn(t,e=10,i=10,n=.1){const o=t.length;if(!t.every(isFinite))return t;if(!(o>1))return t;const r=function(t,e,i){t=+t,e=+e;let n=arguments.length;i=n<2?(e=t,t=0,1):n<3?1:+i;let o=-1;n=0|Math.max(0,Math.ceil((e-t)/i));const r=new Array(n);for(;++o<n;)r[o]=t+o*i;return r}(t.length);for(let a=0;a<i;++a){r.sort(((e,i)=>{return n=t[e],o=t[i],null==n||null==o?NaN:n<o?-1:n>o?1:n>=o?0:NaN;var n,o}));let i=0;for(let n=1;n<o;++n){let o=t[r[n]]-t[r[n-1]];o<e&&(o=(e-o)/2,i=Math.max(i,o),t[r[n-1]]-=o,t[r[n]]+=o)}if(i<n)break}return t}function pn(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function yn(t,e=10,i=10){const n=t.length;let o,r=0;do{o=!1;for(let i=0;i<n;++i)for(let r=i+1;r<n;++r){const n=t[i].AABBBounds,a=t[r].AABBBounds;if(pn(n,a)){const i=e-(a.x1-n.x2);i>0&&(t[r].attribute.x+=i,a.x1+=i,a.x2+=i,o=!0)}}r++}while(o&&r<i)}function mn(t,i){const{label:n,line:o}=i;return{type:"component",componentType:un,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,n)=>{var o;const r=n.vchart.getChart(),a=r.getAllSeries()[0],s="horizontal"===a.direction,l=s?a.getYAxisHelper():a.getXAxisHelper(),d=null===(o=l.getScale)||void 0===o?void 0:o.call(l,0),c=l.isInverse(),h=a.getDimensionField()[0],u=a.getSeriesField(),g=r.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),p=[];if(1===g.length&&["bar","area","line","waterfall"].includes(g[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(d.domain()):d.domain()[0],n=a.getRegion(),{x:o,y:l}=n.getLayoutStartPoint();let y=0;r.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===g[0]?"bar":g[0]).getGraphics().forEach((n=>{var r;const a=n.context.data.find((t=>t[h]===i));if(a){const i=n.AABBBounds;let d,m,v,x;"bar"===g[0]||"waterfall"===g[0]?(d="end"===t?{x:s?(i.x1+i.x2)/2:c?i.x1:i.x2,y:s?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:s?(i.x1+i.x2)/2:c?i.x2:i.x1,y:s?c?i.y1:i.y2:(i.y1+i.y2)/2},m=n.attribute.fill):(d=e.dataToPosition(a),m=n.attribute.stroke||n.attribute.fill),"end"===t?(v=s?"center":c?"end":"start",x=s?c?"top":"bottom":"middle"):(v=s?"center":c?"start":"end",x=s?c?"bottom":"top":"middle");const f=null!==(r=a[u])&&void 0!==r?r:a[h];p.push({point:{x:d.x+o,y:d.y+l},label:f,color:m,textAlign:v,textBaseline:x,series:e,datum:a,id:`${t}-${y}`,position:t}),y++}}))}))}))}return p},line:o,label:Object.assign({space:12},n)}}}class vn extends e.AbstractComponent{constructor(){super(...arguments),this.name=un}render(){var t,i,n,o;this.removeAllChild();const{data:r,layout:a,label:s,line:l={}}=this.attribute;if(e.isEmpty(r))return;const d=null!==(t=null==s?void 0:s.styleMap)&&void 0!==t?t:{},c={},h=r.filter((t=>{var e;return!1!==(null===(e=d[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===a){const t=1.5*(null!==(n=null===(i=null==s?void 0:s.style)||void 0===i?void 0:i.fontSize)&&void 0!==n?n:12),o=(t,i,n)=>{var o,r,a,s,l,d,c,h;const{label:u,color:g,textAlign:p,textBaseline:y,id:m}=t,v=null!==(r=null===(o=n[m])||void 0===o?void 0:o.formatMethod)&&void 0!==r?r:null===(a=this.attribute.label)||void 0===a?void 0:a.formatMethod,x=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:v?v(u,t.datum,{series:t.series}):u},null===(s=this.attribute.label)||void 0===s?void 0:s.style),i),{textAlign:p,textBaseline:y,fill:null!==(c=null===(d=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fill)&&void 0!==c?c:g}),null===(h=n[m])||void 0===h?void 0:h.style));return x.name="series-label-text",x.id=m,this.add(x),x};["start","end"].forEach((e=>{const i=h.filter((t=>t.position===e)),n=gn(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const r={x:t.point.x+(null!==(i=null==s?void 0:s.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:n[e]};o(t,r,d),c[t.id]=r}))}))}else{const t=[],i=[];h.forEach((n=>{var o,r,a,l,c;const{point:h,label:u,color:g,textAlign:p,textBaseline:y,id:m,position:v}=n,x={x:h.x,y:h.y},f=null!==(r=null===(o=d[m])||void 0===o?void 0:o.formatMethod)&&void 0!==r?r:null==s?void 0:s.formatMethod,b=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:f?f(u,n.datum,{series:n.series}):u},null==s?void 0:s.style),x),{textAlign:p,textBaseline:y,fill:null!==(l=null===(a=null==s?void 0:s.style)||void 0===a?void 0:a.fill)&&void 0!==l?l:g}),null===(c=d[m])||void 0===c?void 0:c.style));b.id=m,b.name="series-label-text",this.add(b),"start"===v?t.push(b):"end"===v&&i.push(b)})),t.length&&yn(t,4,10),i.length&&yn(i,4,10);const n=null!==(o=null==s?void 0:s.space)&&void 0!==o?o:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+n*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&h.forEach((t=>{var i,n,o,r,s,h;const{point:u,color:g,id:p}=t,y={x:c[p].x+(null!==(o=null===(n=null===(i=d[p])||void 0===i?void 0:i.style)||void 0===n?void 0:n.dx)&&void 0!==o?o:0),y:c[p].y+(null!==(h=null===(s=null===(r=d[p])||void 0===r?void 0:r.style)||void 0===s?void 0:s.dy)&&void 0!==h?h:0)};if(!1!==l.autoVisible){if("vertical"===a&&u.y!==y.y||"horizontal"===a&&u.x!==y.x){const t=e.createLine(Object.assign({points:[u,y],lineWidth:1,stroke:g},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,y],lineWidth:1,stroke:g},l.style));t.name="series-label-line",this.add(t)}}))}}function xn(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 fn(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e,i;return Object.assign(Object.assign({},t),{bound:(i=t.rect,{x1:i.x,x2:i.x+i.width,y1:i.y,y2:i.y+i.height}),anchorCandidates:An(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const o=i[t],r=o.bound;let a=n.some((t=>xn(t,r)));if(o.anchorCandidates)if(a&&(null===(e=o.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<o.anchorCandidates.length;t++){const e=o.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+r.x2-r.x1,y2:e.y+r.y2-r.y1,anchor:e};if(!n.some((t=>xn(t,i)))){n.push(i),a=!1;break}}a&&n.push(o.bound)}else n.push(o.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function bn(t,i,n){const o=t.map((t=>t.pointCoord)),{x1:r,x2:a,y1:s,y2:l}=e.getAABBFromPoints(o),d=n([(r+a)/2,(s+l)/2]);if(!d)return[];const c=t.map((t=>{const o=t.rect,r=Sn(i,t.pointCoord)?n(function(t,i,n,o=200){const r=5621/o;let a=i;for(let i=1;i<=r;i++){const i=e.destination(a,o,n);if(!Sn(t,i))return[i.x,i.y];a=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],kn(_n(t.point,d)))):t.point;r&&(o.x=r.x,o.y=r.y);const a=kn(_n(t.point,d));let s;const l=[];return a>=-45&&a<45?(s="top",l.push("left","right")):a>=45&&a<135?s="right":a>=-135&&a<-45?(s="left",l.push("left")):(s="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=Mn(t.rect,s,0),t}));return fn(c)}function kn(t){return t>180?t-360:t}function _n(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function Sn(t,i){for(let n=0;n<t.length;n++){if(e.isPointInPolygon(i,t[n]))return!0}return!1}function Mn(t,e,i=0){const n=Object.assign({},t);return"top"===e?(n.x-=t.width/2,n.y-=i+t.height/2):"bottom"===e?(n.x-=t.width/2,n.y+=i-t.height/2):"left"===e?(n.x-=i+t.width,n.y-=t.height/2):"right"===e&&(n.x+=i,n.y-=t.height/2),n}function An(t,e,i,n=0){const o=[];return t.forEach((t=>{const{x:r,y:a}=Mn(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);o.push({x:r,y:a})})),o}const wn={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 Cn extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return wn}}class Ln extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Cn,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,n;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===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,o,r,a,s;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===(o=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===o?void 0:o.longitudeField,this._latitudeField=null===(s=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===s?void 0:s.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 n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?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=[],n=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var n;const o=new e.MarkPoint({position:void 0,animation:!1});return o&&(o.name=`${this.name}_marker_${i}`,o.id=null!==(n=this._spec.id)&&void 0!==n?n:`${this.name}_marker_${this.id}`,o.setAttribute("zIndex",this.layoutZIndex)),o})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:o,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[e],e);o&&i.push(o),r&&n.push(r)}));const o=this._layoutLabels(i);this._layoutMarkers(o,n),this._renderMarkers()}_evaluateMarker(t,i){var n,o,r,a,s,l,d,c,h,u,g,p,y,m;let v=0,x=0,f=0,b=0,k=0;const _=this._spec.position||"top",S=this._spec.offset,M=e.normalizeLayoutPaddingSpec(null===(n=this._spec.background)||void 0===n?void 0:n.padding),A=this._spec.space||0;x+=((null==M?void 0:M.left)||0)+((null==M?void 0:M.right)||0),f+=((null==M?void 0:M.top)||0)+((null==M?void 0:M.bottom)||0);const w={},C=this.dataToPosition(t),L=e.graphicCreator.group({});if(L.name=`${this.name}_marker_itemContainer_${i}`,w.container=L,null===(o=this._spec.background)||void 0===o?void 0:o.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(C),w.labelBackground=t,L.appendChild(t)}if(null===(r=this._spec.icon)||void 0===r?void 0:r.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(C),t.setAttribute("symbolType",null!==(s=null===(a=this._spec.icon.style)||void 0===a?void 0:a.symbolType)&&void 0!==s?s:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,n=null!==(d=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==d?d:0,o=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;w.icon=t,L.appendChild(t),k=n,b+=o,v++}if(null===(h=this._spec.nameLabel)||void 0===h?void 0:h.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(C),i.setAttribute("text",t[this.nameField]);const n=i.AABBBounds,o=null!==(u=(null==n?void 0:n.y2)-(null==n?void 0:n.y1))&&void 0!==u?u:0,r=null!==(g=(null==n?void 0:n.x2)-(null==n?void 0:n.x1))&&void 0!==g?g:0;w.nameLabel=i,L.appendChild(i),k=Math.max(k,o),b+=r,v++}if((null===(p=this._spec.valueLabel)||void 0===p?void 0:p.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(C),i.setAttribute("text",t[this.valueField]);const n=i.AABBBounds,o=null!==(y=(null==n?void 0:n.y2)-(null==n?void 0:n.y1))&&void 0!==y?y:0,r=null!==(m=(null==n?void 0:n.x2)-(null==n?void 0:n.x1))&&void 0!==m?m:0;w.valueLabel=i,L.appendChild(i),k=Math.max(k,o),b+=r,v++}const F=Object.values(w).find((t=>!!t&&"group"!==t.type)),O={x:null==F?void 0:F.getComputedAttribute("x"),y:null==F?void 0:F.getComputedAttribute("y")},T={x:O.x,y:O.y,width:0,height:0};T.width=x+b+(v-1)*A,T.height=f+k;const B={rect:T,point:O,index:i};if("outer"!==_){const t=["top","right","left","bottom"].filter((t=>t!==_));B.rect=Mn(T,_,S),B.anchors=t,B.offset=S}else B.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:B,contentMarks:w}}_layoutMarkers(t,i){var n,o,r;for(let a=0;a<i.length;a++){if(!t[a]||!i[a])return;const{icon:s,nameLabel:l,valueLabel:d,labelBackground:c,container:h}=i[a],u=t[a],g=e.normalizeLayoutPaddingSpec(null===(n=this._spec.background)||void 0===n?void 0:n.padding),p=this._spec.space||0,y=u.height/2;let m=(null==g?void 0:g.left)||0;[s,l,d].forEach(((t,e)=>{var i,n;if(t){const o=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=o.x2-o.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:y}),m+=null!==(n=o.x2-o.x1)&&void 0!==n?n:0,2!==e&&(m+=p)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==h||h.setAttributes({dx:-u.width/2,dy:-u.height/2});const v=this._data.getLatestData()[a],x=this.dataToPosition(v),f=this.getRegions()[0].getLayoutStartPoint(),b=!(!(null===(o=this._spec.leader)||void 0===o?void 0:o.visible)||!(s||l||d));this._markerComponents[a].setAttributes({x:f.x,y:f.y,position:x,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>h,autoRotate:!1,offsetX:u.x+u.width/2-x.x,offsetY:u.y+u.height/2-x.y},itemLine:{visible:b,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(r=this._spec.leader)||void 0===r?void 0:r.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?bn(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):fn(t)}_isRelativeModel(t){var e,i,n;const o=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===o}_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}}Ln.type="mapLabel",Ln.specKey="mapLabel",Ln.transformerConstructor=Cn;const Fn="regressionLine";class On extends e.AbstractComponent{constructor(){super(...arguments),this.name=Fn}render(){this.removeAllChild();const{data:t,line:i={},label:n,name:o="regression-line",confidenceInterval:r}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:a}=t;if(t.area&&!1!==(null==r?void 0:r.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(a)?{fill:a,fillOpacity:.12}:null),null==r?void 0:r.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const n=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(a)?{stroke:a}:null),null==i?void 0:i.style));n.name=`${o}-curve`,this.add(n)}const s=e.last(t.line);if(n&&!1!==n.visible&&n.text&&s){const t=e.createText(Object.assign(Object.assign(Object.assign({},s),{text:n.text,textAlign:"end",textBaseline:"middle"}),n.style));t.name=`${o}-label`,this.add(t)}}))}}const Tn=(t,i,n=(t=>t.x),o=(t=>t.y),r)=>{switch(t){case"logisitc":return e.regressionLogistic(i,n,o);case"lowess":return e.regressionLowess(i,n,o);case"polynomial":return e.regressionPolynomial(i,n,o,{degree:r});default:return e.regressionLinear(i,n,o)}};function Bn(t,i){const{color:n,line:o,confidenceInterval:r,label:a}=i;return{type:"component",componentType:Fn,interactive:!1,style:{data:(o,r)=>{const a=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),s=[];return a&&a.length&&a.forEach((o=>{var r,a;const l=o.getRegion().getLayoutStartPoint(),d=o.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+d.height),h=o.getColorAttribute(),u=o.getSeriesKeys(),g=o.getViewData().latestData,p=null===(r=o.fieldX)||void 0===r?void 0:r[0],y=null===(a=o.fieldY)||void 0===a?void 0:a[0];p&&y&&g&&!(g.length<=2)&&u.forEach((e=>{var r;const a=g.filter((t=>t[null==h?void 0:h.field]===e));if(!a.length)return;const{evaluateGrid:u,confidenceInterval:m}=Tn(t,a,(t=>null==t?void 0:t[p]),(t=>null==t?void 0:t[y]),i.polynomialDegree),v=Math.max(3,Math.floor(a.length/4)),x=u(v),f=m(v);s.push({color:null!=n?n:null===(r=null==h?void 0:h.scale)||void 0===r?void 0:r.scale(e),line:x.map((e=>{const i={[p]:e.x,[y]:e.y};return{x:o.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+d.height*(1-e.y):o.dataToPositionY(i)+l.y)}})),area:f.map((t=>{const e={[p]:t.x,[y]:t.lower};return{x:o.dataToPositionX(e)+l.x,y:c(o.dataToPositionY(e)+l.y),y1:c(o.dataToPositionY({[y]:t.upper})+l.y)}}))})}))})),s},line:o,confidenceInterval:r,label:a}}}function In(t){const{color:i,line:n,confidenceInterval:o,label:r}=t;return{type:"component",componentType:Fn,interactive:!1,zIndex:500,style:{data:(n,o)=>{const r=o.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return r&&r.length&&r.forEach((n=>{var o,r,s;const l=n.getRegion().getLayoutStartPoint(),d=n.getRegion().getLayoutStartPoint(),c=n.getRegion().getLayoutRect(),h=e.clamper(d.y,d.y+c.height),u=n.getViewData().latestData,g=null===(o=n.fieldX)||void 0===o?void 0:o[0],p=null===(r=n.fieldY)||void 0===r?void 0:r[0],y="horizontal"===n.direction,m=n.getRawDataStatisticsByField(g).values;if(y||!g||!p||!u||u.length<=2||m.length<=2)return;const{evaluateGrid:v,confidenceInterval:x}=e.regressionPolynomial(u,(t=>m.indexOf(null==t?void 0:t[g])),(t=>null==t?void 0:t[p]),{degree:t.degree}),f=m.length,b=v(f),k=x(f),_=n.getXAxisHelper().getBandwidth(0)/2;a.push({color:null!=i?i:null===(s=n.getOption().globalScale.getScale("color"))||void 0===s?void 0:s.scale(n.getSeriesKeys()[0]),line:b.map((t=>{const e={[g]:m[t.x],[p]:t.y};return{x:n.dataToPositionX(e)+l.x+_,y:h(n.dataToPositionY(e)+l.y)}})),area:k.map((t=>{const e={[g]:m[t.x],[p]:t.lower};return{x:n.dataToPositionX(e)+l.x+_,y:h(n.dataToPositionY(e)+l.y),y1:h(n.dataToPositionY({[p]:t.upper})+l.y)}}))})})),a},line:n,confidenceInterval:o,label:r}}}const Dn=(t,i,n)=>{switch(t){case"kde":return e.kde(i,n);case"ecdf":return e.ecdf(i)}};function En(t,i){const{line:n,label:o,color:r}=i;return{type:"component",componentType:Fn,interactive:!1,zIndex:500,style:{data:(i,n)=>{const o=n.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return o&&o.length&&o.forEach((i=>{var n,o,s,l,d,c,h,u;const g=i.getRegion().getLayoutStartPoint(),p=i._rawData,y=null==p?void 0:p.rawData,m=null===(o=null===(n=p.transformsArr)||void 0===n?void 0:n.find((t=>"bin"===t.type)))||void 0===o?void 0:o.options,v=null===(s=i.fieldX)||void 0===s?void 0:s[0],x=i.getYAxisHelper().getScale(0),f=i.getViewData().latestData;if(!(y&&y.length&&(null==m?void 0:m.field)&&x&&f&&f.length))return;const b=y.map((t=>t[m.field])),k=Dn(t,b,"kde"===t?{bandwidth:f[0][null!==(d=null===(l=m.outputNames)||void 0===l?void 0:l.x1)&&void 0!==d?d:"x1"]-f[0][null!==(h=null===(c=m.outputNames)||void 0===c?void 0:c.x0)&&void 0!==h?h:"x0"]}:null),_=Math.max(3,Math.floor(b.length/4)),S=k.evaluateGrid(_),M=x.range(),A=M[0],w=e.last(M),C="kde"===t?t=>x.scale(t*y.length*k.bandwidth):t=>A+(w-A)*t;a.push({color:null!=r?r:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:S.map((t=>{const e={[v]:t.x};return{x:i.dataToPositionX(e)+g.x,y:C(t.y)+g.y}}))})})),a},line:n,label:o}}}const jn="ExtensionMarkSyncStatePlugin";class Pn extends e.BasePlugin{constructor(){super(jn),this.type=jn}onAfterInitChart(t,i){var n;if(!this._detectSyncState(i))return;const o=t.globalInstance.getChart();if(!o)return;const r=o.getEvent();if(this._subscribedEvent===r)return;null===(n=this._unsubscribeAfterRender)||void 0===n||n.call(this);const a=()=>this._syncStates();r.on(e.ChartEvent.afterRender,a),this._subscribedEvent=r,this._unsubscribeAfterRender=()=>{r.off(e.ChartEvent.afterRender,a),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 n=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==n?void 0:n.length)&&this._syncSeriesStates(t,n)}))}_syncSeriesStates(t,i){const n=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const o=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(o)&&n.set(String(o),t)}))})),0===n.size)return;const o=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,r)=>{const a=e.isValid(i.name)?`${i.name}`:`${o}_${r}`,s=t.getMarkInName(a);s&&s.getGraphics().forEach((t=>{var i;const o=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(o))return;const r=n.get(String(o));if(!r)return;const a=r.currentStates;(null==a?void 0:a.length)?t.useStates(a):t.clearStates()}))}))}}Pn.pluginType="chart",Pn.type=jn;t.BAR_LINK=ln,t.Bar3dChart=rt,t.Bar3dChartSpecTransformer=N,t.Bar3dSeries=et,t.Bar3dSeriesSpecTransformer=J,t.BarLinkComponent=dn,t.CandlestickChart=Dt,t.CandlestickChartSpecTransformer=_t,t.CandlestickSeries=Bt,t.CombinationCandlestickChart=Pt,t.CombinationCandlestickChart_TYPE=kt,t.ConversionFunnelChart=L,t.ConversionFunnelSeries=F,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=Pn,t.Funnel3dChart=ut,t.Funnel3dSeries=ct,t.Funnel3dSeriesSpecTransformer=st,t.Histogram3dChart=gt,t.ImageCloudChart=Ee,t.MapLabelComponent=Ln,t.PictogramChart=Me,t.PictogramChartSpecTransformer=ne,t.PictogramSeries=_e,t.Pie3dChart=bt,t.Pie3dChartSpecTransformer=pt,t.Pie3dSeries=xt,t.Pie3dSeriesSpecTransformer=vt,t.REGRESSION_LINE=Fn,t.RangeColumn3dChart=Jt,t.RangeColumn3dChartSpecTransformer=qt,t.RangeColumn3dSeries=Yt,t.RangeColumn3dSeriesSpecTransformer=Zt,t.RankingBar=a,t.RankingList=p,t.RegressionLine=On,t.SERIES_BREAK=Qi,t.SequenceScatterKDE=P,t.SequenceScatterLink=B,t.SequenceScatterPixel=V,t.SeriesBreakComponent=en,t.SeriesLabelComponent=vn,t.StorylineChart=Ji,t.StorylineChartSpecTransformer=Ki,t.TimelineChart=Ve,t.WordCloud3dChart=Wt,t.WordCloud3dChartSpecTransformer=Nt,t.WordCloud3dSeries=$t,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==ln)),t.customMark.push(hn(i))},t.appendBarRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.bar)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=y(e,["visible"]);t.customMark.push(In(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.bar)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,n=y(e,["type"]);t.customMark.push(En(i,n))}}))},t.appendScatterRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.scatter)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,n=y(e,["type"]);t.customMark.push(Bn(i,n))}}))},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!==Qi)),t.customMark.push(on(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var n,o,r;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==un)),i||(i=null!==(r=null!==(n=e.get(t,un))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o[0],un))&&void 0!==r?r:{}),i.visible){const{position:e="end"}=i,n=y(i,["position"]);t.customMark.push(mn(e,n))}},t.clearSVGSource=function(){oe.clear(),re=null},t.computeStorylineLayout=He,t.getBarLinkConfig=hn,t.getBarRegressionLineConfig=In,t.getHistogramRegressionLineConfig=En,t.getSVGSource=le,t.getScatterRegressionLineConfig=Bn,t.getSeriesBreakConfig=on,t.getSeriesLabelConfig=mn,t.normalizeLayout=We,t.normalizePadding=Ne,t.register3DPlugin=Z,t.registerAxis3dPlugin=()=>{Z(),ot(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})()},t.registerBar3dChart=()=>{Z(),ot(),it(),e.Factory.registerChart(rt.type,rt)},t.registerBar3dSeries=it,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(ln,(t=>new dn(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),It(),e.Factory.registerChart(Dt.type,Dt)},t.registerCandlestickSeries=It,t.registerCombinationCandlestickChart=()=>{It(),e.Factory.registerChart(Pt.type,Pt)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([L]),i.useSeries([F]))},t.registerEventSeries=ze,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(Pn)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),ot(),ht(),e.Factory.registerChart(ut.type,ut)},t.registerFunnel3dSeries=ht,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),ot(),it(),e.Factory.registerChart(gt.type,gt)},t.registerImageCloudChart=()=>{De(),e.Factory.registerChart(Ee.type,Ee)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([Ln])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),Se(),e.Factory.registerChart(Me.type,Me)},t.registerPictogramSeries=Se,t.registerPie3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),ot(),ft(),e.Factory.registerChart(bt.type,bt)},t.registerPie3dSeries=ft,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),ot(),Xt(),e.Factory.registerChart(Jt.type,Jt)},t.registerRangeColumn3dSeries=Xt,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([a])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([p,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(Fn,(t=>new On(t)))},t.registerSVGSource=ae,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([P,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([B,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 en(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new vn(t)))},t.registerStorylineChart=t=>{e.registerCommonChart(),e.registerCustomMark(),e.registerGroupMark(),e.registerRectMark(),e.registerTextMark(),e.registerImageMark(),e.registerLineMark(),e.registerPathMark(),e.registerArcMark();const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([Ji])},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),ze(),e.Factory.registerChart(Ve.type,Ve)},t.registerWordCloud3dChart=Ht,t.registerWordCloud3dSeries=zt,t.registerWordCloudShape3dChart=()=>{Z(),Vt(),Ht()},t.registerWordCloudShape3dSeries=Vt,t.svgSourceMap=oe,t.transformCandlestickSeriesSpec=Et,t.unregisterSVGSource=se}));
16
+ function y(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}const m={cornerRadius:4,stroke:"black",strokeOpacity:1,lineWidth:1,closePath:!1,pickable:!1},v={symbolType:"triangle",size:8,scaleX:.7,fill:"black"},x={fill:"#606773",fontSize:12},f={fill:"#eff1f9"};class b extends e.FunnelChartSpecTransformer{transformSpec(t){const{conversionArrow:e,extensionMark:i=[],funnelBackground:n}=t;if(e&&e.arrows&&e.arrows.length){const t=function(t){const{arrows:e}=t,i=y(t,["arrows"]),n=e.filter((t=>"left"===t.position)),o=k(e.filter((t=>"right"===t.position)),i),r=k(n,i),a=[];o&&(o.name="arrowRight",a.push(o));r&&(r.name="arrowLeft",a.push(r));return a}(e);t&&t.length&&i.push(...t)}if(n&&n.visible){const t=function(t){const{style:e={}}=t,i=y(t,["style"]);return Object.assign(Object.assign({type:"rect"},i),{dataIndex:0,zIndex:0,style:Object.assign(Object.assign(Object.assign({},f),e),{x:0,y:(t,e)=>e.getPoints(t)[0].y,width:(t,e)=>{const i=e.getRegion(),{width:n}=i.getLayoutRect();return n},height:(t,e)=>{const i=e.getPoints(t),n=i[0];return i[3].y-n.y}})})}(n);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 k(t,i){if(0===(null==t?void 0:t.length))return null;const{line:n,symbol:o,text:r,margin:a}=i,s=[],l={type:"group",zIndex:e.LayoutZIndex.Mark+1,children:[]},d=function(t={},e){const{style:i={}}=t,n=y(t,["style"]),o=(t,e)=>{var i,n;const{from:o,to:r}=t,{vchart:a}=e,s=null===(n=null===(i=null==a?void 0:a.getChart())||void 0===i?void 0:i.getSeriesData())||void 0===n?void 0:n.latestData;return!(r>s.length-1||o>s.length-1)};return Object.assign(Object.assign({type:"polygon",interactive:!1},n),{dataKey:t=>`${t.id}`,style:Object.assign(Object.assign(Object.assign({},m),i),{renderable:o,points:(t,i)=>{if(!o(t,i))return[];let n=t.layout.points;return n=_(t,i,e),n}})})}(n,a);d&&s.push(d);const c=function(t={},e){const{style:i={}}=t,n=y(t,["style"]);return Object.assign(Object.assign({type:"symbol",interactive:!1,dataKey:t=>`${t.id}`},n),{style:Object.assign(Object.assign(Object.assign({},v),i),{x:(t,i)=>{var n,o;let r=t.layout.points;return r=_(t,i,e),null!==(o=null===(n=r[(null==r?void 0:r.length)-1])||void 0===n?void 0:n.x)&&void 0!==o?o:NaN},y:(t,i)=>{var n,o;let r=t.layout.points;return r=_(t,i,e),null!==(o=null===(n=r[(null==r?void 0:r.length)-1])||void 0===n?void 0:n.y)&&void 0!==o?o:NaN},angle:t=>"left"===t.position?90:-90})})}(o,a);c&&s.push(c);const h=function(t={},i){const{style:n={},formatMethod:o,textMargin:r=4}=t,a=y(t,["style","formatMethod","textMargin"]);return Object.assign(Object.assign({type:"text",dataKey:t=>`${t.id}`,interactive:!1,animation:!1},a),{style:Object.assign(Object.assign(Object.assign({},x),{text:(t,i)=>{var n,r,a,s,l,d,c;const{text:h}=t;let u=h;if(e.isFunction(o)){const{vchart:e}=i,{from:g,to:p}=t,{field:y}=t.context,m=null!==(a=null===(r=null===(n=null==e?void 0:e.getChart())||void 0===n?void 0:n.getSeriesData())||void 0===r?void 0:r.latestData)&&void 0!==a?a:[],v=null!==(c=null===(d=null===(l=null===(s=null==e?void 0:e.getChart())||void 0===s?void 0:s.getAllSeries()[0])||void 0===l?void 0:l.getViewData())||void 0===d?void 0:d.latestData)&&void 0!==c?c:[],x=v.find((t=>t[y]===m[g][y])),f=v.find((t=>t[y]===m[p][y]));u=o(h,{arrow:t,from:x,to:f})}return u},x:(t,e)=>{var n,o;let a=t.layout.points;return a=_(t,e,i),null!==(o=(null===(n=a[1])||void 0===n?void 0:n.x)+("left"===t.position?-r:r))&&void 0!==o?o:NaN},y:(t,e)=>{var n,o,r;let a=t.layout.points;return a=_(t,e,i),null!==(r=((null===(n=a[1])||void 0===n?void 0:n.y)+(null===(o=a[2])||void 0===o?void 0:o.y))/2)&&void 0!==r?r:NaN},textAlign:t=>"left"===t.position?"right":"left",textBaseline:"middle"}),n)})}(r,a);return h&&s.push(h),l.children=s,l}function _(t,e,i){var n,o,r,a,s;const{vchart:l}=e,{from:d,to:c}=t,{field:h}=t.context,u=null===(o=null===(n=null==l?void 0:l.getChart())||void 0===n?void 0:n.getSeriesData())||void 0===o?void 0:o.latestData,g=null===(s=null===(a=null===(r=null==l?void 0:l.getChart())||void 0===r?void 0:r.getAllSeries()[0])||void 0===a?void 0:a.getViewData())||void 0===s?void 0:s.latestData;let p=[];if(u&&u.length){const n=g.find((t=>t[h]===u[d][h])),o=g.find((t=>t[h]===u[c][h])),r=g[0];if(n&&o&&r){p=function(t,e,i,n,o=12){const{layout:r,distance:a,position:s}=t,{level:l,fromIndex:d,toIndex:c,fromTotal:h,toTotal:u}=r,g="right"===s,p=g?e[1]:e[0],y=g?e[2]:e[3],m=Math.abs(p.y-y.y),v=g?i[1]:i[0],x=g?i[2]:i[3],f=Math.abs(v.y-x.y),b=g?n[1]:n[0],k=m/(h+1),_=f/(u+1),S=p.y+k*(d+1),M=v.y+_*(c+1),A=g?-1:1,w=[{x:p.x-o*A,y:S},{x:b.x-(o+(l+1)*a)*A,y:S},{x:b.x-(o+(l+1)*a)*A,y:M},{x:v.x-o*A,y:M}];return w}(t,e.getPoints(n),e.getPoints(o),e.getPoints(r),i),t.layout.points=p}}return p}function S(t,e){const{from:i,to:n}=t,{from:o,to:r}=e;return n>o&&r>i}function M(t,e){const{from:i,to:n}=t,{from:o,to:r}=e;return i===o&&n===r}const A=(t,i)=>{var n,o,r;if(!t||!(null===(n=t.arrows)||void 0===n?void 0:n.length))return[];const{arrows:a}=t,s=function(t,i){return t.filter((t=>e.isValidNumber(t.from*t.to))).map(((t,e)=>{const{from:n,to:o,position:r="right"}=t;return Object.assign(Object.assign({},t),{position:r,distance:t.distance||40,from:Math.min(n,o),to:Math.max(n,o),span:Math.abs(n-o),isLayout:!1,context:{field:i},layout:{level:0},id:`${n}-${o}-${r}-${e}`})}))}(a,i.categoryField),l=s.filter((t=>"left"===t.position)),d=s.filter((t=>"right"===t.position));return[...null!==(o=w(l))&&void 0!==o?o:[],...null!==(r=w(d))&&void 0!==r?r:[]]};function w(t){if(0===(null==t?void 0:t.length))return null;const i=new Map;return t.forEach((t=>{const n=i.get(t.from);if(e.isValid(n)){const e=n.fromArrows.find((e=>M(e,t)));e?t.layout.duplicateNode=e:n.degree+=1,n.fromArrows.push(t)}else i.set(t.from,{fromArrows:[t],toArrows:[],totalArrows:[],degree:1});const o=i.get(t.to);if(e.isValid(o)){const e=o.toArrows.find((e=>M(e,t)));e?t.layout.duplicateNode=e:o.degree+=1,o.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((n=>{var o;const r=t.filter((t=>t.layout.isLayout)),a=e.maxInArray(r,((t,e)=>t.layout.level-e.layout.level));let s=null!==(o=null==a?void 0:a.layout.level)&&void 0!==o?o:0;for(;s>=0;){if(r.some((t=>t.layout.level===s&&S(t,n)))){s+=1;break}--s}n.layout.level=Math.max(0,s),n.layout.fromTotal=i.get(n.from).degree,n.layout.toTotal=i.get(n.to).degree;const l=n.layout.duplicateNode;l?(n.layout.fromIndex=l.layout.fromIndex,n.layout.toIndex=l.layout.toIndex):(n.layout.fromIndex=C(n,i.get(n.from).totalArrows),n.layout.toIndex=C(n,i.get(n.to).totalArrows)),n.layout.isLayout=!0})),t}function C(t,e){let i=0,n=0;for(let o=0;o<e.length;o++){const r=e[o];if(r===t){i=o-n;break}r.layout.duplicateNode&&n++}return i}class L extends e.FunnelChart{constructor(){super(...arguments),this.type="conversionFunnel",this.transformerConstructor=b}}L.type="conversionFunnel",L.transformerConstructor=b;class F 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",A),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 O="dataKey";class T extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r;super.transformSpec(t);const a=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const n=t.data[i].nodes;e.push({data:[{id:"nodes",values:n.map(((t,e)=>Object.assign(Object.assign({},t),{[O]: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),s="neighborhood"!==t.taskType;t.type="common",t.dataKey=O,t.data=a[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:a}),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!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o: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===(r=t.infoLabel)||void 0===r?void 0:r.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:s,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 B extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterLink",this.transformerConstructor=T}init(){this.isValid()&&super.init()}isValid(){var t,e,i,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}B.type="sequenceScatterLink",B.view="singleDefault",B.transformerConstructor=T;const I=.2;function D(t){const e=Math.sqrt((2*Math.PI)**2);return Math.exp(-(t**2)/2)/e}const E="dataKey";class j extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r,a;super.transformSpec(t);const s=function(t){const e=[];return Object.keys(t.data).forEach((i=>{const n=t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[E]:e}))),o=function(t,e=100,i){const n=t.reduce(((t,e)=>{const i=e.label;return t[i]=t[i]||[],t[i].push(e),t}),{}),o=[];return Object.entries(n).forEach((([t,n])=>{const r=i||function(t){return t.length**(-1/6)}(n),a=n.map((t=>t.x)),s=n.map((t=>t.y)),l=Math.min(...a),d=Math.max(...a),c=Math.min(...s),h=Math.max(...s),u=l-(d-l)*I,g=c-(h-c)*I;for(let i=0;i<e;i++)for(let a=0;a<e;a++){const e=u+.1*i,s=g+.1*a;let l=0;for(const t of n)l+=D(Math.sqrt((e-t.x)**2+(s-t.y)**2)/r);l/=n.length*r*r,o.push({x:e,y:s,kde:l,label:t})}})),o}(n,150);e.push({data:[{id:"nodes",values:n},{id:"iter",values:[{iter:i}]},{id:"kde",values:o}]})})),e}(t);t.type="common",t.dataKey=E,t.data=s[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:s}),t.animationAppear={duration:null!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o:2e3,easing:"linear"},t.animationUpdate={duration:null!==(a=null===(r=t.player)||void 0===r?void 0:r.duration)&&void 0!==a?a:2e3,easing:"linear"}),t.axes=[{orient:"left",type:"linear",nice:!0},{orient:"bottom",type:"linear",nice:!0,label:{visible:!0}}],super.transformSpec(t)}}class P extends e.BaseChart{constructor(){super(...arguments),this.type="sequenceScatterKDE",this.transformerConstructor=j}init(){this.isValid()&&super.init()}isValid(){var t,e,i,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.call(i,"Data is required"),!1):(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Missing Required Config: `xField`, `yField` "),!1)}}P.type="sequenceScatterKDE",P.view="singleDefault",P.transformerConstructor=j;const R="dataKey";function $(t){const e=[];return Object.keys(t.data).forEach((i=>{let n=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 n=document.createElement("canvas");n.width=e.width,n.height=e.height;const o=n.getContext("2d");if(!o)throw new Error("Failed to get 2D rendering context from canvas");const r=o.createImageData(e.width,e.height);for(let e=0;e<300;e++)for(let n=0;n<300;n++){const o=(null===(i=t[e])||void 0===i?void 0:i[n])||[0,0,0],a=4*(300*e+n);r.data[a]=Math.round(255*o[0]),r.data[a+1]=Math.round(255*o[1]),r.data[a+2]=Math.round(255*o[2]),r.data[a+3]=255}return o.putImageData(r,0,0),n.toDataURL("image/png")}(t.backgroundColors[i],t);n={imageData:e}}e.push({data:[{id:"nodes",values:t.data[i].map(((t,e)=>Object.assign(Object.assign({},t),{[R]:e})))},{id:"inter",values:[{inter:i}]},{id:"background",values:n?[n]:[]}]})})),e}class z extends e.CommonChartSpecTransformer{transformSpec(t){var e,i,n,o,r;super.transformSpec(t);const a=$(t);t.type="common",t.dataKey=R,t.data=a[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:a}),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!==(o=null===(n=t.player)||void 0===n?void 0:n.duration)&&void 0!==o?o: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===(r=t.infoLabel)||void 0===r?void 0:r.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,n;const{xField:o,yField:r,data:a}=this._spec;return o&&r?!!a||(null===(n=(i=this._option).onError)||void 0===n||n.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 N 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,G,U,K;!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"}(G||(G={})),function(t){t.bar3d="bar3d",t.funnel3d="funnel3d",t.transform3d="transform3d",t.pie3d="pie3d"}(U||(U={})),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"}(K||(K={}));const Y=t=>t.zField||t.series&&t.series.some((t=>t.zField));class X extends e.BasePlugin{constructor(){super(X.type),this.type="VChart3dPlugin"}onInit(t,e){var i,n;if(this._is3d=!!(n=e)&&((t=>"bar3d"===t||"funnel3d"===t||"histogram3d"===t||"pie3d"===t||"rangeColumn3d"===t||"wordCloud3d"===t)(n.type)||Y(n),!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&&Y(e)&&(e.layout={type:"layout3d"})}}X.pluginType="chart",X.type="VChart3dPlugin";const Z=()=>{e.registerChartPlugin(X),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 Q 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=Q.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}Q.type="rect3d";const tt=()=>{e.Factory.registerMark(Q.type,Q),e.registerShadowRoot(),e.registerRect3d(),e.registerRectAnimation(),e.Factory.registerGraphicComponent("rect3d",e.createRect3d)};class et extends e.BarSeries{constructor(){super(...arguments),this.type=G.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d",this.transformerConstructor=J}}et.type=G.bar3d,et.mark=q,et.builtInTheme={bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}}},et.transformerConstructor=J;const it=()=>{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)}))),tt(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(et.type,et)};class nt extends e.Layout{layoutItems(t,i,n,o){this._layoutInit(t,i,n,o);const r={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(i,r);const a={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},s=i.filter((t=>"absolute"===t.layoutType)),l=s.filter((t=>"z"===t.layoutOrient));let d={width:0,height:0};if(l.length){d=l[0].getLayoutRect()}this.leftCurrent+=d.width/8,this.rightCurrent-=d.width/8,this.topCurrent+=d.height/8,this.bottomCurrent-=d.height/8;const{regionItems:c,relativeItems:h,relativeOverlapItems:u,allRelatives:g,overlapItems:p}=this._groupItems(i);this.layoutRegionItems(c,h,u,p,r),this._processAutoIndent(c,h,u,p,g,a,r);const y=s.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(y);const m=h.filter((t=>"axes"===t.model.specKey&&e.isXAxis(t.layoutOrient)))[0],v=h.filter((t=>"axes"===t.model.specKey&&e.isYAxis(t.layoutOrient)))[0];if(m&&l.length){const t=m.getLayoutStartPoint(),e=m.getLayoutRect(),i={x:"left"===v.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};l[0].model.directionStr="left"===v.layoutOrient?"r2l":"l2r";const n=m.getLayoutRect(),o=v.getLayoutRect(),r={length:l[0].getLayoutRect().width,width:n.width,height:o.height};m.model.setLayout3dBox&&m.model.setLayout3dBox(r),v.model.setLayout3dBox&&v.model.setLayout3dBox(r),l[0].model.setLayout3dBox&&l[0].model.setLayout3dBox(r),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,n=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const o="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();o?(e.top=Math.max(e.top,r.y1-this.topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this.leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}nt.type="layout3d";const ot=()=>{e.Factory.registerLayout(nt.type,nt)};class rt extends e.BarChart{constructor(){super(...arguments),this.transformerConstructor=N,this.type="bar3d",this.seriesType=G.bar3d}}rt.type="bar3d",rt.seriesType=G.bar3d,rt.transformerConstructor=N;const at=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 st extends e.FunnelSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class lt extends e.BasePolygonMark{_getDefaultStyle(){const t=super._getDefaultStyle();return t.stroke=!1,t}constructor(t,e){super(t,e),this.type=lt.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}lt.type="pyramid3d";const dt=e.getFunnelTheme(!0);class ct extends e.FunnelSeries{constructor(){super(...arguments),this.type=G.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=st}initMark(){var t,e,i,n,o,r,a,s;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ct.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({},ct.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===(n=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===n?void 0:n.visible){const{line:t}=null!==(o=this._spec.outerLabel)&&void 0!==o?o:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ct.mark.outerLabel,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ct.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,n;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===(n=this._funnelOuterLabelMark)||void 0===n||n.line}}ct.type=G.funnel3d,ct.mark=at,ct.builtInTheme={funnel3d:dt},ct.transformerConstructor=st;const ht=()=>{e.Factory.registerMark(lt.type,lt),e.registerShadowRoot(),e.registerPyramid3d(),e.registerPolygonAnimation(),e.Factory.registerGraphicComponent("pyramid3d",e.createPyramid3d),e.registerTextMark(),e.registerRuleMark(),e.Factory.registerSeries(ct.type,ct)};class ut extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=e.FunnelChartSpecTransformer,this.type="funnel3d",this.seriesType=G.funnel3d}}ut.type="funnel3d",ut.seriesType=G.funnel3d,ut.transformerConstructor=e.FunnelChartSpecTransformer;class gt extends e.BaseHistogramChart{constructor(){super(...arguments),this.transformerConstructor=e.HistogramChartSpecTransformer,this.type="histogram3d",this.seriesType=G.bar3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}gt.type="histogram3d",gt.seriesType=G.bar3d,gt.transformerConstructor=e.HistogramChartSpecTransformer;class pt extends e.BasePieChartSpecTransformer{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class yt extends e.BaseArcMark{setDataLabelType(){return"arc"}constructor(t,e){super(t,e),this.type=yt.type,this._markConfig.support3d=!0}setMarkConfig(t){super.setMarkConfig(t),this._markConfig.support3d=!0}}yt.type="arc3d";const mt=Object.assign(Object.assign({},e.baseSeriesMark),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class vt extends e.PieSeriesSpecTransformer{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class xt extends e.BasePieSeries{constructor(){super(...arguments),this.type=G.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=vt}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))}}xt.type=G.pie3d,xt.mark=mt,xt.builtInTheme={pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}}},xt.transformerConstructor=vt;const ft=()=>{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(),e.registerArc3d(),e.Factory.registerGraphicComponent("arc3d",e.createArc3d),e.Factory.registerMark("arc3d",yt),e.Factory.registerSeries(xt.type,xt)};class bt extends e.BasePieChart{constructor(){super(...arguments),this.transformerConstructor=pt,this.type="pie3d",this.seriesType=G.pie3d}}bt.type="pie3d",bt.seriesType=G.pie3d,bt.transformerConstructor=pt;const kt="combinationCandlestick";class _t 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 St extends e.GlyphMark{constructor(){super(...arguments),this.type=St.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:n=i.attribute.x,boxWidth:o=i.attribute.boxWidth,open:r=i.attribute.open,close:a=i.attribute.close,low:s=i.attribute.low,high:l=i.attribute.high}=t,d={};return d.line={points:[{x:n,y:s},{x:n,y:l}]},d.box={x:n-o/2,x1:n+o/2,y:Math.min(r,a),y1:Math.max(r,a),drawStrokeWhenZeroWH:!0},d}}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}}St.type="candlestick";class Mt extends e.ACustomAnimate{constructor(t,e,i,n,o){super(t,e,i,n,o)}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(){return(t=>{const i=t.getFinalAttribute(),{x:n,y:o,open:r,high:a,low:s,close:l}=i,d={from:{x:n,y:o},to:{x:n,y:o}};return e.isValidNumber(r)&&e.isValidNumber(l)&&(r>l?(d.from.open=s,d.to.open=r,d.from.close=s,d.to.close=l,e.isValidNumber(a)&&(d.from.high=s,d.to.high=a)):(d.from.open=a,d.to.open=r,d.from.close=a,d.to.close=l,e.isValidNumber(s)&&(d.from.low=a,d.to.low=s))),d})(this.target,this.params,this.params.options)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(n)}}class At extends e.ACustomAnimate{constructor(t,e,i,n,o){super(t,e,i,n,o)}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(){return(t=>{const i=t.getFinalAttribute(),{x:n,y:o,open:r,high:a,low:s,close:l}=i,d={from:{x:n,y:o},to:{x:n,y:o}};return e.isValidNumber(r)&&e.isValidNumber(l)&&(r>l?(d.from.open=r,d.to.open=s,d.from.close=l,d.to.close=s,e.isValidNumber(a)&&(d.from.high=a,d.to.high=s)):(d.from.open=r,d.to.open=a,d.from.close=l,d.to.close=a,e.isValidNumber(s)&&(d.from.low=s,d.to.low=a))),d})(this.target,this.params,this.params.options)}onUpdate(t,e,i){const n=this.target.attribute;this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(n)}}const wt="candlestick";var Ct,Lt;!function(t){t.OPEN="open",t.HIGH="high",t.LOW="low",t.CLOSE="close",t.SERIES_FIELD="seriesField"}(Ct||(Ct={})),function(t){t.candlestick="candlestick"}(Lt||(Lt={}));const Ft=Object.assign(Object.assign({},e.baseSeriesMark),{candlestick:{name:"candlestick",type:"candlestick"}});class Ot extends e.BaseSeriesTooltipHelper{constructor(){super(...arguments),this.getContentKey=t=>e=>{switch(t){case Ct.OPEN:return this.series.getOpenField();case Ct.HIGH:return this.series.getHighField();case Ct.LOW:return this.series.getLowField();case Ct.CLOSE:return this.series.getCloseField();case Ct.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{switch(t){case Ct.OPEN:return e[this.series.getOpenField()];case Ct.HIGH:return e[this.series.getHighField()];case Ct.LOW:return e[this.series.getLowField()];case Ct.CLOSE:return e[this.series.getCloseField()];case Ct.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(Ct.OPEN),value:this.getContentValue(Ct.OPEN)},{key:this.getContentKey(Ct.HIGH),value:this.getContentValue(Ct.HIGH)},{key:this.getContentKey(Ct.LOW),value:this.getContentValue(Ct.LOW)},{key:this.getContentKey(Ct.CLOSE),value:this.getContentValue(Ct.CLOSE)},{key:this.getContentKey(Ct.SERIES_FIELD),value:this.getContentValue(Ct.SERIES_FIELD)}]}}const Tt={rising:{style:{boxFill:"#FF0000",stroke:"#FF0000"}},falling:{style:{boxFill:"#00AA00",stroke:"#00AA00"}},doji:{style:{boxFill:"#000000",stroke:"#000000"}},candlestick:{style:{lineWidth:1}}};class Bt extends e.CartesianSeries{constructor(){super(...arguments),this.type=wt,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,n,o,r,a,s;super.setAttrFromSpec();const l=this._spec,d=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=d.boxWidth,this._boxFill=d.boxFill,this._strokeColor=d.strokeColor,this._buildMergedStyles(d,null!==(n=null===(i=l.rising)||void 0===i?void 0:i.style)&&void 0!==n?n:{},null!==(r=null===(o=l.falling)||void 0===o?void 0:o.style)&&void 0!==r?r:{},null!==(s=null===(a=l.doji)||void 0===a?void 0:a.style)&&void 0!==s?s:{})}initMark(){this._candlestickMark=this._createMark(Bt.mark.candlestick,{groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t;const i=this._candlestickMark;if(i){const n={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,n,e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series)}}initCandlestickMarkStyle(){var t;const i=this._candlestickMark,n=this._yAxisHelper;if(i&&n){const{dataToPosition:o}=n,r=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{open:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._openField),{bandPosition:this._bandPosition}),r),high:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._highField),{bandPosition:this._bandPosition}),r),low:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._lowField),{bandPosition:this._bandPosition}),r),close:t=>e.valueInScaleRange(o(this.getDatumPositionValues(t,this._closeField),{bandPosition:this._bandPosition}),r)},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 n=this._initAnimationSpec(null===(t=e.Factory.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),o=this._initAnimationSpec(e.userAnimationConfig(wt,this._spec,this._markAttributeContext));this._candlestickMark.setAnimationConfig(e.animationConfig(n,o,i))}}initTooltip(){this._tooltipHelper=new Ot(this),this._candlestickMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark)}_buildMergedStyles(t,i,n,o){this._mergedStyles.rising=e.merge({},t,i),this._mergedStyles.falling=e.merge({},t,n),this._mergedStyles.doji=e.merge({},t,o)}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]}}Bt.type=wt,Bt.builtInTheme={candlestick:Tt},Bt.mark=Ft;const It=()=>{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(St.type,St),e.registerSymbolMark(),e.registerScaleInOutAnimation(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn",Mt),e.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut",At),e.Factory.registerSeries(Bt.type,Bt)};class Dt extends e.BaseChart{_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Dt.type="candlestick",Dt.seriesType=wt,Dt.transformerConstructor=_t;function Et(t){t.yField=[t.openField,t.highField,t.lowField,t.closeField]}class jt 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 n=t;n.region=[null!==(e=t.candlestickRegion)&&void 0!==e?e:{}],t.previewSeries&&n.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 n=t.series.find((e=>e.id===t.candlestickSeries.id));let o;n?(e.merge(n,t.candlestickSeries),o=n):(t.series.push(t.candlestickSeries),o=t.candlestickSeries),Et(o),this._transformSeriesData(t,o),o.regionIndex=0,t.previewSeries&&e.array(t.previewSeries).forEach((i=>{const n=t.series.find((t=>t.id===i.id));let o;n?(e.merge(n,i),o=n):(t.series.push(i),o=i),o.regionIndex=1,this._transformSeriesData(t,o)}))}_transformSeriesData(t,i){var n;i.data&&(t.data=e.array(null!==(n=t.data)&&void 0!==n?n:[]),e.array(i.data).forEach(((e,n)=>{t.data.push(e),0===n&&(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,n;const o={type:"grid",col:2,row:6,elements:[],colWidth:[],rowHeight:[]};let r=0,a=0;if(t.title&&!1!==(null===(i=t.title)||void 0===i?void 0:i.visible)&&r++,t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&("top"===i.orient||"bottom"===i.orient?r++:a++)}if(t.dataZoom&&e.array(t.dataZoom).forEach((t=>{!1!==(null==t?void 0:t.visible)&&("top"===t.orient||"bottom"===t.orient?r++:a++)})),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?r++:a++)}))}r++,a++,t.previewSeries&&r++,o.row=r,o.col=a;const s={top:0,bottom:0,left:0,right:0};if(t.title&&!1!==(null===(n=t.title)||void 0===n?void 0:n.visible)&&this._layoutOrientItem(o,t.title,s,{specKey:"title",index:0},"total"),t.legends){const i=e.array(t.legends)[0];!1!==(null==i?void 0:i.visible)&&this._layoutOrientItem(o,i,s,{specKey:"legends",index:0},"less")}if(t.dataZoom&&e.array(t.dataZoom).forEach(((t,e)=>{!1!==(null==t?void 0:t.visible)&&this._layoutOrientItem(o,t,s,{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(o,t,s,{specKey:"axes",index:i},"one"))}))}const l=this._layoutOrientItem(o,{orient:"top"},s,{specKey:"region",index:0},"one");if(t.previewSeries){const i=this._layoutOrientItem(o,{orient:"bottom"},s,{specKey:"region",index:1},"one"),n=t.axes.findIndex((e=>e===t.previewAxes));if(-1!==n){const t={col:i.col-1,row:i.row,modelKey:"axes",modelIndex:n};o.elements.push(t)}if(t.previewHeight)if("string"==typeof t.previewHeight){if(e.isPercent(t.previewHeight)){const e=t.previewHeight;o.rowHeight.push({index:i.row,size:t=>Number(e.substring(0,e.length-1))*t/100})}}else o.rowHeight.push({index:i.row,size:t.previewHeight})}const d=t.axes.findIndex((t=>"bottom"===t.orient));this._layoutOrientItem(o,t.axes[d],s,{specKey:"axes",index:d},"one"),t.axes.forEach(((e,i)=>{if(e===t.previewAxes)return;const n=o.elements.find((t=>"modelKey"in t&&"axes"===t.modelKey&&t.modelIndex===i));n&&("top"===e.orient||"bottom"===e.orient?n.col=l.col:n.row=l.row)})),e.array(t.dataZoom).forEach(((t,e)=>{const i=o.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=o}_layoutOrientItem(t,e,i,n,o){var r;const a={modelKey:n.specKey,modelIndex:n.index,col:0,row:0},s=null!==(r=e.orient)&&void 0!==r?r:"top",{span:l,index:d}=this._getLayoutElementCommon(t,i,o,s);return t.elements.push(a),"top"===s?(a.row=i.top,a.rowSpan=1,a.colSpan=l,a.col=d,i.top++):"bottom"===s?(a.row=t.row-i.bottom-1,a.rowSpan=1,a.colSpan=l,a.col=d,i.bottom++):"left"===s?(a.col=i.left,a.colSpan=1,a.rowSpan=l,a.row=d,i.left++):"right"===s&&(a.col=t.col-i.right-1,a.colSpan=1,a.rowSpan=l,a.row=d,i.right++),a}_getLayoutElementCommon(t,e,i,n){return"top"===n||"bottom"===n?{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 Pt extends e.BaseChart{constructor(){super(...arguments),this.type=kt,this.transformerConstructor=jt}_setModelOption(){this._modelOption.getDimensionInfo=(t,i,n)=>{var o;return[...null!==(o=e.getCartesianDimensionInfo(t,i,n))&&void 0!==o?o:[]]},this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Pt.type=kt,Pt.transformerConstructor=jt,e.mixin(Pt,e.StackChartMixin);const Rt=t=>({custom:e.RotateBySphereAnimate,customParameters:()=>t,easing:"linear",loop:1/0,duration:6e3});class $t extends e.BaseWordCloudSeries{constructor(){super(...arguments),this.type=G.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 n=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-n.left||0-n.right||0,o=e.height-n.top||0-n.bottom||0,r=Math.max(i,o)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),e.userAnimationConfig("word",this._spec,this._markAttributeContext)))}}$t.type=G.wordCloud3d,$t.builtInTheme={wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}}};const zt=()=>{e.registerTextMark(),e.Factory.registerAnimation("wordCloud3d",(t=>({appear:Rt(t)}))),e.Factory.registerSeries($t.type,$t)},Vt=()=>{zt()};class Nt extends e.BaseWordCloudChartSpecTransformer{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.depth_3d=t.depth_3d,e}}class Wt extends e.BaseWordCloudChart{constructor(){super(...arguments),this.transformerConstructor=Nt,this.type="wordCloud3d",this.seriesType=G.wordCloud3d}}Wt.type="wordCloud3d",Wt.seriesType=G.wordCloud3d,Wt.transformerConstructor=Nt;const Ht=()=>{Z(),zt(),e.Factory.registerChart(Wt.type,Wt)},Gt={label:{space:0}};class Ut{setLayout3dBox(t){this.layout3dBox=t}_afterUpdateAttribute(t,i){const n=e.isZAxis(this._orient),o=e.isXAxis(this._orient),r=e.isYAxis(this._orient);let a=0,s=0;if(!i){const t=this.getRegions();let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,o=i+t[0].getLayoutRect().height;for(let r=1;r<t.length;r++){const a=t[r],{x:s,y:l}=a.getLayoutStartPoint(),{width:d,height:c}=a.getLayoutRect();e=Math.min(e,s),n=Math.max(n,d+s),i=Math.min(i,l),o=Math.max(o,c+l)}a=Math.abs(o-i),s=Math.abs(n-e)}let l=0,d=0;const{width:c,height:h}=this.getLayoutRect();let u={x:0,y:0};o?(u={x:c,y:0},l=a,d=c):r&&(u={x:0,y:h},l=s,d=h);const g=this.layout3dBox?this.layout3dBox.length:0;if(!n){const e=this.getLabelItems(d);return t.grid={length:l},t.start={x:0,y:0},t.text=this._spec.title.text||this._dataFieldText,t.maxWidth=this._getTitleLimit(o),t.items=e,t.grid={type:"line",start:{x:0,y:0},end:u,items:e[0],depth:g,length:l},t}return((t,i)=>{var n;const o=e.getCombinedSizeOfRegions(t.getRegions()),{width:r}=t.getLayoutRect(),a=r,s=t.layout3dBox?t.layout3dBox.length:0,l=t.layout3dBox?t.layout3dBox.width:0,d={x:s,y:0},c=t.getLabelItems(a),h={start:{x:0,y:0},end:d,title:{text:t._spec.title.text||t._dataFieldText,maxWidth:t._getTitleLimit(!1)},items:c,scale:t._scale.clone()},u=null!==(n=t.directionStr)&&void 0!==n?n:"r2l";let g=[0,0],p=-Math.PI/2,y=0;return"l2r"===u&&(y=t.layout3dBox.length,g=[0,0,0],p=Math.PI/2),h.z=y,h.alpha=p,h.anchor3d=g,i||(h.grid={type:"line",start:{x:0,y:0},end:d,items:c[0],verticalFactor:t._axisStyle.verticalFactor,depth:l,length:i?0:o.height,alpha:p,z:y,anchor3d:g}),h})(this,i)}}const Kt=Object.assign(Object.assign({},q),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Yt extends e.RangeColumnSeries{constructor(){super(...arguments),this.type=G.rangeColumn3d,this._barMarkType="rect3d",this._barName=G.bar3d}}Yt.type=G.rangeColumn3d,Yt.mark=Kt;const Xt=()=>{tt(),e.registerCartesianBandAxis(),e.registerCartesianLinearAxis(),e.Factory.registerSeries(Yt.type,Yt)};class Zt extends e.RangeColumnSeriesSpecTransformer{_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar3d")}}class qt extends e.CartesianChartSpecTransformer{_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t,["bar3d","barGapInGroup"]);return"horizontal"===t.direction?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}class Jt extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=qt,this.type="rangeColumn3d",this.seriesType=G.rangeColumn3d}_setModelOption(){this._modelOption.getDimensionInfo=e.getCartesianDimensionInfo,this._modelOption.getDimensionInfoByValue=e.getDimensionInfoByValue,this._modelOption.getRectByDimensionData=e.getCartesianCrosshairRect}}Jt.type="rangeColumn3d",Jt.seriesType=G.rangeColumn3d,Jt.transformerConstructor=qt;const Qt="pictogram",te="pictogram";var ee;!function(t){t.pictogram="pictogram"}(ee||(ee={}));const ie=Object.assign(Object.assign({},e.baseSeriesMark),{pictogram:{name:"pictogram",type:"group"}});class ne extends e.BaseChartSpecTransformer{_isValidSeries(t){return t===te}_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 oe=new Map;let re;function ae(t,i){oe.has(t)&&e.warn(`svg source key of '${t}' already exists, will be overwritten.`),re||(re=new e.DataSet,e.registerDataSetInstanceParser(re,"svg",e.svgParser));const n=new e.DataView(re);n.parse(i,{type:"svg"}),oe.set(t,n)}function se(t){oe.has(t)?oe.delete(t):e.warn(`map type of '${t}' does not exists.`)}function le(t){return oe.get(t)}class de extends e.BaseSeriesSpecTransformer{_getDefaultSpecFromChart(t){var i,n,o;const r=null!==(i=super._getDefaultSpecFromChart(t))&&void 0!==i?i:{},a=t.svg,s=null===(o=null===(n=oe.get(a))||void 0===n?void 0:n.latestData)||void 0===o?void 0:o.elements;if(s&&s.length){s.map((t=>t.name)).filter((t=>e.isValid(t))).forEach((e=>{t[e]&&(r[e]=t[e])}))}return r}}class ce 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 he="element-highlight-by-graphic-name";class ue extends e.ElementHighlight{constructor(){super(...arguments),this.type=he,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:n,blurState:o}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{e.name===t&&a.push(e)}))})),i.updateStates(this,a,r,n,o),i.setStatedGraphics(this,a)}reset(){const{highlightState:t,blurState:e,interaction:i}=this.options;i.clearAllStatesOfTrigger(this,t,e),i.setStatedGraphics(this,[])}}ue.type=he;const ge="element-select-by-graphic-name";class pe extends e.ElementSelect{constructor(){super(...arguments),this.type=ge}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)}))}))}}pe.type=ge;function ye(t){var i;return e.isValid(t)&&"none"!==t&&!(null===(i=t.includes)||void 0===i?void 0:i.call(t,"url"))}const me=t=>{const e=parseFloat(t.strokeWidth);if(!isNaN(e))return e;const i=t.stroke;return i&&ye(i)?1:0},ve=(t,e)=>{var i;const n=null!==(i=t.fill)&&void 0!==i?i:e;return n&&ye(n)?n:void 0},xe=(t,e)=>{var i;const n=null!==(i=t.stroke)&&void 0!==i?i:e;return!(!n||!ye(n))&&n},fe=t=>Object.assign(Object.assign({},t),{x:parseFloat(t.x)||void 0,y:parseFloat(t.y)||void 0,fillStrokeOrder:!1,fill:ve(t),lineWidth:me(t),stroke:xe(t)}),be={group:t=>{const e=fe(t);return Object.assign(Object.assign({},e),{visibleAll:!1!==e.visible})},rule:t=>Object.assign(Object.assign({},fe(t)),{x:parseFloat(t.x1),y:parseFloat(t.y1),x1:parseFloat(t.x2),y1:parseFloat(t.y2)}),rect:t=>Object.assign(Object.assign({},fe(t)),{fill:ve(t,"#000"),width:parseFloat(t.width),height:parseFloat(t.height)}),polygon:t=>Object.assign(Object.assign({},fe(t)),{fill:ve(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({},fe(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({},fe(t)),{path:t.d,fillStrokeOrder:!1,fill:ve(t,"#000")}),arc:t=>{var e;return Object.assign(Object.assign({},fe(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:ve(t,"#000")})},text:(t,e)=>{var i,n;return Object.assign(Object.assign({},fe(t)),{text:e,textAlign:null!==(i=t.textAlign)&&void 0!==i?i:"left",textBaseLine:null!==(n=t.textAnchor)&&void 0!==n?n:"middle",anchor:[0,0],fill:ve(t,"#000")})}},ke=t=>{var i,n;if(!t||!t[0])return{};const{elements:o}=t[0].latestData;if(o&&o.length){o.forEach(((t,i)=>{var n;t[e.DEFAULT_DATA_INDEX]=i,t._uniqueId=`${t.id}-${i}`,t.data=void 0;const{graphicType:o,transform:r}=t,a={visible:"hidden"!==t.attributes.visibility&&"collapse"!==t.attributes.visibility};"text"===t.graphicType?e.merge(a,t._inheritStyle,null===(n=t.parent)||void 0===n?void 0:n._textGroupStyle,t.attributes):"group"!==t.graphicType&&e.merge(a,t._inheritStyle,t.attributes),be[o]?t._finalAttributes=be[o](a,t.value):t._finalAttributes=a,r&&(t._finalAttributes.postMatrix=Object.assign({},r))}));const t=o.filter((t=>"text"===t.tagName));for(let r=0;r<t.length;r++){const a=t[r]._uniqueId,s=o.filter((t=>{let e=!1,i=t.parent;for(;i;){if(i._uniqueId===a){e=!0;break}i=i.parent}return e}));if(s&&s.length){const o=null!==(n=null===(i=t[r]._textGroupStyle)||void 0===i?void 0:i.x)&&void 0!==n?n:0;let a=o;for(let t=0;t<s.length;t++){const i=s[t];if("group"===i.graphicType)a=o;else if(i.value&&void 0===i.parent._textGroupStyle.x){const n=s.slice(0,t).reverse().find((t=>"text"===t.graphicType&&t.value));if(n){a+=e.measureText(n.value,n._finalAttributes).width}i._finalAttributes.x=a}}}}}return o};class _e extends e.GeoSeries{constructor(){super(...arguments),this.type=te,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=le(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,n=e.isValid(t.triggerOff)?t.triggerOff:i?["empty","self"]:["empty",t.trigger];return{type:"element-select-by-graphic-name",trigger:t.trigger,triggerOff:n,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(_e.mark.pictogram,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0},{morph:e.shouldMarkDoMorph(this._spec,_e.mark.pictogram.name)}),this._pictogramMark){this._pictogramMark.setData(this._mapViewData),this._pictogramMark.setUserId(_e.mark.pictogram.name);for(const i of this._mapViewData.getDataView().latestData){const{graphicType:n,name:o,parent:r,id:a,_nameFromParent:s,_uniqueId:l}=i,d=this._createMark({type:n,name:null!=o?o:s},{groupKey:l,isSeriesMark:!1,skipBeforeLayouted:!0,parent:null!==(t=this._idToMark.get(null==r?void 0:r._uniqueId))&&void 0!==t?t:this._pictogramMark},{morph:e.shouldMarkDoMorph(this._spec,_e.mark.pictogram.name)});d&&(d.setData(this._mapViewData),d.setUserId(l),this._idToMark.set(l,d),"group"!==d.type&&d.setMarkConfig({graphicName:d.name}),d.setTransform([{type:"filter",callback:t=>t._uniqueId===l}]))}this._initLabelMark()}}_initLabelMark(){if(!0!==this._spec.label.visible)return;const t=this._createMark(_e.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,viewBoxRect:i}=this._parsedSvgResult,n=this._mapViewData.getDataView().latestData;t&&(this.setMarkStyle(this._pictogramMark,be.group(t.attributes),"normal",e.AttributeLevel.Built_In),t.transform&&this.setMarkStyle(this._pictogramMark,{postMatrix:()=>t.transform},"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 n){const{_uniqueId:i,_finalAttributes:n}=t,o=this._idToMark.get(i),r=this._validElement(t);o&&(this.setMarkStyle(o,{keepStrokeScale:!0},"normal",e.AttributeLevel.Built_In),r?(this.initMarkStyleWithSpec(o,e.merge({},this._spec.pictogram,this._spec[o.name])),this.setMarkStyle(o,n,"normal",e.AttributeLevel.Series),o.setPostProcess("fill",((t,i)=>e.isValid(t)?t:this._spec.defaultFillColor))):(o.setMarkConfig({interactive:!1}),this.setMarkStyle(o,n,"normal",e.AttributeLevel.Built_In)))}this.initLabelMarkStyle()}_validElement(t){return t.name||t._nameFromParent}initTooltip(){this._tooltipHelper=new ce(this),this.getMarksWithoutRoot().forEach((t=>{t&&t.name&&this._tooltipHelper.activeTriggerSet.mark.add(t)}))}dataToPosition(t,i=!1){if(!t)return null;const n=t[this.nameField];if(!n)return null;const o=this.getMarksWithoutRoot().filter((t=>t.name===n));if(!o||0===o.length)return null;let r=new e.Bounds;i?o.forEach((t=>{r=r.union(t.getGraphics()[0].globalAABBBounds)})):o.forEach((t=>{r=r.union(t.getProduct().AABBBounds)}));const a={x:(r.x1+r.x2)/2,y:(r.y1+r.y2)/2};if(i){const{x:t,y:e}=this.getLayoutStartPoint();a.x-=t,a.y-=e}return a}coordToPosition(t){if(!t)return null;const{x:e,y:i}=t,n=this.getRootMatrix();if(!n)return null;const o={};return n.getInverse().transformPoint({x:e,y:i},o),o}getRootMatrix(){var t;return null===(t=this.getPictogramRootGraphic())||void 0===t?void 0:t.transMatrix}getPictogramRootGraphic(){return this._pictogramMark.getProduct()}initData(){var t,i;super.initData();const n=oe.get(this.svg);n||null===(t=this._option)||void 0===t||t.onError("no valid svg found!");const o=new e.DataView(this._dataSet,{name:`pictogram_${this.id}_data`});e.registerDataSetInstanceTransform(this._dataSet,"pictogram",ke),e.registerDataSetInstanceTransform(this._dataSet,"lookup",e.lookup),o.parse([n],{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",o.reRunAllTransform),this._mapViewData=new e.CompilableData(this._option,o)}mapViewDataUpdate(){this._mapViewData.updateData()}onLayoutEnd(){var t;super.onLayoutEnd(),null===(t=this._mapViewData)||void 0===t||t.getDataView().reRunAllTransform()}updateSVGSize(){const{width:t,height:e}=this.getLayoutRect(),i=t/2,n=e/2,o=this.getPictogramRootGraphic();if(o){const r=o.AABBBounds,{x1:a,x2:s,y1:l,y2:d}=o.AABBBounds,c=(a+s)/2,h=(l+d)/2,u=t/r.width(),g=e/r.height(),p=Math.min(u,g);o.scale(p,p,{x:c,y:h}),o.translate(i-c,n-h)}}initEvent(){var t;super.initEvent(),null===(t=this._mapViewData.getDataView())||void 0===t||t.target.addListener("change",this.mapViewDataUpdate.bind(this)),this.event.on(e.ChartEvent.afterMarkLayoutEnd,this.updateSVGSize.bind(this))}handleZoom(t){const{scale:i,scaleCenter:n}=t;if(1===i)return;const o=this.getPictogramRootGraphic();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new e.Matrix}),o.scale(i,i,n))}handlePan(t){const{delta:i}=t;if(0===i[0]&&0===i[1])return;const n=this.getPictogramRootGraphic();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new e.Matrix}),n.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}}_e.type=te,_e.mark=ie,_e.transformerConstructor=de;const Se=()=>{e.Factory.registerSeries(_e.type,_e),e.Factory.registerImplement("registerSVG",ae),e.Factory.registerImplement("unregisterSVG",se),e.Factory.registerInteractionTrigger(ue.type,ue),e.Factory.registerInteractionTrigger(pe.type,pe)};class Me extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=ne,this.type=Qt,this.seriesType=te}}Me.type=te,Me.seriesType=Qt,Me.transformerConstructor=ne;class Ae 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 we="imageCloud",Ce="imageCloud";var Le;!function(t){t.image="image",t.imageMask="imageMask"}(Le||(Le={}));const Fe=Object.assign(Object.assign({},e.baseSeriesMark),{image:{name:"image",type:"image"},imageMask:{name:"imageMask",type:"rect"}});class Oe extends e.ACustomAnimate{constructor(t,e,i,n,o){var r;super(t,e,i,n,o),this._rotations=null!==(r=null==o?void 0:o.rotation)&&void 0!==r?r:1}onBind(){this._scaleX=this.target.attribute.scaleX,e.isValidNumber(this._rotations)||(this.valid=!1)}onUpdate(t,e,i){var n;if(!1===this.valid)return;if(t)return void(i.scaleX=this._scaleX);const o=360*this._rotations*e*Math.PI/180,r=Math.abs(Math.cos(o))*(null!==(n=this._scaleX)&&void 0!==n?n:1);this.target.attribute.scaleX=r,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}function Te(t,i){switch(i){case"axialRotate":return[{custom:Oe,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 Be 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:n}=this._seriesCacheInfo,o=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(n[0]&&o)return null!==(i=o[n[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&n)return n[i[0]]}}get defaultShapeType(){return"square"}}class Ie extends e.BaseSeries{constructor(){super(...arguments),this.type=Ce}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(Fe.imageMask,{dataView:!1,skipBeforeLayouted:!0})),this._imageMark=this._createMark(Fe.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 Be(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,n;if(t){const o=null===(n=null===(i=this._spec)||void 0===i?void 0:i.animationAppear)||void 0===n?void 0:n.preset,r={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")(r,o),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""}}Ie.type=Ce,Ie.mark=Fe;const De=()=>{e.registerImageMark(),e.Factory.registerAnimation("imageCloud",((t,e)=>({appear:Te(t,e),enter:Te(t,e),exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),e.Factory.registerSeries(Ie.type,Ie),e.Factory.registerGrammarTransform("imagecloud",{transform:e.imagecloudTransform})};class Ee extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=Ee.transformerConstructor,this.type=we,this.seriesType=Ce}}Ee.type=we,Ee.seriesType=Ce,Ee.transformerConstructor=Ae;class je 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((n=>{const{orient:o}=n;let r=null;"top"!==o&&"bottom"!==o||(e.x=!0,r=this._setDefaultXAxisSpec(t)),"left"!==o&&"right"!==o||(e.y=!0,r=this._setDefaultYAxisSpec(t)),r&&Object.keys(r).forEach((t=>{n[t]=i.isObject(n[t])?i.merge(r[t],n[t]):i.isNil(n[t])?r[t]:n[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 n=null!==(e=t.direction)&&void 0!==e?e:"horizontal";null===(i=t.series)||void 0===i||i.forEach((t=>{"vertical"===n?(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 Pe="event",Re=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 $e extends e.CartesianSeries{constructor(){super(...arguments),this.type=Pe,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($e.mark.line,{isSeriesMark:!0,groupKey:this._seriesField}),this._arrowMark=this._createMark($e.mark.arrow,{isSeriesMark:!0}),this._dotMark=this._createMark($e.mark.dot,{isSeriesMark:!0}),this._iconMark=this._createMark($e.mark.icon,{isSeriesMark:!0}),this._titleMark=this._createMark($e.mark.title),this._subTitleMark=this._createMark($e.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,n,o,r,a,s,l,d,c,h,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 g=this._spec.dot,p="number"==typeof(null===(t=null==g?void 0:g.style)||void 0===t?void 0:t.size)?g.style.size:8,y=this._spec.title,m=null!==(n=null==y?void 0:y.style)&&void 0!==n?n:{},v=this._spec.subTitle,x=null!==(o=null==v?void 0:v.style)&&void 0!==o?o:{},f="number"==typeof m.fontSize?m.fontSize:14,b=p/2+(null!==(r=null==y?void 0:y.offset)&&void 0!==r?r:6);this._dotMark&&this.setMarkStyle(this._dotMark,{x:t=>this._getPoint(t).x,y:t=>this._getPoint(t).y,size:p,fill:null!==(s=null===(a=null==g?void 0:g.style)||void 0===a?void 0:a.fill)&&void 0!==s?s:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._arrowMark&&this.setMarkStyle(this._arrowMark,{path:t=>this._getArrowPath(t),fill:null!==(d=null===(l=null==g?void 0:g.style)||void 0===l?void 0:l.fill)&&void 0!==d?d:this.getColorAttribute()},e.STATE_VALUE_ENUM.STATE_NORMAL,e.AttributeLevel.Series),this._titleMark&&this.setMarkStyle(this._titleMark,Object.assign(Object.assign({fontSize:14},m),{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({},x),{x:t=>this._getSubTitlePosition(t,b,f).x,y:t=>this._getSubTitlePosition(t,b,f).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 k=this._spec.icon,_="number"==typeof(null===(c=null==k?void 0:k.style)||void 0===c?void 0:c.size)?k.style.size:20,S=(i.isValid(null==k?void 0:k.offset)?k.offset+p/2:b)+_/2;this._iconMark&&this.setMarkStyle(this._iconMark,{x:t=>this._getIconPosition(t,S).x,y:t=>this._getIconPosition(t,S).y,size:_,fill:null!==(u=null===(h=null==k?void 0:k.style)||void 0===h?void 0:h.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),n=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===n?i.x-e:i.x+e,y:i.y}:{x:i.x,y:"primary"===n?i.y-e:i.y+e}}_getSubTitlePosition(t,e,i){var n,o,r,a;const s=this._getPoint(t),l=this._getLabelSide(t),d=null!==(o=null===(n=this._spec.title)||void 0===n?void 0:n.subTitleGap)&&void 0!==o?o:4;if("vertical"===this.direction){const t=null!==(a=null===(r=this._spec.title)||void 0===r?void 0:r.style)&&void 0!==a?a:{},n="number"==typeof t.lineHeight?t.lineHeight:1.2*i;return{x:"primary"===l?s.x-e:s.x+e,y:s.y+n+d}}return{x:s.x,y:"primary"===l?s.y-(e+i+d):s.y+(e+i+d)}}_getIconPosition(t,e){const i=this._getPoint(t),n=this._getLabelSide(t);return"vertical"===this.direction?{x:"primary"===n?i.x+e:i.x-e,y:i.y}:{x:i.x,y:"primary"===n?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 n,o,r,a,s,l;if(!e)return this._getDefaultPosition(i);if(!i||!(i in t))return this._getDefaultPosition(i);const d=t[i];return"band"!==(null===(o=null===(n=e.getSpec)||void 0===n?void 0:n.call(e))||void 0===o?void 0:o.type)&&e.isContinuous?null!==(l=null===(s=e.valueToPosition)||void 0===s?void 0:s.call(e,d))&&void 0!==l?l:this._getDefaultPosition(i):null!==(a=null===(r=e.dataToPosition)||void 0===r?void 0:r.call(e,[d],{bandPosition:.5}))&&void 0!==a?a: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 n=t[this._seriesField];for(let t=i+1;t<e.length;t++){const i=e[t];if(i[this._seriesField]===n)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 n=t[this._seriesField];for(let t=i-1;t>=0;t--){const i=e[t];if(i[this._seriesField]===n)return i}return null}_getArrowPath(t){var e,i;const n=this._getPoint(t),o=this._getNextDatum(t),r=this._getPreviousDatum(t),a=null!==(i=null===(e=this._spec.arrow)||void 0===e?void 0:e.thickness)&&void 0!==i?i:16,s=this._region.getLayoutRect();if("vertical"===this.direction){const t=this.getYAxisHelper().isInverse(),e=r?{x:n.x,y:(this._getPoint(r).y+n.y)/2}:{x:n.x,y:t?0:s.height},i=o?{x:n.x,y:(this._getPoint(o).y+n.y)/2}:{x:n.x,y:t?s.height:0},l=t?1:-1,d=a/3,c=a/2;return`M ${e.x-c} ${e.y} L ${e.x} ${e.y+l*d} L ${e.x+c} ${e.y} \n L ${i.x+c} ${i.y-l*d} \n L ${i.x} ${i.y}\n L ${i.x-c} ${i.y-l*d} Z`}const l=this.getXAxisHelper().isInverse(),d=r?{x:(this._getPoint(r).x+n.x)/2,y:n.y}:{x:l?s.width:0,y:n.y},c=o?{x:(this._getPoint(o).x+n.x)/2,y:n.y}:{x:l?0:s.width,y:n.y},h=l?-1:1,u=a/2,g=a/3;return`M ${d.x} ${d.y-u} L ${d.x+h*g} ${d.y} L ${d.x} ${d.y+u} \n L ${c.x-h*g} ${c.y+u} \n L ${c.x} ${c.y} \n L ${c.x-h*g} ${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)}}$e.type=Pe,$e.mark=Re,$e.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}}},$e.transformerConstructor=e.BaseSeriesSpecTransformer;const ze=()=>{e.registerSymbolMark(),e.registerTextMark(),e.registerLineMark(),e.registerPathMark(),e.Factory.registerSeries($e.type,$e)};class Ve extends e.BaseChart{constructor(){super(...arguments),this.transformerConstructor=je,this.type="timeline",this.seriesType="event"}}Ve.type="timeline",Ve.seriesType="event",Ve.transformerConstructor=je;const Ne=t=>{var e,i,n,o;if(Array.isArray(t))return{top:null!==(e=t[0])&&void 0!==e?e:0,right:null!==(i=t[1])&&void 0!==i?i:0,bottom:null!==(n=t[2])&&void 0!==n?n:0,left:null!==(o=t[3])&&void 0!==o?o:0};const r=null!=t?t:24;return{top:r,right:r,bottom:r,left:r}},We=t=>t?"string"==typeof t?{type:t}:t:{type:"landscape"},He=(t,e)=>{var i,n,o;const r=We(e.layout),a=Ne(null!==(i=r.padding)&&void 0!==i?i:e.padding),s=null!==(n=e.gap)&&void 0!==n?n:40,l=null!==(o=e.lineDistance)&&void 0!==o?o:8,d=Ge(t,r,e.viewBox,e.block,a,s),c="clock"===r.type?Xe(e.viewBox,e.block,a,r):void 0;return{blocks:d,links:Qe(d,l),circleGuide:c}},Ge=(t,e,i,n,o,r)=>{const a=t.length;if(!a)return[];const s={x:o.left,y:o.top,width:Math.max(i.width-o.left-o.right,n.width),height:Math.max(i.height-o.top-o.bottom,n.height)},l={x:s.x+s.width/2,y:s.y+s.height/2};let d;switch(e.type){case"portrait":d=Ue(a,l.x,s.y+n.height/2,l.x,s.y+s.height-n.height/2);break;case"ladder":{const t="down"===e.direction,i=s.x+n.width/2,o=s.x+s.width-n.width/2,r=s.y+n.height/2,l=s.y+s.height-n.height/2,c=t?r:l,h=t?l:r,u=Ue(a,i,c,o,h),g=o-i,p=h-c,y=Math.hypot(g,p)||1,m=-p/y,v=g/y,x=1.2*Math.max(80,Math.min(240,Math.round(.42*s.height)));d=u.map(((t,e)=>{const i=e%2==0?1:-1;return{x:t.x+m*x*i,y:t.y+v*x*i}}));break}case"spiral":d=Ke(a,s,n,r);break;case"clock":d=Ye(a,i,n,o,e);break;case"arc":{const t="down"===e.direction,[i,o]=t?[20,160]:[200,340];d=Ze(a,s,n,e,i,o);break}case"wing":{const t="right"===e.direction?"right":"left",[i,o]="right"===t?[110,250]:[-70,70];d=Ze(a,s,n,e,i,o);break}default:d=Ue(a,s.x+n.width/2,l.y,s.x+s.width-n.width/2,l.y)}return d.map(((e,i)=>{var o,r;return{id:null!==(r=null===(o=t[i])||void 0===o?void 0:o.id)&&void 0!==r?r:i,index:i,datum:t[i],width:n.width,height:n.height,x:e.x-n.width/2,y:e.y-n.height/2,center:e}}))},Ue=(t,e,i,n,o)=>1===t?[{x:(e+n)/2,y:(i+o)/2}]:Array.from({length:t},((r,a)=>{const s=a/(t-1);return{x:e+(n-e)*s,y:i+(o-i)*s}})),Ke=(t,e,i,n)=>{const o=e.x+e.width/2,r=Math.min(Math.max(.65*i.width+n/2,0),Math.max((e.width-i.width)/2,0));return Ue(t,o,e.y+i.height/2,o,e.y+e.height-i.height/2).map(((t,e)=>({x:t.x+(e%2==0?-r:r),y:t.y})))},Ye=(t,e,i,n,o)=>{var r;const a=Xe(e,i,n,o),s=null!==(r=o.startAngle)&&void 0!==r?r:-90;if(1===t){const t=Je(s);return[{x:a.center.x+Math.cos(t)*a.radius,y:a.center.y+Math.sin(t)*a.radius}]}return Array.from({length:t},((e,i)=>{const n=Je(s+360*i/t);return{x:a.center.x+Math.cos(n)*a.radius,y:a.center.y+Math.sin(n)*a.radius}}))},Xe=(t,e,i,n)=>{var o;const r=Math.max(t.width-i.left-i.right,1),a=Math.max(t.height-i.top-i.bottom,1),s={x:i.left+r/2,y:i.top+a/2},l=null!==(o=n.radiusRatio)&&void 0!==o?o:.7,d=Math.max(Math.min(r-e.width,a-e.height)/2,1);return{center:s,radius:Math.max(1,d*l)}},Ze=(t,e,i,n,o,r,a=.88)=>{var s,l,d,c,h;const u=null!==(l=null!==(s=n.startAngle)&&void 0!==s?s:o)&&void 0!==l?l:-90,g=null!==(c=null!==(d=n.endAngle)&&void 0!==d?d:r)&&void 0!==c?c:270,p=null!==(h=n.radiusRatio)&&void 0!==h?h:a,y=Math.max((e.width-i.width)/2,1)*p,m=Math.max((e.height-i.height)/2,1)*p,v=e.x+e.width/2,x=e.y+e.height/2;if(1===t){const t=Je((u+g)/2);return[{x:v+Math.cos(t)*y,y:x+Math.sin(t)*m}]}return Array.from({length:t},((e,i)=>{const n=i/(t-1),o=Je(u+qe(u,g)*n);return{x:v+Math.cos(o)*y,y:x+Math.sin(o)*m}}))},qe=(t,e)=>{const i=e-t;return Math.abs(i)>=360?360:i},Je=t=>t/180*Math.PI,Qe=(t,e)=>{const i=[];for(let n=0;n<t.length-1;n++){const o=t[n],r=t[n+1],a=ti(o,r.center,e),s=ti(r,o.center,e);i.push({from:o,to:r,start:a,end:s,points:[a,s]})}return i},ti=(t,e,i)=>{const n=e.x-t.center.x,o=e.y-t.center.y;if(0===n&&0===o)return{x:t.center.x,y:t.center.y};const r=0===n?Number.POSITIVE_INFINITY:t.width/2/Math.abs(n),a=0===o?Number.POSITIVE_INFINITY:t.height/2/Math.abs(o),s=Math.min(r,a),l=Math.sqrt(n*n+o*o)||1;return{x:t.center.x+n*s+n/l*i,y:t.center.y+o*s+o/l*i}},ei=400,ii=t=>"landscape"===We(t.layout).type,ni=t=>"portrait"===We(t.layout).type,oi=t=>"clock"===We(t.layout).type,ri=t=>"arc"===We(t.layout).type,ai=t=>"wing"===We(t.layout).type,si=t=>"ladder"===We(t.layout).type,li=t=>{var e;return null!==(e=t.themeColor)&&void 0!==e?e:"#e8543d"},di=(t,e)=>{const i=Math.max(0,Math.min(1,e));if(!t)return`rgba(0, 0, 0, ${i})`;const n=t.trim();if(n.startsWith("#")){let t=n.slice(1);if(3!==t.length&&4!==t.length||(t=t.split("").map((t=>t+t)).join("")),6===t.length||8===t.length){return`rgba(${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}, ${i})`}}const o=n.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return o?`rgba(${o[1]}, ${o[2]}, ${o[3]}, ${i})`:n},ci=(t,e)=>{var i,n,o,r,a,s,l;if(null===(i=t.block)||void 0===i?void 0:i.width)return t.block.width;const d=null!==(o=null===(n=t.block)||void 0===n?void 0:n.widthRatio)&&void 0!==o?o:.24,c=null!==(a=null===(r=t.block)||void 0===r?void 0:r.minWidth)&&void 0!==a?a:180,h=null!==(l=null===(s=t.block)||void 0===s?void 0:s.maxWidth)&&void 0!==l?l:Math.max(c,320);return Math.max(c,Math.min(h,Math.round(e*d)))},hi=t=>{var e,i,n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x;const f=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getAllRegions)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n[0],b=null===(o=null==f?void 0:f.getLayoutRect)||void 0===o?void 0:o.call(f),k=null===(r=null==f?void 0:f.getLayoutStartPoint)||void 0===r?void 0:r.call(f),_=null===(s=null===(a=t.chart)||void 0===a?void 0:a.getLayoutRect)||void 0===s?void 0:s.call(a),S=null===(l=t.getLayoutBounds)||void 0===l?void 0:l.call(t);return{width:Math.max(null!==(u=null!==(c=null!==(d=null==b?void 0:b.width)&&void 0!==d?d:null==_?void 0:_.width)&&void 0!==c?c:null===(h=null==S?void 0:S.width)||void 0===h?void 0:h.call(S))&&void 0!==u?u:0,1),height:Math.max(null!==(m=null!==(p=null!==(g=null==b?void 0:b.height)&&void 0!==g?g:null==_?void 0:_.height)&&void 0!==p?p:null===(y=null==S?void 0:S.height)||void 0===y?void 0:y.call(S))&&void 0!==m?m:0,1),startX:null!==(v=null==k?void 0:k.x)&&void 0!==v?v:0,startY:null!==(x=null==k?void 0:k.y)&&void 0!==x?x:0}},ui=(t,e)=>{var i,n,o,r,a,s,l,d,c,h,u,g,p,y,m;const{width:v,height:x,startX:f,startY:b}=hi(e);let k=ci(t,v),_=null!==(n=null===(i=t.block)||void 0===i?void 0:i.height)&&void 0!==n?n:ei;if(ii(t)&&!(null===(o=t.block)||void 0===o?void 0:o.width)){const e=null!==(a=null===(r=t.data)||void 0===r?void 0:r.length)&&void 0!==a?a:0;if(e>0){const i=Ne(null===(s=t.block)||void 0===s?void 0:s.padding),n=80,o=(Math.max(v-i.left-i.right,1)-40*Math.max(e-1,0))/e;k=Math.max(n,Math.floor(o))}}if(ni(t)&&!(null===(l=t.block)||void 0===l?void 0:l.height)){const e=null!==(c=null===(d=t.data)||void 0===d?void 0:d.length)&&void 0!==c?c:0;if(e>0){const i=Ne(null===(h=t.block)||void 0===h?void 0:h.padding),n=Math.max(x-i.top-i.bottom,1);_=Math.max(ei,Math.floor(n/e))}}const S=He(null!==(u=t.data)&&void 0!==u?u:[],{layout:t.layout,viewBox:{width:v,height:x},block:{width:k,height:_},gap:null!==(p=null===(g=t.block)||void 0===g?void 0:g.gap)&&void 0!==p?p:36,padding:null===(y=t.block)||void 0===y?void 0:y.padding,lineDistance:null===(m=t.line)||void 0===m?void 0:m.distance});return f||b?Object.assign(Object.assign({},S),{blocks:S.blocks.map((t=>Object.assign(Object.assign({},t),{x:t.x+f,y:t.y+b,center:{x:t.center.x+f,y:t.center.y+b}}))),links:S.links.map((t=>Object.assign(Object.assign({},t),{start:{x:t.start.x+f,y:t.start.y+b},end:{x:t.end.x+f,y:t.end.y+b},points:t.points.map((t=>({x:t.x+f,y:t.y+b})))})))}):S},gi=(t,e)=>{var i,n,o,r,a,s,l,d,c;const h=Number(null!==(o=null===(n=null===(i=e.content)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fontSize)&&void 0!==o?o:12),u=Number(null!==(s=null===(a=null===(r=e.content)||void 0===r?void 0:r.style)||void 0===a?void 0:a.lineHeight)&&void 0!==s?s:18),g=null!==(c=null===(d=null===(l=e.content)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fill)&&void 0!==c?c:"#596173";return{type:"rich",text:t.reduce(((e,i,n)=>{const o=n===t.length-1?"":"\n";return e.push({text:`${i}${o}`,fontSize:h,lineHeight:u,fill:g}),e}),[])}},pi=t=>{if(!t)return{};return y(t,["width","height","position","gap"])},yi=(t,e,i,n,o,r,a,s)=>{if(!s)return{x:n.left,y:n.top,width:0,height:0};switch(t){case"left":return{x:n.left,y:(i-r)/2,width:o,height:r};case"right":return{x:e-n.right-o,y:(i-r)/2,width:o,height:r};case"bottom":return{x:(e-o)/2,y:i-n.bottom-r,width:o,height:r};default:return{x:(e-o)/2,y:n.top,width:o,height:r}}},mi=(t,e,i,n,o,r,a,s)=>{if(!s)return{x:n.left,y:n.top,width:e-n.left-n.right,height:i-n.top-n.bottom};switch(t){case"left":return{x:n.left+o+a,y:n.top,width:e-n.left-n.right-o-a,height:i-n.top-n.bottom};case"right":return{x:n.left,y:n.top,width:e-n.left-n.right-o-a,height:i-n.top-n.bottom};case"bottom":return{x:n.left,y:n.top,width:e-n.left-n.right,height:i-n.top-n.bottom-r-a};default:return{x:n.left,y:n.top+r+a,width:e-n.left-n.right,height:i-n.top-n.bottom-r-a}}},vi=.5,xi=.86,fi=[4,4],bi=(t,e)=>{var i,n,o;const{width:r,height:a,startX:s,startY:l}=hi(e),d=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),c=Math.max(r-d.left-d.right,1),h=Math.max(a-d.top-d.bottom,1),u=s+d.left+c/2,g=l+d.top+h/2,p=Math.max(Math.min(c,h)/2,1),y=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;return{cx:u,cy:g,R:p,count:y,step:y>0?2*Math.PI/y:0}},ki=(t,e)=>-Math.PI/2+t.step*(e+.5),_i=(t,e,i,n)=>({x:t+Math.cos(n)*i,y:e+Math.sin(n)*i}),Si=(t,e,i)=>{const n=bi(t,e),o=ki(n,i),r=.58*n.R;return Object.assign(Object.assign({},_i(n.cx,n.cy,r,o)),{diameter:.24*n.R,angle:o})},Mi=(t,e,i)=>{var n;const o=bi(t,e),{width:r,startX:a}=hi(e),s=Ne(null===(n=t.block)||void 0===n?void 0:n.padding),l=ki(o,i),d=(t=>Math.cos(t)<0)(l),c=.7*o.R,h=_i(o.cx,o.cy,c,l),u=a+s.left,g=a+r-s.right,p=d?Math.min(Math.max(h.x-u,80),200):Math.min(Math.max(g-h.x,80),200);return{x:h.x,y:h.y,width:p,onLeft:d,anchorY:h.y}},Ai=(t,i,n)=>{var o,r,a;const s=!!i.image,l=li(t),d=Array.isArray(i.content)?i.content:i.content?[i.content]:[],c=[{type:"path",name:`storyline-clock-lead-${n}`,interactive:!1,style:{path:(e,i)=>{const{start:o,end:r}=((t,e,i)=>{const n=bi(t,e),o=ki(n,i),r=.24*n.R/2;return{start:_i(n.cx,n.cy,.58*n.R+r+6,o),end:_i(n.cx,n.cy,.7*n.R-8,o)}})(t,i,n);return`M ${o.x.toFixed(2)} ${o.y.toFixed(2)} L ${r.x.toFixed(2)} ${r.y.toFixed(2)}`},stroke:di(l,.7),lineWidth:1,lineDash:[3,3],fill:"transparent",fillOpacity:0}},s?{type:"image",name:`storyline-clock-dot-${n}`,interactive:!1,style:{x:(e,i)=>{const o=Si(t,i,n);return o.x-o.diameter/2},y:(e,i)=>{const o=Si(t,i,n);return o.y-o.diameter/2},width:(e,i)=>Si(t,i,n).diameter,height:(e,i)=>Si(t,i,n).diameter,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"}}:{type:"symbol",name:`storyline-clock-dot-${n}`,interactive:!1,style:{x:(e,i)=>Si(t,i,n).x,y:(e,i)=>Si(t,i,n).y,size:(e,i)=>Si(t,i,n).diameter,symbolType:"circle",fill:l,stroke:"#ffffff",lineWidth:1.5}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-clock-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(e,i)=>Mi(t,i,n).x,y:(e,i)=>Mi(t,i,n).anchorY-24,text:i.title,maxLineWidth:(e,i)=>Mi(t,i,n).width,fontSize:18,lineHeight:24,fontWeight:"bold",fill:l,stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:(e,i)=>Mi(t,i,n).onLeft?"right":"left",textBaseline:"top"},null===(o=t.title)||void 0===o?void 0:o.style)}):null,d.length?Object.assign(Object.assign({type:"text",name:`storyline-clock-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(e,i)=>Mi(t,i,n).x,y:(e,i)=>Mi(t,i,n).anchorY+4,width:(e,i)=>Mi(t,i,n).width,maxLineWidth:(e,i)=>Mi(t,i,n).width,text:gi(d,t),fontSize:11,lineHeight:15,fill:"#3a3f4d",textAlign:(e,i)=>Mi(t,i,n).onLeft?"right":"left",textBaseline:"top",wordBreak:"break-word"},null===(r=t.content)||void 0===r?void 0:r.style)}):null];return{type:"group",id:`storyline-block-${null!==(a=i.id)&&void 0!==a?a:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,children:c.filter(Boolean)}},wi=(t,e,i)=>{var n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b,k,_,S,M,A,w,C,L;const F=ui(t,e).blocks[i],O=Ne(null!==(o=null===(n=t.block)||void 0===n?void 0:n.padding)&&void 0!==o?o:12),T=null!==(a=null===(r=t.image)||void 0===r?void 0:r.position)&&void 0!==a?a:"top",B=null!==(l=null===(s=t.image)||void 0===s?void 0:s.width)&&void 0!==l?l:48,I=null!==(c=null===(d=t.image)||void 0===d?void 0:d.height)&&void 0!==c?c:48,D=null!==(u=null===(h=t.image)||void 0===h?void 0:h.gap)&&void 0!==u?u:10,E=!!(null===(p=null===(g=t.data)||void 0===g?void 0:g[i])||void 0===p?void 0:p.image),j=Number(null!==(v=null===(m=null===(y=t.title)||void 0===y?void 0:y.style)||void 0===m?void 0:m.fontSize)&&void 0!==v?v:18),P=Number(null!==(b=null===(f=null===(x=t.title)||void 0===x?void 0:x.style)||void 0===f?void 0:f.lineHeight)&&void 0!==b?b:Math.round(1.35*j)),R=(null===(_=null===(k=t.data)||void 0===k?void 0:k[i])||void 0===_?void 0:_.title)?P:0,$=null!==(S=null==F?void 0:F.width)&&void 0!==S?S:ci(t,0),z=null!==(w=null!==(M=null==F?void 0:F.height)&&void 0!==M?M:null===(A=t.block)||void 0===A?void 0:A.height)&&void 0!==w?w:ei,V=yi(T,$,z,O,B,I,0,E),N=mi(T,$,z,O,B,I,D,E),W=(null===(L=null===(C=t.data)||void 0===C?void 0:C[i])||void 0===L?void 0:L.title)?8:0;return{block:{width:$,height:z},imageBox:V,textBox:N,contentBox:{y:N.y+R+W,height:Math.max(0,N.height-R-W)}}},Ci=(t,e,i,n)=>{const o=t[0],r=t[t.length-1];if(!o||!r)return"";let a;if("curve"===e){const t=r.x-o.x,e=r.y-o.y,i=Math.max(Math.min(.22*Math.sqrt(t*t+e*e),80),24);a=`M ${o.x} ${o.y} C ${o.x+t/2} ${o.y-i} ${r.x-t/2} ${r.y+i} ${r.x} ${r.y}`}else if("polyline"===e){const t={x:(o.x+r.x)/2,y:(o.y+r.y)/2};a=`M ${o.x} ${o.y} L ${t.x} ${o.y} L ${t.x} ${r.y} L ${r.x} ${r.y}`}else a=`M ${o.x} ${o.y} L ${r.x} ${r.y}`;return i?`${a} ${Li(o,r,n)}`:a},Li=(t,e,i)=>{const n=Math.atan2(e.y-t.y,e.x-t.x),o=e.x-Math.cos(n-Math.PI/6)*i,r=e.y-Math.sin(n-Math.PI/6)*i,a=e.x-Math.cos(n+Math.PI/6)*i,s=e.y-Math.sin(n+Math.PI/6)*i;return`M ${o} ${r} L ${e.x} ${e.y} L ${a} ${s}`},Fi=(t,e,i)=>{var n,o,r,a;const s=ui(t,e).blocks[i];if(!s)return null;return{x:null!==(o=null===(n=s.center)||void 0===n?void 0:n.x)&&void 0!==o?o:s.x+s.width/2,y:(null!==(a=null===(r=s.center)||void 0===r?void 0:r.y)&&void 0!==a?a:s.y+s.height/2)+(i%2==0?-1:1)*s.height*.1}},Oi=(t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b;const k=!!i.image,_=Array.isArray(i.content)?i.content:i.content?[i.content]:[],S=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),M=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(1.35*S)),A=e=>{var i,o,r,a;const s=ui(t,e).blocks[n],l=null!==(i=null==s?void 0:s.width)&&void 0!==i?i:ci(t,0),d=null!==(a=null!==(o=null==s?void 0:s.height)&&void 0!==o?o:null===(r=t.block)||void 0===r?void 0:r.height)&&void 0!==a?a:ei;return((t,e,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f;const b=Ne(null!==(r=null===(o=t.block)||void 0===o?void 0:o.padding)&&void 0!==r?r:12),k=Number(null!==(l=null===(s=null===(a=t.title)||void 0===a?void 0:a.style)||void 0===s?void 0:s.fontSize)&&void 0!==l?l:18),_=Number(null!==(h=null===(c=null===(d=t.title)||void 0===d?void 0:d.style)||void 0===c?void 0:c.lineHeight)&&void 0!==h?h:Math.max(19,Math.round(1.35*k))),S=Number(null!==(p=null===(g=null===(u=t.content)||void 0===u?void 0:u.style)||void 0===g?void 0:g.fontSize)&&void 0!==p?p:12),M=Number(null!==(v=null===(m=null===(y=t.content)||void 0===y?void 0:y.style)||void 0===m?void 0:m.lineHeight)&&void 0!==v?v:18),A=Math.max(null!==(f=null===(x=t.image)||void 0===x?void 0:x.height)&&void 0!==f?f:Math.round(.42*i),_+b.top+b.bottom),w=4*M,C=_+4+w,L=n%2==0;let F,O,T,B,I,D;const E=0+.2*e,j=E+12,P=Math.max(e-(j-0),0);if(L){const t=0,i=t-64-C;T={x:0,y:t,width:e,height:A},F={x:j,y:i,width:P,height:C},O={x:j,y:i+_+4,width:P,height:w},B={x1:E,y1:t,x2:E,y2:i+_/2},I=i,D=A-I}else{const t=0,i=t+A+64;T={x:0,y:t,width:e,height:A},F={x:j,y:i,width:P,height:C},O={x:j,y:i+_+4,width:P,height:w},B={x1:E,y1:t+A,x2:E,y2:i+C},I=t,D=i+C-t}return{padding:b,titleFontSize:k,titleLineHeight:_,contentFontSize:S,contentLineHeight:M,contentHeight:w,blockWidth:e,imageBox:T,textBox:F,contentBox:O,connector:B,textOnTop:L,groupTop:I,groupHeight:D}})(t,l,d,n)},w=null!==(h=null===(c=t.block)||void 0===c?void 0:c.style)&&void 0!==h?h:{},C=null!==(g=null===(u=t.line)||void 0===u?void 0:u.style)&&void 0!==g?g:{},L=li(t),F=null!==(p=C.stroke)&&void 0!==p?p:L,O=null!==(y=C.lineWidth)&&void 0!==y?y:2,T=null!==(m=C.lineDash)&&void 0!==m?m:[4,4];return{type:"group",id:`storyline-block-${null!==(v=i.id)&&void 0!==v?v:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o;const r=ui(t,i).blocks[n];return null!==(o=null==r?void 0:r.x)&&void 0!==o?o:0},y:(e,i)=>{var o,r,a,s,l,d,c;const h=ui(t,i).blocks[n],u=A(i),g=null!==(r=null===(o=null==h?void 0:h.center)||void 0===o?void 0:o.y)&&void 0!==r?r:(null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0)+(null!==(s=null==h?void 0:h.height)&&void 0!==s?s:0)/2,p=null!==(c=null!==(l=null==h?void 0:h.height)&&void 0!==l?l:null===(d=t.block)||void 0===d?void 0:d.height)&&void 0!==c?c:ei,y=(n%2==0?-1:1)*p*.1;return g-u.imageBox.height/2+y},width:(t,e)=>A(e).blockWidth,height:(t,e)=>A(e).groupHeight},children:[{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:Object.assign({x:(t,e)=>A(e).imageBox.x,y:(t,e)=>A(e).imageBox.y,width:(t,e)=>A(e).imageBox.width,height:(t,e)=>A(e).imageBox.height,cornerRadius:8,fill:"#ffffff",stroke:L,lineWidth:2},w)},k?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(t,e)=>A(e).imageBox.x,y:(t,e)=>A(e).imageBox.y,width:(t,e)=>A(e).imageBox.width,height:(t,e)=>A(e).imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(x=t.image)||void 0===x?void 0:x.style)}):null,{type:"path",name:`storyline-block-connector-${n}`,interactive:!1,style:{stroke:F,lineWidth:O,lineDash:T,fill:F,path:(t,e)=>{const i=A(e),n=i.connector.x1,o=i.connector.y1,r=i.connector.y2,a=r-9*(r<o?-1:1);return`${`M ${n} ${o} L ${n} ${a}`} ${`M ${n-4.5} ${a} L ${n+4.5} ${a} L ${n} ${r} Z`}`}}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(t,e)=>A(e).textBox.x,y:(t,e)=>A(e).textBox.y,text:i.title,maxLineWidth:(t,e)=>A(e).textBox.width,fontSize:S,lineHeight:M,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(f=t.title)||void 0===f?void 0:f.style)}):null,_.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(t,e)=>A(e).contentBox.x,y:(t,e)=>A(e).contentBox.y,width:(t,e)=>A(e).contentBox.width,height:(t,e)=>A(e).contentBox.height,maxLineWidth:(t,e)=>A(e).contentBox.width,heightLimit:(t,e)=>A(e).contentBox.height,text:gi(_,t),fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(b=t.content)||void 0===b?void 0:b.style)}):null].filter(Boolean)}},Ti=(t,e)=>{const i=ui(t,e).blocks;if(!i.length)return{x:0,y:0,width:0,height:0};const n=i[0].center.y,o=i[i.length-1].center.y,r=Math.min(n,o),a=Math.max(n,o);return{x:i[0].center.x-32,y:r-50,width:64,height:a-r+100}},Bi=(t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m;const v=!!i.image,x=!!i.subImage,f=Array.isArray(i.content)?i.content:i.content?[i.content]:[],b=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),k=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.max(19,Math.round(1.35*b))),_=!0===(null===(c=t.image)||void 0===c?void 0:c.showBackground),S=e=>{var i,o,r,a;const s=ui(t,e).blocks[n],l=null!==(i=null==s?void 0:s.width)&&void 0!==i?i:ci(t,0),d=null!==(a=null!==(o=null==s?void 0:s.height)&&void 0!==o?o:null===(r=t.block)||void 0===r?void 0:r.height)&&void 0!==a?a:ei;return((t,e,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f;const b=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),k=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.max(19,Math.round(1.35*b))),_=Number(null!==(u=null===(h=null===(c=t.content)||void 0===c?void 0:c.style)||void 0===h?void 0:h.fontSize)&&void 0!==u?u:12),S=Number(null!==(y=null===(p=null===(g=t.content)||void 0===g?void 0:g.style)||void 0===p?void 0:p.lineHeight)&&void 0!==y?y:18),M=null!==(v=null===(m=t.image)||void 0===m?void 0:m.width)&&void 0!==v?v:180,A=null!==(f=null===(x=t.image)||void 0===x?void 0:x.height)&&void 0!==f?f:110,w=3*S,C=Math.max(w,i-A/2-8-k-4),L=n%2==0,F=L?-56-M:56,O=-A/2,T=O+A+8,B=1*M,I=1*A;return{onLeft:L,titleFontSize:b,titleLineHeight:k,contentFontSize:_,contentLineHeight:S,blockWidth:e,imageBox:{x:F,y:O,width:M,height:A},shadowBox:{x:F-(B-M)/2+(L?-24:24),y:O-(I-A)/2+16,width:B,height:I},textBox:{x:F,y:T,width:M,height:k+4+C},contentBox:{x:F,y:T+k+4,width:M,height:C}}})(t,l,d,n)},M=li(t),A=null!==(u=null===(h=t.block)||void 0===h?void 0:h.style)&&void 0!==u?u:{};return{type:"group",id:`storyline-block-${null!==(g=i.id)&&void 0!==g?g:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;const a=ui(t,i).blocks[n];return null!==(r=null===(o=null==a?void 0:a.center)||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;const a=ui(t,i).blocks[n];return null!==(r=null===(o=null==a?void 0:a.center)||void 0===o?void 0:o.y)&&void 0!==r?r:0}},children:[x&&_?{type:"image",name:`storyline-block-shadow-image-${n}`,interactive:!1,style:{x:(t,e)=>S(e).shadowBox.x,y:(t,e)=>S(e).shadowBox.y,width:(t,e)=>S(e).shadowBox.width,height:(t,e)=>S(e).shadowBox.height,image:i.subImage,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"}}:null,{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:Object.assign({x:(t,e)=>S(e).imageBox.x,y:(t,e)=>S(e).imageBox.y,width:(t,e)=>S(e).imageBox.width,height:(t,e)=>S(e).imageBox.height,cornerRadius:8,fill:"#ffffff",stroke:M,lineWidth:2},A)},v?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(t,e)=>S(e).imageBox.x,y:(t,e)=>S(e).imageBox.y,width:(t,e)=>S(e).imageBox.width,height:(t,e)=>S(e).imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(p=t.image)||void 0===p?void 0:p.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(t,e)=>S(e).textBox.x,y:(t,e)=>S(e).textBox.y,text:i.title,maxLineWidth:(t,e)=>S(e).textBox.width,fontSize:b,lineHeight:k,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(y=t.title)||void 0===y?void 0:y.style)}):null,f.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(t,e)=>S(e).contentBox.x,y:(t,e)=>S(e).contentBox.y,width:(t,e)=>S(e).contentBox.width,height:(t,e)=>S(e).contentBox.height,maxLineWidth:(t,e)=>S(e).contentBox.width,heightLimit:(t,e)=>S(e).contentBox.height,text:gi(f,t),fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(m=t.content)||void 0===m?void 0:m.style)}):null].filter(Boolean)}},Ii=t=>"down"===We(t.layout).direction,Di=(t,e)=>{var i,n,o,r,a;const{width:s,height:l,startX:d,startY:c}=hi(e),h=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),u=Math.max(s-h.left-h.right,1),g=Math.max(l-h.top-h.bottom,1),p=.4*Math.min(u,g),y=Math.max(null!==(o=null===(n=t.centerImage)||void 0===n?void 0:n.width)&&void 0!==o?o:p,80),m=Math.max(null!==(a=null===(r=t.centerImage)||void 0===r?void 0:r.height)&&void 0!==a?a:p,80);return{x:d+h.left+u/2-y/2,y:Ii(t)?c+h.top:c+h.top+g-m,width:y,height:m}},Ei=(t,e)=>{var i,n,o,r;const{width:a,startX:s}=hi(e),l=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),d=Math.max(a-l.left-l.right,1),c=ci(t,a),h=We(t.layout),u="down"===h.direction,g=null!==(n=h.startAngle)&&void 0!==n?n:u?20:200,p=null!==(o=h.endAngle)&&void 0!==o?o:u?160:340,y=null!==(r=h.radiusRatio)&&void 0!==r?r:.88,m=Math.max((d-c)/2,1)*y,v=Di(t,e),x=v.y,f=v.y+v.height,b=Math.sin(g/180*Math.PI);let k,_;if(u){const t=Math.max(1-b,.05);_=(v.height+200)/t,k=x-_*b}else{const t=Math.max(1+b,.05);_=(v.height+200)/t,k=f-_*b}return{cx:s+l.left+d/2,cy:k,rx:m,ry:_,startAngle:g,endAngle:p,centerTop:x,centerBottom:f}},ji=(t,e,i)=>{var n,o,r,a;const s=Ei(t,e),l=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;if(l<=0)return{x:s.cx,y:s.cy};const d=1===l?.5:i/(l-1),c=(s.startAngle+(s.endAngle-s.startAngle)*d)/180*Math.PI,h=s.cx+Math.cos(c)*s.rx,u=s.cy+Math.sin(c)*s.ry,g=Math.cos(c)/s.rx,p=Math.sin(c)/s.ry,y=Math.hypot(g,p)||1,m=g/y,v=p/y,x=(null!==(a=null===(r=t.image)||void 0===r?void 0:r.height)&&void 0!==a?a:140)/2;return{x:h+m*x,y:u+v*x}},Pi=(t,i,n)=>{var o,r,a,s;const l=!!i.image,d=Array.isArray(i.content)?i.content:i.content?[i.content]:[],c=li(t),h=(t=>{var e,i,n,o,r,a,s,l,d,c,h,u,g,p,y,m;const v=Number(null!==(n=null===(i=null===(e=t.title)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fontSize)&&void 0!==n?n:18),x=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.lineHeight)&&void 0!==a?a:Math.max(19,Math.round(1.35*v))),f=Number(null!==(d=null===(l=null===(s=t.content)||void 0===s?void 0:s.style)||void 0===l?void 0:l.fontSize)&&void 0!==d?d:12),b=Number(null!==(u=null===(h=null===(c=t.content)||void 0===c?void 0:c.style)||void 0===h?void 0:h.lineHeight)&&void 0!==u?u:17),k=Math.max(240-x-4,b),_=null!==(p=null===(g=t.image)||void 0===g?void 0:g.width)&&void 0!==p?p:140,S=null!==(m=null===(y=t.image)||void 0===y?void 0:y.height)&&void 0!==m?m:140,M=Ii(t),A={x:-_/2,y:-S/2,width:_,height:S},w=Math.max(_-20,200),C={x:-_/2+20,y:M?A.y+S+10:A.y-10-240,width:w,height:240};return{titleFontSize:v,titleLineHeight:x,contentFontSize:f,contentLineHeight:b,imageBox:A,textBox:C,contentBox:{x:C.x,y:C.y+x+4,width:C.width,height:k},isDown:M}})(t),u=h.isDown?h.imageBox.y+h.imageBox.height:h.textBox.y,g=h.isDown?Math.max(h.textBox.y+h.textBox.height-(h.imageBox.y+h.imageBox.height),0):Math.max(h.imageBox.y-h.textBox.y,0);return{type:"group",id:`storyline-block-${null!==(o=i.id)&&void 0!==o?o:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>ji(t,i,n).x,y:(e,i)=>ji(t,i,n).y},children:[{type:"rect",name:`storyline-block-connector-${n}`,interactive:!1,style:{x:h.imageBox.x,y:u,width:2,height:g,fill:c,fillOpacity:.6}},l?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:h.imageBox.x,y:h.imageBox.y,width:h.imageBox.width,height:h.imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(r=t.image)||void 0===r?void 0:r.style)}):{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:{x:h.imageBox.x,y:h.imageBox.y,width:h.imageBox.width,height:h.imageBox.height,cornerRadius:Math.min(h.imageBox.width,h.imageBox.height)/2,fill:"#ffffff",stroke:c,lineWidth:2}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:h.textBox.x,y:h.textBox.y,text:i.title,maxLineWidth:h.textBox.width,fontSize:h.titleFontSize,lineHeight:h.titleLineHeight,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(a=t.title)||void 0===a?void 0:a.style)}):null,d.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:h.contentBox.x,y:h.contentBox.y,width:h.contentBox.width,height:h.contentBox.height,maxLineWidth:h.contentBox.width,heightLimit:h.contentBox.height,text:gi(d,t),fontSize:12,lineHeight:17,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(s=t.content)||void 0===s?void 0:s.style)}):null].filter(Boolean)}},Ri=t=>{var e;return null!==(e=We(t.layout).direction)&&void 0!==e?e:"left"},$i=(t,e)=>{var i,n,o,r;const{width:a,height:s,startX:l,startY:d}=hi(e),c=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),h=Math.max(a-c.left-c.right,1),u=Math.max(s-c.top-c.bottom,1),g=We(t.layout),p=Ri(t),y="right"===p?110:-70,m="right"===p?250:70,v=null!==(n=g.startAngle)&&void 0!==n?n:y,x=null!==(o=g.endAngle)&&void 0!==o?o:m,f=null!==(r=g.radiusRatio)&&void 0!==r?r:.92,b=u/2*f,k=.6*h*f;return{cx:"right"===p?l+c.left+h-.1*k:l+c.left+.1*k,cy:d+c.top+u/2,rx:k,ry:b,startAngle:v,endAngle:x}},zi=(t,e,i)=>{var n,o;const r=$i(t,e),a=null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0;if(a<=0)return{x:r.cx,y:r.cy};const s=1===a?.5:i/(a-1),l=(r.startAngle+(r.endAngle-r.startAngle)*s)/180*Math.PI;return{x:r.cx+Math.cos(l)*r.rx,y:r.cy+Math.sin(l)*r.ry}},Vi=(t,e)=>{var i,n,o,r,a,s,l,d,c,h,u,g,p,y,m,v;const x=Number(null!==(o=null===(n=null===(i=t.title)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fontSize)&&void 0!==o?o:22),f=Number(null!==(s=null===(a=null===(r=t.title)||void 0===r?void 0:r.style)||void 0===a?void 0:a.lineHeight)&&void 0!==s?s:Math.max(30,Math.round(1.3*x))),b=Number(null!==(c=null===(d=null===(l=t.content)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fontSize)&&void 0!==c?c:12),k=Number(null!==(g=null===(u=null===(h=t.content)||void 0===h?void 0:h.style)||void 0===u?void 0:u.lineHeight)&&void 0!==g?g:17),_=Math.max(110-f-4,k),S=null!==(y=null===(p=t.image)||void 0===p?void 0:p.width)&&void 0!==y?y:96,M=null!==(v=null===(m=t.image)||void 0===m?void 0:m.height)&&void 0!==v?v:96,A={x:-S/2,y:-M/2,width:S,height:M},w=((t,e)=>"right"===Ri(t)?e%2==1:e%2==0)(t,e),C=w?-S/2-14-240:S/2+14;return{onLeft:w,titleFontSize:x,titleLineHeight:f,contentFontSize:b,contentLineHeight:k,imageBox:A,textBox:{x:C,y:-55,width:240,height:110},contentBox:{x:C,y:-55+f+4,width:240,height:_}}},Ni=[12,8],Wi=(t,e)=>{var i;const{width:n,height:o,startX:r,startY:a}=hi(e),s=Ne(null===(i=t.block)||void 0===i?void 0:i.padding),l=r+s.left,d=a+s.top,c=Math.max(n-s.left-s.right,1),h=Math.max(o-s.top-s.bottom,1),u=(t=>"down"===We(t.layout).direction)(t),g=l+c,p=u?d:d+h,y=u?d+h:d,m=g-l,v=y-p;return{x0:l,y0:p,x1:g,y1:y,cx:(l+g)/2,cy:(p+y)/2,angleRad:Math.atan2(v,m)/Math.PI*180,fontSize:Math.max(80,Math.min(240,Math.round(.42*h)))}},Hi=t=>{const i=(t=>{var e,i;const n=We(t.layout);if("string"==typeof n.headline&&n.headline.length>0)return n.headline;const o=null===(i=null===(e=t.title)||void 0===e?void 0:e.style)||void 0===i?void 0:i.text;return"string"==typeof o&&o.length>0?o:"storyline"})(t);if(!i)return null;const n=li(t);return{type:"group",name:"storyline-ladder-headline",zIndex:e.LayoutZIndex.Mark,style:{x:(e,i)=>Wi(t,i).cx,y:(e,i)=>Wi(t,i).cy,angle:(e,i)=>Wi(t,i).angleRad},children:[{type:"text",name:"storyline-ladder-headline-text",interactive:!1,style:{x:0,y:0,text:i,fontSize:(e,i)=>Wi(t,i).fontSize,fontWeight:900,fontFamily:'Impact, "Arial Black", sans-serif',fill:di(n,.92),textAlign:"center",textBaseline:"middle"}}]}},Gi=t=>t%2==1,Ui=(t,e,i)=>{var n,o,r,a,s,l,d,c,h,u,g,p,y,m,v,x,f,b,k,_,S,M,A,w;const C=ui(t,e).blocks[i],L=Ne(null!==(o=null===(n=t.block)||void 0===n?void 0:n.padding)&&void 0!==o?o:12),F=Gi(i)?"right":"left",O=null!==(a=null===(r=t.image)||void 0===r?void 0:r.width)&&void 0!==a?a:96,T=null!==(l=null===(s=t.image)||void 0===s?void 0:s.height)&&void 0!==l?l:96,B=null!==(c=null===(d=t.image)||void 0===d?void 0:d.gap)&&void 0!==c?c:10,I=!!(null===(u=null===(h=t.data)||void 0===h?void 0:h[i])||void 0===u?void 0:u.image),D=Number(null!==(y=null===(p=null===(g=t.title)||void 0===g?void 0:g.style)||void 0===p?void 0:p.fontSize)&&void 0!==y?y:28),E=Number(null!==(x=null===(v=null===(m=t.title)||void 0===m?void 0:m.style)||void 0===v?void 0:v.lineHeight)&&void 0!==x?x:Math.round(D*(36/28))),j=(null===(b=null===(f=t.data)||void 0===f?void 0:f[i])||void 0===b?void 0:b.title)?E:0,P=null!==(k=null==C?void 0:C.width)&&void 0!==k?k:ci(t,0),R=null!==(M=null!==(_=null==C?void 0:C.height)&&void 0!==_?_:null===(S=t.block)||void 0===S?void 0:S.height)&&void 0!==M?M:ei,$=yi(F,P,R,L,O,T,0,I),z=mi(F,P,R,L,O,T,B,I),V=(null===(w=null===(A=t.data)||void 0===A?void 0:A[i])||void 0===w?void 0:w.title)?8:0;return{block:{width:P,height:R},imageBox:$,textBox:z,contentBox:{y:z.y+j+V,height:Math.max(0,z.height-j-V)}}};class Ki extends e.CommonChartSpecTransformer{transformSpec(t){var e;Yi(t);const i=Object.assign(Object.assign({},t),{data:[...null!==(e=t.data)&&void 0!==e?e:[]]});t.type="common",t.data=[],t.series=[],t.axes=[],t.customMark=Xi(i),delete t.layout,delete t.title,super.transformSpec(t)}}const Yi=t=>{var e,i,n,o;const r=ri(t),a=r&&"down"===We(t.layout).direction,s=r&&!a,l=ni(t),d=si(t),c=(()=>{var e,i,n,o,r,a;if(!d)return 0;const s=null!==(i=null===(e=t.block)||void 0===e?void 0:e.minWidth)&&void 0!==i?i:ci(t,0),l=null!==(o=null===(n=t.image)||void 0===n?void 0:n.width)&&void 0!==o?o:96,c=null!==(a=null===(r=t.image)||void 0===r?void 0:r.gap)&&void 0!==a?a:10,h=Math.max(s-l-c-24,90);return Math.round(2*h)})(),h=(()=>{var e,i;if(!d)return 0;const n=null!==(i=null===(e=t.block)||void 0===e?void 0:e.height)&&void 0!==i?i:ei,o=t.height,r="number"==typeof o&&o>0?Math.max(20,Math.round(.18*o)):1/0;return Math.round(Math.min(3*n,r))})(),u=d?h:a?100:s?280:20,g=d?h:a?280:l?160:100,p=d?c:20,y=d?c:20,m=t.padding;if(null!=m)if("number"!=typeof m)if(Array.isArray(m)){const[e,i=y,n,o=p]=m;t.padding=[null!=e?e:u,i,null!=n?n:g,o]}else"object"==typeof m&&(t.padding={top:null!==(e=m.top)&&void 0!==e?e:u,right:null!==(i=m.right)&&void 0!==i?i:y,bottom:null!==(n=m.bottom)&&void 0!==n?n:g,left:null!==(o=m.left)&&void 0!==o?o:p});else t.padding=[Math.max(m,u),Math.max(m,y),Math.max(m,g),Math.max(m,p)];else t.padding=[u,y,g,p]},Xi=t=>{var i;const n=Zi(t),o=(null!==(i=t.data)&&void 0!==i?i:[]).map(((e,i)=>qi(t,e,i)));if(ii(t))return[...o,n].filter(Boolean);if(ni(t))return[n,...o].filter(Boolean);if(ri(t)){const i=(t=>{var i,n,o,r;if(!1===(null===(i=t.centerImage)||void 0===i?void 0:i.visible))return null;const a=li(t),s=!!(null===(n=t.centerImage)||void 0===n?void 0:n.image),l={gradient:"linear",x0:.5,y0:0,x1:.5,y1:1,stops:[{offset:0,color:di(a,.15)},{offset:1,color:a}]};return{type:"group",name:"storyline-arc-center",zIndex:e.LayoutZIndex.Mark,children:[{type:"symbol",name:"storyline-arc-center-symbol",interactive:!1,style:{x:(e,i)=>{const n=Di(t,i);return n.x+n.width/2},y:(e,i)=>{const n=Di(t,i);return n.y+n.height/2},size:(e,i)=>{const n=Di(t,i);return 1.1*Math.max(n.width,n.height)},symbolType:"circle",fill:l,stroke:a,lineWidth:2}},s?Object.assign(Object.assign({type:"image",name:"storyline-arc-center-image",interactive:!1},t.centerImage),{style:Object.assign({x:(e,i)=>Di(t,i).x,y:(e,i)=>Di(t,i).y,width:(e,i)=>Di(t,i).width,height:(e,i)=>Di(t,i).height,image:null===(o=t.centerImage)||void 0===o?void 0:o.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center",anchor:(e,i)=>{const n=Di(t,i);return[n.x+n.width/2,n.y+n.height/2]},dx:(e,i)=>{var n,o;const r=Di(t,i),a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.width,s="number"==typeof a?a:r.width;return(r.width-s)/2},dy:(e,i)=>{var n,o;const r=Di(t,i),a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.height,s="number"==typeof a?a:r.height;return(r.height-s)/2}},null===(r=t.centerImage)||void 0===r?void 0:r.style)}):null].filter(Boolean)}})(t),n=(t=>{var i;if(!0!==(null===(i=t.line)||void 0===i?void 0:i.visible))return null;const n=li(t);return{type:"group",name:"storyline-arc",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-arc-path",interactive:!1,style:{stroke:n,lineWidth:2,lineCap:"round",fill:"transparent",fillOpacity:0,path:(e,i)=>{const n=Ei(t,i),o=n.endAngle-n.startAngle,r=[];for(let t=0;t<=64;t++){const e=t/64,i=(n.startAngle+o*e)/180*Math.PI,a=n.cx+Math.cos(i)*n.rx,s=n.cy+Math.sin(i)*n.ry;r.push(`${0===t?"M":"L"} ${a.toFixed(2)} ${s.toFixed(2)}`)}return r.join(" ")}}}]}})(t);return[i,n,...o].filter(Boolean)}if(oi(t)){const i=(t=>{const i=li(t);return{type:"group",name:"storyline-clock-orbit",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-clock-orbit-path",interactive:!1,style:{path:(e,i)=>{const n=bi(t,i),o=.58*n.R;return[`M ${(n.cx+o).toFixed(2)} ${n.cy.toFixed(2)}`,`A ${o.toFixed(2)} ${o.toFixed(2)} 0 1 1 ${(n.cx-o).toFixed(2)} ${n.cy.toFixed(2)}`,`A ${o.toFixed(2)} ${o.toFixed(2)} 0 1 1 ${(n.cx+o).toFixed(2)} ${n.cy.toFixed(2)}`].join(" ")},stroke:di(i,.7),lineWidth:1,lineDash:fi,fill:"transparent",fillOpacity:0}}]}})(t),n=(t=>{var i,n,o,r;if(!1===(null===(i=t.centerImage)||void 0===i?void 0:i.visible))return null;const a=li(t),s=!!(null===(n=t.centerImage)||void 0===n?void 0:n.image);return{type:"group",name:"storyline-clock-center",zIndex:e.LayoutZIndex.Mark+2,children:[{type:"symbol",name:"storyline-clock-center-halo",interactive:!1,style:{x:(e,i)=>bi(t,i).cx,y:(e,i)=>bi(t,i).cy,size:(e,i)=>bi(t,i).R*vi*2.16,symbolType:"circle",fill:di(a,.28),stroke:"transparent"}},s?{type:"image",name:"storyline-clock-center-image",interactive:!1,style:Object.assign({x:(e,i)=>{const n=bi(t,i);return n.cx-n.R*vi*xi},y:(e,i)=>{const n=bi(t,i);return n.cy-n.R*vi*xi},width:(e,i)=>bi(t,i).R*vi*xi*2,height:(e,i)=>bi(t,i).R*vi*xi*2,image:null===(o=t.centerImage)||void 0===o?void 0:o.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center",anchor:(e,i)=>{const n=bi(t,i);return[n.cx,n.cy]},dx:(e,i)=>{var n,o;const r=bi(t,i).R*vi*xi*2,a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.width;return(r-("number"==typeof a?a:r))/2},dy:(e,i)=>{var n,o;const r=bi(t,i).R*vi*xi*2,a=null===(o=null===(n=t.centerImage)||void 0===n?void 0:n.style)||void 0===o?void 0:o.height;return(r-("number"==typeof a?a:r))/2}},null===(r=t.centerImage)||void 0===r?void 0:r.style)}:{type:"symbol",name:"storyline-clock-center-placeholder",interactive:!1,style:{x:(e,i)=>bi(t,i).cx,y:(e,i)=>bi(t,i).cy,size:(e,i)=>bi(t,i).R*vi*2,symbolType:"circle",fill:"#ffffff",stroke:a,lineWidth:2}}].filter(Boolean)}})(t);return[i,...o,n].filter(Boolean)}if(ai(t)){const i=(t=>{var i,n,o,r,a,s,l,d;if(!1===(null===(i=t.line)||void 0===i?void 0:i.visible))return null;const c=li(t),h=null!==(o=null===(n=t.line)||void 0===n?void 0:n.style)&&void 0!==o?o:{},u=Math.max(Number(null!==(r=h.startWidth)&&void 0!==r?r:2),.5),g=Math.max(Number(null!==(s=null!==(a=h.endWidth)&&void 0!==a?a:h.lineWidth)&&void 0!==s?s:18),u);return{type:"group",name:"storyline-wing-arc",zIndex:e.LayoutZIndex.Mark,children:[{type:"path",name:"storyline-wing-arc-path",interactive:!1,style:{stroke:!1,lineWidth:0,fill:null!==(d=null!==(l=h.fill)&&void 0!==l?l:h.stroke)&&void 0!==d?d:c,opacity:.95,path:(e,i)=>{const n=$i(t,i),o=n.endAngle-n.startAngle,r=[];for(let t=0;t<=96;t++){const e=t/96,i=(n.startAngle+o*e)/180*Math.PI,a=n.cx+Math.cos(i)*n.rx,s=n.cy+Math.sin(i)*n.ry,l=Math.cos(i)/n.rx,d=Math.sin(i)/n.ry,c=Math.hypot(l,d)||1;r.push({x:a,y:s,nx:l/c,ny:d/c,w:u+(g-u)*e})}const a=[];for(let t=0;t<r.length;t++){const e=r[t],i=e.x+e.nx*(e.w/2),n=e.y+e.ny*(e.w/2);a.push(`${0===t?"M":"L"} ${i.toFixed(2)} ${n.toFixed(2)}`)}for(let t=r.length-1;t>=0;t--){const e=r[t],i=e.x-e.nx*(e.w/2),n=e.y-e.ny*(e.w/2);a.push(`L ${i.toFixed(2)} ${n.toFixed(2)}`)}return a.push("Z"),a.join(" ")}}}]}})(t);return[i,...o].filter(Boolean)}if(si(t)){const i=(t=>{const i=li(t);return{type:"group",name:"storyline-ladder-diagonal",zIndex:e.LayoutZIndex.Mark-1,children:[{type:"path",name:"storyline-ladder-diagonal-line",interactive:!1,style:{path:(e,i)=>{const n=Wi(t,i);return`M ${n.x0} ${n.y0} L ${n.x1} ${n.y1}`},stroke:di(i,.85),lineWidth:2,lineDash:Ni,fill:"transparent"}}]}})(t);return[i,Hi(t),...o].filter(Boolean)}return[n,...o].filter(Boolean)},Zi=t=>{var i,n,o;return!1===(null===(i=t.line)||void 0===i?void 0:i.visible)||(null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0)<=1?null:ii(t)?(t=>{var i,n,o,r,a,s,l;const d=li(t),c=null!==(n=null===(i=t.line)||void 0===i?void 0:i.style)&&void 0!==n?n:{},h=null!==(r=null===(o=t.data)||void 0===o?void 0:o.length)&&void 0!==r?r:0,u=[];for(let e=0;e<h;e++){const i=e;u.push({type:"symbol",name:`storyline-landscape-curve-symbol-${i}`,interactive:!1,style:{symbolType:"circle",size:14,fill:d,x:(e,n)=>{var o,r;return null!==(r=null===(o=Fi(t,n,i))||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,n)=>{var o,r;return null!==(r=null===(o=Fi(t,n,i))||void 0===o?void 0:o.y)&&void 0!==r?r:0}}})}return{type:"group",name:"storyline-landscape-curve",zIndex:e.LayoutZIndex.Mark+2,children:[{type:"path",name:"storyline-landscape-curve-path",interactive:!1,style:{stroke:null!==(a=c.stroke)&&void 0!==a?a:d,lineWidth:null!==(s=c.lineWidth)&&void 0!==s?s:4,lineDash:null!==(l=c.lineDash)&&void 0!==l?l:[6,5],lineCap:"round",fill:"transparent",fillOpacity:0,path:(e,i)=>{const n=[];for(let e=0;e<h;e++){const o=Fi(t,i,e);o&&n.push(o)}return(t=>{var e,i;if(t.length<2)return"";if(2===t.length)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;let n=`M ${t[0].x} ${t[0].y}`;for(let o=0;o<t.length-1;o++){const r=null!==(e=t[o-1])&&void 0!==e?e:t[o],a=t[o],s=t[o+1],l=null!==(i=t[o+2])&&void 0!==i?i:s;n+=` C ${a.x+(s.x-r.x)/6} ${a.y+(s.y-r.y)/6}, ${s.x-(l.x-a.x)/6} ${s.y-(l.y-a.y)/6}, ${s.x} ${s.y}`}return n})(n)}}},...u]}})(t):ni(t)?(t=>{var i,n,o,r,a,s;const l=li(t),d=null!==(n=null===(i=t.line)||void 0===i?void 0:i.style)&&void 0!==n?n:{},c={gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:[{offset:0,color:di(l,.2)},{offset:1,color:di(l,1)}]};return{type:"group",name:"storyline-portrait-axis",zIndex:e.LayoutZIndex.Mark,children:[{type:"rect",name:"storyline-portrait-axis-rect",interactive:!1,style:{fill:null!==(o=d.fill)&&void 0!==o?o:c,stroke:null!==(r=d.stroke)&&void 0!==r&&r,lineWidth:null!==(a=d.lineWidth)&&void 0!==a?a:0,cornerRadius:null!==(s=d.cornerRadius)&&void 0!==s?s:0,x:(e,i)=>Ti(t,i).x,y:(e,i)=>Ti(t,i).y,width:(e,i)=>Ti(t,i).width,height:(e,i)=>Ti(t,i).height}}]}})(t):(t=>{var i,n,o,r;return!1===(null===(i=t.line)||void 0===i?void 0:i.visible)||(null!==(o=null===(n=t.data)||void 0===n?void 0:n.length)&&void 0!==o?o:0)<=1?null:{type:"group",name:"storyline-links",zIndex:e.LayoutZIndex.Mark,children:(null!==(r=t.data)&&void 0!==r?r:[]).slice(1).map(((e,i)=>{var n;const o=null!==(n=t.line)&&void 0!==n?n:{},{style:r={},type:a="line",showArrow:s=!1,arrowSize:l=8}=o,d=y(o,["style","type","showArrow","arrowSize"]);return Object.assign(Object.assign({type:"path",name:`storyline-link-${i}`,interactive:!1},d),{style:Object.assign(Object.assign({stroke:"#8a94a6",lineWidth:1.5,fill:"transparent",fillOpacity:0},r),{path:(e,n)=>{const o=ui(t,n).links[i];return o?Ci(o.points,a,s,l):""}})})}))}})(t)},qi=(t,i,n)=>ii(t)?Oi(t,i,n):ni(t)?Bi(t,i,n):ri(t)?Pi(t,i,n):oi(t)?Ai(t,i,n):ai(t)?((t,i,n)=>{var o,r,a,s,l;const d=!!i.image,c=Array.isArray(i.content)?i.content:i.content?[i.content]:[],h=li(t),u=Vi(t,n),g=!0===(null===(o=t.image)||void 0===o?void 0:o.showBackground);return{type:"group",id:`storyline-block-${null!==(r=i.id)&&void 0!==r?r:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>zi(t,i,n).x,y:(e,i)=>zi(t,i,n).y},children:[g?{type:"symbol",name:`storyline-block-image-halo-${n}`,interactive:!1,style:{x:0,y:0,size:Math.max(u.imageBox.width,u.imageBox.height)+12,symbolType:"circle",fill:di(h,.18),stroke:h,lineWidth:1.5}}:null,d?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:u.imageBox.x,y:u.imageBox.y,width:u.imageBox.width,height:u.imageBox.height,image:i.image,repeatX:"no-repeat",repeatY:"no-repeat",imageMode:"cover",imagePosition:"center"},null===(a=t.image)||void 0===a?void 0:a.style)}):{type:"rect",name:`storyline-block-image-bg-${n}`,interactive:!1,style:{x:u.imageBox.x,y:u.imageBox.y,width:u.imageBox.width,height:u.imageBox.height,cornerRadius:Math.min(u.imageBox.width,u.imageBox.height)/2,fill:"#ffffff",stroke:h,lineWidth:2}},i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1,zIndex:e.LayoutZIndex.Mark+10},t.title),{style:Object.assign({x:u.onLeft?u.textBox.x+u.textBox.width:u.textBox.x,y:u.textBox.y,text:i.title,maxLineWidth:u.textBox.width,fontSize:u.titleFontSize,lineHeight:u.titleLineHeight,fontWeight:"bold",fill:h,stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:u.onLeft?"right":"left",textBaseline:"top"},null===(s=t.title)||void 0===s?void 0:s.style)}):null,c.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1,zIndex:e.LayoutZIndex.Mark+10},t.content),{textType:"rich",style:Object.assign({x:u.onLeft?u.contentBox.x+u.contentBox.width:u.contentBox.x,y:u.contentBox.y,width:u.contentBox.width,height:u.contentBox.height,maxLineWidth:u.contentBox.width,heightLimit:u.contentBox.height,text:gi(c,t),fontSize:12,lineHeight:17,textAlign:u.onLeft?"right":"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#1f2430"},null===(l=t.content)||void 0===l?void 0:l.style)}):null].filter(Boolean)}})(t,i,n):si(t)?((t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p,y;const m=!!i.image,v=Gi(n)?"right":"left",x=Array.isArray(i.content)?i.content:i.content?[i.content]:[],f=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:28),b=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(f*(36/28))),k=!0===(null===(c=t.block)||void 0===c?void 0:c.showBackground),_=e=>{const i=Ui(t,e,n);return"right"===v?i.textBox.x+i.textBox.width:i.textBox.x};return{type:"group",id:`storyline-block-${null!==(h=i.id)&&void 0!==h?h:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.y)&&void 0!==r?r:0},width:(e,i)=>Ui(t,i,n).block.width,height:(e,i)=>Ui(t,i,n).block.height},children:[k?{type:"rect",name:`storyline-block-bg-${n}`,interactive:!1,style:Object.assign({x:0,y:0,width:(e,i)=>Ui(t,i,n).block.width,height:(e,i)=>Ui(t,i,n).block.height,cornerRadius:8,fill:"#ffffff",stroke:"#d7dce5",lineWidth:1,shadowBlur:6,shadowColor:"rgba(0, 0, 0, 0.08)"},null===(u=t.block)||void 0===u?void 0:u.style)}:null,m?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(e,i)=>Ui(t,i,n).imageBox.x,y:(e,i)=>Ui(t,i,n).imageBox.y,width:(e,i)=>Ui(t,i,n).imageBox.width,height:(e,i)=>Ui(t,i,n).imageBox.height,image:i.image},null===(g=t.image)||void 0===g?void 0:g.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign(Object.assign({x:(t,e)=>_(e),y:(e,i)=>Ui(t,i,n).textBox.y,text:i.title,maxLineWidth:(e,i)=>Ui(t,i,n).textBox.width,fontSize:f,lineHeight:b,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textBaseline:"top"},null===(p=t.title)||void 0===p?void 0:p.style),{textAlign:v})}):null,x.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign(Object.assign({x:(t,e)=>_(e),y:(e,i)=>Ui(t,i,n).contentBox.y,width:(e,i)=>Ui(t,i,n).textBox.width,text:gi(x,t),maxLineWidth:(e,i)=>Ui(t,i,n).textBox.width,fontSize:16,lineHeight:24,heightLimit:(e,i)=>Ui(t,i,n).contentBox.height,textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(y=t.content)||void 0===y?void 0:y.style),{textAlign:v})}):null].filter(Boolean)}})(t,i,n):((t,i,n)=>{var o,r,a,s,l,d,c,h,u,g,p;const y=!!i.image,m=Array.isArray(i.content)?i.content:i.content?[i.content]:[],v=Number(null!==(a=null===(r=null===(o=t.title)||void 0===o?void 0:o.style)||void 0===r?void 0:r.fontSize)&&void 0!==a?a:18),x=Number(null!==(d=null===(l=null===(s=t.title)||void 0===s?void 0:s.style)||void 0===l?void 0:l.lineHeight)&&void 0!==d?d:Math.round(1.35*v));return{type:"group",id:`storyline-block-${null!==(c=i.id)&&void 0!==c?c:n}`,name:`storyline-block-${n}`,zIndex:e.LayoutZIndex.Mark+1,style:{x:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.x)&&void 0!==r?r:0},y:(e,i)=>{var o,r;return null!==(r=null===(o=ui(t,i).blocks[n])||void 0===o?void 0:o.y)&&void 0!==r?r:0},width:(e,i)=>wi(t,i,n).block.width,height:(e,i)=>wi(t,i,n).block.height},children:[{type:"rect",name:`storyline-block-bg-${n}`,interactive:!1,style:Object.assign({x:0,y:0,width:(e,i)=>wi(t,i,n).block.width,height:(e,i)=>wi(t,i,n).block.height,cornerRadius:8,fill:"#ffffff",stroke:"#d7dce5",lineWidth:1,shadowBlur:6,shadowColor:"rgba(0, 0, 0, 0.08)"},null===(h=t.block)||void 0===h?void 0:h.style)},y?Object.assign(Object.assign({type:"image",name:`storyline-block-image-${n}`,interactive:!1},pi(t.image)),{style:Object.assign({x:(e,i)=>wi(t,i,n).imageBox.x,y:(e,i)=>wi(t,i,n).imageBox.y,width:(e,i)=>wi(t,i,n).imageBox.width,height:(e,i)=>wi(t,i,n).imageBox.height,image:i.image},null===(u=t.image)||void 0===u?void 0:u.style)}):null,i.title?Object.assign(Object.assign({type:"text",name:`storyline-block-title-${n}`,interactive:!1},t.title),{style:Object.assign({x:(e,i)=>wi(t,i,n).textBox.x,y:(e,i)=>wi(t,i,n).textBox.y,text:i.title,maxLineWidth:(e,i)=>wi(t,i,n).textBox.width,fontSize:v,lineHeight:x,fontWeight:"bold",fill:"#1f2430",stroke:"#fff",lineWidth:5,lineJoin:"round",textAlign:"left",textBaseline:"top"},null===(g=t.title)||void 0===g?void 0:g.style)}):null,m.length?Object.assign(Object.assign({type:"text",name:`storyline-block-content-${n}`,interactive:!1},t.content),{textType:"rich",style:Object.assign({x:(e,i)=>wi(t,i,n).textBox.x,y:(e,i)=>wi(t,i,n).contentBox.y,width:(e,i)=>wi(t,i,n).textBox.width,text:gi(m,t),maxLineWidth:(e,i)=>wi(t,i,n).textBox.width,fontSize:12,lineHeight:18,heightLimit:(e,i)=>wi(t,i,n).contentBox.height,textAlign:"left",textBaseline:"top",wordBreak:"break-word",ellipsis:"...",fill:"#596173"},null===(p=t.content)||void 0===p?void 0:p.style)}):null].filter(Boolean)}})(t,i,n);class Ji extends e.BaseChart{constructor(){super(...arguments),this.type="storyline",this.transformerConstructor=Ki}init(){this.isValid()&&super.init()}isValid(){var t,e;const{data:i}=this._spec;return!!Array.isArray(i)||(null===(e=(t=this._option).onError)||void 0===e||e.call(t,"Data is required and should be an array for storyline chart"),!1)}}Ji.type="storyline",Ji.view="singleDefault",Ji.transformerConstructor=Ki;const Qi="seriesBreak";function tn(t,e,i,n,o=!1){const r=[],{x:a,y:s}=t,{x:l,y:d}=e,c=o?Math.floor((d-s)/(2*i)):Math.floor((l-a)/(2*i)),h=Math.PI/180*n,u=i*Math.cos(h),g=i*Math.sin(h);r.push(`M ${a} ${s}`);for(let t=0;t<=c;t++){const e=o?a+(t%2==0?u:-u):a+t*i*2,n=o?s+t*i*2:t%2==0?s-g:s+g;r.push(`L ${e} ${n}`)}return r.push(`L ${o?a:l} ${o?d:s}`),r.join(" ")}class en extends e.AbstractComponent{constructor(){super(...arguments),this.name=Qi}render(){this.removeAllChild();const{data:t=[]}=this.attribute;if(e.isEmpty(t))return;const i=[],n=[];t.forEach((t=>{const{start:o,end:r}=t;((t,i)=>{const{start:n,end:o}=i,r=n.x===o.x,a=r?"x":"y",s=r?"y":"x";let l=!0;const d=1e-6;t.length&&t.forEach((t=>{if(e.isNumberClose(t.start[a],n[a])){const e=Math.min(n[s],o[s]),i=Math.max(n[s],o[s]),r=Math.min(t.start[s],t.end[s]),a=Math.max(t.start[s],t.end[s]);if(!(i<r-d||e>a+d))return t.start[s]=Math.min(r,e),t.end[s]=Math.max(a,i),void(l=!1)}})),l&&t.push(i)})(o.x===r.x?i:n,t)})),[...i,...n].forEach(((t,i)=>{var n;const{start:o,end:r,size:a=4,gap:s=5,style:l={}}=t,d=y(t,["start","end","size","gap","style"]),c=e.createGroup({}),h=o.x===r.x;let u,g,p,m;h?(u={x:o.x-s/2,y:o.y},g={x:r.x-s/2,y:r.y},p={x:o.x+s/2,y:o.y},m={x:r.x+s/2,y:r.y}):(u={x:o.x,y:o.y-s/2},g={x:r.x,y:r.y-s/2},p={x:o.x,y:o.y+s/2},m={x:r.x,y:r.y+s/2});const v=tn(u,g,a,h?75:15,h),x=tn(o,r,a,h?75:15,h),f=tn(p,m,a,h?75:15,h);c.add(e.createPath(Object.assign(Object.assign({path:v,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath(Object.assign(Object.assign({path:f,stroke:"#000",lineWidth:1},l),{pickable:!1,zIndex:1}))),c.add(e.createPath({path:x,stroke:"#fff",lineWidth:s,pickable:!1,zIndex:0})),c.name="series-break",c.data=d,e.isValid(d.axisId)&&(c.id=`${null!==(n=d.axisId)&&void 0!==n?n:""}_${i}`),this.add(c)}))}}function nn(t,e,i=1){return Math.abs(t-e)<i}function on(t,i){return{type:"component",componentType:Qi,interactive:!0,zIndex:500,style:{data:(n,o)=>{const r=[],a=o.vchart.getChart(),s="horizontal"===a.getAllSeries()[0].direction;return t.forEach(((t,n)=>{var o,l;const d=t.id,c=e.isValid(d)?a.getComponentByUserId(d):i&&e.isValid(i[n])?a.getComponentByIndex("axes",i[n]):null===(o=a.getComponentsByKey("axes").filter((e=>e.getSpec().breaks===t.breaks)))||void 0===o?void 0:o[0];if(!c)return;const h=null!=d?d:`${c.type}-${c.id}`,u=function(t){let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,o=i+t[0].getLayoutRect().height;for(let r=1;r<t.length;r++){const a=t[r],{x:s,y:l}=a.getLayoutStartPoint(),{width:d,height:c}=a.getLayoutRect();e=Math.min(e,s),n=Math.max(n,d+s),i=Math.min(i,l),o=Math.max(o,c+l)}return{x1:e,y1:i,x2:n,y2:o}}(c.getRegions());e.array(null===(l=c._break)||void 0===l?void 0:l.breaks).forEach((t=>{const{range:e,breakSymbol:i,gap:n=5}=t,o=c.valueToPosition(e[0]),l=c.valueToPosition(e[1]),d=(o+l)/2+(s?u.x1:u.y1);a.getAllSeries().forEach((t=>{if("bar"===t.type||"waterfall"===t.type){t.getMarkInName("bar").getGraphics().forEach((t=>{const a=t.AABBBounds;let c,g,p,y,m=!1;s?(m=a.x1<(o+l-n)/2&&a.x2>(o+l+n)/2,c=d,g=Math.max(a.y1+u.y1-2,u.y1),p=d,y=Math.min(a.y2+u.y1+2,u.y2)):(m=a.y1<(o+l-n)/2&&a.y2>(o+l+n)/2,c=Math.max(a.x1+u.x1-2,u.x1),g=d,p=Math.min(a.x2+u.x1+2,u.x2),y=d),m&&r.push({start:{x:c,y:g},end:{x:p,y:y},gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}))}else if("line"===t.type){t.getMarkInName(t.type).getGraphics().forEach((t=>{an(t,"line").forEach((t=>{rn(s?{start:{x:(o+l)/2,y:0},end:{x:(o+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(o+l)/2},end:{x:u.x2-u.x1,y:(o+l)/2}},t).forEach((t=>{let o,a;s?(o={x:d,y:Math.max(t[1]+u.y1-10,u.y1)},a={x:d,y:Math.min(t[1]+u.y1+10,u.y2)}):(o={x:Math.max(t[0]+u.x1-10,u.x1),y:d},a={x:Math.min(t[0]+u.x1+10,u.x2),y:d}),r.push({start:o,end:a,gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}))}))}))}else if("area"===t.type){t.getMarkInName("area").getGraphics().forEach((t=>{an(t,"area").forEach((t=>{const a=rn(s?{start:{x:(o+l)/2,y:0},end:{x:(o+l)/2,y:u.y2-u.y1}}:{start:{x:0,y:(o+l)/2},end:{x:u.x2-u.x1,y:(o+l)/2}},t);a.sort(((t,e)=>t[0]-e[0]));for(let o=0;o<a.length-1;o++){const l={x:a[o][0],y:a[o][1]},d={x:a[o+1][0],y:a[o+1][1]};if(sn(s?{x:l.x,y:(l.y+d.y)/2}:{x:(l.x+d.x)/2,y:l.y},t)){let t,o;s?(t={x:l.x+u.x1,y:Math.max(l.y+u.y1-0,u.y1)},o={x:d.x+u.x1,y:Math.min(d.y+u.y1+0,u.y2)}):(t={x:Math.max(l.x+u.x1-0,u.x1),y:l.y+u.y1},o={x:Math.min(d.x+u.x1+0,u.x2),y:d.y+u.y1}),r.push({start:t,end:o,gap:n,style:null==i?void 0:i.style,axisId:h,data:e})}}}))}))}}))}))})),r}}}}function rn(t,i){const n=[];for(let o=1;o<i.length;o++){const r=e.getIntersectPoint([t.start.x,t.start.y],[t.end.x,t.end.y],[i[o].x,i[o].y],[i[o-1].x,i[o-1].y]);r&&!n.find((t=>nn(e.PointService.distancePP({x:t[0],y:t[1]},{x:r[0],y:r[1]}),0)))&&n.push(r)}return n}function an(t,e){const{points:i,segments:n}=t.attribute,o=[];let r=[];const a=t=>{if(t&&t.length){let i=[];if(t.forEach((t=>{var n,a;if(!1===t.defined){if(o.push(r),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)r.push({x:i[t].x,y:i[t].y});r.push(r[0])}r=[],i=[]}else r.push({x:t.x,y:t.y}),"area"===e&&i.push({x:null!==(n=t.x1)&&void 0!==n?n:t.x,y:null!==(a=t.y1)&&void 0!==a?a:t.y})})),"area"===e&&i.length){for(let t=i.length-1;t>=0;t--)r.push({x:i[t].x,y:i[t].y});r.push(r[0])}o.push(r)}};return i&&i.length?a(i):n&&n.length&&n.forEach((t=>{a(t.points)})),o}function sn(t,e){const{x:i,y:n}=t;let o=!1;for(let t=0,r=e.length-1;t<e.length;r=t++){const{x:a,y:s}=e[t],{x:l,y:d}=e[r];s>n!=d>n&&i<(l-a)*(n-s)/(d-s)+a&&(o=!o)}return o}const ln="barLink";class dn extends e.AbstractComponent{constructor(){super(...arguments),this.name=ln}render(){const{data:t,linkStyle:i,areaStyle:n,styleMap:o,label:r,linkType:a="total"}=this.attribute;e.isEmpty(t)||(this.removeAllChild(),t.forEach(((t,s)=>{var l,d,c,h,u;const{linePoints:g,areaPoints:p,id:y=s,color:m,data:v}=t;if(p&&!1!==(null===(l=null==o?void 0:o[`area-${y}`])||void 0===l?void 0:l.visible)){const t=e.createArea(Object.assign(Object.assign({points:p,fillOpacity:.3,fill:m,zIndex:0},n),null==o?void 0:o[`area-${y}`]));t.name="bar-link-area",t.id=`area-${y}`,this.add(t)}if(g&&!1!==(null===(d=null==o?void 0:o[`line-${y}`])||void 0===d?void 0:d.visible)&&0!==(null===(c=null==i?void 0:i.lineStyle)||void 0===c?void 0:c.lineWidth)&&0!==(null===(h=null==o?void 0:o[`line-${y}`])||void 0===h?void 0:h.lineWidth)){const{startSymbol:t={},endSymbol:n={},lineStyle:r}=i||{},a=e.cloneDeep(t),s=e.cloneDeep(n);(null==o?void 0:o[`line-${y}`])&&o[`line-${y}`].stroke&&(a.style=Object.assign(Object.assign({},a.style),{color:o[`line-${y}`].stroke}),s.style=Object.assign(Object.assign({},s.style),{color:o[`line-${y}`].stroke})),a.symbolType||a.originSymbolType||(a.originSymbolType="solidArrow"),s.symbolType||s.originSymbolType||(s.originSymbolType="solidArrow");const l=new e.Segment({points:g,startSymbol:Object.assign({size:8},a),endSymbol:Object.assign({size:8},s),lineStyle:Object.assign(Object.assign({lineDash:[3,3],lineWidth:1,stroke:"#000"},r),null==o?void 0:o[`line-${y}`]),pickable:!0,childrenPickable:!1,zIndex:1});l.name="bar-link-line",l.id=`line-${y}`,this.add(l)}if((null==r?void 0:r.visible)&&!1!==(null===(u=null==o?void 0:o[`label-${y}`])||void 0===u?void 0:u.visible)){const{style:t,formatMethod:i}=r,[n,s]=v;let l=n[e.STACK_FIELD_END],d=s[e.STACK_FIELD_END];"value"===a&&(l=n[e.STACK_FIELD_END]-n[e.STACK_FIELD_START],d=s[e.STACK_FIELD_END]-s[e.STACK_FIELD_START]);const c=d-l,h=(d-l)/l*100,u=e.createText(Object.assign(Object.assign({x:.5*(g[0].x+g[1].x),y:.5*(g[0].y+g[1].y),text:i?i(c,h,v):`${c} ${h}`,fontSize:14,fill:"#000",stroke:"#fff",lineWidth:1,textAlign:"center",textBaseline:"middle",background:"#fff",zIndex:2},t),null==o?void 0:o[`label-${y}`]));u.name="bar-link-label",u.id=`label-${y}`,this.add(u)}})))}}function cn(t,i,n){const{isHorizontal:o,isXAxisInverse:r,isYAxisInverse:a,linkType:s,doFill:l,regionStartX:d,regionStartY:c}=n,h=t.AABBBounds,u=i.AABBBounds;let g,p;return o?(g=[{x:(h.x1+h.x2)/2+d,y:h.y1+c},{x:(u.x1+u.x2)/2+d,y:u.y2+c}],r?("total"===s&&(g=[{x:h.x1+d,y:h.y1+c},{x:u.x1+d,y:u.y2+c}]),l&&(p=[{x:h.x1+d,x1:h.x2+d,y:h.y1+c},{x:u.x1+d,x1:u.x2+d,y:u.y2+c}])):("total"===s&&(g=[{x:h.x2+d,y:h.y1+c},{x:u.x2+d,y:u.y2+c}]),l&&(p=[{x:h.x2+d,x1:h.x1+d,y:h.y1+c},{x:u.x2+d,x1:u.x1+d,y:u.y2+c}]))):(g=[{x:h.x2+d,y:(h.y1+h.y2)/2+c},{x:u.x1+d,y:(u.y1+u.y2)/2+c}],a?("total"===s&&(g=[{x:h.x2+d,y:h.y2+c},{x:u.x1+d,y:u.y2+c}]),l&&(p=[{x:h.x2+d,y:h.y2+c,y1:h.y1+c},{x:u.x1+d,y:u.y2+c,y1:u.y1+c}])):("total"===s&&(g=[{x:h.x2+d,y:h.y1+c},{x:u.x1+d,y:u.y1+c}]),l&&(p=[{x:h.x2+d,y:h.y1+c,y1:h.y2+c},{x:u.x1+d,y:u.y1+c,y1:u.y2+c}]))),{areaPoints:p,linePoints:g,data:[e.getDatumOfGraphic(t),e.getDatumOfGraphic(i)],color:t.attribute.fill}}function hn(t={},i){const{linkType:n="total",doFill:o}=t,r=y(t,["linkType","doFill"]);return{type:"component",componentType:ln,zIndex:500,interactive:!1,style:Object.assign(Object.assign({data:(t,i)=>{const{vchart:r}=i,a=r.getChart().getAllRegions(),s=[];return a.forEach((t=>{const i=t.getSeries().filter((t=>"bar"===t.type)),{x:r,y:a}=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 d=function(t,i){const n={};for(let o=0;o<t.length;o++){const r=t[o],a=e.getDatumOfGraphic(r),s=i.map((t=>a[t])).join("-");n[s]||(n[s]=[]),n[s].push(r)}return n}(l,t);Object.values(d).forEach((t=>{t.sort(((t,i)=>e.getDatumOfGraphic(t)[e.STACK_FIELD_END]-e.getDatumOfGraphic(i)[e.STACK_FIELD_END]))}));const c=i[0],h="horizontal"===c.direction,u=c.getYAxisHelper().isInverse(),g=c.getXAxisHelper().isInverse(),p=Object.values(d);if(p.length)if(h){p[0][0].AABBBounds.y1<p[p.length-1][0].AABBBounds.y1&&p.reverse()}else{p[0][0].AABBBounds.x1>p[p.length-1][0].AABBBounds.x1&&p.reverse()}for(let t=0;t<p.length-1;t++){const e=p[t],i=p[t+1];if(e.forEach(((t,e)=>{var l;const d=cn(t,null!==(l=i[e])&&void 0!==l?l:i[i.length-1],{isHorizontal:h,isXAxisInverse:g,isYAxisInverse:u,doFill:o,linkType:n,regionStartX:r,regionStartY:a});s.push(d)})),e.length<i.length){const t=e[e.length-1];for(let l=e.length;l<i.length;l++){const e=cn(t,i[l],{isHorizontal:h,isXAxisInverse:g,isYAxisInverse:u,doFill:o,linkType:n,regionStartX:r,regionStartY:a});s.push(e)}}}}})),s},linkType:n},r),i)}}const un="seriesLabel";function gn(t,e=10,i=10,n=.1){const o=t.length;if(!t.every(isFinite))return t;if(!(o>1))return t;const r=function(t,e,i){t=+t,e=+e;let n=arguments.length;i=n<2?(e=t,t=0,1):n<3?1:+i;let o=-1;n=0|Math.max(0,Math.ceil((e-t)/i));const r=new Array(n);for(;++o<n;)r[o]=t+o*i;return r}(t.length);for(let a=0;a<i;++a){r.sort(((e,i)=>{return n=t[e],o=t[i],null==n||null==o?NaN:n<o?-1:n>o?1:n>=o?0:NaN;var n,o}));let i=0;for(let n=1;n<o;++n){let o=t[r[n]]-t[r[n-1]];o<e&&(o=(e-o)/2,i=Math.max(i,o),t[r[n-1]]-=o,t[r[n]]+=o)}if(i<n)break}return t}function pn(t,e){return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1)}function yn(t,e=10,i=10){const n=t.length;let o,r=0;do{o=!1;for(let i=0;i<n;++i)for(let r=i+1;r<n;++r){const n=t[i].AABBBounds,a=t[r].AABBBounds;if(pn(n,a)){const i=e-(a.x1-n.x2);i>0&&(t[r].attribute.x+=i,a.x1+=i,a.x2+=i,o=!0)}}r++}while(o&&r<i)}function mn(t,i){const{label:n,line:o}=i;return{type:"component",componentType:un,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,n)=>{var o;const r=n.vchart.getChart(),a=r.getAllSeries()[0],s="horizontal"===a.direction,l=s?a.getYAxisHelper():a.getXAxisHelper(),d=null===(o=l.getScale)||void 0===o?void 0:o.call(l,0),c=l.isInverse(),h=a.getDimensionField()[0],u=a.getSeriesField(),g=r.getAllSeries().map((t=>t.type)).filter(((t,e,i)=>i.indexOf(t)===e)),p=[];if(1===g.length&&["bar","area","line","waterfall"].includes(g[0])){("both-ends"===t?["start","end"]:[t]).forEach((t=>{const i="end"===t?e.last(d.domain()):d.domain()[0],n=a.getRegion(),{x:o,y:l}=n.getLayoutStartPoint();let y=0;r.getAllSeries().forEach((e=>{e.getMarkInName("waterfall"===g[0]?"bar":g[0]).getGraphics().forEach((n=>{var r;const a=n.context.data.find((t=>t[h]===i));if(a){const i=n.AABBBounds;let d,m,v,x;"bar"===g[0]||"waterfall"===g[0]?(d="end"===t?{x:s?(i.x1+i.x2)/2:c?i.x1:i.x2,y:s?c?i.y2:i.y1:(i.y1+i.y2)/2}:{x:s?(i.x1+i.x2)/2:c?i.x2:i.x1,y:s?c?i.y1:i.y2:(i.y1+i.y2)/2},m=n.attribute.fill):(d=e.dataToPosition(a),m=n.attribute.stroke||n.attribute.fill),"end"===t?(v=s?"center":c?"end":"start",x=s?c?"top":"bottom":"middle"):(v=s?"center":c?"start":"end",x=s?c?"bottom":"top":"middle");const f=null!==(r=a[u])&&void 0!==r?r:a[h];p.push({point:{x:d.x+o,y:d.y+l},label:f,color:m,textAlign:v,textBaseline:x,series:e,datum:a,id:`${t}-${y}`,position:t}),y++}}))}))}))}return p},line:o,label:Object.assign({space:12},n)}}}class vn extends e.AbstractComponent{constructor(){super(...arguments),this.name=un}render(){var t,i,n,o;this.removeAllChild();const{data:r,layout:a,label:s,line:l={}}=this.attribute;if(e.isEmpty(r))return;const d=null!==(t=null==s?void 0:s.styleMap)&&void 0!==t?t:{},c={},h=r.filter((t=>{var e;return!1!==(null===(e=d[t.id])||void 0===e?void 0:e.visible)}));if("vertical"===a){const t=1.5*(null!==(n=null===(i=null==s?void 0:s.style)||void 0===i?void 0:i.fontSize)&&void 0!==n?n:12),o=(t,i,n)=>{var o,r,a,s,l,d,c,h;const{label:u,color:g,textAlign:p,textBaseline:y,id:m}=t,v=null!==(r=null===(o=n[m])||void 0===o?void 0:o.formatMethod)&&void 0!==r?r:null===(a=this.attribute.label)||void 0===a?void 0:a.formatMethod,x=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:v?v(u,t.datum,{series:t.series}):u},null===(s=this.attribute.label)||void 0===s?void 0:s.style),i),{textAlign:p,textBaseline:y,fill:null!==(c=null===(d=null===(l=this.attribute.label)||void 0===l?void 0:l.style)||void 0===d?void 0:d.fill)&&void 0!==c?c:g}),null===(h=n[m])||void 0===h?void 0:h.style));return x.name="series-label-text",x.id=m,this.add(x),x};["start","end"].forEach((e=>{const i=h.filter((t=>t.position===e)),n=gn(i.map((t=>t.point.y)),t);i.forEach(((t,e)=>{var i;const r={x:t.point.x+(null!==(i=null==s?void 0:s.space)&&void 0!==i?i:8)*("start"===t.textAlign?1:-1),y:n[e]};o(t,r,d),c[t.id]=r}))}))}else{const t=[],i=[];h.forEach((n=>{var o,r,a,l,c;const{point:h,label:u,color:g,textAlign:p,textBaseline:y,id:m,position:v}=n,x={x:h.x,y:h.y},f=null!==(r=null===(o=d[m])||void 0===o?void 0:o.formatMethod)&&void 0!==r?r:null==s?void 0:s.formatMethod,b=e.createText(Object.assign(Object.assign(Object.assign(Object.assign({text:f?f(u,n.datum,{series:n.series}):u},null==s?void 0:s.style),x),{textAlign:p,textBaseline:y,fill:null!==(l=null===(a=null==s?void 0:s.style)||void 0===a?void 0:a.fill)&&void 0!==l?l:g}),null===(c=d[m])||void 0===c?void 0:c.style));b.id=m,b.name="series-label-text",this.add(b),"start"===v?t.push(b):"end"===v&&i.push(b)})),t.length&&yn(t,4,10),i.length&&yn(i,4,10);const n=null!==(o=null==s?void 0:s.space)&&void 0!==o?o:8;[...t,...i].forEach((t=>{const e="top"===t.attribute.textBaseline?1:-1;t.setAttribute("y",t.attribute.y+n*e),c[t.id]={x:t.attribute.x,y:t.attribute.y}}))}!1!==l.visible&&h.forEach((t=>{var i,n,o,r,s,h;const{point:u,color:g,id:p}=t,y={x:c[p].x+(null!==(o=null===(n=null===(i=d[p])||void 0===i?void 0:i.style)||void 0===n?void 0:n.dx)&&void 0!==o?o:0),y:c[p].y+(null!==(h=null===(s=null===(r=d[p])||void 0===r?void 0:r.style)||void 0===s?void 0:s.dy)&&void 0!==h?h:0)};if(!1!==l.autoVisible){if("vertical"===a&&u.y!==y.y||"horizontal"===a&&u.x!==y.x){const t=e.createLine(Object.assign({points:[u,y],lineWidth:1,stroke:g},l.style));t.name="series-label-line",this.add(t)}}else{const t=e.createLine(Object.assign({points:[u,y],lineWidth:1,stroke:g},l.style));t.name="series-label-line",this.add(t)}}))}}function xn(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 fn(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e,i;return Object.assign(Object.assign({},t),{bound:(i=t.rect,{x1:i.x,x2:i.x+i.width,y1:i.y,y2:i.y+i.height}),anchorCandidates:An(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const o=i[t],r=o.bound;let a=n.some((t=>xn(t,r)));if(o.anchorCandidates)if(a&&(null===(e=o.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t<o.anchorCandidates.length;t++){const e=o.anchorCandidates[t],i={x1:e.x,y1:e.y,x2:e.x+r.x2-r.x1,y2:e.y+r.y2-r.y1,anchor:e};if(!n.some((t=>xn(t,i)))){n.push(i),a=!1;break}}a&&n.push(o.bound)}else n.push(o.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function bn(t,i,n){const o=t.map((t=>t.pointCoord)),{x1:r,x2:a,y1:s,y2:l}=e.getAABBFromPoints(o),d=n([(r+a)/2,(s+l)/2]);if(!d)return[];const c=t.map((t=>{const o=t.rect,r=Sn(i,t.pointCoord)?n(function(t,i,n,o=200){const r=5621/o;let a=i;for(let i=1;i<=r;i++){const i=e.destination(a,o,n);if(!Sn(t,i))return[i.x,i.y];a=[i.x,i.y]}return i}(i,[t.pointCoord.x,t.pointCoord.y],kn(_n(t.point,d)))):t.point;r&&(o.x=r.x,o.y=r.y);const a=kn(_n(t.point,d));let s;const l=[];return a>=-45&&a<45?(s="top",l.push("left","right")):a>=45&&a<135?s="right":a>=-135&&a<-45?(s="left",l.push("left")):(s="bottom",l.push("left","right")),t.anchors=l,t.offset=20,t.rect=Mn(t.rect,s,0),t}));return fn(c)}function kn(t){return t>180?t-360:t}function _n(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function Sn(t,i){for(let n=0;n<t.length;n++){if(e.isPointInPolygon(i,t[n]))return!0}return!1}function Mn(t,e,i=0){const n=Object.assign({},t);return"top"===e?(n.x-=t.width/2,n.y-=i+t.height/2):"bottom"===e?(n.x-=t.width/2,n.y+=i-t.height/2):"left"===e?(n.x-=i+t.width,n.y-=t.height/2):"right"===e&&(n.x+=i,n.y-=t.height/2),n}function An(t,e,i,n=0){const o=[];return t.forEach((t=>{const{x:r,y:a}=Mn(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);o.push({x:r,y:a})})),o}const wn={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 Cn extends e.BaseComponentSpecTransformer{_getDefaultSpecFromChart(){return wn}}class Ln extends e.BaseComponent{constructor(){super(...arguments),this.type="mapLabel",this.name=" mapLabel",this.specKey="mapLabel",this.transformerConstructor=Cn,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,n;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===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,o,r,a,s;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===(o=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===o?void 0:o.longitudeField,this._latitudeField=null===(s=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===s?void 0:s.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 n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?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=[],n=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,i)=>{var n;const o=new e.MarkPoint({position:void 0,animation:!1});return o&&(o.name=`${this.name}_marker_${i}`,o.id=null!==(n=this._spec.id)&&void 0!==n?n:`${this.name}_marker_${this.id}`,o.setAttribute("zIndex",this.layoutZIndex)),o})));this._markerComponents.forEach(((t,e)=>{const{pairInfo:o,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[e],e);o&&i.push(o),r&&n.push(r)}));const o=this._layoutLabels(i);this._layoutMarkers(o,n),this._renderMarkers()}_evaluateMarker(t,i){var n,o,r,a,s,l,d,c,h,u,g,p,y,m;let v=0,x=0,f=0,b=0,k=0;const _=this._spec.position||"top",S=this._spec.offset,M=e.normalizeLayoutPaddingSpec(null===(n=this._spec.background)||void 0===n?void 0:n.padding),A=this._spec.space||0;x+=((null==M?void 0:M.left)||0)+((null==M?void 0:M.right)||0),f+=((null==M?void 0:M.top)||0)+((null==M?void 0:M.bottom)||0);const w={},C=this.dataToPosition(t),L=e.graphicCreator.group({});if(L.name=`${this.name}_marker_itemContainer_${i}`,w.container=L,null===(o=this._spec.background)||void 0===o?void 0:o.visible){const t=e.graphicCreator.rect(e.transformToGraphic(Object.assign({},this._spec.background.style)));t.setAttributes(C),w.labelBackground=t,L.appendChild(t)}if(null===(r=this._spec.icon)||void 0===r?void 0:r.visible){const t=e.graphicCreator.symbol(e.transformToGraphic(Object.assign({},this._spec.icon.style)));t.setAttributes(C),t.setAttribute("symbolType",null!==(s=null===(a=this._spec.icon.style)||void 0===a?void 0:a.symbolType)&&void 0!==s?s:null===(l=this._spec.icon.style)||void 0===l?void 0:l.shape);const i=t.AABBBounds,n=null!==(d=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==d?d:0,o=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;w.icon=t,L.appendChild(t),k=n,b+=o,v++}if(null===(h=this._spec.nameLabel)||void 0===h?void 0:h.visible){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.nameLabel.style)));i.setAttributes(C),i.setAttribute("text",t[this.nameField]);const n=i.AABBBounds,o=null!==(u=(null==n?void 0:n.y2)-(null==n?void 0:n.y1))&&void 0!==u?u:0,r=null!==(g=(null==n?void 0:n.x2)-(null==n?void 0:n.x1))&&void 0!==g?g:0;w.nameLabel=i,L.appendChild(i),k=Math.max(k,o),b+=r,v++}if((null===(p=this._spec.valueLabel)||void 0===p?void 0:p.visible)&&e.isValid(t[this.valueField])){const i=e.graphicCreator.text(e.transformToGraphic(Object.assign({},this._spec.valueLabel.style)));i.setAttributes(C),i.setAttribute("text",t[this.valueField]);const n=i.AABBBounds,o=null!==(y=(null==n?void 0:n.y2)-(null==n?void 0:n.y1))&&void 0!==y?y:0,r=null!==(m=(null==n?void 0:n.x2)-(null==n?void 0:n.x1))&&void 0!==m?m:0;w.valueLabel=i,L.appendChild(i),k=Math.max(k,o),b+=r,v++}const F=Object.values(w).find((t=>!!t&&"group"!==t.type)),O={x:null==F?void 0:F.getComputedAttribute("x"),y:null==F?void 0:F.getComputedAttribute("y")},T={x:O.x,y:O.y,width:0,height:0};T.width=x+b+(v-1)*A,T.height=f+k;const B={rect:T,point:O,index:i};if("outer"!==_){const t=["top","right","left","bottom"].filter((t=>t!==_));B.rect=Mn(T,_,S),B.anchors=t,B.offset=S}else B.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:B,contentMarks:w}}_layoutMarkers(t,i){var n,o,r;for(let a=0;a<i.length;a++){if(!t[a]||!i[a])return;const{icon:s,nameLabel:l,valueLabel:d,labelBackground:c,container:h}=i[a],u=t[a],g=e.normalizeLayoutPaddingSpec(null===(n=this._spec.background)||void 0===n?void 0:n.padding),p=this._spec.space||0,y=u.height/2;let m=(null==g?void 0:g.left)||0;[s,l,d].forEach(((t,e)=>{var i,n;if(t){const o=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=o.x2-o.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:y}),m+=null!==(n=o.x2-o.x1)&&void 0!==n?n:0,2!==e&&(m+=p)}})),null==c||c.setAttributes({x:0,y:0,width:u.width,height:u.height}),null==h||h.setAttributes({dx:-u.width/2,dy:-u.height/2});const v=this._data.getLatestData()[a],x=this.dataToPosition(v),f=this.getRegions()[0].getLayoutStartPoint(),b=!(!(null===(o=this._spec.leader)||void 0===o?void 0:o.visible)||!(s||l||d));this._markerComponents[a].setAttributes({x:f.x,y:f.y,position:x,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>h,autoRotate:!1,offsetX:u.x+u.width/2-x.x,offsetY:u.y+u.height/2-x.y},itemLine:{visible:b,type:"type-po",lineStyle:e.transformToGraphic(Object.assign({},null===(r=this._spec.leader)||void 0===r?void 0:r.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?bn(t,this._map,(t=>this._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):fn(t)}_isRelativeModel(t){var e,i,n;const o=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===o}_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}}Ln.type="mapLabel",Ln.specKey="mapLabel",Ln.transformerConstructor=Cn;const Fn="regressionLine";class On extends e.AbstractComponent{constructor(){super(...arguments),this.name=Fn}render(){this.removeAllChild();const{data:t,line:i={},label:n,name:o="regression-line",confidenceInterval:r}=this.attribute;e.isEmpty(t)||t.forEach((t=>{const{color:a}=t;if(t.area&&!1!==(null==r?void 0:r.visible)){const i=e.createArea(Object.assign(Object.assign({points:t.area},e.isValid(a)?{fill:a,fillOpacity:.12}:null),null==r?void 0:r.style));i.name="scatter-regression-area",this.add(i)}if(t.line&&!1!==(null==i?void 0:i.visible)){const n=e.createLine(Object.assign(Object.assign({points:t.line,lineWidth:1},e.isValid(a)?{stroke:a}:null),null==i?void 0:i.style));n.name=`${o}-curve`,this.add(n)}const s=e.last(t.line);if(n&&!1!==n.visible&&n.text&&s){const t=e.createText(Object.assign(Object.assign(Object.assign({},s),{text:n.text,textAlign:"end",textBaseline:"middle"}),n.style));t.name=`${o}-label`,this.add(t)}}))}}const Tn=(t,i,n=(t=>t.x),o=(t=>t.y),r)=>{switch(t){case"logisitc":return e.regressionLogistic(i,n,o);case"lowess":return e.regressionLowess(i,n,o);case"polynomial":return e.regressionPolynomial(i,n,o,{degree:r});default:return e.regressionLinear(i,n,o)}};function Bn(t,i){const{color:n,line:o,confidenceInterval:r,label:a}=i;return{type:"component",componentType:Fn,interactive:!1,style:{data:(o,r)=>{const a=r.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.scatter)),s=[];return a&&a.length&&a.forEach((o=>{var r,a;const l=o.getRegion().getLayoutStartPoint(),d=o.getRegion().getLayoutRect(),c=e.clamper(l.y,l.y+d.height),h=o.getColorAttribute(),u=o.getSeriesKeys(),g=o.getViewData().latestData,p=null===(r=o.fieldX)||void 0===r?void 0:r[0],y=null===(a=o.fieldY)||void 0===a?void 0:a[0];p&&y&&g&&!(g.length<=2)&&u.forEach((e=>{var r;const a=g.filter((t=>t[null==h?void 0:h.field]===e));if(!a.length)return;const{evaluateGrid:u,confidenceInterval:m}=Tn(t,a,(t=>null==t?void 0:t[p]),(t=>null==t?void 0:t[y]),i.polynomialDegree),v=Math.max(3,Math.floor(a.length/4)),x=u(v),f=m(v);s.push({color:null!=n?n:null===(r=null==h?void 0:h.scale)||void 0===r?void 0:r.scale(e),line:x.map((e=>{const i={[p]:e.x,[y]:e.y};return{x:o.dataToPositionX(i)+l.x,y:c("logisitc"===t?l.y+d.height*(1-e.y):o.dataToPositionY(i)+l.y)}})),area:f.map((t=>{const e={[p]:t.x,[y]:t.lower};return{x:o.dataToPositionX(e)+l.x,y:c(o.dataToPositionY(e)+l.y),y1:c(o.dataToPositionY({[y]:t.upper})+l.y)}}))})}))})),s},line:o,confidenceInterval:r,label:a}}}function In(t){const{color:i,line:n,confidenceInterval:o,label:r}=t;return{type:"component",componentType:Fn,interactive:!1,zIndex:500,style:{data:(n,o)=>{const r=o.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return r&&r.length&&r.forEach((n=>{var o,r,s;const l=n.getRegion().getLayoutStartPoint(),d=n.getRegion().getLayoutStartPoint(),c=n.getRegion().getLayoutRect(),h=e.clamper(d.y,d.y+c.height),u=n.getViewData().latestData,g=null===(o=n.fieldX)||void 0===o?void 0:o[0],p=null===(r=n.fieldY)||void 0===r?void 0:r[0],y="horizontal"===n.direction,m=n.getRawDataStatisticsByField(g).values;if(y||!g||!p||!u||u.length<=2||m.length<=2)return;const{evaluateGrid:v,confidenceInterval:x}=e.regressionPolynomial(u,(t=>m.indexOf(null==t?void 0:t[g])),(t=>null==t?void 0:t[p]),{degree:t.degree}),f=m.length,b=v(f),k=x(f),_=n.getXAxisHelper().getBandwidth(0)/2;a.push({color:null!=i?i:null===(s=n.getOption().globalScale.getScale("color"))||void 0===s?void 0:s.scale(n.getSeriesKeys()[0]),line:b.map((t=>{const e={[g]:m[t.x],[p]:t.y};return{x:n.dataToPositionX(e)+l.x+_,y:h(n.dataToPositionY(e)+l.y)}})),area:k.map((t=>{const e={[g]:m[t.x],[p]:t.lower};return{x:n.dataToPositionX(e)+l.x+_,y:h(n.dataToPositionY(e)+l.y),y1:h(n.dataToPositionY({[p]:t.upper})+l.y)}}))})})),a},line:n,confidenceInterval:o,label:r}}}const Dn=(t,i,n)=>{switch(t){case"kde":return e.kde(i,n);case"ecdf":return e.ecdf(i)}};function En(t,i){const{line:n,label:o,color:r}=i;return{type:"component",componentType:Fn,interactive:!1,zIndex:500,style:{data:(i,n)=>{const o=n.vchart.getChart().getAllSeries().filter((t=>t.type===e.SeriesTypeEnum.bar)),a=[];return o&&o.length&&o.forEach((i=>{var n,o,s,l,d,c,h,u;const g=i.getRegion().getLayoutStartPoint(),p=i._rawData,y=null==p?void 0:p.rawData,m=null===(o=null===(n=p.transformsArr)||void 0===n?void 0:n.find((t=>"bin"===t.type)))||void 0===o?void 0:o.options,v=null===(s=i.fieldX)||void 0===s?void 0:s[0],x=i.getYAxisHelper().getScale(0),f=i.getViewData().latestData;if(!(y&&y.length&&(null==m?void 0:m.field)&&x&&f&&f.length))return;const b=y.map((t=>t[m.field])),k=Dn(t,b,"kde"===t?{bandwidth:f[0][null!==(d=null===(l=m.outputNames)||void 0===l?void 0:l.x1)&&void 0!==d?d:"x1"]-f[0][null!==(h=null===(c=m.outputNames)||void 0===c?void 0:c.x0)&&void 0!==h?h:"x0"]}:null),_=Math.max(3,Math.floor(b.length/4)),S=k.evaluateGrid(_),M=x.range(),A=M[0],w=e.last(M),C="kde"===t?t=>x.scale(t*y.length*k.bandwidth):t=>A+(w-A)*t;a.push({color:null!=r?r:null===(u=i.getOption().globalScale.getScale("color"))||void 0===u?void 0:u.scale(i.getSeriesKeys()[0]),line:S.map((t=>{const e={[v]:t.x};return{x:i.dataToPositionX(e)+g.x,y:C(t.y)+g.y}}))})})),a},line:n,label:o}}}const jn="ExtensionMarkSyncStatePlugin";class Pn extends e.BasePlugin{constructor(){super(jn),this.type=jn}onAfterInitChart(t,i){var n;if(!this._detectSyncState(i))return;const o=t.globalInstance.getChart();if(!o)return;const r=o.getEvent();if(this._subscribedEvent===r)return;null===(n=this._unsubscribeAfterRender)||void 0===n||n.call(this);const a=()=>this._syncStates();r.on(e.ChartEvent.afterRender,a),this._subscribedEvent=r,this._unsubscribeAfterRender=()=>{r.off(e.ChartEvent.afterRender,a),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 n=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==n?void 0:n.length)&&this._syncSeriesStates(t,n)}))}_syncSeriesStates(t,i){const n=new Map;if(t.getActiveMarks().forEach((t=>{t.getGraphics().forEach((t=>{var i;const o=null===(i=t.context)||void 0===i?void 0:i.key;e.isValid(o)&&n.set(String(o),t)}))})),0===n.size)return;const o=`${t.type}_${t.id}_extensionMark`;i.forEach(((i,r)=>{const a=e.isValid(i.name)?`${i.name}`:`${o}_${r}`,s=t.getMarkInName(a);s&&s.getGraphics().forEach((t=>{var i;const o=null===(i=t.context)||void 0===i?void 0:i.key;if(!e.isValid(o))return;const r=n.get(String(o));if(!r)return;const a=r.currentStates;(null==a?void 0:a.length)?t.useStates(a):t.clearStates()}))}))}}Pn.pluginType="chart",Pn.type=jn;t.BAR_LINK=ln,t.Bar3dChart=rt,t.Bar3dChartSpecTransformer=N,t.Bar3dSeries=et,t.Bar3dSeriesSpecTransformer=J,t.BarLinkComponent=dn,t.CandlestickChart=Dt,t.CandlestickChartSpecTransformer=_t,t.CandlestickSeries=Bt,t.CombinationCandlestickChart=Pt,t.CombinationCandlestickChart_TYPE=kt,t.ConversionFunnelChart=L,t.ConversionFunnelSeries=F,t.DEFAULT_STROKE_COLOR="#000",t.DefaultBandWidth=6,t.ExtensionMarkSyncStatePlugin=Pn,t.Funnel3dChart=ut,t.Funnel3dSeries=ct,t.Funnel3dSeriesSpecTransformer=st,t.Histogram3dChart=gt,t.ImageCloudChart=Ee,t.MapLabelComponent=Ln,t.PictogramChart=Me,t.PictogramChartSpecTransformer=ne,t.PictogramSeries=_e,t.Pie3dChart=bt,t.Pie3dChartSpecTransformer=pt,t.Pie3dSeries=xt,t.Pie3dSeriesSpecTransformer=vt,t.REGRESSION_LINE=Fn,t.RangeColumn3dChart=Jt,t.RangeColumn3dChartSpecTransformer=qt,t.RangeColumn3dSeries=Yt,t.RangeColumn3dSeriesSpecTransformer=Zt,t.RankingBar=a,t.RankingList=p,t.RegressionLine=On,t.SERIES_BREAK=Qi,t.SequenceScatterKDE=P,t.SequenceScatterLink=B,t.SequenceScatterPixel=V,t.SeriesBreakComponent=en,t.SeriesLabelComponent=vn,t.StorylineChart=Ji,t.StorylineChartSpecTransformer=Ki,t.TimelineChart=Ve,t.WordCloud3dChart=Wt,t.WordCloud3dChartSpecTransformer=Nt,t.WordCloud3dSeries=$t,t.appendBarLinkConfig=function(t,i){t.customMark=e.array(t.customMark).filter((t=>t.componentType!==ln)),t.customMark.push(hn(i))},t.appendBarRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.bar)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const i=y(e,["visible"]);t.customMark.push(In(i))}}))},t.appendHistogramRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.bar)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,n=y(e,["type"]);t.customMark.push(En(i,n))}}))},t.appendScatterRegressionLineConfig=function(t,i){var n,o;i||(i=null!==(n=e.get(t,Fn))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o.find((t=>t.type===e.SeriesTypeEnum.scatter)),Fn)),e.array(i).forEach((e=>{if(!1!==e.visible){t.customMark||(t.customMark=[]);const{type:i}=e,n=y(e,["type"]);t.customMark.push(Bn(i,n))}}))},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!==Qi)),t.customMark.push(on(i,i.map((e=>t.axes.indexOf(e))))),!0}return!1},t.appendSeriesLabelConfig=function(t,i){var n,o,r;if(t.customMark=e.array(t.customMark).filter((t=>t.componentType!==un)),i||(i=null!==(r=null!==(n=e.get(t,un))&&void 0!==n?n:e.get(null===(o=t.series)||void 0===o?void 0:o[0],un))&&void 0!==r?r:{}),i.visible){const{position:e="end"}=i,n=y(i,["position"]);t.customMark.push(mn(e,n))}},t.clearSVGSource=function(){oe.clear(),re=null},t.computeStorylineLayout=He,t.getBarLinkConfig=hn,t.getBarRegressionLineConfig=In,t.getHistogramRegressionLineConfig=En,t.getSVGSource=le,t.getScatterRegressionLineConfig=Bn,t.getSeriesBreakConfig=on,t.getSeriesLabelConfig=mn,t.normalizeLayout=We,t.normalizePadding=Ne,t.register3DPlugin=Z,t.registerAxis3dPlugin=()=>{Z(),ot(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})(),(()=>{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),Gt)}),e.mixin(t,Ut)})()},t.registerBar3dChart=()=>{Z(),ot(),it(),e.Factory.registerChart(rt.type,rt)},t.registerBar3dSeries=it,t.registerBarLink=()=>{e.Factory.registerGraphicComponent(ln,(t=>new dn(t)))},t.registerCandlestickChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),It(),e.Factory.registerChart(Dt.type,Dt)},t.registerCandlestickSeries=It,t.registerCombinationCandlestickChart=()=>{It(),e.Factory.registerChart(Pt.type,Pt)},t.registerConversionFunnelChart=t=>{e.registerMarkFilterTransform();const i=(null==t?void 0:t.VChart)||e.VChart;i&&(i.useChart([L]),i.useSeries([F]))},t.registerEventSeries=ze,t.registerExtensionMarkSyncStatePlugin=()=>{e.registerChartPlugin(Pn)},t.registerFunnel3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),ot(),ht(),e.Factory.registerChart(ut.type,ut)},t.registerFunnel3dSeries=ht,t.registerHistogram3dChart=()=>{e.registerGroupTooltipProcessor(),e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),ot(),it(),e.Factory.registerChart(gt.type,gt)},t.registerImageCloudChart=()=>{De(),e.Factory.registerChart(Ee.type,Ee)},t.registerMapLabel=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useComponent([Ln])},t.registerPictogramChart=()=>{e.registerMarkTooltipProcessor(),Se(),e.Factory.registerChart(Me.type,Me)},t.registerPictogramSeries=Se,t.registerPie3dChart=()=>{e.registerMarkTooltipProcessor(),Z(),ot(),ft(),e.Factory.registerChart(bt.type,bt)},t.registerPie3dSeries=ft,t.registerRangeColumn3dChart=()=>{e.registerDimensionTooltipProcessor(),e.registerMarkTooltipProcessor(),e.registerDimensionEvents(),e.registerDimensionHover(),Z(),ot(),Xt(),e.Factory.registerChart(Jt.type,Jt)},t.registerRangeColumn3dSeries=Xt,t.registerRankingBarChart=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([a])},t.registerRankingList=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([p,e.BarChart])},t.registerRegressionLine=()=>{e.Factory.registerGraphicComponent(Fn,(t=>new On(t)))},t.registerSVGSource=ae,t.registerSequenceScatterKDE=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([P,e.ScatterChart])},t.registerSequenceScatterLink=t=>{const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([B,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 en(t)))},t.registerSeriesLabel=()=>{e.Factory.registerGraphicComponent("seriesLabel",(t=>new vn(t)))},t.registerStorylineChart=t=>{e.registerCommonChart(),e.registerCustomMark(),e.registerGroupMark(),e.registerRectMark(),e.registerTextMark(),e.registerImageMark(),e.registerLineMark(),e.registerPathMark(),e.registerArcMark();const i=(null==t?void 0:t.VChart)||e.VChart;i&&i.useChart([Ji])},t.registerTimelineChart=()=>{e.registerMarkTooltipProcessor(),ze(),e.Factory.registerChart(Ve.type,Ve)},t.registerWordCloud3dChart=Ht,t.registerWordCloud3dSeries=zt,t.registerWordCloudShape3dChart=()=>{Z(),Vt(),Ht()},t.registerWordCloudShape3dSeries=Vt,t.svgSourceMap=oe,t.transformCandlestickSeriesSpec=Et,t.unregisterSVGSource=se}));