UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

5 lines • 129 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{T as e,C as t,a as i,p as s,k as a,X as o,as as n,aM as r,j as l,N as h,g as d,e as c,R as u,r as g,n as p,H as m,_,i as b,av as x,aN as f,P as v,m as y,ag as w,h as P,aO as A,aH as D,F as k,am as T,aP as M,l as S,q as O,M as C,a0 as X,f as Y,aQ as L,L as F,t as I,u as R,aR as j,b as V}from"./Theme.js";import{C as E}from"./ColorSet.js";import{s as G}from"./DefaultTheme.js";import{w as z,c as N,r as B,S as U,a as W,D as H,C as Z,T as K}from"./Tick.js";import{B as q}from"./Button.js";import{d as Q}from"./tslib.es6.js";function J(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function $(e){this._context=e}function ee(e){return new $(e)}function te(e){return e[0]}function ie(e){return e[1]}function se(e,t){var i=N(!0),s=null,a=ee,o=null,n=z(r);function r(r){var l,h,d,c=(r=J(r)).length,u=!1;for(null==s&&(o=a(d=n())),l=0;l<=c;++l)!(l<c&&i(h=r[l],l,r))===u&&((u=!u)?o.lineStart():o.lineEnd()),u&&o.point(+e(h,l,r),+t(h,l,r));if(d)return o=null,d+""||null}return e="function"==typeof e?e:void 0===e?te:N(e),t="function"==typeof t?t:void 0===t?ie:N(t),r.x=function(t){return arguments.length?(e="function"==typeof t?t:N(+t),r):e},r.y=function(e){return arguments.length?(t="function"==typeof e?e:N(+e),r):t},r.defined=function(e){return arguments.length?(i="function"==typeof e?e:N(!!e),r):i},r.curve=function(e){return arguments.length?(a=e,null!=s&&(o=a(s)),r):a},r.context=function(e){return arguments.length?(null==e?s=o=null:o=a(s=e),r):s},r}function ae(e,t,i){var s=null,a=N(!0),o=null,n=ee,r=null,l=z(h);function h(h){var d,c,u,g,p,m=(h=J(h)).length,_=!1,b=new Array(m),x=new Array(m);for(null==o&&(r=n(p=l())),d=0;d<=m;++d){if(!(d<m&&a(g=h[d],d,h))===_)if(_=!_)c=d,r.areaStart(),r.lineStart();else{for(r.lineEnd(),r.lineStart(),u=d-1;u>=c;--u)r.point(b[u],x[u]);r.lineEnd(),r.areaEnd()}_&&(b[d]=+e(g,d,h),x[d]=+t(g,d,h),r.point(s?+s(g,d,h):b[d],i?+i(g,d,h):x[d]))}if(p)return r=null,p+""||null}function d(){return se().defined(a).curve(n).context(o)}return e="function"==typeof e?e:void 0===e?te:N(+e),t="function"==typeof t?t:N(void 0===t?0:+t),i="function"==typeof i?i:void 0===i?ie:N(+i),h.x=function(t){return arguments.length?(e="function"==typeof t?t:N(+t),s=null,h):e},h.x0=function(t){return arguments.length?(e="function"==typeof t?t:N(+t),h):e},h.x1=function(e){return arguments.length?(s=null==e?null:"function"==typeof e?e:N(+e),h):s},h.y=function(e){return arguments.length?(t="function"==typeof e?e:N(+e),i=null,h):t},h.y0=function(e){return arguments.length?(t="function"==typeof e?e:N(+e),h):t},h.y1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:N(+e),h):i},h.lineX0=h.lineY0=function(){return d().x(e).y(t)},h.lineY1=function(){return d().x(e).y(i)},h.lineX1=function(){return d().x(s).y(t)},h.defined=function(e){return arguments.length?(a="function"==typeof e?e:N(!!e),h):a},h.curve=function(e){return arguments.length?(n=e,null!=o&&(r=n(o)),h):n},h.context=function(e){return arguments.length?(null==e?o=r=null:r=n(o=e),h):o},h}$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};class oe extends e{setupDefaultRules(){super.setupDefaultRules();const e=this._root.interfaceColors,h=this._root.language,d=this.rule.bind(this);d("XYChart").setAll({colors:E.new(this._root,{}),paddingLeft:20,paddingRight:20,paddingTop:16,paddingBottom:16,panX:!1,panY:!1,wheelStep:.25,arrangeTooltips:!0,pinchZoomX:!1,pinchZoomY:!1}),d("XYSeries").setAll({legendLabelText:"{name}"}),d("Rectangle",["plotbackground","xy","background"]).setAll({fill:t.fromHex(0),fillOpacity:0}),d("XYChart",["scrollbar","chart"]).setAll({paddingBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,colors:E.new(this._root,{saturation:0})});{const t=d("Graphics",["scrollbar","overlay"]);t.setAll({fillOpacity:.5}),G(t,"fill",e,"background")}d("RoundedRectangle",["xy","scrollbar","thumb"]).setAll({cornerRadiusTR:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusBL:0,fillOpacity:0,focusable:!0}),d("RoundedRectangle",["xy","scrollbar","thumb"]).states.create("hover",{fillOpacity:.4}),d("RoundedRectangle",["xy","scrollbar","chart","background"]).setAll({cornerRadiusTL:0,cornerRadiusBL:0,cornerRadiusTR:0,cornerRadiusBR:0}),d("RoundedRectangle",["xy","scrollbar","chart","background","resize","button"]).setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),d("AxisRendererX",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0}),d("AxisRendererY",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0,minGridDistance:5}),d("AxisLabel",["xy","scrollbar","x"]).setAll({opacity:.5,centerY:i,minPosition:.01,maxPosition:.99,fontSize:"0.8em"}),d("AxisLabel",["category"]).setAll({text:"{category}",populateText:!0}),d("AxisLabel",["x"]).setAll({centerY:0}),d("AxisLabel",["x","inside"]).setAll({centerY:i}),d("AxisLabel",["x","inside","opposite"]).setAll({centerY:0}),d("AxisLabel",["x","opposite"]).setAll({centerY:i}),d("AxisLabel",["y"]).setAll({centerX:i}),d("AxisLabel",["y","inside"]).setAll({centerX:0}),d("AxisLabel",["y","inside","opposite"]).setAll({centerX:i}),d("AxisLabel",["y","opposite"]).setAll({centerX:0}),d("AxisLabel",["minor"]).setAll({fontSize:"0.6em"}),d("AxisLabel",["xy","scrollbar","y"]).setAll({visible:!1}),d("Grid",["xy","scrollbar","y"]).setAll({visible:!1}),d("Grid",["xy","scrollbar","x"]).setAll({opacity:.5}),d("XYCursor").setAll({behavior:"none",layer:30,exportable:!1,snapToSeriesBy:"xy",moveThreshold:1});{const t=d("Grid",["cursor","x"]);t.setAll({forceInactive:!0,strokeOpacity:.8,strokeDasharray:[2,2],role:"slider",ariaLabel:h.translate("Use left and right arrows to move selection")}),G(t,"stroke",e,"alternativeBackground")}{const t=d("Grid",["cursor","y"]);t.setAll({forceInactive:!0,strokeOpacity:.8,strokeDasharray:[2,2],role:"slider",ariaLabel:h.translate("Use up and down arrows to move selection")}),G(t,"stroke",e,"alternativeBackground")}{const t=d("Graphics",["cursor","selection"]);t.setAll({fillOpacity:.15}),G(t,"fill",e,"alternativeBackground")}d("Axis").setAll({start:0,end:1,minZoomCount:1,maxZoomCount:1/0,maxZoomFactor:1e3,maxDeviation:.1,snapTooltip:!0,tooltipLocation:.5,panX:!0,panY:!0,zoomX:!0,zoomY:!0,fixAxisSize:!0}),d("AxisLabel").setAll({location:.5,multiLocation:0,centerX:s,centerY:s,paddingTop:3,paddingBottom:3,paddingLeft:5,paddingRight:5}),d("Container",["axis","header"]).setAll({layer:30}),d("Rectangle",["axis","header","background"]).setAll({crisp:!0});{const t=d("AxisRenderer");t.setAll({crisp:!0,strokeOpacity:0}),G(t,"stroke",e,"grid")}d("AxisRendererX").setAll({minGridDistance:120,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,width:i}),d("AxisRendererY").setAll({minGridDistance:40,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,height:i});{const t=d("Rectangle",["axis","thumb"]);t.setAll({fillOpacity:0}),G(t,"fill",e,"alternativeBackground"),t.states.create("hover",{fillOpacity:.1})}d("Rectangle",["axis","thumb","x"]).setAll({cursorOverStyle:"ew-resize"}),d("Rectangle",["axis","thumb","y"]).setAll({cursorOverStyle:"ns-resize"});{const t=d("Grid");t.setAll({location:0,strokeOpacity:.15,crisp:!0}),G(t,"stroke",e,"grid")}{const t=d("Grid",["minor"]);t.setAll({location:0,strokeOpacity:.07,crisp:!0}),G(t,"stroke",e,"grid")}d("Grid",["base"]).setAll({strokeOpacity:.3});{const t=d("Graphics",["axis","fill"]);t.setAll({visible:!1,isMeasured:!1,position:"absolute",fillOpacity:.05}),G(t,"fill",e,"alternativeBackground")}d("Graphics",["axis","fill","range"]).setAll({isMeasured:!0}),d("Graphics",["series","fill","range"]).setAll({visible:!1,isMeasured:!0}),d("Grid",["series","range"]).setAll({visible:!1}),d("AxisTick",["series","range"]).setAll({visible:!1}),d("AxisLabel",["series","range"]).setAll({visible:!1});{const t=d("AxisTick");t.setAll({location:.5,multiLocation:0,strokeOpacity:1,isMeasured:!1,position:"absolute",visible:!1}),G(t,"stroke",e,"grid")}d("CategoryAxis").setAll({startLocation:0,endLocation:1,fillRule:(e,t)=>{const i=e.get("axisFill");i&&(a(t)&&t%2!=0?i.setPrivate("visible",!1):i.setPrivate("visible",!0))}});const c=[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:5},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:50},{timeUnit:"millisecond",count:100},{timeUnit:"millisecond",count:500},{timeUnit:"second",count:1},{timeUnit:"second",count:5},{timeUnit:"second",count:10},{timeUnit:"second",count:30},{timeUnit:"minute",count:1},{timeUnit:"minute",count:5},{timeUnit:"minute",count:10},{timeUnit:"minute",count:15},{timeUnit:"minute",count:30},{timeUnit:"hour",count:1},{timeUnit:"hour",count:3},{timeUnit:"hour",count:6},{timeUnit:"hour",count:12},{timeUnit:"day",count:1},{timeUnit:"day",count:2},{timeUnit:"day",count:3},{timeUnit:"day",count:4},{timeUnit:"day",count:5},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"month",count:2},{timeUnit:"month",count:3},{timeUnit:"month",count:6},{timeUnit:"year",count:1},{timeUnit:"year",count:2},{timeUnit:"year",count:5},{timeUnit:"year",count:10},{timeUnit:"year",count:50},{timeUnit:"year",count:100},{timeUnit:"year",count:200},{timeUnit:"year",count:500},{timeUnit:"year",count:1e3},{timeUnit:"year",count:2e3},{timeUnit:"year",count:5e3},{timeUnit:"year",count:1e4},{timeUnit:"year",count:1e5}],u={millisecond:h.translate("_date_millisecond"),second:h.translate("_date_second"),minute:h.translate("_date_minute"),hour:h.translate("_date_hour"),day:h.translate("_date_day"),week:h.translate("_date_day"),month:h.translate("_date_month"),year:h.translate("_date_year")},g={millisecond:h.translate("_date_millisecond"),second:h.translate("_date_second"),minute:h.translate("_date_minute"),hour:h.translate("_date_day"),day:h.translate("_date_day"),week:h.translate("_date_day"),month:h.translate("_date_month")+" "+h.translate("_date_year"),year:h.translate("_date_year")},p={millisecond:h.translate("_date_millisecond_full"),second:h.translate("_date_second_full"),minute:h.translate("_date_minute_full"),hour:h.translate("_date_hour_full"),day:h.translate("_date_day_full"),week:h.translate("_date_week_full"),month:h.translate("_date_month_full"),year:h.translate("_date_year")};d("CategoryDateAxis").setAll({markUnitChange:!0,gridIntervals:n(c),dateFormats:o(u),periodChangeDateFormats:o(g)}),d("DateAxis").setAll({maxZoomFactor:null,strictMinMax:!0,startLocation:0,endLocation:1,markUnitChange:!0,groupData:!1,groupCount:500,gridIntervals:n(c),dateFormats:o(u),periodChangeDateFormats:o(g),tooltipDateFormats:p,groupIntervals:[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:100},{timeUnit:"second",count:1},{timeUnit:"second",count:10},{timeUnit:"minute",count:1},{timeUnit:"minute",count:10},{timeUnit:"hour",count:1},{timeUnit:"day",count:1},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"year",count:1}],fillRule:e=>{const t=e.get("axisFill");if(t){const i=e.component,s=e.get("value"),a=e.get("endValue"),o=i.intervalDuration(),n=i.getPrivate("baseInterval"),r=i.getPrivate("gridInterval",n);let l=i.getPrivate("min",0);if(l=B(new Date(l),r.timeUnit,r.count,this._root.locale.firstDayOfWeek,this._root.utc,void 0,this._root.timezone).getTime(),null!=s&&null!=a){const e=Math.round(Math.round((s-l)/o))/2;e==Math.round(e)?t.setPrivate("visible",!0):t.setPrivate("visible",!1)}}}}),d("GaplessDateAxis").setAll({fillRule:e=>{const t=e.get("axisFill");if(t){const i=e.get("index");let s=!1;a(i)&&i%2!=0||(s=!0),t.setPrivate("visible",s)}}}),d("ValueAxis").setAll({baseValue:0,logarithmic:!1,strictMinMax:!1,autoZoom:!0,fillRule:e=>{const t=e.get("axisFill");if(t){const i=e.component,s=e.get("value"),o=i.getPrivate("step");a(s)&&a(o)&&(r(s/o/2,5)==Math.round(s/o/2)?t.setPrivate("visible",!1):t.setPrivate("visible",!0))}}}),d("DurationAxis").setAll({baseUnit:"second"}),d("XYSeries").setAll({maskBullets:!0,stackToNegative:!0,locationX:.5,locationY:.5,snapTooltip:!1,openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close",seriesTooltipTarget:"series"}),d("BaseColumnSeries").setAll({adjustBulletPosition:!0}),d("ColumnSeries").setAll({clustered:!0}),d("RoundedRectangle",["series","column"]).setAll({position:"absolute",isMeasured:!1,width:l(70),height:l(70),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),d("LineSeries").setAll({connect:!0,autoGapCount:1.1,stackToNegative:!1}),d("Graphics",["series","stroke"]).setAll({position:"absolute",strokeWidth:1,strokeOpacity:1,isMeasured:!1}),d("Graphics",["series","fill"]).setAll({visible:!1,fillOpacity:0,position:"absolute",strokeWidth:0,strokeOpacity:0,isMeasured:!1}),d("Graphics",["line","series","legend","marker","stroke"]).setAll({draw:(e,t)=>{const i=t.parent;if(i){const t=i.height(),s=i.width();e.moveTo(0,t/2),e.lineTo(s,t/2)}}});{const t=d("Graphics",["line","series","legend","marker","stroke"]).states.create("disabled",{});G(t,"stroke",e,"disabled")}d("Graphics",["line","series","legend","marker","fill"]).setAll({draw:(e,t)=>{const i=t.parent;if(i){const t=i.height(),s=i.width();e.moveTo(0,0),e.lineTo(s,0),e.lineTo(s,t),e.lineTo(0,t),e.lineTo(0,0)}}});{const t=d("Graphics",["line","series","legend","marker","fill"]).states.create("disabled",{});G(t,"stroke",e,"disabled")}d("SmoothedXYLineSeries").setAll({tension:.5}),d("SmoothedXLineSeries").setAll({tension:.5}),d("SmoothedYLineSeries").setAll({tension:.5}),d("Candlestick").setAll({position:"absolute",isMeasured:!1,width:l(50),height:l(50),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),d("OHLC").setAll({width:l(80),height:l(80)}),d("CandlestickSeries").setAll({lowValueXGrouped:"low",lowValueYGrouped:"low",highValueXGrouped:"high",highValueYGrouped:"high",openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close"});{const t=d("Rectangle",["column","autocolor"]).states.create("riseFromOpen",{});G(t,"fill",e,"positive"),G(t,"stroke",e,"positive")}{const t=d("Rectangle",["column","autocolor"]).states.create("dropFromOpen",{});G(t,"fill",e,"negative"),G(t,"stroke",e,"negative")}d("Rectangle",["column","autocolor","pro"]).states.create("riseFromOpen",{fillOpacity:0}),d("Rectangle",["column","autocolor","pro"]).states.create("dropFromOpen",{fillOpacity:1});{const t=d("Rectangle",["column","autocolor","pro"]).states.create("riseFromPrevious",{});G(t,"fill",e,"positive"),G(t,"stroke",e,"positive")}{const t=d("Rectangle",["column","autocolor","pro"]).states.create("dropFromPrevious",{});G(t,"fill",e,"negative"),G(t,"stroke",e,"negative")}d("RoundedRectangle",["rangegrip"]).setAll({strokeOpacity:0,fillOpacity:0,strokeWidth:1,width:12,height:12});{const t=d("Graphics",["rangegrip","button","icon"]);t.setAll({interactive:!1,crisp:!0,strokeOpacity:.5,draw:e=>{e.moveTo(0,.5),e.lineTo(0,12.5),e.moveTo(2,.5),e.lineTo(2,12.5),e.moveTo(4,.5),e.lineTo(4,12.5)}}),G(t,"stroke",e,"secondaryButtonText")}d("Button",["rangegrip"]).setAll({draggable:!0,paddingTop:0,paddingBottom:0}),d("Button",["rangegrip","vertical"]).setAll({rotation:90,cursorOverStyle:"ns-resize",centerX:s}),d("Button",["rangegrip","horizontal"]).setAll({cursorOverStyle:"ew-resize",centerX:s}),d("Button",["rangegrip","vertical","left"]).setAll({centerY:i}),d("Button",["rangegrip","vertical","right"]).setAll({centerY:0}),d("Button",["rangegrip","horizontal","top"]).setAll({centerY:0}),d("Button",["rangegrip","horizontal","bottom"]).setAll({centerY:i})}}class ne extends U{constructor(){super(...arguments),Object.defineProperty(this,"xAxes",{enumerable:!0,configurable:!0,writable:!0,value:new h}),Object.defineProperty(this,"yAxes",{enumerable:!0,configurable:!0,writable:!0,value:new h}),Object.defineProperty(this,"topAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(d.new(this._root,{width:i,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"yAxesAndPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(d.new(this._root,{width:i,height:i,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"bottomAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(d.new(this._root,{width:i,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"leftAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(d.new(this._root,{height:i,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"plotsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(d.new(this._root,{width:i,height:i,maskContent:!1}))}),Object.defineProperty(this,"plotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(d.new(this._root,{width:i,height:i}))}),Object.defineProperty(this,"topPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(d.new(this._root,{width:i,height:i}))}),Object.defineProperty(this,"gridContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(d.new(this._root,{width:i,height:i,isMeasured:!1}))}),Object.defineProperty(this,"topGridContainer",{enumerable:!0,configurable:!0,writable:!0,value:d.new(this._root,{width:i,height:i,isMeasured:!1})}),Object.defineProperty(this,"rightAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(d.new(this._root,{height:i,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"axisHeadersContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(d.new(this._root,{}))}),Object.defineProperty(this,"zoomOutButton",{enumerable:!0,configurable:!0,writable:!0,value:this.topPlotContainer.children.push(q.new(this._root,{themeTags:["zoom"],icon:c.new(this._root,{themeTags:["button","icon"]})}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_wheelDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_otherCharts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_movePoints",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_downStartX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downStartY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._defaultThemes.push(oe.new(this._root)),super._afterNew(),this._disposers.push(this.xAxes),this._disposers.push(this.yAxes);const e=this._root;let t=this._root.verticalLayout;const i=this.zoomOutButton;i.events.on("click",(()=>{this.zoomOut()})),i.hide(0),i.states.lookup("default").set("opacity",1),this.chartContainer.set("layout",t);const s=this.plotContainer;s.children.push(this.seriesContainer),this._disposers.push(this._processAxis(this.xAxes,this.bottomAxesContainer)),this._disposers.push(this._processAxis(this.yAxes,this.leftAxesContainer)),s.children.push(this.topGridContainer),s.children.push(this.bulletsContainer),s.set("interactive",!0),s.set("interactiveChildren",!1),s.set("background",u.new(e,{themeTags:["plotbackground","xy","background"]})),this._disposers.push(s.events.on("pointerdown",(e=>{this._handlePlotDown(e)}))),this._disposers.push(s.events.on("globalpointerup",(e=>{this._handlePlotUp(e)}))),this._disposers.push(s.events.on("globalpointermove",(e=>{this._handlePlotMove(e)}))),this._maskGrid(),this._setUpTouch()}_beforeChanged(){super._beforeChanged(),(this.isDirty("pinchZoomX")||this.isDirty("pinchZoomY")||this.get("panX")||this.get("panY"))&&this._setUpTouch()}_setUpTouch(){this.plotContainer._display.cancelTouch||(this.plotContainer._display.cancelTouch=!!(this.get("pinchZoomX")||this.get("pinchZoomY")||this.get("panX")||this.get("panY")))}_maskGrid(){this.gridContainer.set("maskContent",!0),this.topGridContainer.set("maskContent",!0)}_removeSeries(e){e._unstack(),e._posXDp&&e._posXDp.dispose(),e._posYDp&&e._posYDp.dispose(),e.set("baseAxis",void 0);const t=e.get("xAxis");t&&(g(t.series,e),t.markDirtyExtremes());const i=e.get("yAxis");i&&(g(i.series,e),i.markDirtyExtremes());const s=this.get("cursor");if(s){const t=s.get("snapToSeries");t&&g(t,e)}super._removeSeries(e)}handleWheel(e){const t=this.get("wheelX"),i=this.get("wheelY"),s=this.plotContainer,a=e.originalEvent;let o=!1;if(!p(a,this))return;o=!0;const n=s.toLocal(e.point),r=this.get("wheelStep",.2),l=a.deltaY/100,h=a.deltaX/100,d=this.get("wheelZoomPositionX"),c=this.get("wheelZoomPositionY");"zoomX"!==t&&"zoomXY"!==t||0==h||this.xAxes.each((e=>{if(e.get("zoomX")){let t=e.get("start"),i=e.get("end"),a=e.fixPosition(n.x/s.width());null!=d&&(a=d);let l=e.get("maxDeviation",0),c=Math.min(1+l,Math.max(-l,t-r*(i-t)*h*a)),u=Math.max(-l,Math.min(1+l,i+r*(i-t)*h*(1-a)));c==t&&u==i&&(o=!1),1/(u-c)<e.getPrivate("maxZoomFactor",1/0)/e.get("minZoomCount",1)?this._handleWheelAnimation(e.zoom(c,u)):o=!1}})),"zoomX"!==i&&"zoomXY"!==i||0==l||this.xAxes.each((e=>{if(e.get("zoomX")){let t=e.get("start"),i=e.get("end"),a=e.fixPosition(n.x/s.width());null!=d&&(a=d);let h=e.get("maxDeviation",0),c=Math.min(1+h,Math.max(-h,t-r*(i-t)*l*a)),u=Math.max(-h,Math.min(1+h,i+r*(i-t)*l*(1-a)));c==t&&u==i&&(o=!1),1/(u-c)<e.getPrivate("maxZoomFactor",1/0)/e.get("minZoomCount",1)?this._handleWheelAnimation(e.zoom(c,u)):o=!1}})),"zoomY"!==t&&"zoomXY"!==t||0==h||this.yAxes.each((e=>{if(e.get("zoomY")){let t=e.get("start"),i=e.get("end"),a=e.fixPosition(n.y/s.height());null!=c&&(a=c);let l=e.get("maxDeviation",0),d=Math.min(1+l,Math.max(-l,t-r*(i-t)*h*a)),u=Math.max(-l,Math.min(1+l,i+r*(i-t)*h*(1-a)));d==t&&u==i&&(o=!1),1/(u-d)<e.getPrivate("maxZoomFactor",1/0)/e.get("minZoomCount",1)?this._handleWheelAnimation(e.zoom(d,u)):o=!1}})),"zoomY"!==i&&"zoomXY"!==i||0==l||this.yAxes.each((e=>{if(e.get("zoomY")){let t=e.get("start"),i=e.get("end"),a=e.fixPosition(n.y/s.height());null!=c&&(a=c);let h=e.get("maxDeviation",0),d=Math.min(1+h,Math.max(-h,t-r*(i-t)*l*a)),u=Math.max(-h,Math.min(1+h,i+r*(i-t)*l*(1-a)));d==t&&u==i&&(o=!1),1/(u-d)<e.getPrivate("maxZoomFactor",1/0)/e.get("minZoomCount",1)?this._handleWheelAnimation(e.zoom(d,u)):o=!1}})),"panX"!==t&&"panXY"!==t||0==h||this.xAxes.each((e=>{if(e.get("panX")){let t=e.get("start"),i=e.get("end"),s=this._getWheelSign(e)*r*(i-t)*h,a=t+s,n=i+s,l=this._fixWheel(a,n);a=l[0],n=l[1],a==t&&n==i&&(o=!1),this._handleWheelAnimation(e.zoom(a,n))}})),"panX"!==i&&"panXY"!==i||0==l||this.xAxes.each((e=>{if(e.get("panX")){let t=e.get("start"),i=e.get("end"),s=this._getWheelSign(e)*r*(i-t)*l,a=t+s,n=i+s,h=this._fixWheel(a,n);a=h[0],n=h[1],a==t&&n==i&&(o=!1),this._handleWheelAnimation(e.zoom(a,n))}})),"panY"!==t&&"panXY"!==t||0==h||this.yAxes.each((e=>{if(e.get("panY")){let t=e.get("start"),i=e.get("end"),s=this._getWheelSign(e)*r*(i-t)*h,a=t+s,n=i+s,l=this._fixWheel(a,n);a=l[0],n=l[1],a==t&&n==i&&(o=!1),this._handleWheelAnimation(e.zoom(a,n))}})),"panY"!==i&&"panXY"!==i||0==l||this.yAxes.each((e=>{if(e.get("panY")){let t=e.get("start"),i=e.get("end"),s=this._getWheelSign(e)*r*(i-t)*l,a=t-s,n=i-s,h=this._fixWheel(a,n);a=h[0],n=h[1],a==t&&n==i&&(o=!1),this._handleWheelAnimation(e.zoom(a,n))}})),o&&a.preventDefault()}_handleSetWheel(){const e=this.get("wheelX"),t=this.get("wheelY"),i=this.plotContainer;"none"!==e||"none"!==t?(this._wheelDp=i.events.on("wheel",(i=>{const s=i.originalEvent;("none"!==e&&0!=Math.abs(s.deltaX)||"none"!==t&&0!=Math.abs(s.deltaY))&&this.handleWheel(i)})),this._disposers.push(this._wheelDp)):this._wheelDp&&this._wheelDp.dispose()}_getWheelSign(e){let t=1;return e.get("renderer").get("inversed")&&(t=-1),t}_fixWheel(e,t){const i=t-e;return e<0&&(t=(e=0)+i),t>1&&(e=(t=1)-i),[e,t]}_handlePlotDown(e){const t=e.originalEvent;if(2==t.button)return;const i=this.plotContainer;let s=i.toLocal(e.point);if(this.get("pinchZoomX")||this.get("pinchZoomY")){if(t.pointerId&&m(i._downPoints).length>0){const e=this.xAxes.getIndex(0),t=this.yAxes.getIndex(0);e&&(this._downStartX=e.get("start",0),this._downEndX=e.get("end",1)),t&&(this._downStartY=t.get("start",0),this._downEndY=t.get("end",1))}}if((this.get("panX")||this.get("panY"))&&s.x>=0&&s.y>=0&&s.x<=i.width()&&s.y<=this.height()){this._downPoint={x:t.clientX,y:t.clientY};const i=this.get("panX"),s=this.get("panY");i&&this.xAxes.each((e=>{e._panStart=e.get("start"),e._panEnd=e.get("end")})),s&&this.yAxes.each((e=>{e._panStart=e.get("start"),e._panEnd=e.get("end")}));const a="panstarted";this.events.isEnabled(a)&&this.events.dispatch(a,{type:a,target:this,originalEvent:e.originalEvent})}}_handleWheelAnimation(e){e?e.events.on("stopped",(()=>{this._dispatchWheelAnimation()})):this._dispatchWheelAnimation()}_dispatchWheelAnimation(){const e="wheelended";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this})}_handlePlotUp(e){const t=this._downPoint;if(t&&(this.get("panX")||this.get("panY"))){if(e.originalEvent.clientX==t.x&&e.originalEvent.clientY==t.y){const t="pancancelled";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent})}const i="panended";this.events.isEnabled(i)&&this.events.dispatch(i,{type:i,target:this,originalEvent:e.originalEvent})}this._downPoint=void 0,this.xAxes.each((e=>{e._isPanning=!1})),this.yAxes.each((e=>{e._isPanning=!1}))}_handlePlotMove(e){const t=this.plotContainer;if(this.get("pinchZoomX")||this.get("pinchZoomY")){const i=e.originalEvent.pointerId;if(i&&(this._movePoints[i]=e.point,m(t._downPoints).length>1))return void this._handlePinch()}let i=this._downPoint;if(i){i=t.toLocal(this._root.documentPointToRoot(i));let s=t.toLocal(e.point);const a=this.get("panX"),o=this.get("panY");if(a){let e=this.get("scrollbarX");e&&e.events.disableType("rangechanged"),this.xAxes.each((e=>{if(e.get("panX")){e._isPanning=!0;let a=e._panStart,o=e._panEnd,n=(o-a)*(i.x-s.x)/t.width();e.get("renderer").get("inversed")&&(n*=-1);let r=a+n,l=o+n;l-r<1+2*e.get("maxDeviation",1)&&(e.set("start",r),e.set("end",l))}})),e&&e.events.enableType("rangechanged")}if(o){let e=this.get("scrollbarY");e&&e.events.disableType("rangechanged"),this.yAxes.each((e=>{if(e.get("panY")){e._isPanning=!0;let a=e._panStart,o=e._panEnd,n=(o-a)*(i.y-s.y)/t.height();e.get("renderer").get("inversed")&&(n*=-1);let r=a-n,l=o-n;l-r<1+2*e.get("maxDeviation",1)&&(e.set("start",r),e.set("end",l))}})),e&&e.events.enableType("rangechanged")}}}_handlePinch(){const e=this.plotContainer;let t=0,i=[],s=[];if(_(e._downPoints,((e,a)=>{i[t]=a;let o=this._movePoints[e];o&&(s[t]=o),t++})),i.length>1&&s.length>1){const t=e.width(),a=e.height();let o=i[0],n=i[1],r=s[0],l=s[1];if(o&&n&&r&&l){if(r=e.toLocal(r),l=e.toLocal(l),o=e.toLocal(o),n=e.toLocal(n),this.get("pinchZoomX")){const e=this._downStartX,i=this._downEndX;if(null!=e&&null!=i){o.x>n.x&&([o,n]=[n,o],[r,l]=[l,r]);let s=e+o.x/t*(i-e),a=e+n.x/t*(i-e),h=e+r.x/t*(i-e),d=e+l.x/t*(i-e),c=Math.max(.001,a-s)/Math.max(.001,d-h),u=e*c+s-h*c,g=i*c+a-d*c;this.xAxes.each((e=>{let t=e.fixPosition(u),i=e.fixPosition(g);e.zoom(t,i,0)}))}}if(this.get("pinchZoomY")){const e=this._downStartY,t=this._downEndY;if(null!=e&&null!=t){o.y<n.y&&([o,n]=[n,o],[r,l]=[l,r]);let i=e+(1-o.y/a)*(t-e),s=e+(1-n.y/a)*(t-e),h=e+(1-r.y/a)*(t-e),d=e+(1-l.y/a)*(t-e),c=Math.max(.001,s-i)/Math.max(.001,d-h),u=e*c+i-h*c,g=t*c+s-d*c;this.yAxes.each((e=>{let t=e.fixPosition(u),i=e.fixPosition(g);e.zoom(t,i,0)}))}}}}}_handleCursorPosition(){const e=this.get("cursor");if(e){const t=e.getPrivate("point");let i=e.get("snapToSeries");if(e._downPoint&&(i=void 0),i&&t){const s=e.get("snapToSeriesBy"),a=[];b(i,(e=>{if(!e.isHidden()&&!e.isHiding())if("x!"!=s&&"y!"!=s){const t=e.startIndex(),i=e.endIndex();for(let s=t;s<i;s++){const t=e.dataItems[s];t&&!t.isHidden()&&a.push(t)}}else{const t=e.get("tooltipDataItem");t&&a.push(t)}}));let o,n=1/0;if(b(a,(e=>{const i=e.get("point");if(i){let a=0;a="x"==s||"x!"==s?Math.abs(t.x-i.x):"y"==s||"y!"==s?Math.abs(t.y-i.y):Math.hypot(t.x-i.x,t.y-i.y),a<n&&(n=a,o=e)}})),b(i,(e=>{const t=e.get("tooltip");t&&t._setDataItem(void 0)})),o){let t=o.component;t.showDataItemTooltip(o),t.setRaw("tooltipDataItem",o);const i=o.get("point");i&&e.handleMove(t.toGlobal({x:i.x-t.x(),y:i.y-t.y()}),!0)}}}}_updateCursor(){let e=this.get("cursor");e&&e.updateCursor()}_addCursor(e){this.plotContainer.children.push(e)}_prepareChildren(){if(super._prepareChildren(),this.series.each((e=>{this._colorize(e)})),(this.isDirty("wheelX")||this.isDirty("wheelY"))&&this._handleSetWheel(),this.isDirty("cursor")){const e=this._prevSettings.cursor,t=this.get("cursor");t!==e&&(this._disposeProperty("cursor"),e&&e.dispose(),t&&(t._setChart(this),this._addCursor(t),this._pushPropertyDisposer("cursor",t.events.on("selectended",(()=>{this._handleCursorSelectEnd()})))),this._prevSettings.cursor=t)}if(this.isDirty("scrollbarX")){const e=this._prevSettings.scrollbarX,t=this.get("scrollbarX");t!==e&&(this._disposeProperty("scrollbarX"),e&&e.dispose(),t&&(t.parent||this.topAxesContainer.children.push(t),this._pushPropertyDisposer("scrollbarX",t.events.on("rangechanged",(e=>{this._handleScrollbar(this.xAxes,e.start,e.end,e.grip)}))),this._pushPropertyDisposer("scrollbarX",t.events.on("released",(()=>{this.xAxes.each((e=>{e.get("zoomable")&&this._handleAxisSelection(e)}))}))),t.setPrivate("positionTextFunction",(e=>{const t=this.xAxes.getIndex(0);return t&&t.getTooltipText(e,!1)||""}))),this._prevSettings.scrollbarX=t)}if(this.isDirty("scrollbarY")){const e=this._prevSettings.scrollbarY,t=this.get("scrollbarY");t!==e&&(this._disposeProperty("scrollbarY"),e&&e.dispose(),t&&(t.parent||this.rightAxesContainer.children.push(t),this._pushPropertyDisposer("scrollbarY",t.events.on("rangechanged",(e=>{this._handleScrollbar(this.yAxes,e.start,e.end,e.grip)}))),this._pushPropertyDisposer("scrollbarY",t.events.on("released",(()=>{this.yAxes.each((e=>{e.get("zoomable")&&this._handleAxisSelection(e)}))}))),t.setPrivate("positionTextFunction",(e=>{const t=this.yAxes.getIndex(0);return t&&t.getTooltipText(e,!1)||""}))),this._prevSettings.scrollbarY=t)}this._handleZoomOut()}_processSeries(e){super._processSeries(e);const t=e.get("xAxis"),i=e.get("yAxis");x(t.series,e),x(i.series,e),e._posXDp=e.addDisposer(t.events.on("positionchanged",(()=>{e._fixPosition()}))),e._posXDp=e.addDisposer(i.events.on("positionchanged",(()=>{e._fixPosition()}))),e.get("baseAxis")||(i.isType("CategoryAxis")||i.isType("DateAxis")?e.set("baseAxis",i):e.set("baseAxis",t)),e.get("stacked")&&(e._markDirtyKey("stacked"),b(e.dataItems,(e=>{e.set("stackToItemY",void 0),e.set("stackToItemX",void 0)}))),e._markDirtyAxes(),i.markDirtyExtremes(),t.markDirtyExtremes(),t._seriesAdded=!0,i._seriesAdded=!0,this._colorize(e)}_colorize(e){const t=this.get("colors");if(t&&null==e.get("fill")){const i=t.next();e._setSoft("stroke",i),e._setSoft("fill",i)}const i=this.get("patterns");if(i&&null==e.get("fillPattern")){const t=i.next();e._setSoft("fillPattern",t)}}_handleCursorSelectEnd(){const e=this.get("cursor"),t=e.get("behavior"),i=e.getPrivate("downPositionX",0),s=e.getPrivate("downPositionY",0),a=Math.min(1,Math.max(0,e.getPrivate("positionX",.5))),o=Math.min(1,Math.max(0,e.getPrivate("positionY",.5)));this.xAxes.each((e=>{if("zoomX"===t||"zoomXY"===t){let t=e.toAxisPosition(i),s=e.toAxisPosition(a);e.zoom(t,s)}e.setPrivate("updateScrollbar",!0)})),this.yAxes.each((e=>{if("zoomY"===t||"zoomXY"===t){let t=e.toAxisPosition(s),i=e.toAxisPosition(o);e.zoom(t,i)}e.setPrivate("updateScrollbar",!0)}))}_handleScrollbar(e,t,i,s){e.each((e=>{let a=e.fixPosition(t),o=e.fixPosition(i),n=e.zoom(a,o,void 0,s);const r="updateScrollbar";e.setPrivateRaw(r,!1),n?n.events.on("stopped",(()=>{e.setPrivateRaw(r,!0)})):e.setPrivateRaw(r,!0)}))}_processAxis(e,t){return e.events.onAll((e=>{if("clear"===e.type)b(e.oldValues,(e=>{this._removeAxis(e)}));else if("push"===e.type)t.children.push(e.newValue),e.newValue.processChart(this);else if("setIndex"===e.type)t.children.setIndex(e.index,e.newValue),e.newValue.processChart(this);else if("insertIndex"===e.type)t.children.insertIndex(e.index,e.newValue),e.newValue.processChart(this);else if("removeIndex"===e.type)this._removeAxis(e.oldValue);else{if("moveIndex"!==e.type)throw new Error("Unknown IListEvent type");t.children.moveValue(e.value,e.newIndex),e.value.processChart(this)}}))}_removeAxis(e){if(!e.isDisposed()){const t=e.parent;t&&t.children.removeValue(e);const i=e.gridContainer,s=i.parent;s&&s.children.removeValue(i);const a=e.topGridContainer,o=a.parent;o&&o.children.removeValue(a)}}_updateChartLayout(){const e=this.leftAxesContainer.width(),t=this.rightAxesContainer.width(),i=this.bottomAxesContainer;i.set("paddingLeft",e),i.set("paddingRight",t);const s=this.topAxesContainer;s.set("paddingLeft",e),s.set("paddingRight",t)}processAxis(e){this.get("cursor")&&(this.addDisposer(e.on("start",(()=>{this._updateCursor()}))),this.addDisposer(e.on("end",(()=>{this._updateCursor()}))))}_handleAxisSelection(e,t){let i=e.fixPosition(e.get("start",0)),s=e.fixPosition(e.get("end",1));if(i>s&&([i,s]=[s,i]),-1!=this.xAxes.indexOf(e)){if(t||e.getPrivate("updateScrollbar")){let e=this.get("scrollbarX");!e||e.getPrivate("isBusy")&&!t||(e.setRaw("start",i),e.setRaw("end",s),e.updateGrips())}}else if(-1!=this.yAxes.indexOf(e)&&(t||e.getPrivate("updateScrollbar"))){let e=this.get("scrollbarY");!e||e.getPrivate("isBusy")&&!t||(e.setRaw("start",i),e.setRaw("end",s),e.updateGrips())}this._handleZoomOut()}_handleZoomOut(){let e=this.zoomOutButton;if(e&&e.parent){let t=!1;this.xAxes.each((e=>{0==r(e.get("start",0),6)&&1==r(e.get("end",1),6)||(t=!0)})),this.yAxes.each((e=>{0==r(e.get("start",0),6)&&1==r(e.get("end",1),6)||(t=!0)})),t?e.isHidden()&&e.show():e.hide()}}inPlot(e){const t=this.plotContainer,i=this.getPrivate("otherCharts",this._otherCharts),s=t.toGlobal(e);if(e.x>=-.5&&e.y>=-.5&&e.x<=t.width()+.5&&e.y<=t.height()+.5)return!0;if(i)for(let a=i.length-1;a>=0;a--){const e=i[a];if(e!=this){const t=e.plotContainer,i=this._root.rootPointToDocument(s),a=e._root.documentPointToRoot(i),o=t.toLocal(a);if(o.x>=-.1&&o.y>=-.1&&o.x<=t.width()+.1&&o.y<=t.height()+.1)return!0}}return!1}arrangeTooltips(){const e=this.plotContainer,t=e.width(),i=e.height();let s=this.height();const o=this._root.tooltipContainer.get("layerMargin");o&&o.bottom>s&&(s=o.bottom);let n=e._display.toGlobal({x:0,y:0}),r=e._display.toGlobal({x:t,y:i});const l=[];let h,d,c=0,u=1/0,g=this._movePoint,p=this.get("maxTooltipDistance"),m=this.get("maxTooltipDistanceBy","xy");a(p)&&this.series.each((e=>{if(!e.isHidden()){const t=e.get("tooltip");if(t){let i=t.get("pointTo");if(i){let t=Math.hypot(g.x-i.x,g.y-i.y);"x"==m?t=Math.abs(g.x-i.x):"y"==m&&(t=Math.abs(g.y-i.y)),t<u&&(u=t,h=e,d=i)}}}}));const _=[];if(this.series.each((e=>{const t=e.get("tooltip");if(t&&!t.get("forceHidden")){let i=!1,s=t.get("pointTo");if(s){if(p>=0){let s=t.get("pointTo");if(s&&d&&e!=h){let e=Math.hypot(d.x-s.x,d.y-s.y);"x"==m?e=Math.abs(d.x-s.x):"y"==m&&(e=Math.abs(d.y-s.y)),e>p&&(i=!0)}}else-1==p&&e!=h&&(i=!0);this.inPlot(this._tooltipToLocal(s))&&t.dataItem?i||(c+=s.y):i=!0,i||e.isHidden()||e.isHiding()?t.hide(0):(t.show(),l.push(t),_.push(e))}}})),this.setPrivate("tooltipSeries",_),this.get("arrangeTooltips")){let e=0,t=0;const a=this._root.tooltipContainer,o=l.length;if(c/o>i/2+n.y){l.sort(((e,t)=>f(t.get("pointTo").y,e.get("pointTo").y)));let i=r.y;if(b(l,(s=>{let o=s.height();t++,e+=o;let l=s.get("centerY");l instanceof v&&(o*=l.value),o+=s.get("marginBottom",0),s.set("bounds",{left:n.x,top:n.y,right:r.x,bottom:i}),s.setPrivate("customData",{left:n.x,top:n.y,right:r.x,bottom:i}),i=Math.min(i-o,s._fy-o),s.parent==a&&a.children.moveValue(s,0)})),i<0){l.reverse();let e=i;b(l,(s=>{t++;let a=s.get("bounds");if(a){let t=a.top-i,o=a.bottom-i;t<e&&(t=e,o=t+s.height()),s.set("bounds",{left:a.left,top:t,right:a.right,bottom:o}),e=a.bottom-i+s.get("marginBottom",0)}}))}}else{l.reverse(),l.sort(((e,t)=>f(e.get("pointTo").y,t.get("pointTo").y)));let i=0;if(b(l,(o=>{t++;let l=o.height();e+=l;let h=o.get("centerY");h instanceof v&&(l*=h.value),l+=o.get("marginBottom",0),o.set("bounds",{left:n.x,top:i,right:r.x,bottom:Math.max(n.y+s,i+l)}),o.parent==a&&a.children.moveValue(o,0),i=Math.max(i+l,o._fy+l)})),i>s){l.reverse();let e=s;b(l,(a=>{t++;let o=a.get("bounds");if(o){let t=o.top-(s-i),n=o.bottom-(s-i);n>e&&(n=e,t=n-a.height()),a.set("bounds",{left:o.left,top:t,right:o.right,bottom:n}),e=n-a.height()-a.get("marginBottom",0)}}))}}0==e&&t>0&&this._disposers.push(this.root.events.once("frameended",(()=>{this.arrangeTooltips()})))}}_tooltipToLocal(e){return this.plotContainer.toLocal(e)}zoomOut(){this.xAxes.each((e=>{e.setPrivate("updateScrollbar",!0),e.zoom(0,1)})),this.yAxes.each((e=>{e.setPrivate("updateScrollbar",!0),e.zoom(0,1)}))}_dispose(){super._dispose();const e=this.get("cursor");e&&e.dispose()}}Object.defineProperty(ne,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYChart"}),Object.defineProperty(ne,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:U.classNames.concat([ne.className])});class re extends c{_beforeChanged(){super._beforeChanged(),(this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}}Object.defineProperty(re,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Grid"}),Object.defineProperty(re,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:c.classNames.concat([re.className])});class le extends d{constructor(){super(...arguments),Object.defineProperty(this,"_alwaysShow",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lineX",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(re.new(this._root,{themeTags:["x"]}))}),Object.defineProperty(this,"lineY",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(re.new(this._root,{themeTags:["y"]}))}),Object.defineProperty(this,"selection",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(c.new(this._root,{themeTags:["selection","cursor"],layer:30}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastPoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_lastPoint2",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_tooltipX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_tooltipY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._settings.themeTags=y(this._settings.themeTags,["xy","cursor"]),super._afterNew(),this.setAll({width:i,height:i,isMeasured:!0,position:"absolute"}),this.states.create("hidden",{visible:!0,opacity:0}),this._drawLines(),this.setPrivateRaw("visible",!1),this._disposers.push(this.setTimeout((()=>{this.setPrivate("visible",!0)}),500)),this._disposers.push(this.lineX.events.on("positionchanged",(()=>{this._handleXLine()}))),this._disposers.push(this.lineY.events.on("positionchanged",(()=>{this._handleYLine()}))),this._disposers.push(this.lineX.events.on("focus",(()=>this._handleLineFocus()))),this._disposers.push(this.lineX.events.on("blur",(()=>this._handleLineBlur()))),this._disposers.push(this.lineY.events.on("focus",(()=>this._handleLineFocus()))),this._disposers.push(this.lineY.events.on("blur",(()=>this._handleLineBlur()))),w("keyboardevents")&&this._disposers.push(P(document,"keydown",(e=>{this._handleLineMove(D(e),e.ctrlKey)})))}_setUpTouch(){const e=this.chart;e&&(e.plotContainer._display.cancelTouch="none"!=this.get("behavior"))}_handleXLine(){let e=this.lineX.x(),t=!0;(e<0||e>this.width())&&(t=!1),this.lineX.setPrivate("visible",t)}_handleYLine(){let e=this.lineY.y(),t=!0;(e<0||e>this.height())&&(t=!1),this.lineY.setPrivate("visible",t)}_handleLineMove(e,t){let i="";const s=this.chart;let a;if(s&&s.xAxes.length){this._root.focused(this.lineX)?(i="positionX",a=s.xAxes.getIndex(0)):this._root.focused(this.lineY)&&(a=s.yAxes.getIndex(0),i="positionY");let o=1;if(t&&(o=5),a){let t,s=a.get("renderer").get("inversed",!1);"ArrowRight"==e||"ArrowDown"==e?t=1:"ArrowLeft"==e||"ArrowUp"==e?t=-1:"Tab"==e&&(t=0),null!=t&&(s&&(t*=-1),this.set(i,a.nextPosition(t*o)))}}}_handleLineFocus(){this._alwaysShow=this.get("alwaysShow",!1),this.setAll({positionX:this.getPrivate("positionX",0),positionY:this.getPrivate("positionY",0),alwaysShow:!0}),this._handleLineMove("Tab")}_handleLineBlur(){(this.lineX.isFocus()||this.lineY.isFocus())&&this.setAll({positionX:void 0,positionY:void 0,alwaysShow:this._alwaysShow})}_prepareChildren(){if(super._prepareChildren(),this.isDirty("xAxis")){this._tooltipX=!1;const e=this.get("xAxis");if(e){const t=e.get("tooltip");t&&(this._tooltipX=!0,this._disposers.push(t.on("pointTo",(()=>{this._updateXLine(t)}))))}}if(this.isDirty("yAxis")){this._tooltipY=!1;const e=this.get("yAxis");if(e){const t=e.get("tooltip");t&&(this._tooltipY=!0,this._disposers.push(t.on("pointTo",(()=>{this._updateYLine(t)}))))}}}_handleSyncWith(){const e=this.chart;if(e){const t=this.get("syncWith"),i=[];t&&b(t,(e=>{const t=e.chart;t&&i.push(t)})),e._otherCharts=i}}_updateChildren(){if(super._updateChildren(),this._handleSyncWith(),this.isDirty("positionX")||this.isDirty("positionY")){const e=this.get("positionX"),t=this.get("positionY");null==e&&null==t?this.hide(0):(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0))),this.handleMove())}}_updateXLine(e){let t=r(this._display.toLocal(e.get("pointTo",{x:0,y:0})).x,3);this._toX!=t&&(this.lineX.animate({key:"x",to:t,duration:e.get("animationDuration",0),easing:e.get("animationEasing")}),this._toX=t)}_updateYLine(e){let t=r(this._display.toLocal(e.get("pointTo",{x:0,y:0})).y,3);this._toY!=t&&(this.lineY.animate({key:"y",to:t,duration:e.get("animationDuration",0),easing:e.get("animationEasing")}),this._toY=t)}_drawLines(){this.lineX.set("draw",(e=>{e.moveTo(0,0),e.lineTo(0,this.height())})),this.lineY.set("draw",(e=>{e.moveTo(0,0),e.lineTo(this.width(),0)}))}updateCursor(){this.get("alwaysShow")&&(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0)))),this.handleMove()}_setChart(e){this.chart=e,this._handleSyncWith();const t=e.plotContainer;this.events.on("boundschanged",(()=>{this._disposers.push(this.setTimeout((()=>{this.updateCursor()}),50))})),w("touchevents")&&(this._disposers.push(t.events.on("click",(e=>{A(e.originalEvent)&&this._handleMove(e)}))),this._setUpTouch()),this._disposers.push(t.events.on("pointerdown",(e=>{this._handleCursorDown(e)}))),this._disposers.push(t.events.on("globalpointerup",(e=>{this._handleCursorUp(e),e.native||this.isHidden()||this._handleMove(e)}))),this._disposers.push(t.events.on("globalpointermove",(e=>{(this.get("syncWith")||0!=m(t._downPoints).length||e.native||!this.isHidden())&&(this._handleMove(e),Math.hypot(this._lastPoint2.x-e.point.x,this._lastPoint2.y-e.point.y)>1&&(this._handleLineBlur(),this._lastPoint2=e.point))})));const i=this.parent;i&&i.children.moveValue(this.selection)}_inPlot(e){const t=this.chart;return!!t&&t.inPlot(e)}_handleCursorDown(e){if(2==e.originalEvent.button)return;const t=e.point;let i=this._display.toLocal(t);const s=this.chart;if(this.selection.set("draw",(()=>{})),s&&this._inPlot(i)){if(this._downPoint=i,"none"!=this.get("behavior")){this.selection.show();const t="selectstarted";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent})}let t=this._getPosition(i).x,s=this._getPosition(i).y;this.setPrivate("downPositionX",t),this.setPrivate("downPositionY",s)}}_handleCursorUp(e){if(this._downPoint){const t=this.get("behavior","none");if("none"!=t){"z"===t.charAt(0)&&this.selection.hide();const i=e.point;let s=this._display.toLocal(i);const a=this._downPoint,o=this.get("moveThreshold",1);if(s&&a){let i=!1;if("zoomX"!==t&&"zoomXY"!==t&&"selectX"!==t&&"selectXY"!==t||Math.abs(s.x-a.x)>o&&(i=!0),"zoomY"!==t&&"zoomXY"!==t&&"selectY"!==t&&"selectXY"!==t||Math.abs(s.y-a.y)>o&&(i=!0),i){const t="selectended";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent})}else{const t="selectcancelled";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent})}}}}this._downPoint=void 0}_handleMove(e){if(this.getPrivate("visible")){const t=this.chart;if(t&&m(t.plotContainer._downPoints).length>1)return void this.set("forceHidden",!0);this.set("forceHidden",!1);const i=e.point,s=this._lastPoint;if(Math.round(s.x)===Math.round(i.x)&&Math.round(s.y)===Math.round(i.y))return;this._lastPoint=i,this.setPrivate("lastPoint",i),this.handleMove({x:i.x,y:i.y},!1,e.originalEvent)}}_getPosition(e){return{x:e.x/this.width(),y:e.y/this.height()}}handleMove(e,t,i){e||(e=this._movePoint);const s=this.get("alwaysShow");if(!e)return void this.hide(0);this._movePoint=e;let o=this._display.toLocal(e),n=this.chart;if(n&&(this._inPlot(o)||this._downPoint)){if(n._movePoint=e,this.isHidden()){this.show();"z"==this.get("behavior","").charAt(0)&&this.selection.set("draw",(()=>{}))}let r=o.x,l=o.y,h=this._getPosition(o);this.setPrivate("point",o);let d=this.get("snapToSeries");this._downPoint&&(d=void 0);let c=this.get("positionX"),u=h.x;a(c)&&(u=c);let g=this.get("positionY"),p=h.y;a(g)&&(p=g),this.setPrivate("positionX",u),this.setPrivate("positionY",p);const m=this._getPoint(u,p);if(r=m.x,l=m.y,n.xAxes.each((e=>{e._handleCursorPosition(u,d),s&&e.handleCursorShow()})),n.yAxes.each((e=>{e._handleCursorPosition(p,d),s&&e.handleCursorShow()})),!t){n._handleCursorPosition();const t="cursormoved";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,point:e,originalEvent:i})}this._updateLines(r,l),n.arrangeTooltips()}else if(!this._downPoint&&!s){this.hide(0);const e="cursorhidden";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this})}this._downPoint&&"none"!=this.get("behavior")&&this._updateSelection(o)}_getPoint(e,t){return{x:this.width()*e,y:this.height()*t}}_updateLines(e,t){this._tooltipX||this.lineX.set("x",e),this._tooltipY||this.lineY.set("y",t),this._drawLines()}_updateSelection(e){const t=this.selection,i=this.get("behavior"),s=this.width(),a=this.height();e.x<0&&(e.x=0),e.x>s&&(e.x=s),e.y<0&&(e.y=0),e.y>a&&(e.y=a),t.set("draw",(t=>{const o=this._downPoint;o&&("zoomXY"===i||"selectXY"===i?(t.moveTo(o.x,o.y),t.lineTo(o.x,e.y),t.lineTo(e.x,e.y),t.lineTo(e.x,o.y),t.lineTo(o.x,o.y)):"zoomX"===i||"selectX"===i?(t.moveTo(o.x,0),t.lineTo(o.x,a),t.lineTo(e.x,a),t.lineTo(e.x,0),t.lineTo(o.x,0)):"zoomY"!==i&&"selectY"!==i||(t.moveTo(0,o.y),t.lineTo(s,o.y),t.lineTo(s,e.y),t.lineTo(0,e.y),t.lineTo(0,o.y)))}))}_onHide(){if(this.isHidden()){let e=this.chart;e&&(e.xAxes.each((e=>{e.handleCursorHide()})),e.yAxes.each((e=>{e.handleCursorHide()})),e.series.each((e=>{e.handleCursorHide()})))}super._onHide()}_onShow(){if(!this.isHidden()){let e=this.chart;e&&(e.xAxes.each((e=>{e.handleCursorShow()})),e.yAxes.each((e=>{e.handleCursorShow()})))}super._onShow()}_dispose(){super._dispose(),this.selection.dispose()}}function he(e,t){return null==e?t:null==t?e:t<e?t:e}function de(e,t){return null==e?t:null==t?e:t>e?t:e}Object.defineProperty(le,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYCursor"}),Object.defineProperty(le,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:d.classNames.concat([le.className])});class ce extends W{constructor(){super(...arguments),Object.defineProperty(this,"_xField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_axesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_stackDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataSets",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_mainContainerMask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_y",{enumerable:!0,configu