UNPKG

billboard.js

Version:

Re-usable easy interface JavaScript chart library, based on D3 v4+

41 lines • 477 kB
/*!
 * Copyright (c) 2017 ~ present NAVER Corp.
 * billboard.js project is licensed under the MIT license
 *
 * billboard.js, JavaScript chart library
 * https://naver.github.io/billboard.js/
 *
 * @version 4.1.1
 */(function(Jt,fn){if(typeof exports=="object"&&typeof module=="object")module.exports=fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-brush","d3-drag","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],fn);else{var ii=typeof exports=="object"?fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):fn(Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3);for(var ai in ii)(typeof exports=="object"?exports:Jt)[ai]=ii[ai]}})(this,function(_s,Jt,fn,ii,ai,jc,Uc,Kc,Zc,qc){return(function(){var Jc=[,,(function(J){"use strict";J.exports=jc}),(function(J){"use strict";J.exports=ai}),(function(J){"use strict";J.exports=Uc}),(function(J){"use strict";J.exports=Kc}),(function(J){"use strict";J.exports=Jt}),(function(J){"use strict";J.exports=_s}),(function(J){"use strict";J.exports=Zc}),(function(J){"use strict";J.exports=qc}),(function(J){"use strict";J.exports=ii}),(function(J){"use strict";J.exports=fn})],xs={};function wt(J){var Qt=xs[J];if(Qt!==void 0)return Qt.exports;var F=xs[J]={exports:{}};return Jc[J](F,F.exports,wt),F.exports}wt.d=function(J,Qt){for(var F in Qt)wt.o(Qt,F)&&!wt.o(J,F)&&Object.defineProperty(J,F,{enumerable:!0,get:Qt[F]})},wt.o=function(J,Qt){return Object.prototype.hasOwnProperty.call(J,Qt)},wt.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})};var ji={};return(function(){"use strict"})(),(function(){"use strict";wt.r(ji),wt.d(ji,{bb:function(){return Yc},default:function(){return Yc}});var J={};wt.r(J),wt.d(J,{selection:function(){return El},subchart:function(){return Ml},zoom:function(){return zl}});var Qt={};wt.r(Qt),wt.d(Qt,{area:function(){return sc},areaLineRange:function(){return oc},areaSpline:function(){return lc},areaSplineRange:function(){return cc},areaStep:function(){return uc},areaStepRange:function(){return rc},bar:function(){return dc},bubble:function(){return hc},candlestick:function(){return xc},donut:function(){return kc},funnel:function(){return Pc},gauge:function(){return Dc},line:function(){return Ic},pie:function(){return Oc},polar:function(){return Bc},radar:function(){return Nc},scatter:function(){return Xc},spline:function(){return Mc},step:function(){return Fc},treemap:function(){return Wc}});var F=wt(2);const O={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Qc={export:"exportApi",flow:"flow",xgrids:"grid",ygrids:"grid",regions:"regions",category:"category",categories:"category"},ms=16,_e=10,dt=6,Je=3,tu=dt+Je,vs=1,bs={x:{start:"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",end:"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"},y:{start:"M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",end:"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"}},Ui={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},ce={Area:[O.AREA,O.AREA_SPLINE,O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.AREA_STEP,O.AREA_STEP_RANGE],AreaRange:[O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.AREA_STEP_RANGE],Arc:[O.PIE,O.DONUT,O.GAUGE,O.POLAR,O.RADAR],Line:[O.LINE,O.SPLINE,O.AREA,O.AREA_SPLINE,O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.STEP,O.AREA_STEP,O.AREA_STEP_RANGE],Step:[O.STEP,O.AREA_STEP,O.AREA_STEP_RANGE],Spline:[O.SPLINE,O.AREA_SPLINE,O.AREA_SPLINE_RANGE]};var Qe=wt(3);const q=e=>e||e===0,z=e=>typeof e=="function",Q=e=>typeof e=="string",$=e=>typeof e=="number",Ct=e=>typeof e=="undefined",ct=e=>typeof e!="undefined",tn=e=>typeof e=="boolean",eu=e=>Math.ceil(e/10)*10,gn=e=>Math.ceil(e)+.5,en=e=>e[1]-e[0],Ut=e=>typeof e=="object",nu=e=>{for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},se=e=>Ct(e)||e===null||Q(e)&&e.length===0||Ut(e)&&!(e instanceof Date)&&nu(e)||$(e)&&isNaN(e),bt=e=>!se(e),ot=e=>Array.isArray(e),tt=e=>e&&!(e!=null&&e.nodeType)&&Ut(e)&&!ot(e);function iu(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function au(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=s=>setTimeout(s,1),a=s=>clearTimeout(s);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:a,n?e.requestIdleCallback:i,n?e.cancelIdleCallback:a]}const N=iu(),nt=N==null?void 0:N.document,[ys,su,Ts,ou]=au(N),ru=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),lu=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),si=new Map;ru.forEach(e=>si.set(e.toLowerCase(),e));const oi=new Map;lu.forEach(e=>oi.set(e.toLowerCase(),e));const cu=new Set(["http:","https:","mailto:"]),uu=new Set(["href","src","xlink:href"]),du=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,hu=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,fu=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,ws=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,Cs=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,gu=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function Ki(e){return e.replace(/&colon;/gi,":").replace(/&newline;/gi,`
`).replace(/&tab;/gi,"	").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function Ss(e){const n=Ki(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const i=n.match(/^[^/?#]*:/);return i?cu.has(i[0]):!0}function pu(e){const n=Ki(e).replace(/[\u0000-\u001f]/g,"");Cs.lastIndex=0;let i;for(;(i=Cs.exec(n))!==null;)if(!Ss(i[1]))return null;const a=n.toLowerCase().replace(/\s/g,"");for(const s of gu)if(a.includes(s))return null;return e}const _u={'"':"&quot;","'":"&#39;","`":"&#96;"},xu=/["'`]/g;function Zi(e){return e.replace(xu,t=>_u[t])}function mu(e,t,n=!1){if(uu.has(e))return Ss(t)?n?Zi(t):t:null;if(e==="style"){const a=pu(t);return a===null?null:n?Zi(a):a}const i=Ki(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(i)?null:n?Zi(t):t}function vu(e){const t=e.match(du);return t?t[1].toLowerCase():null}function bu(e){const t=vu(e);return t!==null&&si.has(t)}function yu(e){var t,n,i;const a=e.match(hu);if(a){const p=a[1].toLowerCase();return`</${(t=si.get(p))!=null?t:p}>`}const s=e.match(fu);if(!s)return"";const[,o,r,l]=s,c=o.toLowerCase(),d=(n=si.get(c))!=null?n:c,u=[];ws.lastIndex=0;let h;for(;(h=ws.exec(r))!==null;){const p=h[1].toLowerCase(),_=h[2],x=h[3],m=h[4];if(p.startsWith("on"))continue;const v=(i=oi.get(p))!=null?i:p;let b,y;if(_!==void 0)b=_,y='"';else if(x!==void 0)b=x,y="'";else if(m!==void 0)b=m,y='"';else{oi.has(p)&&u.push(v);continue}if(oi.has(p)){const w=mu(p,b,m!==void 0);w!==null&&u.push(`${v}=${y}${w}${y}`)}}const f=u.length>0?` ${u.join(" ")}`:"";return`<${d}${f}${l?"/>":">"}`}function Se(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?bu(t)?yu(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var Tu=Object.defineProperty,ks=Object.getOwnPropertySymbols,wu=Object.prototype.hasOwnProperty,Cu=Object.prototype.propertyIsEnumerable,As=(e,t,n)=>t in e?Tu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ls=(e,t)=>{for(var n in t||(t={}))wu.call(t,n)&&As(e,n,t[n]);if(ks)for(var n of ks(t))Cu.call(t,n)&&As(e,n,t[n]);return e};function Rs(e,t){for(let n=0;n<e.length;n++){const i=e[n];i!==null&&ct(i)&&t(i,n)}}function Ne(e,t,n){return ct(e[t])?e[t]:n}function Su(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function H(e,t,...n){const i=z(e);return i&&e.call(t,...n),i}function ri(e,t){let n=0;const i=function(...a){!--n&&t.apply(this,a)};"duration"in e?e.each(()=>++n).on("end",i):(++n,e.call(i))}const Ot=e=>e.charAt(0).toUpperCase()+e.slice(1);function ku(e,t="-"){return e.split(t).map((n,i)=>i?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const nn=e=>[].slice.call(e);function Au(...e){const t=n=>{if(ot(n))return n.map(t);if(tt(n)&&n.constructor){const i=new n.constructor;for(const a in n)i[a]=t(n[a]);return i}return n};return e.map(n=>t(n)).reduce((n,i)=>Ls(Ls({},n),i))}function St(e={},t){ot(t)&&t.forEach(n=>St(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function qi(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(i=>new Date(i)):n}function Lu(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function ke(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return tt(e)&&tt(n)&&Object.keys(n).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const a=n[i];a instanceof Date?e[i]=new Date(a.getTime()):tt(a)?(!e[i]&&(e[i]={}),e[i]=ke(e[i],a)):e[i]=ot(a)?a.concat():a}}),ke(e,...t)}function pn(e,t=!0){let n;return e[0]instanceof Date?n=t?(i,a)=>i-a:(i,a)=>a-i:t&&!e.every(isNaN)?n=(i,a)=>i-a:t||(n=(i,a)=>i>a&&-1||i<a&&1||i===a&&0),e.concat().sort(n)}function ue(e,t){let n=t.filter(i=>bt(i));if(n.length)if($(n[0])){let i=e==="min"?1/0:-1/0;for(const a of n)(e==="min"?a<i:a>i)&&(i=a);n=i}else n[0]instanceof Date&&(n=pn(n,e==="min")[0]);else n=void 0;return n}const li=(e,t,n=1)=>{const i=[],a=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=0;s<a;s++)i.push(e+s*n);return i};let Ru=0;function xe(e=!0){const t=++Ru;return e?String(t):t}function Ji(e,t,n,i,a){if(n>i)return-1;const s=Math.floor((n+i)/2);let{x:o,w:r=0}=e[s];return a&&(o=e[s].y,r=e[s].h),t>=o&&t<=o+r?s:t<o?Ji(e,t,n,s-1,a):Ji(e,t,s+1,i,a)}function an(e,t){return Se(e.replace(/\{=([^}]+)\}/g,(n,i)=>{var a;return(a=t[i])!=null?a:""}))}function Vt(e){var t;let n;if(e instanceof Date)n=e;else if(Q(e)){const{config:i,format:a}=this;n=(t=a.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else $(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function Es(e){if(tt(e)&&!Q(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(Q(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,i=n,a=n,s=i]=t;return{top:n,right:i,bottom:a,left:s}}function Ps(e,t){t()===!1?ys(()=>Ps(e,t)):e()}function Ds(e,t=(n=>n)){const n=new Set;return Rs(e,(i,a)=>{n.add(t(i,a))}),n}function Is(e,t,n=(i=>i)){const i=new Map;return Rs(e,(a,s)=>{i.set(t(a,s),n(a,s))}),i}function Xe(e="linear",t,n){const i={linear:Qe.scaleLinear,log:Qe.scaleSymlog,_log:Qe.scaleLog,time:Qe.scaleTime,utc:Qe.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,n!=null?n:1])}var Eu={getXScale(e,t,n,i){const a=this,s=a.state.loading!=="append"&&a.scale.zoom||Xe(a.axis.getAxisType("x"),e,t);return a.getCustomizedXScale(n?s.domain(n):s,i)},getYScale(e,t,n,i,a){const o=this.axis.getAxisType(e);if(a&&a.type===o)return a.range([t,n]),i&&a.domain(i),a;const r=Xe(o,t,n);return i&&r.domain(i),r},getYScaleById(e,t=!1){var n;const i=((n=this.axis)==null?void 0:n.getId(e))==="y2",a=t?i?"subY2":"subY":i?"y2":"y";return this.scale[a]},getCustomizedXScale(e,t){const n=this,i=()=>(t?t():n.axis.x.tickOffset())||(n.axis.isCategorized()?(e(1)-e(0))/2:0),a=n.config.axis_x_inverted,s=function(o){return e(o)+i()};for(const o in e)s[o]=e[o];return s.orgDomain=()=>e.domain(),s.orgScale=()=>e,n.axis.isCategorized()&&(s.domain=function(o){let r=o;return arguments.length?(e.domain(r),s):(r=this.orgDomain(),a?[r[0]+1,r[1]]:[r[0],r[1]+1])}),s},updateScales(e,t=!0){var n,i,a,s,o,r,l,c,d;const u=this,{axis:h,config:f,format:g,org:p,scale:_,state:{current:x,width:m,height:v,width2:b,height2:y,hasAxis:T,hasTreemap:w}}=u;if(T){const C=f.axis_rotated,k=u.getResettedPadding(1),S={x:C?k:0,y:C?0:v,subX:C?1:0,subY:C?0:y},A={x:C?v:m,y:C?m:k,subX:C?v:m,subY:C?b:1},L=t?(n=_.x)==null?void 0:n.orgDomain():_.zoom||(a=(i=_.x)==null?void 0:i.domain)==null?void 0:a.call(i),E=t?p.xDomain:_.zoom||(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:o.call(s);_.x=u.getXScale(S.x,A.x,L,()=>h.x.tickOffset()),_.subX=u.getXScale(S.x,A.x,E,D=>{var R;return D%1?0:((R=h.subX)!=null?R:h.x).tickOffset()}),g.xAxisTick=h.getXAxisTickFormat(),g.subXAxisTick=h.getXAxisTickFormat(!0),h.setAxis("x",_.x,f.axis_x_tick_outer,e),f.subchart_show&&h.setAxis("subX",_.subX,(r=f.subchart_axis_x_tick_outer)!=null?r:f.axis_x_tick_outer,e),_.y=u.getYScale("y",S.y,A.y,_.y?_.y.domain():f.axis_y_default,_.y),_.subY=u.getYScale("y",S.subY,A.subY,_.subY?_.subY.domain():f.axis_y_default,_.subY),h.setAxis("y",_.y,f.axis_y_tick_outer,e),f.subchart_show&&f.subchart_axis_y_show&&h.setAxis("subY",_.subY,(l=f.subchart_axis_y_tick_outer)!=null?l:f.axis_y_tick_outer,e),(f.axis_y2_show||f.subchart_axis_y2_show)&&(_.y2=u.getYScale("y2",S.y,A.y,_.y2?_.y2.domain():f.axis_y2_default,_.y2),_.subY2=u.getYScale("y2",S.subY,A.subY,_.subY2?_.subY2.domain():f.axis_y2_default,_.subY2),h.setAxis("y2",_.y2,f.axis_y2_tick_outer,e),f.subchart_show&&f.subchart_axis_y2_show&&h.setAxis("subY2",_.subY2,(c=f.subchart_axis_y2_tick_outer)!=null?c:f.axis_y2_tick_outer,e))}else if(w){const C=u.getCurrentPadding();_.x=(0,Qe.scaleLinear)().rangeRound([C.left,x.width-C.right]),_.y=(0,Qe.scaleLinear)().rangeRound([C.top,x.height-C.bottom])}else(d=u.updateArc)==null||d.call(u)},xx(e){const t=this,{config:n,scale:{x:i,zoom:a}}=t,s=n.zoom_enabled&&a?a:i;return e?s(q(e.x)?e.x:e):null},xv(e){const t=this,{axis:n,config:i,scale:{x:a,zoom:s}}=t,o=i.zoom_enabled&&s?s:a;let r=t.getBaseValue(e);return n.isTimeSeries()?r=Vt.call(t,r):n.isCategorized()&&Q(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:n,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:n)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}};const Ms=1e5;function de(e){const t=/(\d+(?:\.\d+)?)px/.exec(e),n=parseFloat(t?t[1]:e);return Number.isFinite(n)?n:12}function te(e,t,n,i){return t.indices[n]||e.getShapeIndices(i)}function _n(e,t,n=[]){var i;const a=typeof t=="string"?t:t==null?void 0:t.id;return!((i=e.isGrouped)!=null&&i.call(e,a))||n.some(s=>s(e,t))}function Ge(e,t){var n;const i=typeof t=="string"?t:t==null?void 0:t.id;return i&&((n=e.data_types)==null?void 0:n[i])||e.data_type||O.LINE}function ci(e){const t=+e;return Number.isFinite(t)?t:null}function Fs(e){var t,n;const i=(n=(t=e.scale.zoom||e.scale.x)==null?void 0:t.domain)==null?void 0:n.call(t),a=ci(i==null?void 0:i[0]),s=ci(i==null?void 0:i[1]);return a===null||s===null?null:[Math.min(a,s),Math.max(a,s)]}function ui(e){return ci(e==null?void 0:e.x)}function Pu(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ui(e[s]);if(o===null)return 0;(n?o<t:o>t)?i=s+1:a=s}return i}function Du(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ui(e[s]);if(o===null)return e.length;(n?o<=t:o>=t)?i=s+1:a=s}return i}function Ae(e,t,n=1){const i=(t==null?void 0:t.values)||[],a={start:0,end:i.length},s=Fs(e);if(!i.length||!s)return a;const o=e.state,r=o._canvasVisibleRangeCache||(o._canvasVisibleRangeCache=new Map),l=[t.id,i.length,o.dataGeneration,s[0],s[1],n].join(":"),c=r.get(t.id);if((c==null?void 0:c.key)===l)return c.range;const d=ui(i[0]),u=ui(i[i.length-1]);if(d===null||u===null)return a;const h=d<=u,f=Pu(i,s[0],h),g=Du(i,s[1],h),p={start:Math.max(0,Math.min(f,g)-n),end:Math.min(i.length,Math.max(f,g)+n)};return r.set(t.id,{key:l,range:p}),p}function ee(e,t){return Ge(e.config,t)===O.BAR}function Mn(e,t){return ce.Area.indexOf(Ge(e.config,t))>-1}function xn(e,t){const n=Ge(e.config,t);return ce.Line.indexOf(n)>-1}function Ve(e,t){return Ge(e.config,t)===O.SCATTER}function We(e,t){return Ge(e.config,t)===O.BUBBLE}function he(e,t){return xn(e,t)||Ve(e,t)||We(e,t)}function Wt(e,t){return Ge(e.config,t)===O.CANDLESTICK}function Qi(e,t){return Ge(e.config,t)===O.TREEMAP}function Mm(e,t){const n=Ge(e,t);return n===O.BAR||ce.Area.indexOf(n)>-1}function Rt(e,t){const n=e.getBaseValue(t);return n!=null}function yt(e,t){return Number.isFinite(e)&&Number.isFinite(t)}function Os(e,t,n){const i=Math.ceil(n)+1,a=Math.max(1,Math.ceil(e)+i*2+1),s=Math.max(1,Math.ceil(t)+i*2+1);return{data:new Uint8Array(a*s),height:s,offset:i,width:a}}function $s(e,t,n){const i=Math.round(t)+e.offset,a=Math.round(n)+e.offset;if(i<0||i>=e.width||a<0||a>=e.height)return!1;const s=a*e.width+i;return e.data[s]?!1:(e.data[s]=1,!0)}function zt(e,t,n,i=`axis_${t}`){const a=e[`${i}_tick_${n}`];return a!==void 0?a:e[`axis_${t}_tick_${n}`]}function di(e,t){const n=typeof e=="function"?e.call(t):e;return n!=null&&n.length?n:void 0}function Bs(e,t,n){var i,a,s,o,r,l;if((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i,n))return t instanceof Date?t:Vt.call(e,t);if(n==="x"&&((o=(s=e.axis)==null?void 0:s.isCategorized)!=null&&o.call(s))&&typeof t=="string"){const c=e.config.axis_x_categories.indexOf(t);return c>=0?c:t}return(l=(r=e.axis)==null?void 0:r.isLog)!=null&&l.call(r,n)&&t!==null&&t!==void 0?+t:t}function Le(e,t){return Bs(e,t,"x")}function Fn(e,t,n="y"){return Bs(e,t,n)}function zs(e,t,n="y"){return t.map(i=>Fn(e,i,n))}function ta(e,t){return t.map(n=>Le(e,n)).filter(n=>{var i,a;return!(typeof n=="string"&&((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)))})}function sn(e,t){const n=typeof t=="function"?t():t;return e.ticks?e.ticks(n):e.domain()}function Ns(e,t){const[n,i]=e.domain(),a=+n,s=+i;if(t||!Number.isFinite(a)||!Number.isFinite(s)||s<=0)return sn(e,t);const o=Xe("_log").domain([a>0?a:1,s]).range(e.range());let r=o.ticks();for(let l=s.toFixed().length;r.length>15;l--)r=o.ticks(l);return r.length&&(r.splice(0,1,n),r.splice(r.length-1,1,i)),r}function On(e,t){const n=+e,i=+t;return Number.isFinite(n)&&Number.isFinite(i)?Math.abs(n-i)<1e-6:e===t}function Iu(e,t){const[n,i]=t,a=e.slice();return n!==void 0&&!a.some(s=>On(s,n))&&a.unshift(n),i!==void 0&&!a.some(s=>On(s,i))&&a.push(i),a}function Xs(e,t){const n=Le(e,t);return ci(n)}function ea(e){var t,n,i,a,s,o,r,l;const{scale:c}=e,d=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),u=((a=(i=c.subX)==null?void 0:i.domain)==null?void 0:a.call(i))||((o=(s=c.x)==null?void 0:s.orgDomain)==null?void 0:o.call(s))||((l=(r=c.x)==null?void 0:r.domain)==null?void 0:l.call(r));return!(d!=null&&d.length)||!(u!=null&&u.length)?!1:!On(d[0],u[0])||!On(d[1],u[1])}function Kt(e){return ea(e)?e.scale.zoom:e.scale.x}function Mu(e,t,n=0){var i,a;const s=(a=(i=Kt(e)).domain)==null?void 0:a.call(i);if(!(s!=null&&s.length))return!0;const o=Xs(e,t),r=+s[0],l=+s[1];return o===null||!Number.isFinite(r)||!Number.isFinite(l)?!0:o>=Math.min(r,l)-n&&o<=Math.max(r,l)+n}function Fu(e,t){const n=[t>0?Math.abs(e[t]-e[t-1]):1/0,t<e.length-1?Math.abs(e[t+1]-e[t]):1/0].filter(Number.isFinite),i=Math.min(...n);return Number.isFinite(i)?i/2:0}function Gs(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<t?n=a+1:i=a}return n}function Ou(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<=t?n=a+1:i=a}return n}function $u(e,t){var n;const{axis:i,state:a}=e,s=[a.dataGeneration,(n=i==null?void 0:i.isTimeSeries)!=null&&n.call(i)?1:0,t.map(c=>`${c.id}:${c.values.length}`).join(",")].join("|"),o=a._canvasXDataTickCache;if((o==null?void 0:o.key)===s)return o;const r=e.mapTargetsToUniqueXs(t),l={key:s,values:r,comparable:r.map(c=>{var d;return(d=Xs(e,c))!=null?d:NaN})};return a._canvasXDataTickCache=l,l}function Bu(e,t){const{values:n,comparable:i}=t;if(!ea(e))return n;const a=Fs(e);if(!a||i.length!==n.length||!Number.isFinite(i[0]))return n.filter(d=>Mu(e,d));const[s,o]=a;let r=Gs(i,s),l=Ou(i,o);const c=d=>{const u=Gs(i,d);let h=-1,f=1/0;for(const g of[u-1,u]){const p=i[g],_=Math.abs(p-d);_<f&&(f=_,h=g)}h>-1&&h<i.length&&f<=Fu(i,h)+1e-6&&(r=Math.min(r,h),l=Math.max(l,h+1))};return c(s),c(o),n.slice(Math.max(0,r),Math.min(n.length,l))}function zu(e,t){return typeof e=="function"?`fn:${t}`:Array.isArray(e)?e.map(n=>n instanceof Date?+n:String(n)).join(","):""}function Nu(e,t){var n,i,a;const{config:s,state:o}=e,l=(((i=(n=Kt(e)).domain)==null?void 0:i.call(n))||[]).map(d=>d instanceof Date?+d:String(d)).join(","),c=s.axis_rotated?o.height:o.width;return[t?1:0,o.dataGeneration,l,c,s.axis_x_tick_fit?1:0,s.axis_x_tick_count||"",s.axis_x_tick_culling,s.axis_x_tick_culling_max||"",s.axis_x_tick_culling_reverse?1:0,((a=s.axis_x_categories)==null?void 0:a.length)||0,zu(s.axis_x_tick_values,o.redrawGeneration)].join("|")}function na(e,t,n,i=!1){var a;return(a=e.axis)!=null&&a.generateTickValues?e.axis.generateTickValues(t,n,i):t}function Xu(e,t){const[n,i]=e,a=[];if(!t||!Number.isFinite(t))return a;for(let s=Math.round(n);s<=i;s+=t)a.push(s);return a}function hi(e,t=!0){var n,i,a,s,o,r,l;const{axis:c,config:d}=e,u=Kt(e),h=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),f=e.state._canvasXTickValuesCache||(e.state._canvasXTickValuesCache=new Map),g=Nu(e,t),p=f.get(g);if(p)return p;const _=v=>(f.set(g,v),v);if(!(h!=null&&h.length))return _([]);const x=di(d.axis_x_tick_values,e.api);if(x){const v=ta(e,x);return _(t?aa(e,v):v)}if(d.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const v=$u(e,h),b=Bu(e,v),y=na(e,b,d.axis_x_tick_count,(i=c==null?void 0:c.isTimeSeries)==null?void 0:i.call(c));return _(t?aa(e,y,!0):y)}if(ea(e)&&!((a=c==null?void 0:c.isCategorized)!=null&&a.call(c))){const v=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||u.domain(),b=Iu(sn(u,d.axis_x_tick_count||_e),v);return _(t?gi(b,sa(e)):b)}if((r=c==null?void 0:c.isCategorized)!=null&&r.call(c)&&((l=d.axis_x_categories)!=null&&l.length)){const v=d.axis_x_categories.map((b,y)=>y);return _(t?gi(v,sa(e)):v)}const m=sn(u,d.axis_x_tick_count||_e);return _(t?gi(m,sa(e)):m)}function Gu(e){const{config:t,state:{height2:n,width2:i}}=e,a=t.axis_rotated?n:i,s=zt(t,"x","count","subchart_axis_x"),o=zt(t,"x","culling","subchart_axis_x"),r=zt(t,"x","culling_max","subchart_axis_x");if(s)return s;if(o!==!1)return Math.min(r||_e,Math.max(2,Math.floor(a/70)))}function Vs(e,t=!0){var n,i,a,s;const{axis:o,config:r,scale:l}=e,c=l.subX,d=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),u=zt(r,"x","count","subchart_axis_x"),h=Gu(e),f=(_,x=!1)=>t?aa(e,_,x,"subchart_axis_x",h):_;if(!c||!(d!=null&&d.length))return[];const g=di(zt(r,"x","values","subchart_axis_x"),e.api);if(g)return f(ta(e,g));if(r.axis_x_tick_fit&&e.mapTargetsToUniqueXs){const _=na(e,e.mapTargetsToUniqueXs(d),u,(i=o==null?void 0:o.isTimeSeries)==null?void 0:i.call(o));return f(_,!0)}if((a=o==null?void 0:o.isCategorized)!=null&&a.call(o)&&((s=r.axis_x_categories)!=null&&s.length))return f(r.axis_x_categories.map((_,x)=>x),!0);const p=sn(c,u||_e);return f(p,!0)}function Ws(e,t=Kt(e),n=e.config.axis_x_tick_outer){var i,a;const s=t,o=((i=s.orgDomain)==null?void 0:i.call(s))||((a=s.domain)==null?void 0:a.call(s));if(!(o!=null&&o.length))return[];const r=+o[0],l=+o[o.length-1];if(!Number.isFinite(r)||!Number.isFinite(l))return[];const c=Math.ceil(Math.min(r,l)),d=Math.floor(Math.max(r,l)),u=Array.from({length:Math.max(0,d-c+1)},(h,f)=>c+f);return n?u.slice(1,-1):u}function ia(e,t,n=Kt(e)){var i,a,s,o,r;const l=n,c=Le(e,t);if((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)){const d=(s=l.orgScale)==null?void 0:s.call(l);if(d)return d(c);const u=((r=(o=e.axis.x)==null?void 0:o.tickOffset)==null?void 0:r.call(o))||(l(1)-l(0))/2;return l(c)-u}return l(c)}function Ys(e,t,n,i=Kt(e)){if(t.length<2)return!1;const a=Math.max(1,n)/2,s=t.map(r=>ia(e,r,i)).filter(Number.isFinite).sort((r,l)=>r-l);if(s.length<2)return!1;let o=s[0]+a;for(let r=1;r<s.length;r++){const l=s[r]-a,c=s[r]+a;if(l<=o+vs)return!0;o=Math.max(o,c)}return!1}function fi(e,t,n=Kt(e)){const i=new Set;return t.filter(a=>{const s=ia(e,a,n),o=Math.round(s);return!Number.isFinite(s)||i.has(o)?!1:(i.add(o),!0)})}function Vu(e,t,n=1){var i;const{axis:a,config:s}=e;if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const r=Ws(e);return fi(e,r)}if(s.axis_x_tick_culling===!1||s.axis_x_tick_culling_lines===!1)return t;const o=hi(e,!1);return Ys(e,o,n)?t:fi(e,o)}function Wu(e,t,n=1){var i;const{axis:a,config:s,scale:o}=e,r=o.subX,l=zt(s,"x","culling","subchart_axis_x"),c=zt(s,"x","culling_lines","subchart_axis_x"),d=zt(s,"x","outer","subchart_axis_x");if(!r)return[];if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const h=Ws(e,r,d);return fi(e,h,r)}if(l===!1||c===!1)return t;const u=Vs(e,!1);return Ys(e,u,n,r)?t:fi(e,u,r)}function $n(e,t="y",n,i=!0,a=e.scale[t],s=`axis_${t}`){var o,r,l;const{axis:c,config:d}=e,u=`axis_${t}`,h=di(zt(d,t,"values",s),e.api),f=_=>i?Uu(e,t,_,s):_;if(h)return f(zs(e,h,t));const g=Xu(a.domain(),d[`${u}_tick_stepSize`]);if(g.length)return f(g);const p=n!=null?n:zt(d,t,"count",s);if((o=c==null?void 0:c.isTimeSeries)!=null&&o.call(c,t)&&d[`${u}_tick_time_value`])return f(sn(a,d[`${u}_tick_time_value`]));if((r=c==null?void 0:c.isLog)!=null&&r.call(c,t))return f(Ns(a,p));if(p){const _=a.domain();return f(na(e,_,_.every(x=>x===0)?1:p,(l=c==null?void 0:c.isTimeSeries)==null?void 0:l.call(c,t)))}return f(sn(a,_e))}function Yu(e,t,n){const i=t==="x"?Kt(e):e.scale[t],a=i!=null&&i.copy?i.copy():i;return n.domain&&(a!=null&&a.domain)&&a.domain(n.domain),a}function Hu(e,t,n,i){var a,s,o;const r=i.tick||{},l=di(r.values,e.api);return l?t==="x"?ta(e,l):zs(e,l,t):t!=="x"&&((s=(a=e.axis)==null?void 0:a.isLog)!=null&&s.call(a,t))?Ns(n,r.count):sn(n,(o=r.count)!=null?o:_e)}function ju(e,t){var n;const i=(n=t.tick)==null?void 0:n.format;return typeof i=="function"?i.bind(e.api):(a=>a)}function gi(e,t){const n=e.length-1;if(t&&n>t){const i=e.length-1;return t<=1?[e[0]]:Array.from({length:t},(a,s)=>e[Math.round(s*i/(t-1))])}return e}function Uu(e,t,n,i=`axis_${t}`){const{config:a}=e;if(!zt(a,t,"culling",i))return n;const o=zt(a,t,"culling_max",i)||_e,r=zt(a,t,"culling_reverse",i),l=n.slice().sort((h,f)=>{const g=+h,p=+f,_=Number.isFinite(g)&&Number.isFinite(p)?g-p:String(h).localeCompare(String(f));return r?-_:_}),c=l.length;let d=0;for(let h=1;h<c;h++)if(c/h<o){d=h;break}if(!d)return n;const u=new Set(l.filter((h,f)=>f%d===0));return n.filter(h=>u.has(h))}function aa(e,t,n=!1,i="axis_x",a){const{config:s}=e;if(zt(s,"x","culling",i)===!1)return t;const r=a||zt(s,"x","culling_max",i)||_e,l=zt(s,"x","culling_reverse",i),c=n?t:t.slice().sort((f,g)=>{const p=+f,_=+g;return Number.isFinite(p)&&Number.isFinite(_)?l?_-p:p-_:l?String(g).localeCompare(String(f)):String(f).localeCompare(String(g))}),d=c.length;let u=0;for(let f=1;f<d;f++)if(d/f<r){u=f;break}if(!u)return t;if(n)return t.filter((f,g)=>l?(d-1-g)%u===0:g%u===0);const h=new Set(c.filter((f,g)=>g%u===0));return t.filter(f=>h.has(f))}function sa(e){const{config:t,state:{height:n,width:i}}=e,a=t.axis_rotated?n:i;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||_e,Math.max(2,Math.floor(a/70)))}function Ku(e){var t,n;const{axis:i,config:a}=e,s=(n=(t=i==null?void 0:i.y)==null?void 0:t.getGeneratedTicks)==null?void 0:n.call(t,a.grid_y_ticks);return s!=null&&s.length?s:a.grid_y_ticks?gi($n(e,"y",void 0,!1),a.grid_y_ticks):$n(e,"y",void 0,!1)}var Zu=Object.defineProperty,qu=(e,t,n)=>t in e?Zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ju=(e,t,n)=>qu(e,typeof t!="symbol"?t+"":t,n);class Hs{constructor(t){Ju(this,"ctx",t)}get context(){return this.ctx}withContext(t,n){const i=this.ctx;this.ctx=t;try{n()}finally{this.ctx=i}}withState(t){const{ctx:n}=this;n.save();try{t(n)}finally{n.restore()}}withTranslation(t,n,i){this.withState(a=>{a.translate(t,n),i(a)})}clipRect(t,n){this.withState(i=>{i.beginPath(),i.rect(t.x,t.y,t.w,t.h),i.clip(),n(i)})}measureText(t){return this.ctx.measureText(t)}traceLine(t,n,i,a){const{ctx:s}=this;s.moveTo(t,n),s.lineTo(i,a)}traceCrispLine(t,n,i,a,s){this.traceLine(this.crisp(t,s),this.crisp(n,s),this.crisp(i,s),this.crisp(a,s))}traceCircle(t,n,i){this.ctx.moveTo(t+i,n),this.ctx.arc(t,n,i,0,Math.PI*2)}strokePath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.stroke()})}fillPath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.fill()})}fillRect(t,n){this.withStyle(n,i=>{i.fillRect(t.x,t.y,t.w,t.h)})}fillRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.fillRect(a,i);return}this.fillPath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.strokeRect(a,i);return}this.strokePath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRect(t,n){this.withStyle(n,i=>{i.strokeRect(t.x,t.y,t.w,t.h)})}text(t,n,i,a){const s=(r,l,c)=>{(a==null?void 0:a.maxWidth)===void 0?r.fillText(t,l,c):r.fillText(t,l,c,a.maxWidth)},o=r=>{a!=null&&a.angle?(r.translate(n,i),r.rotate(a.angle*Math.PI/180),s(r,0,0)):s(r,n,i)};a!=null&&a.angle?this.withState(r=>{this.applyStyle(a),o(r)}):this.withStyle(a,o)}textLines(t,n,i,a){this.withState(s=>{const o=t.split(`
`),r=de((a==null?void 0:a.font)||s.font),l=o.length>1?-((o.length-1)*r):0;this.applyStyle(a),s.translate(n,i),a!=null&&a.angle&&s.rotate(a.angle*Math.PI/180),o.forEach((c,d)=>{const u=l+d*r;(a==null?void 0:a.maxWidth)===void 0?s.fillText(c,0,u):s.fillText(c,0,u,a.maxWidth)})})}point(t,n,i,a,s){this.withStyle(s,o=>{const r=!(s!=null&&s.stroke)||s.fill!==void 0,l=(s==null?void 0:s.stroke)!==void 0;if(t==="rectangle"){const c=a*2,d={x:n-a,y:i-a,w:c,h:c};r&&o.fillRect(d.x,d.y,d.w,d.h),l&&o.strokeRect(d.x,d.y,d.w,d.h)}else o.beginPath(),o.arc(n,i,a,0,Math.PI*2),r&&o.fill(),l&&o.stroke()})}getRectRadii(t,n){const i=typeof n=="number"?{tl:n,tr:n,br:n,bl:n}:{tl:n.tl||0,tr:n.tr||0,br:n.br||0,bl:n.bl||0},a=Math.max(0,Math.min(Math.abs(t.w),Math.abs(t.h))/2);return{tl:Math.max(0,Math.min(i.tl,a)),tr:Math.max(0,Math.min(i.tr,a)),br:Math.max(0,Math.min(i.br,a)),bl:Math.max(0,Math.min(i.bl,a))}}traceRoundRect(t,n,i){const{x:a,y:s,w:o,h:r}=n,l=a+o,c=s+r;t.moveTo(a+i.tl,s),t.lineTo(l-i.tr,s),i.tr?t.quadraticCurveTo(l,s,l,s+i.tr):t.lineTo(l,s),t.lineTo(l,c-i.br),i.br?t.quadraticCurveTo(l,c,l-i.br,c):t.lineTo(l,c),t.lineTo(a+i.bl,c),i.bl?t.quadraticCurveTo(a,c,a,c-i.bl):t.lineTo(a,c),t.lineTo(a,s+i.tl),i.tl?t.quadraticCurveTo(a,s,a+i.tl,s):t.lineTo(a,s),t.closePath()}normalizeRect(t){const n=t.w<0?t.x+t.w:t.x,i=t.h<0?t.y+t.h:t.y;return{x:n,y:i,w:Math.abs(t.w),h:Math.abs(t.h)}}applyStyle(t){if(!t)return;const{ctx:n}=this;t.fill!==void 0&&(n.fillStyle=t.fill),t.stroke!==void 0&&(n.strokeStyle=t.stroke),t.lineWidth!==void 0&&(n.lineWidth=t.lineWidth),t.alpha!==void 0&&(n.globalAlpha=t.alpha),t.font!==void 0&&(n.font=t.font),t.textAlign!==void 0&&(n.textAlign=t.textAlign),t.textBaseline!==void 0&&(n.textBaseline=t.textBaseline),t.lineDash!==void 0&&n.setLineDash(t.lineDash)}withStyle(t,n){t?this.withState(i=>{this.applyStyle(t),n(i)}):n(this.ctx)}crisp(t,n){return n%2?Math.round(t)+.5:Math.round(t)}}var Qu=Object.defineProperty,td=Object.defineProperties,ed=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertySymbols,nd=Object.prototype.hasOwnProperty,id=Object.prototype.propertyIsEnumerable,oa=(e,t,n)=>t in e?Qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Us=(e,t)=>{for(var n in t||(t={}))nd.call(t,n)&&oa(e,n,t[n]);if(js)for(var n of js(t))id.call(t,n)&&oa(e,n,t[n]);return e},Ks=(e,t)=>td(e,ed(t)),ra=(e,t,n)=>oa(e,typeof t!="symbol"?t+"":t,n);const Zs=20,qs=15;function la(e){return e?-1:1}function ad(e,t){return e?t?-1:1:t?1:-1}function sd(e,t){var n,i,a;const s=t==="y2"?"subY2":"subY",o=(a=(i=(n=e.axis)==null?void 0:n[s])==null?void 0:i.tickFormat)==null?void 0:a.call(i),r=e.config[`subchart_axis_${t}_tick_format`]||e.config[`axis_${t}_tick_format`];return o||(typeof r=="function"?r.bind(e.api):(l=>l))}function od(e){return e?{stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.dashArray}:void 0}function rd(e){return e?{fill:e.labelColor,font:e.labelFont}:void 0}function ca(e,t,n){return{x:e.left-Zs,y:0,w:t+Zs*2,h:n}}function ua(e,t,n){return{x:0,y:e.top-qs,w:t,h:n+qs*2}}function ld(e,t){var n,i;const a=(i=(n=e.config.axis_tooltip)==null?void 0:n.backgroundColor)!=null?i:"black";return typeof a=="string"?a:(a==null?void 0:a[t])||null}function cd(e,t,n){var i,a;const s=e.scale[t];if(!(s!=null&&s.invert))return null;const o=s.invert(n);if(o==null)return null;if(t==="x"&&((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i)))return e.format.xAxisTick(o);const r=Number(o);return Number.isFinite(r)?r.toFixed(2):`${o}`}function ud(e,t){const{config:n,state:{height:i,margin:a,width:s}}=e,o=n.axis_rotated,r={x:a.left,y:a.top};return t==="x"?!o&&(r.y+=i):t==="y"?o&&(r.y+=i):o?r.y-=1:r.x+=s,r}function dd(e,t,n,i){return i?{x:e.x+n,y:e.y-t}:{x:e.x+t,y:e.y+n}}function Js(e,t){const n=e?e(t):t;return n==null?"":String(n)}function Bn(e,t){return e[`${t}TickFont`]||e.labelFont}function da(e,t){const n=e.measureText("0"),i=(n.fontBoundingBoxAscent||0)+(n.fontBoundingBoxDescent||0),a=(n.actualBoundingBoxAscent||0)+(n.actualBoundingBoxDescent||0),s=(t||10)*(11.5/10);return Math.max(t,i,a,s)}function hd(e){return 11.5-2.5*(e/15)*(e>0?1:-1)}function fd(e){return 8*Math.sin(Math.PI*(e/180))}function ha(e,t){if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return Number.isFinite(n)?/em$/.test(e.trim())?n*t:n:0}return 0}function gd(e,t,n){if(!t)return[e];const i=n.measureText("0").width||5.5;function a(s,o){let r;for(let l=1;l<o.length;l++)if(o.charAt(l)===" "&&(r=l),t<i*(l+1)){const c=r||l;return a(s.concat(o.slice(0,c)),o.slice(r?r+1:l))}return s.concat(o)}return a([],e)}function fa(e,t,n,i){var a,s;const o=e.config.axis_x_tick_width;if(o&&o>0)return o;if(n)return 95;if((s=(a=e.axis)==null?void 0:a.isCategorized)!=null&&s.call(a)&&t.length>1){const r=i(Le(e,t[0])),l=i(Le(e,t[1]));return Math.max(0,Math.abs(l-r)-12)}return 110}function Qs(e,t,n,i,a=[],s=!1,o=Kt(e),r){const l=n?n(i):i;if(l==null)return[""];if(Array.isArray(l))return l.map(d=>String(d));const c=String(l);return c.indexOf(`
`)>-1?c.split(`
`):e.config.axis_x_tick_multiline?gd(c,r!=null?r:fa(e,a,s,o),t):[c]}function ga(e,t){const{isRotated:n,tickCount:i,tickIndex:a,tickRotate:s,tickTextDirection:o}=t,r=e.config.axis_x_tick_text_inner;let l=n?o>0?"left":"right":s?s>0?"left":"right":"center";return!n&&a===0&&(r===!0||r!=null&&r.first)?l="left":!n&&a===i-1&&(r===!0||r!=null&&r.last)&&(l="right"),l}function pd(e,t){var n,i;return((n=e==null?void 0:e.indexOf("center"))!=null?n:-1)>-1?{x:t/2,align:"center"}:((i=e==null?void 0:e.indexOf("right"))!=null?i:-1)>-1?{x:t,align:"right"}:{x:0,align:"left"}}function Ye(e){return Number.isFinite(e)}function pi(e,t,n){return Ye(e)&&e>=Math.min(t,n)&&e<=Math.max(t,n)}function to(e){return e?-1:1}function _d(e,t,n){return t?n?e.axis_y2_inner?1:-1:e.axis_y_inner?-1:1:n?e.axis_y2_inner?-1:1:e.axis_y_inner?1:-1}function pa(e,t,n=Kt(e)){return n(Le(e,t))}function xd(e,t){var n,i;return(i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&typeof t=="string"&&Number.isNaN(Number(t))?e.config.axis_x_categories.indexOf(t):Le(e,t)}function md(e,t){var n,i;return!!((i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&Number.isNaN(Number(t)))}function eo(e,t,n,i){var a,s;if(t===void 0)return n;let o=Kt(e)(xd(e,t));if(md(e,t)){const r=Kt(e),l=((s=(a=e.axis.x)==null?void 0:a.tickOffset)==null?void 0:s.call(a))||(r(1)-r(0))/2;o+=l*(i==="start"?-1:1)}return o}function no(e,t,n="y"){return e.scale[n||"y"](Fn(e,t,n))}function io(e,t,n){return e==="start"?t+4:e==="middle"?(t+n)/2:n-4}function ao(e,t,n){return e==="start"?n-4:e==="middle"?(t+n)/2:t+4}function vd(e,t){const{config:n,scale:i,state:{width:a,height:s}}=e,o=t.axis||"x",r=n.axis_rotated;if(o==="x"){const h=eo(e,t.start,0,"start"),f=eo(e,t.end,r?s:a,"end"),g=Math.min(h,f),p=Math.abs(f-h);return r?{x:0,y:g,w:a,h:p}:{x:g,y:0,w:p,h:s}}if(!i[o])return null;const l=t.start===void 0?r?0:s:no(e,t.start,o),c=t.end===void 0?r?a:0:no(e,t.end,o),d=Math.min(l,c),u=Math.abs(c-l);return r?{x:d,y:0,w:u,h:s}:{x:0,y:d,w:a,h:u}}class bd{constructor(t,n){ra(this,"engine",t),ra(this,"theme",n),ra(this,"painter"),this.painter=new Hs(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}draw(t){this.drawRegions(t),this.drawGrid(t),this.drawAxis(t)}drawAxis(t){const{config:n}=t;n.axis_x_show&&this.drawXAxis(t),n.axis_y_show&&this.drawYAxis(t),n.axis_y2_show&&t.scale.y2&&this.drawYAxis(t,"y2"),this.drawAdditionalAxes(t),this.drawAxisLabels(t)}drawSubXAxis(t){var n,i,a,s;const{ctx:o,painter:r,theme:{style:{axis:l}}}=this,{config:c,format:d,scale:u,state:{current:h,margin2:f,width2:g,height2:p}}=t;if(!c.subchart_show||!c.subchart_axis_x_show||!u.subX||g<=0||p<=0)return;const _=c.axis_rotated,x=r.crisp(f.left,l.lineWidth),m=r.crisp(f.top+p,l.lineWidth),v=f.left,b=f.left+g,y=f.top,T=f.top+p,w=_?y:v,C=_?T:b,k=Vs(t),S=Wu(t,k,l.tickWidth),A=(n=c.subchart_axis_x_tick_outer)!=null?n:c.axis_x_tick_outer,L=_?c.axis_x_tick_inner?1:-1:c.axis_x_tick_inner?-1:1,E=to(_),D=la(_),R=c.axis_x_tick_text_position,P=_?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0,B=d.subXAxisTick||((s=(a=t.axis)==null?void 0:a.getXAxisTickFormat)==null?void 0:s.call(a,!0));r.clipRect(_?ua(f,h.width,p):Ks(Us({},ca(f,g,h.height-f.top)),{y:f.top}),()=>{o.globalAlpha=1,o.strokeStyle=l.lineColor,o.lineWidth=l.lineWidth,o.setLineDash([]),r.strokePath(()=>{_?r.traceLine(x,y,x,T):r.traceLine(v,m,b,m),A&&(_?(r.traceLine(x,y,x+dt*E,y),r.traceLine(x,T,x+dt*E,T)):(r.traceLine(v,m,v,m+dt*E),r.traceLine(b,m,b,m+dt*E)))});const I=Bn(l,"x");o.font=I,o.fillStyle=l.labelColor,o.textAlign=_?D>0?"left":"right":"center",o.textBaseline=_?"middle":D>0?"top":"bottom",o.strokeStyle=l.tickColor,o.lineWidth=l.tickWidth;const X=da(r,de(I)),G=fa(t,k,_,u.subX);if(c.subchart_axis_x_tick_show)for(const Z of S){const et=u.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;pi(_?xt:rt,w,C)&&r.strokePath(()=>{_?r.traceLine(x,xt,x+dt*L,xt):r.traceLine(rt,m,rt,m+dt*L)})}for(const Z of k){const et=u.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;if(!pi(_?xt:rt,w,C)||!c.subchart_axis_x_tick_text_show)continue;const Tt=Qs(t,r,B,Z,k,_,u.subX,G);let _t,mt;_?(_t=x+(dt+Je)*D+(R.x||0),mt=xt+(R.y||0),o.textAlign=D>0?"left":"right",o.textBaseline="middle"):(_t=rt+(R.x||0),mt=m+(dt+Je)*D+(R.y||0),o.textAlign=P?P>0?"left":"right":"center",o.textBaseline=D>0?"top":"bottom"),r.withState(Pt=>{Pt.translate(_t,mt),P&&Pt.rotate(P*Math.PI/180),Tt.forEach((Dt,Lt)=>{Pt.fillText(Dt,0,Lt*X)})})}})}drawSubYAxes(t){const{config:n,scale:i,state:{margin2:a,width2:s,height2:o}}=t;!n.subchart_show||s<=0||o<=0||["y","y2"].forEach(r=>{var l;const c=r==="y2"?i.subY2:i.subY;!n[`subchart_axis_${r}_show`]||!c||this.drawYAxis(t,r,{scale:c,ticks:$n(t,r,void 0,!0,c,`subchart_axis_${r}`),format:sd(t,r),index:0,outerTick:(l=n[`subchart_axis_${r}_tick_outer`])!=null?l:n[`axis_${r}_tick_outer`],margin:a,width:s,height:o,prefix:`subchart_axis_${r}`,tickShow:n[`subchart_axis_${r}_tick_show`],tickTextShow:n[`subchart_axis_${r}_tick_text_show`],tickTextPosition:n[`axis_${r}_tick_text_position`]})})}drawTitle(t){var n,i;const{ctx:a,painter:s,theme:{style:{title:o}}}=this,{config:r,state:{current:l}}=t;if(!r.title_text)return;const c=String(r.title_text).split(`
`),d=de(o.font),u=d*1.5,{x:h,align:f}=pd(r.title_position,l.width),g=(i=(n=t.getCanvasTitleHeight)==null?void 0:n.call(t))!=null?i:d,p=(r.title_padding.top||0)+g;s.withState(()=>{a.font=o.font,a.fillStyle=o.color,a.textAlign=f,a.textBaseline="alphabetic",c.forEach((_,x)=>{a.fillText(_,h,p+(x?d+(x-1)*u:0))})})}drawAxisLabels(t){const{ctx:n,painter:i,theme:{style:{axis:a}}}=this,{axis:s,config:o}=t,r=de(a.labelFont),l=["x","y","y2"],c={x:a.xLabelColor,y:a.yLabelColor,y2:a.y2LabelColor},d={start:"left",middle:"center",end:"right"};s&&i.withState(()=>{n.font=a.labelFont,n.textBaseline="alphabetic",l.forEach(u=>{const h=s.getLabelText(u);if(!h||!o[`axis_${u}_show`]||u==="y2"&&!t.scale.y2)return;const f=u==="x"&&o.axis_rotated||u!=="x"&&!o.axis_rotated,g=ud(t,u),p=s.xForAxisLabel(u)+ha(s.dxForAxisLabel(u),r),_=ha(s.dyForAxisLabel(u),r),{x,y:m}=dd(g,p,_,f),v=s.textAnchorForAxisLabel(u);n.fillStyle=c[u]||a.labelColor,n.textAlign=d[v]||"center",i.text(String(h),x,m,{angle:f?-90:0})})})}drawGrid(t){const{ctx:n,painter:i,theme:{style:{grid:a}}}=this,{config:s,scale:o,state:{height:r,margin:l,width:c}}=t;if(!a.lineColor)return;const d=s.axis_rotated,u=l.left,h=l.left+c,f=l.top,g=l.top+r;i.withState(()=>{n.strokeStyle=a.lineColor,n.lineWidth=a.lineWidth,a.dashArray.length&&n.setLineDash(a.dashArray),s.grid_x_show&&o.x&&i.strokePath(()=>{for(const p of hi(t)){const _=pa(t,p);Ye(_)&&(d?i.traceCrispLine(u,l.top+_,h,l.top+_,a.lineWidth):i.traceCrispLine(l.left+_,f,l.left+_,g,a.lineWidth))}}),s.grid_y_show&&o.y&&i.strokePath(()=>{for(const p of Ku(t)){const _=Fn(t,p),x=o.y(_);Ye(x)&&(d?i.traceCrispLine(l.left+x,f,l.left+x,g,a.lineWidth):i.traceCrispLine(u,l.top+x,h,l.top+x,a.lineWidth))}}),!s.grid_lines_front&&this.drawGridLines(t)})}drawRegions(t){const{ctx:n,painter:i,theme:{style:{region:a}}}=this,{config:s,state:{height:o,margin:r,width:l}}=t,c=s.regions||[];c.length&&i.clipRect({x:r.left,y:r.top,w:l,h:o},()=>{var d;n.fillStyle=a.fill,n.font=a.labelFont,n.textBaseline="top";for(const u of c){const h=vd(t,u);if(!h||!Ye(h.x)||!Ye(h.y)||!h.w||!h.h)continue;const f=r.left+h.x,g=r.top+h.y,p=h.w,_=h.h;if(n.globalAlpha=Number.isFinite(u.opacity)?u.opacity:a.opacity,i.fillRect({x:f,y:g,w:p,h:_}),(d=u.label)!=null&&d.text){const x=u.label,m=x.center||"",v=String(x.text),b=i.measureText(v).width,y=parseFloat(n.font)||12;let T=f+(x.x||0),w=g+(x.y||0);m.indexOf("x")>-1&&(T+=(p-b)/2),m.indexOf("y")>-1&&(w+=(_-y)/2),i.text(v,T,w,{angle:x.rotated?-90:0,alpha:1,fill:x.color||a.labelColor})}}})}drawGridLines(t){const{ctx:n,painter:i,theme:{style:{axis:a,grid:s}}}=this,{config:o,scale:r,state:{height:l,margin:c,width:d}}=t,u=o.axis_rotated,h=c.left,f=c.left+d,g=c.top,p=c.top+l;s.lineColor&&i.withState(()=>{n.strokeStyle=s.lineColor,n.lineWidth=s.lineWidth,n.font=s.labelFont||a.labelFont,n.fillStyle=s.labelColor,n.textBaseline="middle",n.setLineDash([]);const _=(y,T,w,C=!1,k)=>{y&&i.text(y,T,w,Ks(Us({},k),{angle:C?-90:0}))},x=(y,T,w)=>{const C=od(this.theme.getGridLineStyle(T,y,"line"));i.strokePath(w,C)},m=(y,T)=>rd(this.theme.getGridLineStyle(y,T,"text")),v=y=>{if(y.value===void 0||!r.x)return;const T=pa(t,y.value);if(Ye(T))if(u){const w=c.top+T;x(y,"x",()=>{i.traceLine(h,w,f,w)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,io(y.position,h,f),w-5,!1,m("x",y))}else{const w=c.left+T;x(y,"x",()=>{i.traceLine(w,g,w,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,w-5,ao(y.position,g,p),!0,m("x",y))}},b=y=>{const T=y.axis==="y2"?r.y2:r.y,w=y.axis==="y2"?"y2":"y";if(y.value===void 0||!T)return;const C=Fn(t,y.value,w),k=T(C);if(Ye(k))if(u){const S=c.left+k;x(y,"y",()=>{i.traceLine(S,g,S,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,S-5,ao(y.position,g,p),!0,m("y",y))}else{const S=c.top+k;x(y,"y",()=>{i.traceLine(h,S,f,S)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,io(y.position,h,f),S-5,!1,m("y",y))}};(o.grid_x_lines||[]).forEach(v),(o.grid_y_lines||[]).forEach(b)})}drawAdditionalAxes(t){["x","y","y2"].forEach(n=>{const i=t.config[`axis_${n}_axes`]||[];!i.length||!t.scale[n]||!t.config[`axis_${n}_show`]||i.forEach((a,s)=>{var o;const r=Yu(t,n,a);if(!r)return;const l={scale:r,ticks:Hu(t,n,r,a),format:ju(t,a),index:s+1,outerTick:((o=a.tick)==null?void 0:o.outer)!==!1};n==="x"?this.drawXAxis(t,l):this.drawYAxis(t,n,l)})})}drawXAxis(t,n){var i;const{ctx:a,painter:s,theme:{style:{axis:o}}}=this,{axis:r,config:l,state:{current:c,margin:d,width:u,height:h}}=t,f=l.axis_rotated,g=n!=null&&n.index?t.getAxisSize("x")*n.index:0,p=(n==null?void 0:n.scale)||Kt(t),_=s.crisp(d.left-(f?g:0),o.lineWidth),x=s.crisp(d.top+h+(f?0:g),o.lineWidth),m=d.left,v=d.left+u,b=d.top,y=d.top+h,T=f?b:m,w=f?y:v,C=(n==null?void 0:n.ticks)||hi(t),k=(n==null?void 0:n.ticks)||Vu(t,C,o.tickWidth),S=(n==null?void 0:n.format)||r.getXAxisTickFormat(),A=n?n.outerTick:l.axis_x_tick_outer,L=f?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,E=to(f),D=la(f),R=l.axis_x_tick_text_position,P=f?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0;s.clipRect(f?ua(d,c.width,h):ca(d,u,c.height),()=>{if(a.strokeStyle=o.lineColor,a.lineWidth=o.lineWidth,s.strokePath(()=>{f?s.traceLine(_,b,_,y):s.traceLine(m,x,v,x),A&&(f?(s.traceLine(_,b,_+dt*E,b),s.traceLine(_,y,_+dt*E,y)):(s.traceLine(m,x,m,x+dt*E),s.traceLine(v,x,v,x+dt*E)))}),a.font=Bn(o,"x"),a.fillStyle=o.labelColor,a.textAlign=f?D>0?"left":"right":"center",a.textBaseline=f?"middle":D>0?"top":"bottom",a.strokeStyle=o.tickColor,a.lineWidth=o.tickWidth,l.axis_x_tick_show&&s.strokePath(()=>{for(const G of k){const Z=ia(t,G,p),et=d.left+Z,rt=d.top+Z;pi(f?rt:et,T,w)&&(f?s.traceLine(_,rt,_+dt*L,rt):s.traceLine(et,x,et,x+dt*L))}}),!n&&!l.axis_x_tick_text_show)return;const B=Bn(o,"x"),I=da(s,de(B)),X=fa(t,C,f,p);C.forEach((G,Z)=>{this.drawXAxisTickText(t,G,S,o.labelColor,{isRotated:f,rangeEnd:w,rangeStart:T,tickCount:C.length,tickFont:B,tickIndex:Z,tickLineHeight:I,tickTextDirection:D,tickTextWidth:X,tickRotate:P,tickTextPosition:R,targetScale:p,ticks:C,x:_,y:x})})})}drawFocusedXAxisTick(t,n){var i;const{painter:a,theme:{style:{axis:s}}}=this,{axis:o,config:r,state:{current:l,margin:c,width:d,height:u}}=t,h=(i=n==null?void 0:n[0])==null?void 0:i.x;if(h===void 0||!o||!r.axis_x_show||!r.axis_x_tick_text_show||!s.activeLabelColor||s.activeLabelColor===s.labelColor)return;const f=hi(t),g=f.findIndex(w=>On(w,h)),p=f[g];if(p===void 0)return;const _=r.axis_rotated,x=a.crisp(c.left,s.lineWidth),m=a.crisp(c.top+u,s.lineWidth),v=_?c.top:c.left,b=_?c.top+u:c.left+d,y=o.getXAxisTickFormat(),T=la(_);a.clipRect(_?ua(c,l.width,u):ca(c,d,l.height),()=>{var w;this.drawXAxisTickText(t,p,y,s.activeLabelColor,{isRotated:_,rangeEnd:b,rangeStart:v,targetScale:Kt(t),tickCount:f.length,tickIndex:g,tickTextDirection:T,tickRotate:_?0:((w=t.getAxisTickRotate)==null?void 0:w.call(t,"x"))||0,tickTextPosition:r.axis_x_tick_text_position,ticks:f,x,y:m})})}drawAxisTooltip(t,n){const{ctx:i,painter:a,theme:{style:{axis:s,grid:o}}}=this,{config:r,state:{margin:l,width:c,height:d}}=t;if(!r.axis_tooltip||!n)return;const u=r.axis_rotated,h=n[0]-l.left,f=n[1]-l.top,g=h>=0&&h<=c,p=f>=0&&f<=d;if(!g&&!p)return;const _=l.left+h,x=l.top+f,m=de(s.labelFont),v=m||10,b=(y,T,w,C,k)=>{const S=ld(t,y),A=S&&cd(t,y,T);if(!A)return;i.font=s.labelFont,i.textAlign=k,i.textBaseline="alphabetic";const L=i.measureText(A),E=L.width,D=L.actualBoundingBoxAscent||v*.8,R=L.actualBoundingBoxDescent||v*.2,P=Math.max(2,E*.15),B=Math.max(3,v*.25),I=k==="right"?w-E:k==="center"?w-E/2:w,X=C-D;i.fillStyle=S,i.fillRect(I-P,X-B,E+P*2,D+R+B*2),i.fillStyle="#fff",i.fillText(A,w,C)};a.withState(()=>{i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.setLineDash([]),a.strokePath(()=>{g&&a.traceLine(_,l.top,_,l.top+d),p&&a.traceLine(l.left,x,l.left+c,x)}),i.setLineDash([]),u?(p&&r.axis_x_show&&b("x",f,l.left-m*.3,x+m*.4,"right"),g&&r.axis_y_show&&b("y",h,_-m*1.3,l.top+d+m*1.15,"left"),g&&r.axis_y2_show&&t.scale.y2&&b("y2",h,_-m*1.3,l.top-m*.4,"left")):(g&&r.axis_x_show&&b("x",h,_-m,l.top+d+m*1.15,"left"),p&&r.axis_y_show&&b("y",f,l.left-m*.4,x+m*.3,"right"),p&&r.axis_y2_show&&t.scale.y2&&b("y2",f,l.left+c+m*.4,x+m*.3,"left"))})}drawXAxisTickText(t,n,i,a,s){var o,r;const{ctx:l,painter:c,theme:{style:{axis:d}}}=this,{state:{margin:u}}=t,{isRotated:h,rangeEnd:f,rangeStart:g,tickTextDirection:p,tickRotate:_,tickTextPosition:x,targetScale:m,ticks:v,x:b,y}=s,T=pa(t,n,m),w=u.left+T,C=u.top+T;if(!pi(h?C:w,g,f))return;const S=(o=s.tickFont)!=null?o:Bn(d,"x");l.font=S,l.fillStyle=a;const A=Qs(t,c,i,n,v,h,m,s.tickTextWidth),L=(r=s.tickLineHeight)!=null?r:da(c,de(S));let E,D;if(h)E=b+(dt+Je)*p+(x.x||0),D=C+(x.y||0),l.textAlign=ga(t,s),l.textBaseline="middle";else if(_){const R=de(S),P=x.y?ha(x.y,R):.71*R,B=fd(_)+(x.x||0),I=hd(_)+P;l.textAlign=ga(t,s),l.textBaseline="alphabetic",c.withState(X=>{X.translate(w,y),X.rotate(_*Math.PI/180),A.forEach((G,Z)=>{X.fillText(G,B,I+Z*L)})});return}else E=w+(x.x||0),D=y+(dt+Je)*p+(x.y||0),l.textAlign=ga(t,s),l.textBaseline=p>0?"top":"bottom";c.withState(R=>{R.translate(E,D),_&&R.rotate(_*Math.PI/180),A.forEach((P,B)=>{R.fillText(P,0,B*L)})})}drawYAxis(t,n="y",i){var a,s,o,r,l,c,d,u;const{ctx:h,painter:f,theme:{style:{axis:g}}}=this,{config:p,scale:_,state:x}=t,{margin:m,width:v,height:b}=x,y=(i==null?void 0:i.margin)||m,T=(a=i==null?void 0:i.width)!=null?a:v,w=(s=i==null?void 0:i.height)!=null?s:b,C=(i==null?void 0:i.prefix)||`axis_${n}`,k=(i==null?void 0:i.scale)||_[n],S=n==="y2",A=p.axis_rotated,L=i!=null&&i.index?t.getAxisSize(n)*i.index:0,E=f.crisp(y.left+(S?T+(A?0:L):-L),g.lineWidth),D=f.crisp(y.top+(A?S?-L-1:w+L:0),g.lineWidth),R=y.left,P=y.left+T,B=y.top,I=y.top+w,X=(i==null?void 0:i.ticks)||$n(t,n),G=(i==null?void 0:i.ticks)||(p[`${C}_tick_culling`]&&p[`${C}_tick_culling_lines`]!==!1?$n(t,n,void 0,!1):X),Z=(i==null?void 0:i.format)||((l=(r=(o=t.axis)==null?void 0:o[n])==null?void 0:r.tickFormat)==null?void 0:l.call(r))||((c=p[`${C}_tick_format`])==null?void 0:c.bind(t.api))||(Pt=>Pt),et=i?i.outerTick:p[`${C}_tick_outer`],rt=A?S?p.axis_y2_tick_inner?1:-1:p.axis_y_tick_inner?-1:1:S?p.axis_y2_tick_inner?-1:1:p.axis_y_tick_inner?1:-1,xt=_d(p,A,S),gt=ad(A,S),Tt=(i==null?void 0:i.tickTextPosition)||p[`${C}_tick_text_position`]||p[`axis_${n}_tick_text_position`],_t=(d=i==null?void 0:i.tickShow)!=null?d:i?!0:p[`${C}_tick_show`],mt=(u=i==null?void 0:i.tickTextShow)!=null?u:i?!0:p[`${C}_tick_text_show`];f.withState(()=>{h.strokeStyle=g.lineColor,h.lineWidth=g.lineWidth,f.strokePath(()=>{A?f.traceLine(R,D,P,D):f.traceLine(E,B,E,I),et&&(A?(f.traceLine(R,D,R,D+dt*xt),f.traceLine(P,D,P,D+dt*xt)):(f.traceLine(E,B,E+dt*xt,B),f.traceLine(E,I,E+dt*xt,I)))});const Pt=Bn(g,n);h.font=Pt,h.fillStyle=g.labelColor,h.textAlign=A?"center":gt>0?"left":"right",h.textBaseline=A?gt>0?"top":"bottom":"middle",h.strokeStyle=g.tickColor,h.lineWidth=g.tickWidth;const Dt=[],Lt=[],$e=(Ht,Be)=>{const hn=Fn(t,Ht,n),Yi=y.left+k(hn),Hi=y.top+k(hn);Ye(A?Yi:Hi)&&Be.push({tick:Ht,tx:Yi,ty:Hi})};for(const Ht of X)$e(Ht,Dt);for(const Ht of G)$e(Ht,Lt);if(_t&&f.strokePath(()=>{for(const{tx:Ht,ty:Be}of Lt)A?f.traceLine(Ht,D,Ht,D+dt*rt):f.traceLine(E,Be,E+dt*rt,Be)}),mt)for(const{tick:Ht,tx:Be,ty:hn}of Dt)A?f.text(Js(Z,Ht),Be+(Tt.x||0),D+dt*gt+(Tt.y||0)):f.text(Js(Z,Ht),E+(dt+Je)*gt+(Tt.x||0),hn+(Tt.y||0))})}}const oe={canvas:"bb-canvas",overlay:"bb-canvas-overlay",legend:"bb-canvas-legend",legendBottom:"bb-canvas-legend-bottom",legendInset:"bb-canvas-legend-inset",legendItemInteractive:"bb-legend-item-interactive",legendItemTileCircle:"bb-legend-item-tile-circle",legendItemTitle:"bb-legend-item-title",legendRight:"bb-canvas-legend-right"};var Fm=oe,yd=Object.defineProperty,Td=(e,t,n)=>t in e?yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mn=(e,t,n)=>Td(e,typeof t!="symbol"?t+"":t,n);class wd{constructor(){mn(this,"canvas"),mn(this,"ctx"),mn(this,"dpr",1),mn(this,"frame",null),mn(this,"frameCtx",null),mn(this,"frameValid",!1)}init(t,n,i){this.canvas=nt.createElement("canvas"),this.canvas.className=oe.canvas,this.canvas.style.display="block",t.appendChild(this.canvas),this.dpr=N.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d"),this.resize(n,i)}resize(t,n){const i=Math.max(0,t),a=Math.max(0,n);this.dpr=N.devicePixelRatio||1,this.canvas.width=i*this.dpr,this.canvas.height=a*this.dpr,this.canvas.style.width=`${i}px`,this.canvas.style.height=`${a}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.frame=null,this.frameCtx=null,this.frameValid=!1}clearOverlay(){this.frameValid&&this.restoreFrame()}withOverlay(t){const{ctx:n}=this;this.frameValid?this.clearOverlay():this.captureFrame(),n.save(),n.setTransform(this.dpr,0,0,this.dpr,0,0);try{t(n)}finally{n.restore()}}beginFrame(t,n){const{ctx:i}=this;this.frameValid=!1,i.save(),i.setTransform(this.dpr,0,0,this.dpr,0,0),i.clearRect(0,0,t,n)}endFrame(){this.ctx.restore()}captureFrame(){const{canvas:t}=this;if(this.frameValid=!1,t.width&&t.height){let{frame:n,frameCtx:i}=this;if(!n){const a=nt.createElement("canvas");n=a,i=a.getContext("2d"),this.frame=n,this.frameCtx=i}if(!n||!i)return;i.setTransform(1,0,0,1,0,0),n.width!==t.width||n.height!==t.height?(n.width=t.width,n.height=t.height):i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),this.frameValid=!0}}restoreFrame(){if(!this.frameValid||!this.frame||!this.frameCtx)return;const{canvas:t,ctx:n}=this;n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.drawImage(this.frame,0,0),n.restore(),n.setTransform(this.dpr,0,0,this.dpr,0,0)}destroy(){var t;(t=this.canvas)==null||t.remove(),this.frame=null,this.frameCtx=null,this.frameValid=!1}}function _a(e){const{config:t,state:n}=e;return!!(t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&t.subchart_show&&t.subchart_brush_enabled===!1&&n.width2>0&&n.height2>0)}function so(e,t){var n;const{config:i,scale:a,state:s}=e,o=a.zoom||a.x,r=a.subX;if(!o||!r)return null;const l=i.axis_rotated?s.height2:s.width2,c=i.axis_rotated?s.height:s.width,d=(n=r.invert)==null?void 0:n.call(r,t);let u=d==null?NaN:o(d);return!Number.isFinite(u)&&l>0&&(u=Math.max(0,Math.min(1,t/l))*c),Number.isFinite(u)?Math.max(0,Math.min(c,u)):null}const xa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oo=/([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;function Cd(e){const t=new Set;let n=-1,i=0,a=!1,s;for(oo.lastIndex=0;s=oo.exec(e);)if(s[1])a=s[1]==="a"||s[1]==="A",i=0;else if(n++,a){const o=i%7;(o===2||o===3||o===4)&&t.add(n),i++}return t}function Sd(e,t){const n=Cd(t),i=[],a=[];let s=0,o=-1,r=-1,l,c;const d=f=>{i[o]?i[o]+=f:i[++o]=f};xa.lastIndex=0;const u=xa,h=new RegExp(xa.source,"g");for(e+="",t+="";(l=u.exec(e))&&(c=h.exec(t));){if(r++,c.index>s&&d(t.slice(s,c.index)),l[0]===c[0])d(c[0]);else{const f=+l[0],g=+c[0],p=n.has(r);i[++o]=null,a.push({index:o,fn:p?_=>Math.round(f+(g-f)*_):_=>f+(g-f)*_})}s=h.lastIndex}if(s<t.length&&d(t.slice(s)),!a.length){const f=i.join("");return()=>f}return f=>{for(let g=0,p=a.length;g<p;g++){const{index:_,fn:x}=a[g];i[_]=String(x(f))}return i.join("")}}function _i(e){const{bar_radius:t,bar_radius_ratio:n}=e.config;return $(t)&&t>0?()=>t:$(n)?i=>i*n:null}function ma(e){const{config:t,data:n}=e,i=new Set;if(!t.data_groups.length)return i;const a=e.orderTargets(e.filterTargetsToShow(n.targets.filter(e.isBarType,e)));for(const s of t.data_groups){const o=new Set(s),r=new Map,l=new Map;for(const c of a)if(o.has(c.id))for(const d of c.values)d.value===null||d.value===0||(d.value>0?r:l).set(d.index,c.id);for(const[c,d]of r)i.add(`${d}:${c}`);for(const[c,d]of l)i.add(`${d}:${c}`)}return i}function kd(e,t,n){return n?e?t?{tl:n,bl:n}:{tr:n,br:n}:t?{br:n,bl:n}:{tl:n,tr:n}:0}function Ad(e,t,n,i){let a="";return n?i&&e[0]<t?a=`0 ${t-e[0]}px 0 0`:!i&&e[0]>t&&(a=`0 0 0 ${e[0]-t}px`):i&&e[1]>t?a=`${e[1]-t}px 0 0 0`:!i&&e[1]<t&&(a=`0 0 ${t-e[1]}px 0`),a?`inset(${a})`:null}function va(e,t,n,i,a,s){const{config:o,state:r}=e,l=o.axis_rotated,c=+l,d=+!c,u=t.value<0,h=o[`axis_${e.axis.getId(t.id)}_inverted`],f=!h&&u||h&&!u,g=e.isGrouped(t.id),p=i&&g&&t.value!==0?r.hiddenTargetIds.has(t.id)&&s?s(t):a.has(`${t.id}:${t.index}`):!1,_=[n[0][c],n[0][d]];let x=0;if(i){const v=l?d:c,b=Math.abs(n[2][v]-n[0][v]);x=Math.max(0,!g||p?i(b):0)}const m=l?n[1][c]+(f?x:-x):n[1][d]+(f?-x:x);return{radius:x,corners:kd(l,f,x),clipPath:x?Ad(_,m,l,f):null,indexX:c,indexY:d,isNegative:f,pos:m}}const ro="2 2";function lo(e,t,n){const i=e.axis.isTimeSeries(),a=(s,o)=>Ct(s)?o:i?Vt.call(e,s):s;return(n||[]).map(s=>{var o,r;return{start:a(s.start,(o=t[0])==null?void 0:o.x),end:a(s.end,(r=t[t.length-1])==null?void 0:r.x),style:s.style||{dasharray:ro}}})}function co(e,t){for(let n=0,i;i=t[n];n++)if(i.start<e&&e<=i.end)return i.style;return!1}function Ld(e){const t=String((e==null?void 0:e.dasharray)||ro).split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:[2,2]}function Rd(e,t,n,i,a){const s=e.config.axis_rotated,o=lo(e,t,a),r=[];for(let l=1;l<t.length;l++){const c=t[l-1],d=t[l];if(!q(c.value)||!q(d.value)){r.push({isBreak:!0});continue}const u=co(d.x,o),h=n(c.x),f=i(c.value),g=n(d.x),p=i(d.value);r.push({start:s?[f,h]:[h,f],end:s?[p,g]:[g,p],dash:u?Ld(u):[]})}return r}function xi(e,t){return e.config.axis_rotated?[t[1],t[0]]:[t[0],t[1]]}function uo(e,t,n=1){const i=t.map(h=>xi(e,h)),a=i.map(([h])=>h),s=i.map(([,h])=>h),o=Math.min(...a),r=Math.min(...s),l=Math.max(...a)-o,c=Math.max(...s)-r,d=Math.max(n,l),u=Math.max(n,c);return{x:o-(d-l)/2,y:r-(u-c)/2,w:d,h:u}}function zn(e,t){var n,i;const a=(n=e.isGrouped)!=null&&n.call(e,t.id)&&e.circleY?e.circleY(t,t.index):e.getYScaleById(t.id)(e.getBaseValue(t)),s=(i=e.xx(t))!=null?i:NaN;return e.config.axis_rotated?{x:a,y:s}:{x:s,y:a}}function Ed(e,t,n){return{x:e.cx(t,n),y:e.cy(t,n)}}function Pd(e,t){return{body:uo(e,[t[0],t[1]]),wickStart:xi(e,[t[2][0],t[2][1]]),wickEnd:xi(e,[t[2][0],t[2][2]])}}function vn(e,t,n,i=!1){if(t===n)return{x:0,y:0,w:e.state.width,h:0};const{scale:{x:a,y:s}}=e,o=a(t.x0),r=s(t.y0),l=a(t.x1)-o,c=s(t.y1)-r;return{x:o,y:r,w:i?Math.max(0,l):l,h:i?Math.max(0,c):c}}function Dd(e,t,n,i){const{config:a}=e,{id:s,value:o,ratio:r=0}=t,l=a.treemap_label_format,c=typeof l=="function"?l.bind(e.api)(o,r,s,{width:n,height:i}):`${s}
${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var pt=wt(4),Id=Object.defineProperty,Md=Object.defineProperties,Fd=Object.getOwnPropertyDescriptors,ho=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,$d=Object.prototype.propertyIsEnumerable,fo=(e,t,n)=>t in e?Id(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,go=(e,t)=>{for(var n in t||(t={}))Od.call(t,n)&&fo(e,n,t[n]);if(ho)for(var n of ho(t))$d.call(t,n)&&fo(e,n,t[n]);return e},po=(e,t)=>Md(e,Fd(t));function _o(e,t){return t?n=>{var i;const a=(i=e.getSubchartCandlestickShapeValue)==null?void 0:i.call(e,n,!0);return a===void 0?e.getBaseValue(n):a}:n=>e.getBaseValue(n)}function xo(e,t,n){return n?t.map(i=>{var a;const s=(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,i,n);return s===void 0?i:po(go({},i),{value:s})}):t}function Bd(e,t,n){return e.isStepType(t)?e.convertValuesToStep(n):n}function mo(e,t,n,i){const{config:a,scale:s}=e,o=a.line_connectNull,r=a.axis_rotated,l=e.generateGetLinePoints(t,n),c=e.getYScaleById.bind(e),d=_o(e,n),u=p=>(n?e.subxx:e.xx).call(e,p),h=(p,_)=>e.isGrouped(p.id)?l(p,_)[0][1]:c(p.id,n)(d(p));let f=(0,pt.line)();f=r?f.x(h).y(u):f.x(u).y(h),i&&(f=f.context(i)),o||(f=f.defined(p=>d(p)!==null));const g=n?s.subX:s.x;return p=>{const _=c(p.id,n);let x=o?e.filterRemoveNull(p.values):p.values,m=0,v=0,b;if(e.isLineType(p)){const y=a.data_regions[p.id];y&&!i&&e.lineWithRegions?(x=xo(e,x,n),e.isAreaRangeType(p)&&(x=x.map(T=>po(go({},T),{value:e.getRangedData(T,"mid")}))),e.isStepType(p)&&(x=e.convertValuesToStep(x)),b=e.lineWithRegions(x,s.zoom||g,_,y)):b=f.curve(e.getCurve(p))(Bd(e,p,x))}else x[0]&&(m=g(x[0].x),v=_(d(x[0]))),b=r?`M ${v} ${m}`:`M ${m} ${v}`;return b||(i?void 0:"M 0 0")}}function vo(e,t,n,i){const{config:a}=e,s=a.line_connectNull,o=a.axis_rotated,r=e.generateGetAreaPoints(t,n),l=e.getYScaleById.bind(e),c=_o(e,n),d=new Map,u=p=>{let _=d.get(p);return _===void 0&&(_=e.getShapeYMin(p,n),d.set(p,_)),_},h=p=>(n?e.subxx:e.xx).call(e,p),f=(p,_)=>e.isGrouped(p.id)?r(p,_)[0][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"high"):u(p.id)),g=(p,_)=>e.isGrouped(p.id)?r(p,_)[1][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"low"):c(p));return p=>{let _=s?e.filterRemoveNull(p.values):p.values,x=0,m=0,v;if(e.isAreaType(p)){let b=(0,pt.area)();b=o?b.y(h).x0(f).x1(g):b.x(h).y0(a.area_above?0:a.area_below?n?e.state.height2:e.state.height:f).y1(g),i&&(b=b.context(i)),s||(b=b.defined(y=>c(y)!==null)),_=xo(e,_,n),e.isStepType(p)&&(_=e.convertValuesToStep(_)),v=b.curve(e.getCurve(p))(_)}else _[0]&&(x=(n?e.scale.subX:e.scale.x)(_[0].x),m=e.getYScaleById(p.id,n)(c(_[0]))),v=o?`M ${m} ${x}`:`M ${x} ${m}`;return v||(i?void 0:"M 0 0")}}let Re;function mi(e,t){if(!$(t)||t>=1)return e;const n=e.match(/^#([\da-f]{3}|[\da-f]{6})$/i);if(n){const s=(n[1].length===3?n[1].split("").map(r=>r+r).join(""):n[1]).match(/.{2}/g);return s?`rgba(${s.map(r=>parseInt(r,16)).join(",")},${t})`:e}if(/^rgb\(/i.test(e))return e.replace(/^rgb\((.*)\)$/i,`rgba($1,${t})`);if(/^rgba\(/i.test(e))return e.replace(/^rgba\((.*),\s*([\d.]+)\)$/i,(a,s,o)=>`rgba(${s},${Number(o)*t})`);const i=zd(e);return i&&i!==e?mi(i,t):e}function zd(e){if(!N.document||(Re===void 0&&(Re=N.document.createElement("canvas").getContext("2d")),!Re))return null;Re.fillStyle="#000",Re.fillStyle=e;const t=Re.fillStyle;Re.fillStyle="#fff",Re.fillStyle=e;const n=Re.fillStyle;return t===n?t:null}function Nn(e,t,n,i){const a=t(n,i),s=uo(e,a);return yt(s.x,s.y)&&yt(s.x+s.w,s.y+s.h)?{points:a,rect:s}:null}function Xn(e,t,n,i){const a=t(n,i),{body:s,wickStart:o,wickEnd:r}=Pd(e,a);return yt(s.x,s.y)&&yt(s.x+s.w,s.y+s.h)&&yt(o[0],o[1])&&yt(r[0],r[1])?{body:s,points:a,wickStart:o,wickEnd:r}:null}const Nd=1.2;function ba(e,t){var n,i,a;let{value:s}=t;if((n=e.isBubbleZType)!=null&&n.call(e,t))s=e.getBubbleZData(s,"z");else if((i=e.isCandlestickType)!=null&&i.call(e,t)){const o=(a=e.getCandlestickData)==null?void 0:a.call(e,t);o&&(s=o.close)}return s}function bo(e,t){const n=e.dataLabelFormat(t.id)(ba(e,t),t.id,t.index,[]);return n==null?null:String(n)}function yo(e){return`${e.id}:${e.index}`}function ya(e,t,n){var i;if(!(t!=null&&t.length))return()=>!1;if(e.config.tooltip_grouped&&t.length>1){const s=(i=t[0])==null?void 0:i.index;return o=>s!==void 0&&o.index===s&&n(e,o)}const a=new Set(t.filter(s=>s&&n(e,s)).map(yo));return s=>a.has(yo(s))}function vi(e,t,n,i){const a=e.config.data_labels_position;let s;if(z(a))s=a.bind(e.api)(n,ba(e,t),t.id,t.index,i);else if(a){const o=t.id in a?a[t.id]:a;s=o==null?void 0:o[n]}return $(s)?s:0}function Xd(e,t){var n,i;const a=(n=e.config.data_labels)==null?void 0:n.image;if(z(a))return(i=a.call(e.api,ba(e,t),t.id,t.index))!=null?i:null;if(a){const{url:s="",width:o=0,height:r=0,pos:l}=a;return{url:s,width:o,height:r,pos:l}}return null}function Gd(e,t){return an(e.url,{ID:t.id})}function Vd(e,t,n,i,a,s){var o,r,l;const{width:c=0,height:d=0,pos:u}=t,h=c/2,f=d/2,g=Ta(e.canvasEngine.ctx,n,i,a).h,p=de(e.canvasEngine.ctx.font),_=i-h,x=a-f-((o=e.isTreemapType)!=null&&o.call(e,s)?p*.7:g/2);let m=i,v=a;return e.config.axis_rotated?m+=h:v+=f,{x:_+((r=u==null?void 0:u.x)!=null?r:0),y:x+((l=u==null?void 0:u.y)!=null?l:0),textX:m,textY:v}}function To(e,t,n){var i,a,s;const o=(i=e.updateTextColor)==null?void 0:i.call(e,t);return typeof o=="string"?o:(a=e.isTreemapType)!=null&&a.call(e,t)?n:((s=e.color)==null?void 0:s.call(e,t))||n}function Wd(e,t){var n;const i=e.config.data_labels_backgroundColors;if(!i)return null;if(Q(i))return i;if(z(i)){const s=(n=e.color)==null?void 0:n.call(e,t),o=i.bind(e.api)(s,t);return o==null?null:String(o)}const a=i[t.id];return a==null?null:String(a)}function Yd(e){var t,n,i;if(!e)return null;const a=tt(e)?e:{};return{padding:Es((t=a.padding)!=null?t:"3 5"),radius:$(a.radius)?a.radius:10,stroke:(n=a.stroke)!=null?n:"#000",strokeWidth:$(a.strokeWidth)?a.strokeWidth:1,fill:(i=a.fill)!=null?i:"none"}}function Ta(e,t,n,i,a={top:0,right:0,bottom:0,left:0}){var s,o;const r=t.split(`
`),l=r.map(x=>e.measureText(x)),c=Math.max(...l.map(x=>x.width),0),d=de(e.font),u=d*Nd,h=l[0]?(l[0].fontBoundingBoxAscent||0)+(l[0].fontBoundingBoxDescent||0):0,f=l[0]&&(l[0].fontBoundingBoxDescent||l[0].actualBoundingBoxDescent)||0,g=r.length>1?u*r.length:Math.max(d,h,((s=l[0])==null?void 0:s.actualBoundingBoxAscent)+((o=l[0])==null?void 0:o.actualBoundingBoxDescent)||0);let p=n,_=i;return e.textAlign==="center"?p-=c/2:(e.textAlign==="right"||e.textAlign==="end")&&(p-=c),e.textBaseline==="middle"?_-=g/2:e.textBaseline==="alphabetic"?_-=g-f:(e.textBaseline==="bottom"||e.textBaseline==="ideographic")&&(_-=g),{x:p-a.left,y:_-a.top,w:c+a.left+a.right,h:g+a.top+a.bottom}}function wo(e,t,n,i,a,s){var o,r;const l=t.context,c=Wd(e,n),d=Yd((o=e.config.data_labels)==null?void 0:o.border),u=(r=d==null?void 0:d.padding)!=null?r:{top:0,right:0,bottom:0,left:0},h=Ta(l,i,a,s,u),f=e.config.data_labels.rotate;t.withState(g=>{var p;f&&(g.translate(a,s),g.rotate(f*Math.PI/180),h.x-=a,h.y-=s),c&&t.fillRoundRect(h,(p=d==null?void 0:d.radius)!=null?p:0,{fill:c}),d&&(d.fill!=="none"&&t.fillRoundRect(h,d.radius,{fill:d.fill}),t.strokeRoundRect(h,d.radius,{stroke:d.stroke,lineWidth:d.strokeWidth}))})}function Hd(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function jd(e){return e==="start"?"left":e==="end"?"right":"center"}function Ud(e,t,n,i){var a,s,o;const r=Hd(e.config.data_labels.rotate),l=e.config.axis_rotated,c=e.config[`axis_${(a=e.axis)==null?void 0:a.getId(t.id)}_inverted`],d=Wt(e,t),{value:u}=t,h=$(u)&&u<0||d&&!((o=(s=e.getCandlestickData)==null?void 0:s.call(e,t))!=null&&o._isUp),f=4,g=f*2;return l?r==="start"?(n+=h?0:g,i+=f):r==="middle"?(n+=g,i-=g):r==="end"&&(h&&(n-=g),i+=f):(r==="start"?(n+=f,h&&(i+=g*2)):r==="middle"?i-=g:r==="end"&&(n-=f,h&&(i+=g*2)),c&&(i+=h?-17:d?13:7)),{x:n,y:i,textAlign:jd(r)}}function Co(e,t,n,i,a){var s;if(e.config.axis_rotated)i+=6,t.textAlign="left",t.textBaseline="middle";else if(We(e,n))t.textAlign="center",t.textBaseline="middle";else{const{config:o,state:r}=e,l=o[`axis_${(s=e.axis)==null?void 0:s.getId(n.id)}_inverted`],c=n.value<0||n.value===0&&!r.hasPositiveValue&&r.hasNegativeValue;let d=3;$(o.point_r)&&o.point_r>5&&(xn(e,n)||Ve(e,n))&&(d+=o.point_r/2.3),t.textAlign="center",(l?!c:c)?(a+=d,t.textBaseline="top"):(a-=d*2,t.textBaseline="bottom")}return{x:i,y:a}}var Kd=Object.defineProperty,So=Object.getOwnPropertySymbols,Zd=Object.prototype.hasOwnProperty,qd=Object.prototype.propertyIsEnumerable,ko=(e,t,n)=>t in e?Kd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t)=>{for(var n in t||(t={}))Zd.call(t,n)&&ko(e,n,t[n]);if(So)for(var n of So(t))qd.call(t,n)&&ko(e,n,t[n]);return e};const Ao={x:0,y:0,w:8,h:8},wa=new Map,Lo=[1,0,0,1,0,0];function Jd(e){return e==="circle"||e==="rectangle"}function $t(e,t,n=0){const i=e.getAttribute(t),a=i===null?NaN:parseFloat(i);return Number.isFinite(a)?a:n}function Qd(e){const t=(e.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)||[]).map(Number).filter(Number.isFinite),n=[];for(let i=0;i<t.length-1;i+=2)n.push([t[i],t[i+1]]);return n}function th(e){const t=(e==null?void 0:e.trim().split(/[\s,]+/).map(Number).filter(Number.isFinite))||[];return t.length===4?{x:t[0],y:t[1],w:t[2],h:t[3]}:null}function Ro(e){const t=e.map(([s])=>s),n=e.map(([,s])=>s),i=Math.min(...t),a=Math.min(...n);return{x:i,y:a,w:Math.max(...t)-i,h:Math.max(...n)-a}}function eh(e){const t=e.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.w)&&Number.isFinite(o.h));if(!t.length)return Ee({},Ao);const n=Math.min(...t.map(o=>o.x)),i=Math.min(...t.map(o=>o.y)),a=Math.max(...t.map(o=>o.x+o.w)),s=Math.max(...t.map(o=>o.y+o.h));return{x:n,y:i,w:a-n,h:s-i}}function Gn(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function nh(e){let t=[...Lo];return((e==null?void 0:e.match(/[a-z]+\([^)]*\)/gi))||[]).forEach(n=>{var i;const[,a,s]=n.match(/^([a-z]+)\(([^)]*)\)$/i)||[],o=a==null?void 0:a.toLowerCase(),r=((s==null?void 0:s.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi))||[]).map(Number).filter(Number.isFinite);let l=null;if(o==="matrix"&&r.length>=6)l=r.slice(0,6);else if(o==="translate"&&r.length)l=[1,0,0,1,r[0],r[1]||0];else if(o==="scale"&&r.length)l=[r[0],0,0,(i=r[1])!=null?i:r[0],0,0];else if(o==="rotate"&&r.length){const c=r[0]*Math.PI/180,d=Math.cos(c),u=Math.sin(c),h=[d,u,-u,d,0,0];l=r.length>=3?Gn(Gn([1,0,0,1,r[1],r[2]],h),[1,0,0,1,-r[1],-r[2]]):h}else o==="skewx"&&r.length?l=[1,0,Math.tan(r[0]*Math.PI/180),1,0,0]:o==="skewy"&&r.length&&(l=[1,Math.tan(r[0]*Math.PI/180),0,1,0,0]);l&&(t=Gn(t,l))}),t}function He(e,t){const n=e.getAttribute("style"),i=e.getAttribute(t),a=n==null?void 0:n.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"));return((a==null?void 0:a[1])||i||"").trim()||null}function ih(e,t){const n=Ee({},t),i=He(e,"fill"),a=He(e,"stroke"),s=He(e,"stroke-width"),o=He(e,"opacity"),r=He(e,"fill-opacity"),l=He(e,"stroke-opacity");if(i&&(n.fill=i==="none"?null:i),a&&(n.stroke=a==="none"?null:a),s){const c=parseFloat(s);Number.isFinite(c)&&(n.lineWidth=c)}return[o,r,l].forEach(c=>{var d;const u=c===null?NaN:parseFloat(c);Number.isFinite(u)&&(n.alpha=((d=n.alpha)!=null?d:1)*u)}),n}function ah(e){const t=new Map;return Array.from(e.querySelectorAll("[id]")).forEach(n=>{const i=n.getAttribute("id");i&&t.set(i,n)}),t}function me(e,t){const n=e==null?void 0:e.trim();return n?/%$/.test(n)?n:parseFloat(n):t}function ve(e,t,n,i){if(typeof e=="number")return Number.isFinite(e)?e:i;if(typeof e=="string"&&/%$/.test(e)){const s=parseFloat(e);return Number.isFinite(s)?t+n*s/100:i}const a=parseFloat(e!=null?e:"");return Number.isFinite(a)?a:i}function sh(e){const t=(e==null?void 0:e.trim())||"0",n=parseFloat(t),i=/%$/.test(t)?n/100:n;return Math.max(0,Math.min(1,Number.isFinite(i)?i:0))}function oh(e){return Array.from(e.children||[]).filter(t=>t.tagName.toLowerCase()==="stop").map(t=>{const n=He(t,"stop-color")||"#000",i=He(t,"stop-opacity"),a=i===null?NaN:parseFloat(i);return{offset:sh(t.getAttribute("offset")),color:n,opacity:Number.isFinite(a)?a:void 0}})}function rh(e){const t=new Map;return e.forEach((n,i)=>{const a=n.tagName.toLowerCase(),s=oh(n);s.length&&(a==="lineargradient"?t.set(i,{type:"linearGradient",x1:me(n.getAttribute("x1"),"0%"),y1:me(n.getAttribute("y1"),"0%"),x2:me(n.getAttribute("x2"),"100%"),y2:me(n.getAttribute("y2"),"0%"),stops:s}):a==="radialgradient"&&t.set(i,{type:"radialGradient",cx:me(n.getAttribute("cx"),"50%"),cy:me(n.getAttribute("cy"),"50%"),r:me(n.getAttribute("r"),"50%"),fx:me(n.getAttribute("fx"),"50%"),fy:me(n.getAttribute("fy"),"50%"),fr:me(n.getAttribute("fr"),0),stops:s}))}),t}function Ca(e,t,n,i=Lo,a={},s=new Set){const o=e.tagName.toLowerCase(),r=Array.from(e.children||[]),l=ih(e,a),c=Gn(i,nh(e.getAttribute("transform"))),d={matrix:c,style:l};if(o==="defs")return[];if(o==="svg"||o==="g"||o==="symbol")return r.reduce((u,h)=>u.concat(Ca(h,t,n,c,l,s)),[]);if(o==="use"){const u=e.getAttribute("href")||e.getAttribute("xlink:href")||"",h=u.charAt(0)==="#"?u.slice(1):"",f=h&&n.get(h);if(!f||s.has(h))return[];const g=$t(e,"x",0),p=$t(e,"y",0),_=Gn(c,[1,0,0,1,g,p]);s.add(h);const x=Ca(f,t,n,_,l,s);return s.delete(h),x}if(o==="polygon"||o==="polyline"){const u=Qd(e.getAttribute("points")||"");return u.length?[Ee({type:o,points:u,box:Ro(u)},d)]:[]}if(o==="circle"){const u=$t(e,"cx",0),h=$t(e,"cy",0),f=$t(e,"r",0);return f>0?[Ee({type:"circle",cx:u,cy:h,r:f,box:{x:u-f,y:h-f,w:f*2,h:f*2}},d)]:[]}if(o==="ellipse"){const u=$t(e,"cx",0),h=$t(e,"cy",0),f=$t(e,"rx",0),g=$t(e,"ry",0);return f>0&&g>0?[Ee({type:"ellipse",cx:u,cy:h,rx:f,ry:g,box:{x:u-f,y:h-g,w:f*2,h:g*2}},d)]:[]}if(o==="rect"){const u=$t(e,"x",0),h=$t(e,"y",0),f=$t(e,"width",0),g=$t(e,"height",0);return f>0&&g>0?[Ee({type:"rect",x:u,y:h,w:f,h:g,box:{x:u,y:h,w:f,h:g}},d)]:[]}if(o==="line"){const u=$t(e,"x1",0),h=$t(e,"y1",0),f=$t(e,"x2",0),g=$t(e,"y2",0);return[Ee({type:"line",x1:u,y1:h,x2:f,y2:g,box:Ro([[u,h],[f,g]])},d)]}if(o==="path"){const u=e.getAttribute("d")||"";return u?[Ee({type:"path",d:u,box:t},d)]:[]}return[]}function lh(e){if(!/^</.test(e))return null;if(wa.has(e))return wa.get(e)||null;let t=null;try{const i=new N.DOMParser().parseFromString(Se(e),"image/svg+xml").documentElement,a=th(i.getAttribute("viewBox"))||Ao,s=ah(i),o=Ca(i,a,s);o.length&&(t={shapes:o,box:i.tagName.toLowerCase()==="svg"?a:eh(o.map(r=>r.box)),paints:rh(s)})}catch(n){t=null}return wa.set(e,t),t}function ch(e,t){if(t.type==="polygon"||t.type==="polyline"){const[n,...i]=t.points;e.moveTo(n[0],n[1]),i.forEach(([a,s])=>e.lineTo(a,s)),t.type==="polygon"&&e.closePath()}else t.type==="circle"?(e.moveTo(t.cx+t.r,t.cy),e.arc(t.cx,t.cy,t.r,0,Math.PI*2)):t.type==="ellipse"?(e.moveTo(t.cx+t.rx,t.cy),e.ellipse(t.cx,t.cy,t.rx,t.ry,0,0,Math.PI*2)):t.type==="rect"?e.rect(t.x,t.y,t.w,t.h):t.type==="line"&&(e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2))}function bi(e){const t=e==null?void 0:e.match(/^url\(#([^)]+)\)$/);return(t==null?void 0:t[1])||null}function Eo(e,t,n){const{x:i,y:a,w:s,h:o}=n,r=t.type==="linearGradient"?e.createLinearGradient(ve(t.x1,i,s,i),ve(t.y1,a,o,a),ve(t.x2,i,s,i+s),ve(t.y2,a,o,a)):e.createRadialGradient(ve(t.fx,i,s,i+s/2),ve(t.fy,a,o,a+o/2),ve(t.fr,i,Math.max(s,o),0),ve(t.cx,i,s,i+s/2),ve(t.cy,a,o,a+o/2),Math.max(.01,ve(t.r,0,Math.max(s,o),Math.max(s,o)/2)));return t.stops.forEach(({offset:l,color:c,opacity:d})=>{r.addColorStop(l,d===void 0?c:mi(c,d))}),r}function uh(e,t,n,i,a){const s=Ee({},t||{});if(n.fill!==void 0)if(n.fill===null)delete s.fill;else if(bi(n.fill)){const o=i.get(bi(n.fill));o&&(s.fill=Eo(e,o,a))}else/^url\(/.test(n.fill)||(s.fill=n.fill);if(n.stroke!==void 0)if(n.stroke===null)delete s.stroke;else if(bi(n.stroke)){const o=i.get(bi(n.stroke));o&&(s.stroke=Eo(e,o,a))}else/^url\(/.test(n.stroke)||(s.stroke=n.stroke);return n.lineWidth!==void 0&&(s.lineWidth=n.lineWidth),{style:s,shouldFill:n.fill!==null&&(!s.stroke||s.fill!==void 0),shouldStroke:n.stroke!==null&&s.stroke!==void 0,alpha:n.alpha}}function Vn(e,t,n,i,a,s,o=a){if(Jd(t)){e.point(t,n,i,a,s);return}const r=lh(t);if(!r||a<=0){e.point("circle",n,i,a,s);return}e.withState(l=>{const{box:c,paints:d,shapes:u}=r,h=o>0?a/o:1,f=g=>{const{style:p,shouldFill:_,shouldStroke:x,alpha:m}=uh(l,s,g.style,d,c);if(l.save(),e.applyStyle(p),m!==void 0&&(l.globalAlpha*=m),l.transform(...g.matrix),l.beginPath(),g.type==="path"){if(N.Path2D){const v=g.path2D||(g.path2D=new N.Path2D(g.d));_&&l.fill(v),x&&l.stroke(v)}}else ch(l,g),_&&l.fill(),x&&l.stroke();l.restore()};l.translate(n-(c.x+c.w/2)*h,i-(c.y+c.h/2)*h),l.scale(h,h),u.forEach(f)})}var dh=Object.defineProperty,hh=Object.defineProperties,fh=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,gh=Object.prototype.hasOwnProperty,ph=Object.prototype.propertyIsEnumerable,Sa=(e,t,n)=>t in e?dh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Do=(e,t)=>{for(var n in t||(t={}))gh.call(t,n)&&Sa(e,n,t[n]);if(Po)for(var n of Po(t))ph.call(t,n)&&Sa(e,n,t[n]);return e},Io=(e,t)=>hh(e,fh(t)),bn=(e,t,n)=>Sa(e,typeof t!="symbol"?t+"":t,n);const _h=[Mn,ee,he,Wt],xh=1e3,Mo=new WeakMap,Fo=new Map;function Oo(e,t){if(!t||t==="none")return;const n=t.match(/^matrix\(([^)]+)\)$/),i=t.match(/^matrix3d\(([^)]+)\)$/);if(n){const a=n[1].split(",").map(s=>Number(s.trim()));a.length===6&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5])}else if(i){const a=i[1].split(",").map(s=>Number(s.trim()));a.length===16&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[4],a[5],a[12],a[13])}}function mh(e,t,n){const i=e.naturalWidth||e.width,a=e.naturalHeight||e.height;if(!i||!a||!t||!n)return{x:0,y:0,w:t,h:n};const s=Math.min(t/i,n/a),o=i*s,r=a*s;return{x:(t-o)/2,y:(n-r)/2,w:o,h:r}}function vh(e){const{state:t}=e;return t.hasFunnel||t.hasTreemap?{x:0,y:0}:{x:gn(t.margin.left),y:gn(t.margin.top)}}function $o(e,t,n,i,a=!1){i.strokePath(s=>{mo(e,n,a,s)(t)},{lineDash:[]})}function Bo(e,t,n,i,a=!1){i.fillPath(s=>{vo(e,n,a,s)(t)})}function zo(e,t){const n=Ae(e,t);return n.start===0&&n.end===t.values.length?t:Io(Do({},t),{values:t.values.slice(n.start,n.end)})}function ka(e,t){if(!(e!=null&&e.length)||!(t!=null&&t.id))return null;let n=Mo.get(e);if(!n){n=new Map;for(const i of e){if(!(i!=null&&i.id))continue;const a=`${i.id}:*`;n.has(a)||n.set(a,i),"index"in i&&n.set(`${i.id}:${i.index}`,i)}Mo.set(e,n)}return"index"in t?n.get(`${t.id}:${t.index}`)||null:n.get(`${t.id}:*`)||null}function bh(e,t){const n=N.Path2D;if(!n)return null;const i=`${e}:${t}`,a=Fo.get(i);if(a)return a;const s=new n(bs[e][t]);return Fo.set(i,s),s}function Wn(e,t){const n=e.config.color_onover;return!n||!t?null:tt(n)?t.id in n?n[t.id]:null:Q(n)?n:z(n)?n.call(e.api,t):null}function yh(e,t,n){const i=ka(n,t);return Wn(e,i)||e.color(t.id)}function No(e){var t;return(e==null?void 0:e.id)||((t=e==null?void 0:e.data)==null?void 0:t.id)}function Xo(e,t){var n;const i=No(t);return!!i&&((n=e.state.focusedTargetIds)==null?void 0:n.has(i))}function be(e,t){var n;const i=No(t);return i&&((n=e.state.defocusedTargetIds)!=null&&n.has(i))?e.canvasTheme.style.shape.targetDefocusedOpacity:1}function Th(e,t,n,i=!1){var a;const s=(a=e.generateGetAreaPoints)==null?void 0:a.call(e,n,i);if(!s)return null;const o=Ae(e,t);let r=1/0,l=1/0,c=-1/0,d=-1/0;for(let u=o.start;u<o.end;u++){const h=t.values[u];Rt(e,h)&&s(h,u).forEach(([f,g])=>{yt(f,g)&&(r=Math.min(r,f),l=Math.min(l,g),c=Math.max(c,f),d=Math.max(d,g))})}return Number.isFinite(r)&&Number.isFinite(l)?{x:r,y:l,w:c-r,h:d-l}:null}function yi(e,t,n){return t+n*($(e)?e:0)}function Go(e,t,n,i,a,s){const o=e.config[`${i}_linearGradient`];if(!o||!a||!a.w||!a.h)return s;const r=e.config.axis_rotated,l=typeof o=="object"?o:{},c=l.x||(r?[1,0]:[0,0]),d=l.y||(r?[0,0]:[0,1]),u=Array.isArray(l.stops)?l.stops:[[0,s,1],[1,s,0]],h=t.createLinearGradient(yi(c[0],a.x,a.w),yi(d[0],a.y,a.h),yi(c[1],a.x,a.w),yi(d[1],a.y,a.h));return u.forEach(([f,g,p])=>{const _=z(g)?g.call(e.api,n.id):g,x=String(_||s),m=Number(f),v=Number.isFinite(m)?Math.max(0,Math.min(1,m)):0;h.addColorStop(v,mi(x,p))}),h}function Pe(e,t){return _n(e,t,_h)}function Ti(e,t){const n=e.config.point_opacity;return Number.isFinite(n)?n:Ve(e,t)||We(e,t)?.5:1}function Yn(e,t,n){var i,a;const s=e.config.point_r;return We(e,t)||z(s)?(a=(i=e.pointR)==null?void 0:i.call(e,n))!=null?a:2.5:s}function wh(e,t,n,i){return!i&&n==="circle"&&Ve(e,t)&&!z(e.config.point_r)&&t.values.length>Ms}function Ch(e,t){const{bar_connectLine:n}=e.config,i=tt(n)?n[t]:n;return/^(start|end)-(start|end)$/.test(i)?i:null}function Sh(e,t,n){const{indexX:i,indexY:a,pos:s}=n;return e.config.axis_rotated?{x:t[0][i],y:t[0][a],width:t[0][i]-s,height:t[2][a]-t[0][a]}:{x:t[0][i],y:s,width:t[2][i]-t[0][i],height:t[3][a]-s}}function kh(e,t,n,i,a=1){if(i.length<2)return;const s=e.config.axis_rotated,o=/^start-(start|end)$/.test(n),r=/^end-(start|end)$/.test(n),l=/\w+-end$/.test(n),c=/\w+-start$/.test(n),d=f=>({x:s?r?f.x-f.width:f.x:f.x+f.width,y:s||o?f.y+f.height:f.y}),u=f=>({x:s?f.x-(l?f.width:0):f.x,y:s?f.y:f.y+(c?f.height:0)});let h=d(i[0]);t.strokePath(()=>{for(let f=1;f<i.length;f++){const g=u(i[f]);t.traceLine(h.x,h.y,g.x,g.y),f<i.length-1&&(h=d(i[f]))}},{alpha:a,stroke:e.canvasTheme.style.shape.barConnectLineColor,lineWidth:e.canvasTheme.style.shape.barConnectLineWidth,lineDash:[]})}function Aa(e,t){var n;const{config:i}=e;if(We(e,t))return"circle";const a=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],s=Array.isArray(i.point_pattern)&&i.point_pattern.length?i.point_pattern:[i.point_type],o=Math.max(0,a.indexOf(t.id)),r=s[o%s.length];return/^rect(angle)?$/i.test(r)||r==="rectangle"?"rectangle":r||"circle"}function Ah(e,t,n,i,a,s,o){const r=e.config.point_radialGradient;if(!r||!s)return o;const l=tt(r)?r:{},c=$(l.cx)?l.cx:.3,d=$(l.cy)?l.cy:.3,u=$(l.r)?l.r:.7,h=Array.isArray(l.stops)?l.stops:[[.1,null,1],[.9,null,0]],f=i+(c-.5)*s*2,g=a+(d-.5)*s*2,p=t.createRadialGradient(f,g,0,f,g,Math.max(1,s*u*2));return h.forEach(([_,x,m])=>{let v=z(x)?x.bind(e.api)(n.id):x;v||(v=o);const b=Number(_),y=Number.isFinite(b)?Math.max(0,Math.min(1,b)):0;p.addColorStop(y,mi(v,m))}),p}function Vo(e,t,n){const i=e.config.candlestick_color_down;return(n!=null&&n._isUp?e.color(t):i&&typeof i=="object"?i[t.id]:i)||e.color(t)}function Lh(e,t){return e.shouldDrawPointsForLine?e.shouldDrawPointsForLine(t):!0}function Rh(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function Eh(e,t,n){const{config:i,scale:a}=e,s=a.zoom||a.x,o=e.getYScaleById(t.id),r=i.line_connectNull?e.filterRemoveNull(t.values):t.values;let l=e.isAreaRangeType(t)?r.map(g=>Io(Do({},g),{value:e.getRangedData(g,"mid")})):r;e.isStepType(t)&&(l=e.convertValuesToStep(l));const c=Rd(e,l,s,o,i.data_regions[t.id]);let d=null,u=[];const h=()=>{if(u.length<2||!d){u=[];return}n.strokePath(g=>{const[p,..._]=u;g.moveTo(p[0],p[1]),_.forEach(x=>{g.lineTo(x[0],x[1])})},{lineDash:d}),u=[]},f=(g,p,_)=>{!d||!Rh(d,_)?(h(),d=_,u=[g,p]):u.push(p)};for(const{start:g,end:p,dash:_,isBreak:x}of c){if(x||!g||!p||!_){h(),d=null;continue}if(!yt(g[0],g[1])||!yt(p[0],p[1])){h(),d=null;continue}f(g,p,_)}h()}class Ph{constructor(t,n){bn(this,"engine",t),bn(this,"theme",n),bn(this,"painter"),bn(this,"labelImageCache",new Map),bn(this,"backgroundImageCache",new Map),bn(this,"backgroundClassStyleCache",new Map),this.painter=new Hs(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}destroy(){const t=n=>{n.image.onload=null,n.image.onerror=null};this.labelImageCache.forEach(t),this.backgroundImageCache.forEach(t),this.labelImageCache.clear(),this.backgroundImageCache.clear(),this.backgroundClassStyleCache.clear()}getLabelImage(t,n){if(!t||!N.Image)return null;let i=this.labelImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.labelImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.redraw)==null||s.call(n)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundImage(t,n){if(!t||!N.Image)return null;let i=this.backgroundImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.backgroundImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.renderCanvasFrame)==null||s.call(n,void 0,null,!1)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundClassStyle(t,n){if(!n||!N.document)return{};const i=this.backgroundClassStyleCache.get(n);if(i)return i;const a=N.document.createElement("div");a.className=n,a.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:1px;height:1px;",t.$el.chart.node().appendChild(a);const s=N.getComputedStyle(a),o=parseFloat(s.opacity),r={opacity:Number.isFinite(o)?o:void 0,transform:s.transform||void 0};return a.remove(),this.backgroundClassStyleCache.set(n,r),r}drawBackground(t){const n=t.config.background;if(!(n!=null&&n.imgUrl)&&!(n!=null&&n.color))return;const{ctx:i,painter:a}=this,{current:s,margin:o,width:r,height:l}=t.state,c=this.getBackgroundClassStyle(t,n.class);a.withState(()=>{if(c.opacity!==void 0&&(i.globalAlpha*=c.opacity),n.imgUrl){const d=this.getBackgroundImage(n.imgUrl,t);if(d!=null&&d.loaded){const u=vh(t),h=mh(d.image,s.width,s.height);i.translate(u.x,u.y),Oo(i,c.transform),i.drawImage(d.image,h.x,h.y,h.w,h.h)}}else n.color&&(Oo(i,c.transform),a.fillRect({x:o.left,y:o.top,w:r,h:l},{fill:n.color}))})}drawLabelImage(t,n,i,a,s){const o=Xd(t,n);if(!(o!=null&&o.url))return{x:a,y:s};const r=Gd(o,n),l=Vd(t,o,i,a,s,n),c=this.getLabelImage(r,t);return c!=null&&c.loaded&&this.ctx.drawImage(c.image,l.x,l.y,o.width,o.height),{x:l.textX,y:l.textY}}drawDataLabel(t,n,i,a,s){const{painter:o,theme:{style:r}}=this;if({x:a,y:s}=this.drawLabelImage(t,n,i,a,s),t.config.data_labels.rotate){const l=Ud(t,n,a,s);a=l.x,s=l.y,this.ctx.textAlign=l.textAlign}this.ctx.fillStyle=To(t,n,r.label.color),wo(t,o,n,i,a,s),o.textLines(i,a,s,{angle:t.config.data_labels.rotate})}drawFocusLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,theme:{style:s}}=this,o=n.filter(l=>l&&Rt(t,l)&&he(t,l)&&Pe(t,{id:l.id})),r={size:()=>o.length};o.length&&(a.font=s.label.font,o.forEach(l=>{const c=bo(t,l);let{x:d,y:u}=zn(t,l);c&&({x:d,y:u}=Co(t,a,l,d,u),d+=vi(t,l,"x",r),u+=vi(t,l,"y",r),yt(d,u)&&this.drawDataLabel(t,l,c,d,u))}))}draw(t,n,i){if(t.state.hasTreemap){this.drawTreemaps(t);return}const{margin:a,width:s,height:o}=t.state,r=()=>{t.config.area_front||this.drawAreas(t,n,i),this.drawLines(t,n),t.config.area_front&&this.drawAreas(t,n,i),this.drawCircles(t,n,i)},l=()=>{t.config.bar_front||this.drawBars(t,n,i),this.drawCandlesticks(t,n,i),r(),t.config.bar_front&&this.drawBars(t,n,i),this.drawSelections(t,n),this.drawLabels(t,n)};t.config.clipPath===!1?l():this.painter.clipRect({x:a.left,y:a.top,w:s,h:o},l)}drawSubchart(t,n){const{config:i,state:a}=t;if(!i.subchart_show||!a.hasAxis||a.width2<=0||a.height2<=0)return;const{ctx:s,painter:o,theme:{style:r}}=this,{margin2:l,width2:c,height2:d}=a,u={x:l.left,y:l.top,w:c,h:d};t.withSubchartTypeContext(()=>{var h;const f=t.filterTargetsToShow().filter(Pe.bind(null,t)),g=t.getDrawShape();(h=t.updateSubchartYDomain)==null||h.call(t,f),o.withState(()=>{o.clipRect(u,()=>{o.withTranslation(u.x,u.y,()=>{var p,_,x,m,v,b;const y=f.filter(Mn.bind(null,t)),T=te(t,g,O.AREA,Mn.bind(null,t));for(const R of y)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=r.shape.areaOpacity*be(t,R),s.fillStyle=t.color(R.id),Bo(t,R,T,o,!0));s.globalAlpha=1;const w=f.filter(ee.bind(null,t)),C=te(t,g,O.BAR,ee.bind(null,t)),k=(p=t.generateGetBarPoints)==null?void 0:p.call(t,C,!0);if(k){for(const R of w)s.globalAlpha=r.shape.barOpacity*be(t,R),s.fillStyle=t.color(R.id),R.values.forEach((P,B)=>{var I;if(!Rt(t,P))return;const X=Nn(t,k,P,B),G=((I=t.getSubchartCandlestickBarColor)==null?void 0:I.call(t,P,!0))||s.fillStyle;X&&o.fillRect(X.rect,{fill:G})});s.globalAlpha=1}const S=f.filter(Wt.bind(null,t)),A=te(t,g,O.CANDLESTICK,Wt.bind(null,t)),L=(_=t.generateGetCandlestickPoints)==null?void 0:_.call(t,A,!0);if(L){s.lineWidth=r.shape.candlestickLineWidth;for(const R of S){const P=be(t,R);s.globalAlpha=P,R.values.forEach((B,I)=>{var X;const G=(X=t.getCandlestickData)==null?void 0:X.call(t,B),Z=G&&Xn(t,L,B,I);if(!Z)return;const et=Vo(t,{id:R.id},G);s.strokeStyle=et,s.fillStyle=et,o.strokePath(()=>{o.traceLine(Z.wickStart[0],Z.wickStart[1],Z.wickEnd[0],Z.wickEnd[1])}),o.fillRect(Z.body,{fill:s.fillStyle})})}}const E=f.filter(xn.bind(null,t)),D=te(t,g,O.LINE,xn.bind(null,t));s.globalAlpha=1;for(const R of E)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=be(t,R),s.lineWidth=Xo(t,R)?r.shape.lineFocusedWidth:r.shape.lineWidth,s.strokeStyle=t.color(R.id),$o(t,R,D,o,!0));if(s.globalAlpha=1,i.point_show&&!((x=t.isPointFocusOnly)!=null&&x.call(t))){const R=(m=t.updateCircleY)==null?void 0:m.call(t,!0),P=(v=t.subxx)==null?void 0:v.bind(t);if(P&&R){for(const B of f){if(!Ve(t,B)&&!We(t,B))continue;const I=t.color(B.id),X=r.shape.pointFillColor||I,G=r.shape.pointStrokeColor||I,Z=G?(b=r.shape.pointLineWidth)!=null?b:1:0,et=G&&Z>0?{fill:X,stroke:G,lineWidth:Z}:{fill:X};s.globalAlpha=Ti(t,B)*be(t,B),B.values.forEach((rt,xt)=>{if(!Rt(t,rt))return;const gt=i.axis_rotated?R(rt,xt):P(rt),Tt=i.axis_rotated?P(rt):R(rt,xt),_t=Math.min(Yn(t,B,rt),3);yt(gt,Tt)&&Vn(o,"circle",gt,Tt,_t,et)})}s.globalAlpha=1}}})}),this.drawSubchartBrush(t)})})}drawSubchartBrush(t){var n,i;const{config:a,scale:s,state:o}=t,r=o.domain;if(!a.subchart_show||a.subchart_brush_enabled===!1||!(r!=null&&r.length)||!s.subX)return;const{margin2:l,width2:c,height2:d}=o,u=s.subX(r[0]),h=s.subX(r[1]),f=a.axis_rotated?d:c,g=(i=(n=t.axis)==null?void 0:n.getExtent)==null?void 0:i.call(n),p=Array.isArray(g)&&g.length>=2&&g.every(Number.isFinite)?g.slice(0,2):[0,f],_=Math.max(0,Math.min(f,Math.min(...p))),x=Math.max(0,Math.min(f,Math.max(...p))),m=Math.max(_,Math.min(x,Math.min(u,h))),v=Math.max(_,Math.min(x,Math.max(u,h))),b=v-m;if(b<=0)return;const y=a.axis_rotated?{x:l.left,y:l.top+m,w:c,h:b}:{x:l.left+m,y:l.top,w:b,h:d};this.painter.fillRect(y,{fill:this.theme.style.subchartBrush.fill,alpha:this.theme.style.subchartBrush.opacity}),a.subchart_showHandle&&(this.drawSubchartBrushHandle(t,m,"start"),this.drawSubchartBrushHandle(t,v,"end"))}drawSubchartBrushHandle(t,n,i){const{config:a,state:{margin2:s,width2:o,height2:r}}=t,{ctx:l,painter:c,theme:{style:d}}=this,u=a.axis_rotated,h=d.subchartBrush.handleFill,f=d.subchartBrush.handleStroke,g=u?s.left+o/2:s.left+n,p=u?s.top+n:s.top+r/2,_=bh(u?"y":"x",i);_&&c.withState(()=>{l.translate(g,p),l.fillStyle=h,l.strokeStyle=f,l.lineWidth=d.subchartBrush.handleLineWidth,l.globalAlpha=d.subchartBrush.handleOpacity,l.fill(_),l.globalAlpha=1,l.stroke(_)})}drawBars(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=ee.bind(null,t),l=ya(t,i,ee),c=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),d=t.generateGetBarPoints(te(t,n,O.BAR,r),!1),{margin:u}=t.state,h=_i(t),f=h?ma(t):new Set;d&&s.withTranslation(u.left,u.top,()=>{var g;for(const p of c){const _=Ae(t,p),x=Ch(t,p.id),m=be(t,p),v=[],b=[];for(let y=_.start;y<_.end;y++){const T=p.values[y];if(!Rt(t,T))continue;const w=Nn(t,d,T,y);if(!w)continue;const{points:C,rect:k}=w,S=va(t,T,C,h,f,(g=t.isStackingRadiusData)==null?void 0:g.bind(t));b.push({d:T,points:C,rect:k,radiusInfo:S}),x&&v.push(Sh(t,C,S))}x&&o.shape.barConnectLineWidth>0&&kh(t,s,x,v,m);for(const{d:y,rect:T,radiusInfo:w}of b){const C=Wn(t,ka(i,y)),k=C||t.color(p.id),A=(l(y)?o.shape.barExpandedOpacity:o.shape.barOpacity)*m;a.fillStyle=C?k:Go(t,a,p,"bar",T,k),h?s.fillRoundRect(T,w.corners,{alpha:A}):s.fillRect(T,{alpha:A}),o.shape.barLineWidth>0&&(a.strokeStyle=o.shape.barStrokeColor,a.lineWidth=o.shape.barLineWidth,h?s.strokeRoundRect(T,w.corners,{alpha:o.shape.barOpacity*m}):s.strokeRect(T,{alpha:o.shape.barOpacity*m}))}}})}drawCandlesticks(t,n,i){var a;const{ctx:s,painter:o,theme:{style:r}}=this,l=Wt.bind(null,t),c=ya(t,i,Wt),d=t.filterTargetsToShow().filter(l).filter(Pe.bind(null,t)),u=(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,O.CANDLESTICK,l),!1),{margin:h}=t.state;u&&o.withTranslation(h.left,h.top,()=>{var f;s.lineWidth=r.shape.candlestickLineWidth;for(const g of d){const p=Ae(t,g),_=be(t,g),x=r.shape.candlestickLineWidth,m=r.shape.candlestickStrokeColor||"#000";for(let v=p.start;v<p.end;v++){const b=g.values[v],y=(f=t.getCandlestickData)==null?void 0:f.call(t,b);if(!y)continue;const T=Xn(t,u,b,v);if(!T)continue;const{body:w,wickStart:C,wickEnd:k}=T;s.fillStyle=Wn(t,ka(i,b))||Vo(t,b,y),s.strokeStyle=m,s.globalAlpha=_,x>0&&o.strokePath(()=>{o.traceLine(C[0],C[1],k[0],k[1])}),o.fillRect(w,{alpha:(c(b)?r.shape.candlestickExpandedOpacity:1)*_}),x>0&&o.strokeRect(w,{alpha:_,lineWidth:x,stroke:m})}}s.globalAlpha=1})}hasExpandedShapeFocus(t,n){return!!(n!=null&&n.some(i=>i&&(ee(t,i)||Wt(t,i))))}drawLines(t,n){const{ctx:i,painter:a,theme:{style:s}}=this,o=xn.bind(null,t),r=t.filterTargetsToShow().filter(o).filter(Pe.bind(null,t)),l=te(t,n,O.LINE,o),{margin:c}=t.state;t.generateGetLinePoints&&a.withTranslation(c.left,c.top,()=>{var d;for(const u of r){const h=zo(t,u);h.values.some(Rt.bind(null,t))&&(i.globalAlpha=be(t,u),i.lineWidth=Xo(t,u)?s.shape.lineFocusedWidth:s.shape.lineWidth,i.strokeStyle=t.color(u.id),(d=t.config.data_regions)!=null&&d[h.id]?Eh(t,h,a):$o(t,h,l,a))}i.globalAlpha=1})}drawAreas(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=Mn.bind(null,t),l=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),c=te(t,n,O.AREA,r),{margin:d}=t.state;t.generateGetAreaPoints&&s.withTranslation(d.left,d.top,()=>{for(const u of l){const h=zo(t,u);if(!h.values.some(Rt.bind(null,t)))continue;const f=yh(t,h,i);a.globalAlpha=o.shape.areaOpacity*be(t,u),a.fillStyle=Go(t,a,h,"area",t.config.area_linearGradient?Th(t,u,c):null,f),Bo(t,h,c,s)}a.globalAlpha=1})}drawCircles(t,n,i){var a;if(!t.config.point_show||(a=t.isPointFocusOnly)!=null&&a.call(t))return;const{ctx:s,painter:o,theme:{style:r}}=this,{cx:l,cy:c}=n.pos,{margin:d}=t.state,u=ya(t,i,he),h=!!(i!=null&&i.some(f=>f&&he(t,f)));!l||!c||o.withTranslation(d.left,d.top,()=>{var f,g,p;for(const _ of t.filterTargetsToShow()){if(!he(t,_)||!Pe(t,_)||xn(t,_)&&!Lh(t,_))continue;const x=t.color(_.id),m=Aa(t,_),v=be(t,_),b=!!t.config.point_radialGradient,y=wh(t,_,m,b),T=Ae(t,_),w=T.end-T.start,C=y?Os(t.state.width,t.state.height,Yn(t,_,_.values[T.start]||_.values[0])):null,k=Ti(t,_)*v;s.fillStyle=x,s.globalAlpha=k;const S=r.shape.pointFillColor||x,A=r.shape.pointStrokeColor||x,L=A?(f=r.shape.pointLineWidth)!=null?f:1:0,E=!!A&&L>0,D=E&&m==="circle"&&$(k)&&k<1&&S===A;if(!h&&!b&&m==="circle")if(s.fillStyle=S,E&&!D&&(s.strokeStyle=A,s.lineWidth=L),w>xh)for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Yn(t,_,P),I=D?B+L/2:B,X=l(P,R),G=c(P,R);yt(X,G)&&(C&&!$s(C,X,G)||(s.beginPath(),s.arc(X,G,I,0,Math.PI*2),s.fill(),E&&!D&&s.stroke()))}else{s.beginPath();for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Yn(t,_,P),I=D?B+L/2:B,X=l(P,R),G=c(P,R);yt(X,G)&&o.traceCircle(X,G,I)}s.fill(),E&&!D&&s.stroke()}else for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=u(P),I=Yn(t,_,P),X=B?(p=(g=t.pointExpandedR)==null?void 0:g.call(t,P))!=null?p:I*1.75:I,G=l(P,R),Z=c(P,R),et=Wn(t,P),rt=et||x,xt=r.shape.pointFillColor||rt,gt=r.shape.pointStrokeColor||rt,Tt=B&&(et||r.focusPoint.fill)||xt,_t=B?et||r.focusPoint.stroke||rt:gt,mt=B?r.focusPoint.lineWidth:L,Pt=Ti(t,P)*v,Dt=!!_t&&(mt!=null?mt:0)>0,Lt=m==="circle"&&Dt&&$(Pt)&&Pt<1&&Tt===_t,$e=Lt?X+(mt||0)/2:X;yt(G,Z)&&(s.fillStyle=b?Ah(t,s,P,G,Z,X,rt):Tt,s.globalAlpha=Pt,Vn(o,m,G,Z,$e,Dt&&!Lt?{fill:s.fillStyle,stroke:_t,lineWidth:mt}:void 0,I))}}})}drawSelections(t,n){var i,a;const s=(i=t.getCanvasSelectedData)==null?void 0:i.call(t);if(!t.config.data_selection_enabled||!(s!=null&&s.length)||t.state.hasTreemap)return;const{ctx:o,painter:r,theme:{style:l}}=this,{margin:c}=t.state,d=ee.bind(null,t),u=Wt.bind(null,t),h=s.some(d)?t.generateGetBarPoints(te(t,n,O.BAR,d),!1):null,f=s.some(u)?(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,O.CANDLESTICK,u),!1):null,g=h?_i(t):null,p=g?ma(t):new Set;r.withTranslation(c.left,c.top,()=>{s.forEach(_=>{var x,m,v,b,y,T,w;const C=t.color(_.id);if(d(_)&&h){const k=Nn(t,h,_,_.index);if(!k)return;const{points:S,rect:A}=k,L=g?va(t,_,S,g,p).corners:0;g?r.fillRoundRect(A,L,{fill:"#fff",alpha:.3}):r.fillRect(A,{fill:"#fff",alpha:.3}),g?r.strokeRoundRect(A,L,{stroke:C,lineWidth:2}):r.strokeRect(A,{stroke:C,lineWidth:2})}else if(u(_)&&f){if(!((x=t.getCandlestickData)==null?void 0:x.call(t,_)))return;const S=Xn(t,f,_,_.index);if(!S)return;const{body:A,wickStart:L,wickEnd:E}=S;r.strokePath(()=>{r.traceLine(L[0],L[1],E[0],E[1])},{stroke:C,lineWidth:3}),r.fillRect(A,{fill:"#fff",alpha:.3}),r.strokeRect(A,{stroke:C,lineWidth:2})}else if(he(t,_)){const k=Aa(t,{id:_.id}),{x:S,y:A}=zn(t,_),L=(v=(m=t.pointR)==null?void 0:m.call(t,_))!=null?v:2.5,E=(y=(b=t.pointSelectR)==null?void 0:b.call(t,_))!=null?y:L*2;if(!yt(S,A))return;Vn(r,"circle",S,A,E,{fill:l.selectedPoint.fill,lineWidth:l.selectedPoint.lineWidth,stroke:l.selectedPoint.stroke||C}),(T=t.isPointFocusOnly)!=null&&T.call(t)||Vn(r,k,S,A,L,{fill:l.shape.pointFillColor||C,stroke:l.shape.pointStrokeColor||C,lineWidth:(w=l.shape.pointLineWidth)!=null?w:1})}}),o.globalAlpha=1})}drawLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,painter:s,theme:{style:o}}=this,{margin:r}=t.state,{cx:l,cy:c}=n.pos,d=n.indices[O.BAR]?t.generateGetBarPoints(n.indices[O.BAR],!1):null,u=t.generateGetCandlestickPoints?t.generateGetCandlestickPoints(te(t,n,O.CANDLESTICK,Wt.bind(null,t)),!1):null,h=t.filterTargetsToShow().filter(_=>(ee(t,_)||he(t,_)||Mn(t,_)||Wt(t,_))&&Pe(t,_)),f=[];let g=0;h.forEach(_=>{const x=Ae(t,_),m=t.labelishData(_),v=[];for(let b=0;b<m.length;b++){const y=m[b],T=bo(t,y);T&&y.index>=x.start&&y.index<x.end&&Rt(t,y)&&v.push({d:y,text:T})}g+=v.length,v.length&&f.push(v)});const p={size:()=>g};s.withTranslation(r.left,r.top,()=>{a.font=o.label.font,a.textAlign="center",f.forEach(_=>{var x,m;for(const{d:v,text:b}of _){let y,T;if(ee(t,v)&&d){const w=Nn(t,d,v,v.index);if(!w)continue;const{points:C,rect:k}=w,S=t.getBaseValue(v),A=xi(t,C[2]),L=S<0,E=Ta(a,b,0,0).h;y=t.config.axis_rotated&&!t.config.data_labels.centered?A[0]+(L?-4:4):k.x+k.w/2,T=t.config.data_labels.centered||t.config.axis_rotated?k.y+k.h/2:A[1]+(L?E-3:-3),a.textAlign=t.config.axis_rotated&&!t.config.data_labels.centered?L?"right":"left":"center",a.textBaseline=t.config.data_labels.centered||t.config.axis_rotated?"middle":"alphabetic"}else if(Wt(t,v)&&u){const w=(x=t.getCandlestickData)==null?void 0:x.call(t,v),C=Xn(t,u,v,v.index),k=w==null?void 0:w._isUp;if(!C)continue;const{wickEnd:S,wickStart:A}=C,L=t.config[`axis_${(m=t.axis)==null?void 0:m.getId(v.id)}_inverted`];y=t.config.axis_rotated?k?S[0]+4:A[0]-4:A[0],T=t.config.axis_rotated?A[1]+3:k?S[1]-3:A[1]+12,!t.config.axis_rotated&&L&&(T+=15*(k?1:-1)),a.textAlign=t.config.axis_rotated?k?"left":"right":"center",a.textBaseline="alphabetic"}else l&&c&&({x:y,y:T}=Ed(n.pos,v,v.index),{x:y,y:T}=Co(t,a,v,y,T));y+=vi(t,v,"x",p),T+=vi(t,v,"y",p),yt(y,T)&&this.drawDataLabel(t,v,b,y,T)}})})}drawEmptyLabel(t){const n=t.config.data_empty_label_text,i=t.filterTargetsToShow();if(!n||i.length)return;const{margin:a,width:s,height:o}=t.state,{style:r}=this.theme;this.painter.text(String(n),a.left+s/2,a.top+o/2,{fill:r.emptyLabel.color,font:r.emptyLabel.font,textAlign:"center",textBaseline:"middle"})}drawZoomBrush(t,n,i){const{axis_rotated:a}=t.config,{height:s,margin:o,width:r}=t.state,l=Math.min(n,i),c=Math.abs(i-n),d=a?{x:o.left,y:o.top+l,w:r,h:c}:{x:o.left+l,y:o.top,w:c,h:s};c<=0||this.painter.fillRect(d,{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawSelectionDragArea(t,n){const{margin:i,width:a,height:s}=t.state,o={x:i.left,y:i.top,w:a,h:s},r=Math.max(o.x,n.x),l=Math.max(o.y,n.y),c=Math.min(o.x+o.w,n.x+n.w),d=Math.min(o.y+o.h,n.y+n.h);c<=r||d<=l||this.painter.fillRect({x:r,y:l,w:c-r,h:d-l},{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawTreemaps(t){var n;const{ctx:i,painter:a,theme:{style:s}}=this,{config:o}=t,r=(n=t.getTreemapRoot)==null?void 0:n.call(t,t.data.targets),l=(r==null?void 0:r.children)||[];a.withState(()=>{var c;i.lineWidth=s.treemap.lineWidth,i.strokeStyle=s.treemap.stroke;for(const d of l){const{data:u}=d;if(!Qi(t,u))continue;const{x:h,y:f,w:g,h:p}=vn(t,d,r,!0);if(!yt(h,f)||!yt(h+g,f+p)||g<=0||p<=0)continue;const _={x:h,y:f,w:g,h:p};if(i.fillStyle=t.color(u.name),a.fillRect(_),a.strokeRect(_),!o.treemap_label_show||(u.ratio||0)<(o.treemap_label_threshold||0))continue;const x=Dd(t,u,g,p);if(!x)continue;const m=x.split(`
`),v=!!o.data_labels.centered;i.font=s.label.font;const b=de(i.font),y=i.measureText((c=m[0])!=null?c:""),T=(y.fontBoundingBoxAscent||0)+(y.fontBoundingBoxDescent||0)||(y.actualBoundingBoxAscent||0)+(y.actualBoundingBoxDescent||0),w=Math.max(b,T)+(m.length-1)*b,C=v?f+p/2:f+w+5;let k=v?h+g/2:h+5,S=C-(m.length-1)*b/(v?2:1);i.textAlign=v?"center":"left",i.textBaseline=v?"middle":"alphabetic",{x:k,y:S}=this.drawLabelImage(t,u,x,k,S),i.fillStyle=To(t,u,s.label.color),wo(t,a,u,x,k,v?S+(m.length-1)*b/2:C),m.forEach((A,L)=>{a.text(A,k,S+L*b,{maxWidth:Math.max(0,g-8)})})}})}drawSubchartFocus(t,n){const{config:i,scale:a,state:s}=t,o=n==null?void 0:n.find(_=>_&&Rt(t,_));if(!o||!i.subchart_show||i.subchart_grid_focus_continuous||i.subchart_brush_enabled!==!1||i.grid_focus_show===!1||i.subchart_grid_focus===!1||!i.tooltip_show||i.axis_tooltip||!a.subX||s.width2<=0||s.height2<=0)return;const{margin2:r,width2:l,height2:c}=s,d=a.subX(o.x);if(!Number.isFinite(d))return;const{painter:u,theme:{style:h}}=this,f=h.axis.lineWidth,g=u.crisp(r.left+d,f),p=u.crisp(r.top+d,f);u.strokePath(()=>{i.axis_rotated?u.traceLine(r.left,p,r.left+l,p):u.traceLine(g,r.top,g,r.top+c)},{lineDash:h.focusGrid.dashArray,lineWidth:h.focusGrid.lineWidth,stroke:h.focusGrid.lineColor})}drawFocus(t,n){if(!(n!=null&&n.length))return;const{painter:i}=this,{style:a}=this.theme,{margin:s}=t.state,o=n.find(r=>r&&Rt(t,r));t.config.subchart_grid_focus!==!1&&!_a(t)&&this.drawSubchartFocus(t,n),i.withTranslation(s.left,s.top,()=>{if(t.config.tooltip_show&&t.config.grid_focus_show!==!1&&!t.config.axis_tooltip&&o){const{x:r,y:l}=zn(t,o),c=a.axis.lineWidth,d=t.config.axis_rotated,u=Number.isFinite(d?l:r),h=Number.isFinite(d?r:l),f=v=>i.crisp(s.left+v,c)-s.left,g=v=>i.crisp(s.top+v,c)-s.top,p=t.config.grid_focus_edge&&!t.config.tooltip_grouped,_=_a(t),x=_?t.state.margin2.left-s.left+t.state.width2:t.state.width,m=_?t.state.margin2.top-s.top+t.state.height2:t.state.height;u&&i.strokePath(()=>{var v,b;if(d){if(i.traceLine(f(0),l,p&&h?r:f(x),l),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((v=t.axis)==null?void 0:v.getId(o.id))==="y2";i.traceLine(r,p&&!y?l:g(0),r,p&&y?l:g(t.state.height))}}else if(i.traceLine(r,p&&h?l:g(0),r,g(m)),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((b=t.axis)==null?void 0:b.getId(o.id))==="y2";i.traceLine(p&&y?r:f(0),l,p&&!y?r:f(t.state.width),l)}},{lineDash:a.focusGrid.dashArray,lineWidth:a.focusGrid.lineWidth,stroke:a.focusGrid.lineColor})}t.config.point_show&&!t.state.canvasFocusMainRedraw&&n.filter(r=>r&&Rt(t,r)&&he(t,r)&&Pe(t,{id:r.id})).forEach(r=>{var l,c,d,u;const h=Aa(t,{id:r.id}),{x:f,y:g}=zn(t,r),p=(c=(l=t.pointR)==null?void 0:l.call(t,r))!=null?c:2.5,_=(u=(d=t.pointExpandedR)==null?void 0:d.call(t,r))!=null?u:p*1.75,x=Wn(t,r),m=x||t.color(r.id),v=x||a.focusPoint.fill||a.shape.pointFillColor||m,b=x||a.focusPoint.stroke||m,y=a.focusPoint.lineWidth,T=Ti(t,r),w=!!b&&(y!=null?y:0)>0,C=h==="circle"&&w&&$(T)&&T<1&&v===b;yt(f,g)&&Vn(i,h,f,g,C?_+(y||0)/2:_,w&&!C?{fill:v,lineWidth:y,stroke:b,alpha:T}:{fill:v,alpha:T},p)}),this.drawFocusLabels(t,n)})}}var Dh=Object.defineProperty,Wo=Object.getOwnPropertySymbols,Ih=Object.prototype.hasOwnProperty,Mh=Object.prototype.propertyIsEnumerable,Fh=(e,t,n)=>t in e?Dh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oh=(e,t)=>{var n={};for(var i in e)Ih.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&Wo)for(var i of Wo(e))t.indexOf(i)<0&&Mh.call(e,i)&&(n[i]=e[i]);return n},Hn=(e,t,n)=>Fh(e,typeof t!="symbol"?t+"":t,n);const ye="http://www.w3.org/2000/svg";function Y(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:"");return Number.isFinite(n)?n:t}function on(e,t){const n=Y(e.opacity,1),i=Y(e["fill-opacity"],1),a=n*i;return Number.isFinite(a)?a:t}function K(e,t){const n=e==null?void 0:e.trim();return n&&!/^(none|transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i.test(n)?n:t}function yn(e,t){const n=K(e,""),i=t?K(t,""):"";return n&&n!==i?n:void 0}function Tn(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:""),i=typeof t=="number"?t:parseFloat(t!=null?t:"");return Number.isFinite(n)&&(!Number.isFinite(i)||n!==i)?n:void 0}function jn(e){return Array.isArray(e)?e.filter(t=>Number.isFinite(t)&&t>0):(e||"").split(/[,\s]+/).map(t=>parseFloat(t)).filter(t=>Number.isFinite(t)&&t>0)}function $h(e,t){const n=e.getPropertyValue("font").trim();if(n)return n;const i=e.getPropertyValue("font-size").trim(),a=e.getPropertyValue("font-family").trim();if(!i||!a)return t;const s=e.getPropertyValue("font-style").trim(),o=e.getPropertyValue("font-variant").trim(),r=e.getPropertyValue("font-weight").trim(),l=e.getPropertyValue("line-height").trim(),c=l&&l!=="normal"?`${i}/${l}`:i;return[s&&s!=="normal"?s:"",o&&o!=="normal"?o:"",r&&!/^(normal|400)$/.test(r)?r:"",c,a].filter(Boolean).join(" ")}function Te(e,t){var n;const i=t.replace(/-([a-z])/g,(a,s)=>s.toUpperCase());return(n=e[t])!=null?n:e[i]}function it(e,t){const n=Te(e,t);return(n==null?"":K(String(n),""))||void 0}function Ft(e,t){const n=Te(e,t),i=typeof n=="number"?n:parseFloat(String(n!=null?n:""));return Number.isFinite(i)?i:void 0}function je(e){const t=Ft(e,"opacity"),n=Ft(e,"fill-opacity");return t===void 0&&n===void 0?void 0:(t!=null?t:1)*(n!=null?n:1)}function La(e){const t=Te(e,"stroke-dasharray"),n=t==null?[]:jn(t);return n.length?n:void 0}function ne(e){var t,n,i,a;const s=Te(e,"font");if(s!=null&&String(s).trim())return String(s).trim();const o=Te(e,"font-size"),r=Te(e,"font-family");if(o==null||r==null)return;const l=String(o).trim(),c=String(r).trim();if(!l||!c)return;const d=String((t=Te(e,"font-style"))!=null?t:"").trim(),u=String((n=Te(e,"font-variant"))!=null?n:"").trim(),h=String((i=Te(e,"font-weight"))!=null?i:"").trim(),f=String((a=Te(e,"line-height"))!=null?a:"").trim();return[d&&d!=="normal"?d:"",u&&u!=="normal"?u:"",h&&!/^(normal|400)$/.test(h)?h:"",f&&f!=="normal"?`${l}/${f}`:l,c].filter(Boolean).join(" ")}function st(e,t,n){var i;const a=Object.keys(n).reduce((s,o)=>(n[o]!==void 0&&(s[o]=n[o]),s),{});Object.keys(a).length&&(e[t]=ke((i=e[t])!=null?i:{},a))}function Yo(e){return e.split(",").map(t=>t.trim().replace(/\s*>\s*/g," ").replace(/\s+/g," ").replace(/^(?:svg)?\.bb\s+/,"").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g,"$1.")).filter(Boolean)}function Ra(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function Ho(e,t,n){return Ra(t).forEach(i=>{n!=null&&n.has(i)||(e[i]=t[i])}),e}function jo(e){const t=e.split(" ");return t.every((n,i)=>n==="line"||n==="text"?i===t.length-1:/^(\.[A-Za-z_-][\w-]*)+$/.test(n))}function Uo(e){const t=e.split(" "),n=t[t.length-1];return n==="line"||n==="text"?n:null}function Bh(e){return(e||"").split(/\s+/).filter(Boolean)}function zh(e,t){const n=t==="text"?{labelColor:it(e,"fill"),labelFont:ne(e)}:{lineColor:it(e,"stroke"),lineWidth:Ft(e,"stroke-width"),dashArray:La(e)};return Ho({},n)}function Nh(e){const t=[];return Object.keys(e!=null?e:{}).forEach(n=>{Yo(n).forEach(i=>{const a=Uo(i)||"line",s=zh(e[n],a);jo(i)&&Ra(s).length&&t.push({selector:i,target:a,style:s})})}),t}function Xh(e,t,n,i){if(!jo(e))return!1;const a=Uo(e);if(a&&a!==i)return!1;if(!a&&i==="text")return!1;const s=Bh(n),o=`bb-${t}grid-line`,r=new Set(["bb-grid","bb-grid-lines",`bb-${t}grid-lines`,o,...s]),l=(e.match(/\.[A-Za-z_-][\w-]*/g)||[]).map(c=>c.slice(1));return!!l.length&&l.every(c=>r.has(c))&&(l.includes(o)||s.some(c=>l.includes(c)))}function Gh(e,t,n){switch(t){case".bb-axis path.domain":case".bb-axis .domain":case".bb-axis-x path.domain":case".bb-axis-x .domain":case".bb-axis-y path.domain":case".bb-axis-y .domain":case".bb-axis-y2 path.domain":case".bb-axis-y2 .domain":st(e,"axis",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-axis line":case".bb-axis .tick line":case".bb-axis-x line":case".bb-axis-x .tick line":case".bb-axis-y line":case".bb-axis-y .tick line":case".bb-axis-y2 line":case".bb-axis-y2 .tick line":st(e,"axis",{tickColor:it(n,"stroke"),tickWidth:Ft(n,"stroke-width")});break;case".bb-axis text":case".bb-axis .tick text":{const i=ne(n);st(e,"axis",{labelColor:it(n,"fill"),xTickFont:i,yTickFont:i,y2TickFont:i});break}case".bb-axis-x text":case".bb-axis-x .tick text":st(e,"axis",{labelColor:it(n,"fill"),xTickFont:ne(n)});break;case".bb-axis-y text":case".bb-axis-y .tick text":st(e,"axis",{labelColor:it(n,"fill"),yTickFont:ne(n)});break;case".bb-axis-y2 text":case".bb-axis-y2 .tick text":st(e,"axis",{labelColor:it(n,"fill"),y2TickFont:ne(n)});break;case".tick._active_ text":case".bb-axis .tick._active_ text":case".bb-axis-x .tick._active_ text":st(e,"axis",{activeLabelColor:it(n,"fill")});break;case".bb-axis-x-label":case".bb-axis-x .bb-axis-x-label":st(e,"axis",{labelFont:ne(n),xLabelColor:it(n,"fill")});break;case".bb-axis-y-label":case".bb-axis-y .bb-axis-y-label":st(e,"axis",{labelFont:ne(n),yLabelColor:it(n,"fill")});break;case".bb-axis-y2-label":case".bb-axis-y2 .bb-axis-y2-label":st(e,"axis",{labelFont:ne(n),y2LabelColor:it(n,"fill")});break;case".bb-grid line":case".bb-grid .bb-xgrid":case".bb-grid .bb-ygrid":case".bb-xgrid":case".bb-ygrid":st(e,"grid",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width"),dashArray:La(n)});break;case".bb-grid text":st(e,"grid",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus":st(e,"focusGrid",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width"),dashArray:La(n)});break;case".bb-region rect":case".bb-region":st(e,"region",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-region text":st(e,"region",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-bar":st(e,"shape",{barOpacity:je(n),barStrokeColor:it(n,"stroke"),barLineWidth:Ft(n,"stroke-width")});break;case".bb-bar._expanded_":st(e,"shape",{barExpandedOpacity:je(n)});break;case".bb-candlestick":st(e,"shape",{candlestickStrokeColor:it(n,"stroke"),candlestickLineWidth:Ft(n,"stroke-width")});break;case".bb-candlestick._expanded_":st(e,"shape",{candlestickExpandedOpacity:je(n)});break;case".bb-line":st(e,"shape",{barConnectLineColor:it(n,"stroke"),barConnectLineWidth:Ft(n,"stroke-width"),lineWidth:Ft(n,"stroke-width")});break;case".bb-target.bb-focused .bb-line":case".bb-target.bb-focused path.bb-line":st(e,"shape",{lineFocusedWidth:Ft(n,"stroke-width")});break;case".bb-target.bb-defocused":st(e,"shape",{targetDefocusedOpacity:Ft(n,"opacity")});break;case".bb-area":st(e,"shape",{areaOpacity:je(n)});break;case".bb-circle":st(e,"shape",{pointFillColor:it(n,"fill"),pointStrokeColor:it(n,"stroke"),pointLineWidth:Ft(n,"stroke-width")});break;case".bb-selected-circle":st(e,"selectedPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-circle._expanded_":st(e,"focusPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-zoom-brush":st(e,"zoomBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .extent":case".bb-brush .selection":st(e,"subchartBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .handle--custom":st(e,"subchartBrush",{handleFill:it(n,"fill"),handleOpacity:je(n),handleStroke:it(n,"stroke"),handleLineWidth:Ft(n,"stroke-width")});break;case".bb-chart-treemaps rect":case".bb-chart-treemaps":st(e,"treemap",{stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-text.bb-empty":case".bb-text .bb-empty":case".bb-empty":st(e,"emptyLabel",{color:it(n,"fill"),font:ne(n)});break;case".bb-text":st(e,"label",{color:it(n,"fill"),font:ne(n)});break;case".bb-title":st(e,"title",{color:it(n,"fill"),font:ne(n)});break}}function Vh(e){const t={};return Object.keys(e!=null?e:{}).forEach(n=>{Yo(n).forEach(i=>{Gh(t,i,e[n])})}),t}function Wh(e){if(!e)return{};const t=e,{selectors:n}=t,i=Oh(t,["selectors"]);return ke({},Vh(n),i)}function Ko(e,t){try{return JSON.stringify({className:e.className,style:e.getAttribute("style")||"",override:t||null})}catch(n){return null}}class Yh{constructor(){Hn(this,"style"),Hn(this,"cacheContainer",null),Hn(this,"cacheKey",null),Hn(this,"gridLineSelectorOverrides",[]),Hn(this,"directGridOverrideKeys",new Set)}load(t,n){var i,a,s,o,r;const l=nt.createElementNS(ye,"svg");this.gridLineSelectorOverrides=Nh(n==null?void 0:n.selectors),this.directGridOverrideKeys=new Set(Object.keys((i=n==null?void 0:n.grid)!=null?i:{})),l.setAttribute("class","bb"),l.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden",t.appendChild(l);const c=(Mt,Gt)=>{const jt=N.getComputedStyle(Mt),qt={};for(const Bt of Gt)qt[Bt]=Bt==="font"?$h(jt,""):jt.getPropertyValue(Bt).trim();return qt},d=(Mt,Gt,jt)=>{const qt=nt.createElementNS(ye,Mt);qt.setAttribute("class",Gt),l.appendChild(qt);const Bt=c(qt,jt);return l.removeChild(qt),Bt},u=(Mt,Gt,jt,qt)=>{const Bt=nt.createElementNS(ye,"g"),le=nt.createElementNS(ye,Gt);Bt.setAttribute("class",Mt),jt&&le.setAttribute("class",jt),Bt.appendChild(le),l.appendChild(Bt);const ze=c(le,qt);return l.removeChild(Bt),ze},h=(Mt,Gt,jt,qt,Bt)=>{const le=nt.createElementNS(ye,"g"),ze=nt.createElementNS(ye,"g"),ni=nt.createElementNS(ye,jt);le.setAttribute("class",Mt),ze.setAttribute("class",Gt),qt&&ni.setAttribute("class",qt),ze.appendChild(ni),le.appendChild(ze),l.appendChild(le);const Im=c(ni,Bt);return l.removeChild(le),Im},f=(Mt,Gt,jt,qt="")=>{const Bt=nt.createElementNS(ye,"g"),le=nt.createElementNS(ye,"g"),ze=nt.createElementNS(ye,Gt);Bt.setAttribute("class",`bb-axis ${Mt}`),le.setAttribute("class",["tick",qt].filter(Boolean).join(" ")),ze.textContent=Gt==="text"?"0":"",le.appendChild(ze),Bt.appendChild(le),l.appendChild(Bt);const ni=c(ze,jt);return l.removeChild(Bt),ni},g="rgb(1, 2, 3)",p=(Mt,Gt)=>{const jt=nt.createElement("style");jt.textContent=`
				.bb-shapes-canvas-probe .bb-circle {
					fill: ${g};
					stroke: ${g};
				}
			`,nt.head.appendChild(jt);try{return u("bb-shapes bb-shapes-canvas-probe","circle",Mt,Gt)}finally{jt.remove()}},_=u("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),x=f("bb-axis-x","line",["stroke","stroke-width"]),m=f("bb-axis-x","text",["fill","font"]),v=f("bb-axis-x","text",["fill"],"_active_"),b=f("bb-axis-y","text",["fill","font"]),y=f("bb-axis-y2","text",["fill","font"]),T=u("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),w=u("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),C=u("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),k=d("circle","",["fill","stroke","stroke-width"]),S=u("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),A=u("bb-grid","text","",["fill","font"]),L=h("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),E=d("text","bb-text bb-empty",["fill","font"]),D=u("bb-region","rect","",["fill","fill-opacity"]),R=u("bb-region","text","",["fill","font"]),P=d("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),B=d("path","bb-bar _expanded_",["opacity","fill-opacity"]),I=d("path","bb-candlestick",["stroke","stroke-width"]),X=d("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),G=d("path","bb-line",["stroke-width"]),Z=u("bb-target bb-focused","path","bb-line",["stroke-width"]),et=d("g","bb-target bb-defocused",["opacity"]),rt=d("path","bb-area",["opacity","fill-opacity"]),xt=d("circle","bb-circle",["fill","stroke","stroke-width"]),gt=d("circle","bb-selected-circle",["fill","stroke","stroke-width"]),Tt=p("bb-circle _expanded_",["fill","stroke","stroke-width"]),_t=d("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),mt=u("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),Pt=u("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),Dt=u("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),Lt=u("bb-chart-treemaps","rect","",["stroke","stroke-width"]),$e=d("text","bb-text",["fill","font"]),Ht=u("","text","bb-title",["fill","font"]),Be=K(_t.fill,"#000"),hn=Y(_t["fill-opacity"]||_t.opacity,.1),Yi=K(Pt.fill,K(mt.fill,Be)),Hi=(r=(o=(s=(a=Tn(Pt["fill-opacity"],1))!=null?a:Tn(Pt.opacity,1))!=null?s:Tn(mt["fill-opacity"],1))!=null?o:Tn(mt.opacity,1))!=null?r:hn,ps=K(Dt.stroke,"transparent"),vt={axis:{lineColor:K(_.stroke,"#000"),lineWidth:Y(_["stroke-width"],1),tickColor:K(x.stroke,K(_.stroke,"#000")),tickWidth:Y(x["stroke-width"],Y(_["stroke-width"],1)),labelFont:w.font||b.font||"10px sans-serif",xTickFont:m.font||b.font||"10px sans-serif",yTickFont:b.font||"10px sans-serif",y2TickFont:y.font||b.font||"10px sans-serif",labelColor:K(b.fill,"#000"),xLabelColor:K(T.fill,K(m.fill,"#000")),yLabelColor:K(w.fill,K(b.fill,"#000")),y2LabelColor:K(C.fill,K(w.fill,K(b.fill,"#000"))),activeLabelColor:yn(v.fill,m.fill)||K(b.fill,"#000")},grid:{lineColor:K(S.stroke,"#aaa"),lineWidth:Y(S["stroke-width"],1),dashArray:jn(S["stroke-dasharray"]),labelFont:A.font||b.font||"10px sans-serif",labelColor:K(A.fill,"#aaa")},focusGrid:{lineColor:K(L.stroke,K(S.stroke,"#aaa")),lineWidth:Y(L["stroke-width"],Y(S["stroke-width"],1)),dashArray:jn(L["stroke-dasharray"]||S["stroke-dasharray"])},emptyLabel:{font:E.font||$e.font||b.font||"20px sans-serif",color:K(E.fill,"#808080")},region:{fill:K(D.fill,"steelblue"),opacity:Y(D["fill-opacity"],.1),labelFont:R.font||b.font||"10px sans-serif",labelColor:K(R.fill,"#000")},shape:{barOpacity:on(P,1),barExpandedOpacity:Y(on(B,on(P,1)),on(P,1)),barStrokeColor:K(P.stroke,"#000"),barLineWidth:Y(P["stroke-width"],0),barConnectLineColor:K(G.stroke,"#000"),barConnectLineWidth:Y(G["stroke-width"],1),candlestickStrokeColor:K(I.stroke,"#000"),candlestickLineWidth:Y(I["stroke-width"],1),candlestickExpandedOpacity:Y(on(X,1),1),lineWidth:Y(G["stroke-width"],1),lineFocusedWidth:Y(Z["stroke-width"],2),areaOpacity:on(rt,.2),targetDefocusedOpacity:Y(et.opacity,.3),pointFillColor:yn(xt.fill,k.fill),pointStrokeColor:yn(xt.stroke,k.stroke),pointLineWidth:Tn(xt["stroke-width"],k["stroke-width"])},selectedPoint:{fill:K(gt.fill,"#fff"),stroke:yn(gt.stroke),lineWidth:Y(gt["stroke-width"],2)},focusPoint:{fill:yn(Tt.fill,g),stroke:yn(Tt.stroke,g),lineWidth:Y(Tt["stroke-width"],1)},zoomBrush:{fill:Be,opacity:hn},subchartBrush:{fill:Yi,opacity:Hi,handleFill:K(Dt.fill,"transparent"),handleOpacity:on(Dt,1),handleStroke:ps,handleLineWidth:Y(Dt["stroke-width"],ps==="transparent"?0:1)},treemap:{stroke:K(Lt.stroke,"#fff"),lineWidth:Y(Lt["stroke-width"],1)},label:{font:$e.font||b.font||"10px sans-serif",color:K($e.fill,"#000")},title:{font:Ht.font||$e.font||b.font||"14px sans-serif",color:K(Ht.fill,"#000")}},Em=Wh(n),M=ke(vt,Em),qe=n==null?void 0:n.axis,Pm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelColor"),Dm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelFont");if(M.axis.lineWidth=Y(M.axis.lineWidth,vt.axis.lineWidth),M.axis.tickWidth=Y(M.axis.tickWidth,M.axis.lineWidth),Dm){const Mt=qe,Gt=M.axis.labelFont;Mt.xTickFont===void 0&&(M.axis.xTickFont=Gt),Mt.yTickFont===void 0&&(M.axis.yTickFont=Gt),Mt.y2TickFont===void 0&&(M.axis.y2TickFont=Gt)}if(M.axis.labelFont=M.axis.labelFont||vt.axis.labelFont,M.axis.xTickFont=M.axis.xTickFont||M.axis.labelFont,M.axis.yTickFont=M.axis.yTickFont||M.axis.labelFont,M.axis.y2TickFont=M.axis.y2TickFont||M.axis.yTickFont,M.axis.labelColor=K(M.axis.labelColor,vt.axis.labelColor),Pm){const Mt=M.axis.labelColor;qe.xLabelColor===void 0&&(M.axis.xLabelColor=Mt),qe.yLabelColor===void 0&&(M.axis.yLabelColor=Mt),qe.y2LabelColor===void 0&&(M.axis.y2LabelColor=Mt)}M.axis.xLabelColor=K(M.axis.xLabelColor,M.axis.labelColor),M.axis.yLabelColor=K(M.axis.yLabelColor,M.axis.labelColor),M.axis.y2LabelColor=K(M.axis.y2LabelColor,M.axis.yLabelColor),M.axis.activeLabelColor=K(M.axis.activeLabelColor,M.axis.labelColor),M.grid.lineWidth=Y(M.grid.lineWidth,vt.grid.lineWidth),M.grid.dashArray=jn(M.grid.dashArray),M.focusGrid.lineWidth=Y(M.focusGrid.lineWidth,vt.focusGrid.lineWidth),M.focusGrid.dashArray=jn(M.focusGrid.dashArray),M.region.opacity=Y(M.region.opacity,vt.region.opacity),M.shape.barOpacity=Y(M.shape.barOpacity,vt.shape.barOpacity),M.shape.barExpandedOpacity=Y(M.shape.barExpandedOpacity,M.shape.barOpacity),M.shape.barLineWidth=Y(M.shape.barLineWidth,vt.shape.barLineWidth),M.shape.barConnectLineWidth=Y(M.shape.barConnectLineWidth,vt.shape.barConnectLineWidth),M.shape.candlestickLineWidth=Y(M.shape.candlestickLineWidth,vt.shape.candlestickLineWidth),M.shape.candlestickStrokeColor=K(M.shape.candlestickStrokeColor,vt.shape.candlestickStrokeColor),M.shape.candlestickExpandedOpacity=Y(M.shape.candlestickExpandedOpacity,vt.shape.candlestickExpandedOpacity),M.shape.lineWidth=Y(M.shape.lineWidth,vt.shape.lineWidth),M.shape.lineFocusedWidth=Y(M.shape.lineFocusedWidth,vt.shape.lineFocusedWidth),M.shape.areaOpacity=Y(M.shape.areaOpacity,vt.shape.areaOpacity),M.shape.targetDefocusedOpacity=Y(M.shape.targetDefocusedOpacity,vt.shape.targetDefocusedOpacity),M.shape.pointLineWidth=Tn(M.shape.pointLineWidth),M.selectedPoint.lineWidth=Y(M.selectedPoint.lineWidth,vt.selectedPoint.lineWidth),M.focusPoint.lineWidth=Y(M.focusPoint.lineWidth,vt.focusPoint.lineWidth),M.zoomBrush.opacity=Y(M.zoomBrush.opacity,vt.zoomBrush.opacity),M.subchartBrush.opacity=Y(M.subchartBrush.opacity,vt.subchartBrush.opacity),M.subchartBrush.handleOpacity=Y(M.subchartBrush.handleOpacity,vt.subchartBrush.handleOpacity),M.subchartBrush.handleLineWidth=Y(M.subchartBrush.handleLineWidth,vt.subchartBrush.handleLineWidth),M.treemap.lineWidth=Y(M.treemap.lineWidth,vt.treemap.lineWidth),this.style=M,this.cacheContainer=t,this.cacheKey=Ko(t,n),l.remove()}reload(t,n){const i=Ko(t,n);i!==null&&this.style&&this.cacheContainer===t&&this.cacheKey===i||this.load(t,n)}getGridLineStyle(t,n={},i="line"){const a={};for(const s of this.gridLineSelectorOverrides)Xh(s.selector,t,n.class,i)&&Ho(a,s.style,this.directGridOverrideKeys);return Ra(a).length?a:void 0}}var Hh=Object.defineProperty,jh=(e,t,n)=>t in e?Hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fe=(e,t,n)=>jh(e,typeof t!="symbol"?t+"":t,n);const rn=24,Zo=64,Ea=[he,ee,Wt];function wn(e,t){return Math.floor(e/t)}function qo(e,t,n){var i,a;const s=wn(t.x,n),o=wn(t.x+((i=t.w)!=null?i:0),n),r=wn(t.y,n),l=wn(t.y+((a=t.h)!=null?a:0),n);for(let c=s;c<=o;c++)for(let d=r;d<=l;d++){const u=`${c}:${d}`,h=e.get(u);h?h.push(t):e.set(u,[t])}}function Jo(e,t,n,i,a=0){const s=wn(t,i),o=wn(n,i),r=[];for(let l=-a;l<=a;l++)for(let c=-a;c<=a;c++){const d=e.get(`${s+l}:${o+c}`);if(d!=null&&d.length)for(let u=0;u<d.length;u++)r.push(d[u])}return r}function Uh(e,t){var n,i,a;const s=e.config.point_sensitivity;if(Number.isFinite(s))return s;(n=e.pointR)==null||n.call(e,t);const o=(a=(i=e.getPointSensitivity)==null?void 0:i.call(e,t))!=null?a:rn;return Number.isFinite(o)?o:rn}function Kh(e,t){return Ve(e,t)&&t.values.length>Ms&&!e.config.data_selection_enabled&&Number.isFinite(e.config.point_sensitivity)&&Number.isFinite(e.config.point_r)}class Zh{constructor(){fe(this,"bars",[]),fe(this,"points",[]),fe(this,"indices",[]),fe(this,"barGrid",new Map),fe(this,"pointGrid",new Map),fe(this,"plot",{x:0,y:0,w:0,h:0}),fe(this,"pointCellSize",rn),fe(this,"maxPointSensitivity",rn),fe(this,"grouped",!1),fe(this,"pointBased",!1),fe(this,"indexAxis","x")}rebuild(t,n){var i,a,s;const{current:o,margin:r,width:l,height:c}=t.state,d=t.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=rn,this.indexAxis=t.config.axis_rotated?"y":"x",this.plot=t.state.hasTreemap?{x:0,y:0,w:o.width,h:o.height}:{x:r.left,y:r.top,w:l,h:c},this.grouped=!!t.config.tooltip_grouped&&!t.state.hasTreemap,this.pointBased=!(t.config.axis_x_forceAsSingle&&this.grouped)&&(!!((i=t.isMultipleX)!=null&&i.call(t))||d.some(_=>Ve(t,_)||We(t,_)));const h=this.grouped&&(!this.pointBased||t.config.data_selection_enabled&&t.config.data_selection_grouped)?new Map:null,f=(_,x,m)=>{var v,b;if(!h)return;const y=(b=(v=t.getXCacheKey)==null?void 0:v.call(t,m.x))!=null?b:m.index;Number.isFinite(m.index)&&!h.has(y)&&yt(_,x)&&h.set(y,{x:_,y:x,data:m})};if(t.state.hasTreemap){const _=(a=t.getTreemapRoot)==null?void 0:a.call(t,t.data.targets),x=(_==null?void 0:_.children)||[];for(const m of x){const{data:v}=m;if(!Qi(t,v))continue;const{x:b,y,w:T,h:w}=vn(t,m,_,!0);!yt(b,y)||!yt(b+T,y+w)||this.addBar({x:b,y,w:T,h:w,data:v})}this.indices=[];return}if(n.indices[O.BAR]||d.some(ee.bind(null,t))){const _=ee.bind(null,t),x=te(t,n,O.BAR,_),m=t.generateGetBarPoints(x,!1);d.filter(_).filter(v=>_n(t,v,Ea)).forEach(v=>{const b=Ae(t,v);for(let y=b.start;y<b.end;y++){const T=v.values[y];if(!Rt(t,T))continue;const w=Nn(t,m,T,y);if(!w)continue;const{rect:C}=w,k=r.left+C.x,S=r.top+C.y,{w:A,h:L}=C;this.addBar({x:k,y:S,w:A,h:L,data:T}),f(k+A/2,S+L/2,T)}})}if(n.indices[O.CANDLESTICK]||d.some(Wt.bind(null,t))){const _=Wt.bind(null,t),x=te(t,n,O.CANDLESTICK,_),m=(s=t.generateGetCandlestickPoints)==null?void 0:s.call(t,x,!1);m&&d.filter(_).filter(v=>_n(t,v,Ea)).forEach(v=>{var b;const y=Ae(t,v);for(let T=y.start;T<y.end;T++){const w=v.values[T];if(!((b=t.getCandlestickData)==null?void 0:b.call(t,w)))continue;const k=Xn(t,m,w,T);if(!k)continue;const{body:S}=k,A=r.left+S.x,L=r.top+S.y,{w:E,h:D}=S;this.addBar({x:A,y:L,w:Math.max(1,E),h:Math.max(1,D),data:w}),f(A+E/2,L+D/2,w)}})}const{cx:g,cy:p}=n.pos;g&&p&&d.filter(he.bind(null,t)).filter(_=>_n(t,_,Ea)).forEach(_=>{const x=Ae(t,_),m=Kh(t,_)?Os(l,c,t.config.point_r):null;for(let v=x.start;v<x.end;v++){const b=_.values[v];if(!Rt(t,b))continue;const y=r.left+g(b,v),T=r.top+p(b,v),w=Uh(t,b);yt(y,T)&&(m&&!$s(m,y-r.left,T-r.top)||(this.addPoint({x:y,y:T,sensitivity:w,data:b}),f(y,T,b)))}}),this.buildPointGrid(),this.indices=h?Array.from(h.values()).sort((_,x)=>_[this.indexAxis]-x[this.indexAxis]):[]}hitBar(t,n){for(const i of Jo(this.barGrid,t,n,Zo)){const{w:a=0,h:s=0}=i;if(t>=i.x&&t<=i.x+a&&n>=i.y&&n<=i.y+s)return i.data}return null}hitPoint(t,n){var i,a;let s=null,o=Number.POSITIVE_INFINITY;for(const r of Jo(this.pointGrid,t,n,this.pointCellSize,1)){const l=r.x-t,c=r.y-n,d=Math.sqrt(l*l+c*c),u=(i=r.sensitivity)!=null?i:rn;d<=u&&d<o&&(o=d,s=r)}return(a=s==null?void 0:s.data)!=null?a:null}findNearest(t,n){const i=this.hitBar(t,n);if(i)return i;if(!this.pointBased&&this.grouped&&this.isWithinPlot(t,n)){const a=this.findNearestIndexItem(t,n);if(a)return a.data}return this.hitPoint(t,n)}findNearestShape(t,n){var i;return(i=this.hitBar(t,n))!=null?i:this.hitPoint(t,n)}findNearestIndexByCoord(t,n){var i,a;return(a=(i=this.findNearestIndexItem(t,n))==null?void 0:i.data)!=null?a:null}findInRect(t,n=!1){const i=Math.min(t.x,t.x+t.w),a=Math.max(t.x,t.x+t.w),s=Math.min(t.y,t.y+t.h),o=Math.max(t.y,t.y+t.h),r=new Set,l=[],c=d=>{const u=d.data,h=`${u.id}:${u.index}`;r.has(h)||(r.add(h),l.push(u))};if(n){const d=this.indexAxis,u=d==="y"?s:i,h=d==="y"?o:a;return this.indices.filter(f=>f[d]>=u&&f[d]<=h).forEach(c),l}return this.bars.filter(d=>{var u,h;const f=(u=d.w)!=null?u:0,g=(h=d.h)!=null?h:0;return!(a<d.x||d.x+f<i)&&!(o<d.y||d.y+g<s)}).forEach(c),this.points.filter(d=>d.x>=i&&d.x<=a&&d.y>=s&&d.y<=o).forEach(c),l}addBar(t){this.bars.push(t),qo(this.barGrid,t,Zo)}addPoint(t){var n;const i=(n=t.sensitivity)!=null?n:rn;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,i),this.points.push(t)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const t of this.points)qo(this.pointGrid,t,this.pointCellSize)}isWithinPlot(t,n){const{plot:i}=this;return t>=i.x&&t<=i.x+i.w&&n>=i.y&&n<=i.y+i.h}findNearestIndexItem(t,n){const{indexAxis:i,indices:a}=this,s=i==="y"?n:t;if(!a.length)return null;let o=0,r=a.length-1;for(;o<r;){const d=o+r>>1;a[d][i]<s?o=d+1:r=d}const l=a[o],c=a[o-1];return c&&Math.abs(c[i]-s)<Math.abs(l[i]-s)?c:l}}var wi=wt(5),qh=Object.defineProperty,Qo=Object.getOwnPropertySymbols,Jh=Object.prototype.hasOwnProperty,Qh=Object.prototype.propertyIsEnumerable,tr=(e,t,n)=>t in e?qh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ft=(e,t)=>{for(var n in t||(t={}))Jh.call(t,n)&&tr(e,n,t[n]);if(Qo)for(var n of Qo(t))Qh.call(t,n)&&tr(e,n,t[n]);return e};const U={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},at={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},Ci={area:"bb-area",areas:"bb-areas"},It={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},ie={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},De={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},Nt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Pa={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},ln={dragarea:"bb-dragarea",INCLUDED:"_included_"},Un={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ae={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},j={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},we={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Ie={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},lt={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",xgridFocusContinuous:"bb-xgrid-focus-continuous",ygridFocus:"bb-ygrid-focus"},kt={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Me={level:"bb-level",levels:"bb-levels"},er={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},Kn={region:"bb-region",regions:"bb-regions"},ut={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},At={shape:"bb-shape",shapes:"bb-shapes"},nr={brush:"bb-brush",subchart:"bb-subchart"},Et={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},Si={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},ir={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Da={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var V=ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft({},U),at),Ci),It),ie),De),Nt),Pa),ln),ae),j),we),Ie),lt),Un),kt),Me),er),Kn),ut),At),nr),Et),Si),ir),Da),tf={boost_useCssRule:!1,boost_useWorker:!1,boost_workerUrl:void 0},ef={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},nf={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},af={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,resize_live:!1,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},render_mode:"svg",canvas_theme:{},regions:[]},sf={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},of={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},rf={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},lf={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},cf=Object.defineProperty,uf=(e,t,n)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,df=(e,t,n)=>uf(e,typeof t!="symbol"?t+"":t,n);const ar=class Hc{static setOptions(t){for(let n=0;n<t.length;n++)Object.assign(this.data,t[n])}constructor(){return Au(af,tf,rf,ef,lf,nf,sf,of,Hc.data)}};df(ar,"data",{});let cn=ar;class hf{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null,subY:null,subY2:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class ff{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,isCanvasMode:!1,canvasShape:null,canvasFocusKey:null,canvasSubchartBrushDragging:!1,canvasSubchartBrushMode:null,canvasSubchartBrushStart:null,canvasSubchartBrushOrigin:null,canvasSubchartBrushMoved:!1,canvasFlowFrame:null,canvasFlowFinish:null,canvasFocusMainRedraw:!1,cssRule:{},loading:void 0,domain:void 0,subchartSourceTypes:void 0,current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,canvasInlineStyle:{minHeight:""},canvasSelection:new Set,canvasSelectionDragStart:null,canvasSelectionDragIncluded:new Set,canvasSelectionDragging:!1,canvasSelectionDragMoved:!1,canvasSelectionDragMoveHandler:null,canvasSelectionDragEndHandler:null,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,resizePreview:!1,resizeRedrawTime:0,resizeLiveScale:null,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:new Set,hiddenLegendIds:new Set,focusedTargetIds:new Set,defocusedTargetIds:new Set,radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null},pendingRaf:null,rafBatchQueue:[],dirty:{data:!1,visibility:!1,size:!1},redrawGeneration:0,dataGeneration:0,_targetsToShow:null,_cachedDrawShape:null,_canvasVisibleRangeCache:null,_canvasXDataTickCache:null,_canvasXTickValuesCache:null,_eventRectFingerprint:null,_lastTooltipMouse:null,_gridFocusEl:null,generateClassCache:new Map}}}const sr={element:hf,state:ff};class gf{constructor(){Object.keys(sr).forEach(t=>{this[t]=new sr[t]})}getStore(t){return this[t]}}var pf=Object.defineProperty,_f=(e,t,n)=>t in e?pf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xf=(e,t,n)=>_f(e,typeof t!="symbol"?t+"":t,n);const W={bubbleBaseLength:"$baseLength",bubbleMaxValue:"$bubbleMaxValue",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",visibleTotalPerIndex:"$visibleTotalPerIndex",domainMinMax:"$domainMinMax",filteredTargets:"$filteredTargets",svgLeft:"$svgLeft",valuesByX:"$valuesByX",legendItemTextBox:"legendItemTextBox",legendItemMap:"$legendItemMap",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect",shapeOffset:"$shapeOffset",maxTickSize:"$maxTickSize",maxDataCountTarget:"$maxDataCountTarget",valuesXIndexMap:"$valuesXIndexMap"};class mf{constructor(){xf(this,"cache",new Map)}add(t,n,i=!1){const a=i?this.cloneTarget(n):n;return this.cache.set(t,a),a}remove(t){const n=Q(t)?[t]:t;for(let i=0;i<n.length;i++)this.cache.delete(n[i])}get(t,n=!1){if(n&&Array.isArray(t)){const i=[];for(let a=0,s;s=t[a];a++)this.cache.has(s)&&i.push(this.cache.get(s));return i}else return this.cache.has(t)?this.cache.get(t):null}has(t){return this.cache.has(t)}getKeys(){return Array.from(this.cache.keys())}reset(t,n){t?this.cache.clear():this.cache.forEach((i,a)=>{/^\$/.test(a)&&(n!=null&&n.some(s=>a.startsWith(s))||this.cache.delete(a))})}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const or="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function vf(e){const t=e,{config:n}=t;let i="";if(se(n.data_type||n.data_types)&&!t[Ui.LINE])i="line";else for(const a in Ui){const s=O[a];if(t.hasType(s)&&!t[Ui[a]]){i=s;break}}i&&rr(`Please, make sure if %c${ku(i)}`,"module has been imported and specified correctly.",or)}function Om(e){const t=Qc[e];t&&rr(`Please, make sure if %c${t}`,"module has been imported and specified correctly.",or)}function rr(e,t,n){var i;const a="[billboard.js]";if((i=N.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${a} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${a} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const bf=/\s?(bb-)/g,yf=/\.+/g;function Tf(e){return e.replace(bf,".$1").replace(yf,".")}function lr(e,t,n=!1){const i=s=>s[e?"getBoundingClientRect":"getBBox"](),a=e?"rectClient":"rectBBox";return n?i(t):!(a in t)||t.hasAttribute("width")&&t[a].width!==+(t.getAttribute("width")||0)?t[a]=i(t):t[a]}function Cn(e,t,n=[-1,1],i=!1){if(!(!e||!Q(t)))if(t.indexOf(`
`)===-1)e.text(t);else{const a=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(a[0]!==a[1]){const s=t.split(`
`),o=i?s.length-1:1;e.html(""),s.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?n[0]*o:n[1]}em`).text(r)})}}}function cr(e){const{x:t,y:n,width:i,height:a}=Ue(e,!0);return[{x:t,y:n+a},{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+a}]}function ur(e){const{width:t,height:n}=ht(e),i=cr(e),a=i[0].x,s=Math.min(i[0].y,i[1].y);return{x:a,y:s,width:t,height:n}}function Zt(e,t){var n;const i=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let a=[0,0];try{a=(0,F.pointer)(i||e,t)}catch(s){}return a.map(s=>isNaN(s)?0:s)}function ht(e,t=!1){return lr(!0,e,t)}function Ue(e,t=!1){return lr(!1,e,t)}function wf(e,t,n){const{rootSelector:i="",sheet:a}=e,s=`${i} ${Tf(t)} {${n.join(";")}}`;return a[a.insertRule?"insertRule":"addRule"](s,a.cssRules.length)}function Cf(e){let t=[];return e.forEach(n=>{var i;try{n.cssRules&&n.cssRules.length&&(t=t.concat(nn(n.cssRules)))}catch(a){(i=N.console)==null||i.warn(`Error while reading rules from ${n.href}: ${String(a)}`)}}),t}function dr(e){var t,n,i,a,s,o;return{x:((n=(t=N.pageXOffset)!=null?t:N.scrollX)!=null?n:0)+((i=e.scrollLeft)!=null?i:0),y:((s=(a=N.pageYOffset)!=null?a:N.scrollY)!=null?s:0)+((o=e.scrollTop)!=null?o:0)}}function ki(e,t=0,n=0,i=!0){const a=new DOMPoint(t,n),s=e.getScreenCTM(),o=a.matrixTransform(i?s==null?void 0:s.inverse():s);if(i===!1){const r=ht(e);o.x-=r.x,o.y-=r.y}return o}function Ia(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Ma(e,t){var n;const i=(n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,t);if(i)return parseFloat(i);const a=Ia(e);return t==="x"?a.e:a.f}function Fa(e){const t=e.attr("viewBox");return t?t.trim().split(/[\s,]+/).length===4:!1}function Sf(e,t,n=!1){const i=!!e.node;let a=!1;for(const[s,o]of Object.entries(t))if(a=i?e.style(s)===o:e.style[s]===o,n?!a:a)break;return a}function Zn(){var e,t;return((e=nt)==null?void 0:e.hidden)===!1||((t=nt)==null?void 0:t.visibilityState)==="visible"}function kf(e,t){const{DocumentTouch:n,matchMedia:i,navigator:a}=N,s=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(a&&"maxTouchPoints"in a)o=a.maxTouchPoints>0;else if("ontouchmove"in N||n&&nt instanceof n)o=!0;else if(s)o=!0;else{const l=a.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!s&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function hr(e,t){e.pendingRaf!==null?(N.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}const Oa={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,i=e())=>{t.dispatchEvent(new MouseEvent(n,i))}}catch(t){return(n,i,a=e())=>{const s=nt.createEvent("MouseEvent");s.initMouseEvent(i,a.bubbles,a.cancelable,N,0,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const i=new Touch(ke({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}},{setTimeout:Af,clearTimeout:Lf}=N;function Rf(e,t){const n=[];let i,a=null;const s=function(){s.clear(),t&&a===null&&(a=ys(()=>{a=null,t()})),e===!1?i=Ts(()=>{i=null,n.forEach(o=>o())},{timeout:200}):i=Af(()=>{i=null,n.forEach(o=>o())},$(e)?e:200)};return s.clear=()=>{i&&((e===!1?ou:Lf)(i),i=null)},s.clearLive=()=>{a!==null&&(su(a),a=null)},s.add=o=>n.push(o),s.remove=o=>{const r=n.indexOf(o);r!==-1&&n.splice(r,1)},s}function fr(){let e=[];const t=function(n,i){function a(){var s;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(s=l.empty)!=null&&s.call(l)){o++;continue}if(Zn()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}Ps(()=>{i==null||i()},a)};return t.add=function(n){ot(n)?e=e.concat(n):e.push(n)},t}const Ce={},Ai=new Set,un=new Map,Ef=5e3,gr=3;let Pf=0;function Df(){try{return"var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});"}catch(e){return""}}function $a(){const{Blob:e,Worker:t,URL:n}=N;return t&&e&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:e,Worker:t,URL:n}:null}function pr(){return N.Worker||null}function If(e){var t,n;return typeof e=="number"?{timeout:e,workerUrl:""}:{timeout:(t=e==null?void 0:e.timeout)!=null?t:Ef,workerUrl:(n=e==null?void 0:e.workerUrl)!=null?n:""}}function _r(e,t=!1){var n,i;const a=Ce[e];t&&Ai.add(e),a&&((n=a.worker)==null||n.terminate(),a.revoke&&((i=$a())==null||i.URL.revokeObjectURL(a.src)),delete Ce[e]);for(const s of un.keys())s.startsWith(`${e}:`)&&un.delete(s)}function Mf(e,t){if(e===t)return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return!0}}function Ff(e){const[t,...n]=e;return Array.isArray(t)?[t.slice(0,gr).map(i=>Array.isArray(i)?i.slice(0,gr+1):i),...n]:e}function xr(e,t,n,i){const a=++Pf;let s=!1,o;const r=new Promise((l,c)=>{const d=(g,p)=>{s||(s=!0,o(),g(p))},u=function(g){var p;((p=g.data)==null?void 0:p.id)===a&&(g.data.error?d(c,new Error(g.data.error)):d(l,g.data.result))},h=function(){d(c,new Error("worker error"))},f=setTimeout(()=>d(c,new Error("worker timeout")),i);o=()=>{clearTimeout(f),e.removeEventListener("message",u),e.removeEventListener("error",h)},e.addEventListener("message",u),e.addEventListener("error",h)});try{e.postMessage({args:n,id:a,op:t})}catch(l){throw s=!0,o(),l}return r}function Of(e,t,n,i,a,s){const o=Ff(a),r=xr(e,n,o,s).then(l=>Mf(l,i(...o)),()=>!1).then(l=>(l?un.set(t,!0):un.delete(t),l));return un.set(t,r),r}function $f(e,t=""){const n=!!pr(),i=t?null:$a(),a=t?"":Df(),s=t||"blob";if(!n||!t&&(!i||!a)||Ai.has(s))return null;if(!(s in Ce))try{if(t)Ce[s]={revoke:!1,src:t,worker:null};else if(i){const o=new i.Blob([a],{type:"text/javascript"});Ce[s]={revoke:!0,src:i.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:Ce[s].src}}function Bf(e,t){const n=Ce[e],i=pr();if(!n||!i||Ai.has(e))return null;if(!n.worker)try{n.worker=new i(t)}catch(a){return _r(e,!0),null}return n.worker}function Ba(e=!0,t,n,i,a){const{timeout:s,workerUrl:o}=If(a),r=function(...c){const d=n(...c);i(d)};let l=r;if(e){const c=$f(t,o),d=c?Bf(c.key,c.src):null;if(d&&c){const{key:u}=c;l=function(...h){var f;const g=()=>{_r(u,!0),l=r,r(...h)};try{const p=`${u}:${t}`,_=(f=un.get(p))!=null?f:Of(d,p,t,n,h,s);xr(d,t,h,s).then(x=>{_===!0?i(x):_.then(m=>m?i(x):g())},g)}catch(p){g()}}}}return l}function zf(){const e=$a();for(const t in Ce){const n=Ce[t];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(e==null||e.URL.revokeObjectURL(n.src)),delete Ce[t]}Ai.clear(),un.clear()}const za=34,qn=10,Na=13;function mr(e){const t=e.charCodeAt(0);function n(a,s){const o=[];let r=a.length,l=0,c=0,d=r<=0,u=!1;a.charCodeAt(0)===65279&&l++,a.charCodeAt(r-1)===qn&&--r,a.charCodeAt(r-1)===Na&&--r;function h(){if(d)return null;if(u)return u=!1,null;const g=l;let p,_;if(a.charCodeAt(g)===za){for(;++l<r;)if(a.charCodeAt(l)===za){if(a.charCodeAt(l+1)!==za)break;l++}return(_=l++)>=r?d=!0:(p=a.charCodeAt(l++))===qn?u=!0:p===Na&&(u=!0,a.charCodeAt(l)===qn&&++l),a.slice(g+1,_).replace(/""/g,'"')}for(;l<r;){if((p=a.charCodeAt(_=l++))===qn)u=!0;else if(p===Na)u=!0,a.charCodeAt(l)===qn&&++l;else if(p!==t)continue;return a.slice(g,_)}return d=!0,a.slice(g,r)}let f;for(;(f=h())!==null;){const g=[];for(;f!==null;)g.push(f),f=h();if(s){const p=s(g,c++);p!=null&&o.push(p)}else o.push(g)}return o}function i(a,s){let o=[];return n(a,(r,l)=>{var c;if(l===0)return o=r,null;const d={};for(let u=0;u<o.length;u++)d[o[u]]=(c=r[u])!=null?c:"";return s?s(d,l-1,o):d})}return{parse:i,parseRows:n}}const vr=mr(","),br=mr("	"),Nf=vr.parse,Xf=vr.parseRows,Gf=br.parse,Vf=br.parseRows;function yr(e){const t=[];return e.forEach(function(n,i){const a=n[0];n.forEach(function(s,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][a]=s}})}),t}function Tr(e){const t=e[0],n=[];return e.forEach(function(i,a){if(a>0){const s={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${a}, ${r})!`);s[t[r]]=o}),n.push(s)}}),n}function wr(e,t){const n=[];let i,a;if(Array.isArray(e)){const s=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let d=o;return c.some(function(u){return!(d=d&&typeof d=="object"&&u in d?d[u]:void 0)}),d};t.x?i=t.value.concat(t.x):i=t.value,n.push(i),e.forEach(function(o){const r=i.map(function(l){let c=s(o,l);return typeof c=="undefined"&&(c=null),c});n.push(r)}),a=Tr(n)}else Object.keys(e).forEach(function(s){var o;const r=[].concat(e[s]);(o=r.unshift)==null||o.call(r,s),n.push(r)}),a=yr(n);return a}function Wf(e,t="csv",n,i,a){const s=new XMLHttpRequest,o={csv:Yf,tsv:Hf,json:wr};s.open("GET",e),n&&Object.keys(n).forEach(function(r){s.setRequestHeader(r,n[r])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const r=s.responseText;r&&a.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},s.send()}function Cr(e,t){const n=e.rows(t);let i;return n.length===1?(i=[{}],n[0].forEach(a=>{i[0][a]=null})):i=e.parse(t),i}function Yf(e){return Cr({rows:Xf,parse:Nf},e)}function Hf(e){return Cr({rows:Vf,parse:Gf},e)}const jf=5e3;function Uf(e){var t,n;const i=e[0];if(ot(i)){let a=0;for(let s=0,o=e.length;s<o;s++)a+=(n=(t=e[s])==null?void 0:t.length)!=null?n:0;return a}return e.length*Object.keys(i!=null?i:{}).length}function Sr(e,t){const n=e||(t==null?void 0:t.data_keys);return n!=null&&n.x&&(t.data_x=n.x),n}function Kf(e,t,n){const i=this,{config:a}=i;let s;e.forEach(o=>{const r=i.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(r)>=0?s=(n.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const d=l[r];return q(d)?i.generateTargetX(d,o,c):!1}).filter(l=>l!==!1)):a.data_x?s=this.getOtherTargetXs():bt(a.data_xs)&&(s=i.getXValuesOfXKey(r,i.data.targets)):s=t.map((l,c)=>c),s)i.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var Zf={convertData(e,t){const{config:n}=this,i=o=>!(o!=null&&o.length)||se(o[0])?!1:n.boost_useWorker==="auto"?Uf(o)>=jf:!!n.boost_useWorker,a=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=e;if(e.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const r=`data_${o}`;r in e&&(s[o]=e[r])})),s.url&&t)Wf(s.url,s.mimeType,s.headers,Sr(s.keys,n),t);else if(s.json)Ba(i(s.json),"json",wr,t,a)(s.json,Sr(s.keys,n));else if(s.rows)Ba(i(s.rows),"rows",Tr,t,a)(s.rows);else if(s.columns)Ba(i(s.columns),"columns",yr,t,a)(s.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const n=this,{axis:i,config:a,state:s}=n,o=a.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((g,p)=>(n.isX.call(n,p)?g.xs.push(p):g.ids.push(p),g),{ids:[],xs:[]}):{ids:[],xs:[]},d={appendXs:t,xs:c,categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};Kf.bind(n)(l,e,d);const u=d.customX&&d.categorized&&a.axis_x_categories.length?new Map(a.axis_x_categories.map((g,p)=>[g,p])):null,h=a.data_idConverter.bind(n.api),f=l.map((g,p)=>{const _=h(g),x=n.getXKey(g),m=d.customX&&d.categorized,v=m&&p===0&&(()=>{const T=Ds(a.axis_x_categories);return e.every(w=>T.has(w[x]))})(),b=e.__append__,y=x===null&&b?n.api.data.values(g).length:0;return{id:_,id_org:g,values:e.map((T,w)=>{var C;const k=T[x];let S=T[g],A;if(S=S!==null&&!isNaN(S)&&!tt(S)?+S:ot(S)||tt(S)?S:null,(m||s.hasRadar)&&p===0&&!Ct(k)){!v&&w===0&&!b&&(a.axis_x_categories=[],u&&u.clear());const L=String(k);A=(C=u==null?void 0:u.get(L))!=null?C:-1,A===-1&&(A=a.axis_x_categories.length,a.axis_x_categories.push(k),u==null||u.set(L,A))}else A=n.generateTargetX(k,g,y+w);return(Ct(S)||n.data.xs[g].length<=w)&&(A=void 0),{x:A,value:S,id:_,index:-1}}).filter(T=>ct(T.x))}});if(f.forEach(g=>{var p;a.data_xSort&&(g.values=g.values.sort((_,x)=>{const m=_.x||_.x===0?_.x:1/0,v=x.x||x.x===0?x.x:1/0;return m-v})),g.values.forEach((_,x)=>_.index=x),(p=n.data.xs[g.id])==null||p.sort((_,x)=>_-x)}),s.hasNegativeValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value<0)),s.hasPositiveValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value>0)),o&&n.isValidChartType(o)){const g=n.mapToIds(f).filter(p=>!(p in a.data_types)||!n.isValidChartType(a.data_types[p]));n.setTargetType(g,o)}return f.forEach(g=>n.cache.add(g.id_org,g,!0)),f}};const qf={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function kr(e){return ot(e)?e:[e]}var Jf={isX(e){const t=this,{config:n}=t,i=n.data_x&&e===n.data_x,a=bt(n.data_xs)&&Su(n.data_xs,e);return i||a},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||Ut(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(Ut(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(n=>n.indexOf(e)>=0&&n.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:n}=t;return t.data.targets.filter(s=>n.getId(s.id)===e).map(s=>s.id).some(s=>t.isGrouped(s))},getXKey(e){const t=this,{config:n}=t;return n.data_x?n.data_x:bt(n.data_xs)?n.data_xs[e]:null},getXValuesOfXKey(e,t){const n=this,i=t&&bt(t)?n.mapToIds(t):[];let a;return i.forEach(s=>{n.getXKey(s)===e&&(a=n.data.xs[s])}),a},getIndexByX(e,t){const n=this;return t?t.indexOf(Q(e)?e:+e):(n.filterByX(n.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const n=this;return e in n.data.xs&&n.data.xs[e]&&q(n.data.xs[e][t])?n.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:n}=t;Object.keys(e).forEach(i=>{n.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(bt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:n}=t;let i;return e&&(i=n.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const n=this;let i=n.filterTargetsToShow(n.data.targets).map(a=>n.addName(n.getValueOnIndex(a.values,e)));return t&&(i=i.filter(a=>a&&"value"in a&&q(a.value))),i},getValueOnIndex(e,t){var n;if(((n=e[t])==null?void 0:n.index)===t)return e[t];const i=e.filter(a=>a.index===t);return i.length?i[0]:null},updateTargetX(e,t){const n=this;e.forEach(i=>{i.values.forEach((a,s)=>{a.x=n.generateTargetX(t[s],i.id,s)}),n.data.xs[i.id]=t})},updateTargetXs(e,t){const n=this;e.forEach(i=>{t[i.id]&&n.updateTargetX([i],t[i.id])})},generateTargetX(e,t,n){const i=this,{axis:a}=i;let s=a!=null&&a.isCategorized()?n:e||n;if(a!=null&&a.isTimeSeries()){const o=Vt.bind(i);s=o(e||i.getXValue(t,n))}else a!=null&&a.isCustomX()&&!(a!=null&&a.isCategorized())&&(s=q(e)?+e:i.getXValue(t,n));return s},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return ct(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return ct(t)?t:null},getBaseValue(e){const t=this,{hasAxis:n}=t.state;let{value:i}=e;return i&&n&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let n=1/0,i=-1/0;const a=e||this.data.targets.map(s=>s.values);for(let s=0;s<a.length;s++){const o=a[s];for(let r=0;r<o.length;r++){const l=t(o[r]);$(l)&&(l<n&&(n=l),l>i&&(i=l))}}return{min:n,max:i}},getMinMaxData(){const e=this,t=W.dataMinMax;let n=e.cache.get(t);if(!n){const i=e.data.targets.map(c=>c.values),a=e.getMinMaxValue(i),s=[],o=[],{min:r,max:l}=a;i.forEach(c=>{const d=e.getFilteredDataByValue(c,r),u=e.getFilteredDataByValue(c,l);if(d.length)for(let h=0;h<d.length;h++)s.push(d[h]);if(u.length)for(let h=0;h<u.length;h++)o.push(u[h])}),e.cache.add(t,n={min:s,max:o})}return n},getTotalPerIndex(e){const t=this,{config:n}=t,i=e?`${W.dataTotalPerIndex}-${e}`:W.dataTotalPerIndex,a=t.cache.get(i);let s=(a==null?void 0:a.generation)===t.state.dataGeneration?a.value:null;if((t.config.data_groups.length||t.isStackNormalized())&&!s){s=[];let{targets:o}=t.data;if(t.isStackNormalizedPerGroup()&&e){const r=n.data_groups.find(l=>l.indexOf(e)>=0);if(r)o=o.filter(l=>r.indexOf(l.id)>=0);else return null}o.forEach(r=>{r.values.forEach((l,c)=>{s[c]||(s[c]=0),s[c]+=$(l.value)?l.value:0})}),t.cache.add(i,{generation:t.state.dataGeneration,value:s})}return s},getVisibleTotalPerIndex(e){const t=this,{api:n,config:i,state:a,cache:s}=t;let o=s.get(W.visibleTotalPerIndex);if((!o||o.generation!==a.dataGeneration)&&(o=s.add(W.visibleTotalPerIndex,{generation:a.dataGeneration,values:new Map})),o.values.has(e))return o.values.get(e);const r=n.data.values.bind(n),{hiddenTargetIds:l}=a;let c=t.getTotalPerIndex(e);if(c===null)return o.values.set(e,c),c;if(l.size){let d=[...l];if(e){const u=i.data_groups.find(h=>h.indexOf(e)>=0);u&&(d=d.filter(h=>u.indexOf(h)>=0))}if(d.length){let u=r(d,!1);u.length&&(u=u.reduce((h,f)=>h.map((g,p)=>($(g)?g:0)+f[p])),c=c.map((h,f)=>h-u[f]))}}return o.values.set(e,c),c},getTotalDataSum(e){const t=this,n=W.dataTotalSum;let i=t.cache.get(n);return $(i)||(i=t.data.targets.reduce((a,s)=>a+s.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(n,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:n}}=e;let i=0;return n.size&&(i=t.data.values.bind(t)([...n]).reduce((a,s)=>a+s,0)),i},getFilteredDataByValue(e,t){return e.filter(n=>this.getBaseValue(n)===t)},getMaxDataCount(){const{targets:e}=this.data;let t=0;for(let n=0;n<e.length;n++)e[n].values.length>t&&(t=e[n].values.length);return t},getMaxDataCountTarget(){const e=this,{cache:t,state:n}=e,i=t.get(W.maxDataCountTarget);if(i&&i.generation===n.dataGeneration)return i.value;let a=e.filterTargetsToShow()||[];const s=a.length,o=e.config.axis_x_inverted;if(s>1){const r=[];for(let l=0;l<a.length;l++){const c=a[l].values;for(let d=0;d<c.length;d++)r.push(c[d].x)}a=r,a=pn(qi(a)).map((l,c,d)=>({x:l,index:o?d.length-c-1:c}))}else s&&(a=a[0].values.concat());return t.add(W.maxDataCountTarget,{value:a,generation:n.dataGeneration}),a},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?ot(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const n=this.mapToIds(e);for(let i=0,a;a=n[i];i++)if(a===t)return!0;return!1},isTargetToShow(e){return!this.state.hiddenTargetIds.has(e)},isLegendToShow(e){return!this.state.hiddenLegendIds.has(e)},getTargetsToShow(){var e;const{state:t}=this;return(e=t._targetsToShow)!=null?e:this.filterTargetsToShow()},filterTargetsToShow(e){const t=this;if(!e){const{cache:n,data:i,state:a}=t,s=W.filteredTargets,o=n.get(s);if(o&&o.generation===a.dataGeneration)return o.value;const r=i.targets.filter(l=>t.isTargetToShow(l.id));return n.add(s,{value:r,generation:a.dataGeneration}),r}return e.filter(n=>t.isTargetToShow(n.id))},mapTargetsToUniqueXs(e){const t=this,{axis:n}=t;let i=[];return e!=null&&e.length&&(i=qi(Lu(e.map(a=>a.values.map(s=>+s.x)))),i=n!=null&&n.isTimeSeries()?i.map(a=>new Date(+a)):i.map(Number)),pn(i)},addTargetIds(e,t){const{state:n}=this;kr(t).forEach(i=>n[e].add(i))},removeTargetIds(e,t){const{state:n}=this;kr(t).forEach(i=>n[e].delete(i))},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e),this.cache.remove(W.visibleTotalPerIndex)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e),this.cache.remove(W.visibleTotalPerIndex)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:n}=t.state,i={},a=t.isMultipleX();let s=null;if(a){const o=t.cache.get(W.valuesXIndexMap);if(o&&o.generation===t.state.dataGeneration)s=o.value;else{const r=t.mapTargetsToUniqueXs(t.data.targets).map(l=>Q(l)?l:+l);s=new Map(r.map((l,c)=>[l,c])),t.cache.add(W.valuesXIndexMap,{value:s,generation:t.state.dataGeneration})}}return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>q(l)||l===null).forEach(l=>{let{value:c}=l;if(c!==null&&t.isCandlestickType(l)&&(c=ot(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),ot(c))r.push(...c);else if(tt(c)&&"high"in c)r.push(...Object.values(c));else if(t.isBubbleZType(l))r.push(n&&t.getBubbleZData(c,"y"));else if(a&&s){const d=Q(l.x)?l.x:+l.x,u=s.get(d);u!==void 0&&(r[u]=c)}else r.push(c)}),i[o.id]=r}),i},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(e){const t=this,n=e.slice(),i=t.getSortCompareFn();return i&&n.sort(i),n},getSortCompareFn(e=!1){const t=this,{config:n}=t,i=n.data_order,a=/asc/i.test(i),s=/desc/i.test(i);let o;if(a||s){const r=(c,d)=>c+Math.abs(d.value),l=c=>$(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,d)=>{const u=l(c),h=l(d);return e?a?u-h:h-u:a?h-u:u-h}}else z(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return this.getValuesByX(e).get(this.getXCacheKey(t))||[]},filterNullish(e){const t=n=>q(n.value);return e&&e.filter(n=>"value"in n?t(n):n.values.some(t))},filterRemoveNull(e){return e.filter(t=>q(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return tn(e)&&e||Ut(e)&&bt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:n,config:i,state:{hasRadar:a,inputType:s,eventReceiver:{coords:o,rect:r}}}=t;let l;if(a){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const d=(0,F.select)(c).datum();l=d&&Object.keys(d).length===1?d.index:void 0}else{const c=i.axis_rotated,d=dr(n.chart.node()),u=s==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?u.clientY+d.y:u.clientX+d.x;if(Fa(n.svg)){const f=[h,0];c&&f.reverse(),h=ki(n.eventRect.node(),...f)[c?"y":"x"]}else h-=c?r.top:r.left;l=Ji(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,n){var i,a,s;const o=this,r=1.3,l=[e,t].map(c=>o.dataLabelFormat()(c));if(o.config.render_mode==="canvas"&&!o.$el.svg){const c=(a=(i=o.$el.chart)==null?void 0:i.node)==null?void 0:a.call(i),d=c==null?void 0:c.ownerDocument,u=d==null?void 0:d.createElementNS("http://www.w3.org/2000/svg","svg");if(c&&u){const h=l.map(g=>{const p=d.createElementNS("http://www.w3.org/2000/svg","text");return p.textContent=g,u.appendChild(p),p});u.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",c.appendChild(u);const f=h.map(g=>g.getBoundingClientRect()[n]*r);return u.remove(),f}}return((s=o.getTextRect(l))==null?void 0:s.map(c=>c[n]*r))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const n=e[t].x,i=[];let a;for(a=t-1;a>=0&&n===e[a].x;a--)i.push(e[a]);for(a=t;a<e.length&&n===e[a].x;a++)i.push(e[a]);return i},getXCacheKey(e){return Q(e)?e:+e},getValuesByX(e){const t=this,{cache:n,state:i}=t,a=e.map(r=>{const{values:l}=r,c=l[0],d=l[l.length-1];return`${r.id}:${l.length}:${c?t.getXCacheKey(c.x):""}:${d?t.getXCacheKey(d.x):""}`}).join("|"),s=n.get(W.valuesByX);if(s&&s.generation===i.dataGeneration&&s.targetKey===a)return s.value;const o=new Map;for(let r=0;r<e.length;r++){const l=e[r].values;for(let c=0;c<l.length;c++){const d=l[c],u=t.getXCacheKey(d.x),h=o.get(u);h?h.push(d):o.set(u,[d])}}return n.add(W.valuesByX,{generation:i.dataGeneration,targetKey:a,value:o}),o},getClosestCandidates(e,t,n=!0){const i=this,{config:a,scale:s}=i,o=e.length,r=e[0];if(!n||o<200||!r||!a.data_xSort)return e;const l=i.isBarType(r.id),c=i.isCandlestickType(r.id),d=a.point_sensitivity;if(!(l||c)&&!$(d))return e;const u=s.zoom||s.x,h=t[+a.axis_rotated],f=u(e[0].x)<=u(e[o-1].x);let g=0,p=o-1;for(;g<p;){const b=g+p>>1,y=u(e[b].x);(f?y<h:y>h)?g=b+1:p=b}const _=[],x=new Set,m=b=>{b>=0&&b<o&&!x.has(b)&&(x.add(b),_.push(e[b]))},v=b=>{if(b<0||b>=o)return;const y=i.getXCacheKey(e[b].x);let T=b;for(;T>=0&&i.getXCacheKey(e[T].x)===y;)m(T--);for(T=b+1;T<o&&i.getXCacheKey(e[T].x)===y;)m(T++)};if(l||c)for(let b=g-2;b<=g+2;b++)v(b);else{const b=d,y=(T,w)=>{for(let C=T;C>=0&&C<o;C+=w){const k=e[C];if(Math.abs(u(k.x)-h)>b)break;m(C)}};y(g,1),y(g-1,-1)}return _},findClosestFromTargets(e,t){const n=this,i=[];for(let a=0;a<e.length;a++){const s=n.findClosest(e[a].values,t);s&&i.push(s)}return n.findClosest(i,t,!1)},findClosest(e,t,n=!0){const i=this,{$el:{main:a}}=i,s=i.getClosestCandidates(e,t,n);let o,r;for(let l=0;l<s.length;l++){const c=s[l];if(!c||!q(c.value))continue;const d=i.isBarType(c.id),u=i.isCandlestickType(c.id);if(d||u){const h=d?`.${ie.chartBar}.${U.target}${i.getTargetSelectorSuffix(c.id)} .${ie.bar}-${c.index}`:`.${De.chartCandlestick}.${U.target}${i.getTargetSelectorSuffix(c.id)} .${De.candlestick}-${c.index} path`;!r&&i.isWithinBar(a.select(h).node())&&(r=c)}else{const h=i.dist(c,t),f=i.getPointSensitivity(c);h<f&&(o===void 0||h<o)&&(o=h,r=c)}}return r},dist(e,t){const n=this,{config:{axis_rotated:i},scale:a}=n,s=+i,o=+!i,r=n.circleY(e,e.index),c=(a.zoom||a.x)(e.x)-t[s],d=r-t[o];return Math.sqrt(c*c+d*d)},convertValuesToStep(e){const t=this,{axis:n,config:i}=t,a=i.line_step_type,s=n?n.isCategorized():!1,o=ot(e)?e.concat():[e];if(!(s||/step\-(after|before)/.test(a)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:d}=r;o.unshift({x:--d,value:r.value,id:c}),s&&a==="step-after"&&o.unshift({x:d-1,value:r.value,id:c}),d=l.x,o.push({x:++d,value:l.value,id:c}),s&&a==="step-before"&&o.push({x:d+1,value:l.value,id:c})}return o},convertValuesToRange(e){const t=ot(e)?e.concat():[e],n=[];return t.forEach(i=>{const{x:a,id:s}=i;n.push({x:a,id:s,value:i.value[0]}),n.push({x:a,id:s,value:i.value[2]})}),n},updateDataAttributes(e,t){const n=this,{config:i}=n,a=i[`data_${e}`];return Ct(t)||(Object.keys(t).forEach(s=>{a[s]=t[s]}),n.redraw({withLegend:!0})),a},getRangedData(e,t="",n="areaRange"){var i,a;const s=e==null?void 0:e.value;if(ot(s)){if(n==="bar")return s.reduce((o,r)=>r-o);{const o=(a=(i=qf[n])==null?void 0:i[t])!=null?a:-1;return o>=0?s[o]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:n}=t;if(n.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=a=>t.getRatio("index",a,!0);e.forEach(a=>{"values"in a?a.values.forEach(i):i(a)})}},getRatio(e,t,n=!1){const i=this,{config:a,state:s}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=a.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=i.getVisibleTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(l===null)return r;const c=l[t.index];t.ratio=$(t.value)&&l&&c?t.value/c:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/s.current.dataMax*a.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((d,u)=>u-d);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return n&&r?r*100:r},updateDataIndexByX(e){const t=this,n=e.reduce((i,a,s)=>(i[Number(a.x)]=s,i),{});t.data.targets.forEach(i=>{i.values.forEach((a,s)=>{let o=n[Number(a.x)];o===void 0&&(o=s),a.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(tt(e.value)&&("z"in e.value||"y"in e.value)||ot(e.value)&&e.value.length>=2)},isBarRangeType(e){var t;const n=this,{value:i}=e;return n.isBarType(e)&&!((t=n.isSubchartSourceTypeOf)!=null&&t.call(n,e,O.CANDLESTICK))&&ot(i)&&i.length>=2&&i.every($)},getDataById(e){var t;const n=this.cache.get(e)||this.api.data(e);return(t=n==null?void 0:n[0])!=null?t:n}};function Li(e,t=!1){const n=this,{api:i}=n;t&&n.api.flush(!0),e==null||e.call(i)}var Qf={load(e,t){const n=this,{axis:i,data:a,org:s,scale:o}=n,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;if(c){t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var h;const f=((h=t.types)==null?void 0:h[u.id])||t.type;n.setTargetType(u.id,f)});const d=new Map(c.map(u=>[u.id,u]));a.targets.forEach(u=>{const h=d.get(u.id);if(h){if(r){const f=h.values;for(let g=0;g<f.length;g++)u.values.push(f[g])}else u.values=h.values;d.delete(u.id)}}),d.forEach(u=>a.targets.push(u))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Li.call(n,t.done,t.resizeAfter);return}n.updateTargets(a.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),l.domain=n.getXDomain(a.targets),l.x.domain(l.domain),l.currentDomain=n.zoom.getDomain(),n.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=l.domain,s.xScale=l.x,i.isCategorized()&&(l.currentDomain=n.getZoomDomainValue(l.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=l.x.domain(s.xDomain)),n.updateCurrentZoomTransform(l.x,l.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Li.call(n,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(!1,[W.filteredTargets,W.maxDataCountTarget,W.valuesXIndexMap,W.maxTickSize]),t.convertData(e,n=>{const i=e.data||n;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var n;const i=this,{state:a,$el:s,$T:o}=i,r=!!((n=i.hasLegendDefsPoint)!=null&&n.call(i));let l=t,c=e;if(i.cache.reset(!1,[W.filteredTargets,W.maxDataCountTarget,W.valuesXIndexMap,W.maxTickSize]),l||(l=()=>{}),c=c.filter(h=>i.hasTarget(i.data.targets,h)),c.length===0){l();return}const d=new Set(c);if(a.isCanvasMode){c.forEach(h=>{a.withoutFadeIn[h]=!1}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),i.removeHiddenTargetIds(c),i.removeHiddenLegendIds(c),i.updateTypesElements(),l();return}c.forEach(h=>{var f;const g=i.getTargetSelectorSuffix(h);a.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${j.legendItem}${g}`).remove(),r&&((f=s.defs)==null||f.select(`#${i.getDefsPointId(g)}`).remove())}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),a.hasFunnel&&i.updateFunnel(i.data.targets),a.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const u=s.svg.selectAll(c.map(h=>i.selectorTarget(h)));o(u).style("opacity","0").remove().call(ri,l)}},Ar=wt(6),tg={setExpand(e,t,n){const i=this,{config:a,$el:{circle:s}}=i;s&&a.point_focus_expand_enabled&&i.expandCircles(e,t,n),i.expandBarTypeShapes(!0,e,t,n)},expandBarTypeShapes(e=!0,t,n,i){const a=this;["bar","candlestick"].filter(s=>a.$el[s]).forEach(s=>{i&&a.$el[s].classed(U.EXPANDED,!1),a.getShapeByIndex(s,t,n).classed(U.EXPANDED,e)})},setOverOut(e,t){const n=this,{config:i,state:{hasFunnel:a,hasRadar:s,hasTreemap:o},$el:{main:r}}=n,l=tt(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(n.api);if(i.color_onover&&n.setOverColor(e,t,l),l){const d=n.getTargetSelectorSuffix(t.id),u=a||o?`${U.target+d} .${At.shape}`:at.arc+d;c(t,r.select(`.${u}`).node())}else if(i.tooltip_grouped)e&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(t,!0)):n.setExpand(t,null,!0)),!n.isMultipleX()&&r.selectAll(`.${At.shape}-${t}`).each(function(d){c(d,this)});else{const d=n.cache.get(W.setOverOut)||[],u=r.selectAll(`.${At.shape}-${t}`).filter(function(f){return n.isWithinShape(this,f)}),h=u.filter(function(){return d.every(f=>f!==this)});if(!e||u.empty()||d.length===h.size()&&h.nodes().every((f,g)=>f!==d[g]))for(;d.length;){const f=d.pop();i.data_onout.bind(n.api)((0,F.select)(f).datum(),f)}h.each(function(){e&&(c((0,F.select)(this).datum(),this),d.push(this))}),n.cache.add(W.setOverOut,d)}}},callOverOutForTouch(e){const t=this,n=t.cache.get(W.callOverOutForTouch);(tt(e)&&n?e.id!==n.id:e!==n)&&((n||$(n))&&t.setOverOut(!1,n),(e||$(e))&&t.setOverOut(!0,e),t.cache.add(W.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:n}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,Ar.drag)().on("drag",function(i){n.event=i,e.drag(Zt(i,this))}).on("start",function(i){n.event=i,e.dragstart(Zt(i,this))}).on("end",i=>{n.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,n){var i,a,s;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:d,hasRadar:u,hasTreemap:h},$el:{eventRect:f,funnel:g,radar:p,svg:_,treemap:x}}=o;let m=(s=(a=(d||h)&&l.rect||u&&p.axes.select(`.${It.axis}-${t} text`)||f||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:a.node)==null?void 0:s.call(a);if(m){const v=o.isMultipleX(),b=r.axis_rotated;let{width:y,left:T,top:w}=ht(m);if(c&&!u&&!v){const A=l.coords[t];A?(y=A.w,T+=A.x,w+=A.y):(y=0,T=0,w=0)}let C=T+(n?n[0]:0)+(v||b?0:y/2),k=w+(n?n[1]:0)+(b?4:0);if(Fa(_)&&o.$el.eventRect){const A=ki(o.$el.eventRect.node(),C,k,!1);C=A.x,k=A.y}const S={screenX:C,screenY:k,clientX:C,clientY:k,bubbles:u};(d||h)&&(m=(g!=null?g:x).node()),Oa[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{canvas:t,eventRect:n,svg:i,zoomResetBtn:a}}=e;n==null||n.on(".zoom wheel.zoom .drag",null),t==null||t.on(".zoom wheel.zoom .drag",null),i==null||i.on("wheel",null),a==null||a.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:n,eventRect:i,legend:a,region:s,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,s==null?void 0:s.list,l==null?void 0:l.getSelection(),n==null?void 0:n.selectAll("path"),a==null?void 0:a.selectAll("g"),r].forEach(d=>d==null?void 0:d.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},eg={categoryName(e){var t;const{axis_x_categories:n}=this.config;return(t=n==null?void 0:n[e])!=null?t:e}};const ng=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var ig={generateClass(e,t){const n=this.state.generateClassCache,i=`${e}\0${t}`;let a=n.get(i);return a||(a=` ${e} ${e+this.getTargetSelectorSuffix(t)}`,n.set(i,a)),a},getClass(e,t){const n=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),a=n?"id":"index";return s=>{const o=s.data||s;return((t?this.generateClass(V[n?"shapes":"shape"],o[a]):"")+this.generateClass(V[e],o[i?"id":a])).trim()}},getChartClass(e){return t=>V[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],n=[];return function(i){var a;const s=i.id||((a=i.data)==null?void 0:a.id)||i;return n.indexOf(s)<0&&n.push(s),t[n.indexOf(s)%t.length]}},classRegion(e,t){return`${this.generateClass(V.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let n="";return t&&(n=` ${V.target}-${t}`),this.generateClass(V.target,e)+n},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.has(e.id)?V.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.has(e.id)?V.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(ng,"-")},selectorTarget(e,t="",n=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${V.target+i} ${n}, ${t}.${V.circles+i} ${n}`},selectorTargets(e,t){const n=e||[];return n.length?n.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${V.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}};const ag=(e,t,n)=>{const i=(0,F.select)(e.cloneNode(!0));return i.attr("id",n).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:n,node:i.node()}};function sg(e){const t=W.colorPattern,{body:n}=nt;let i=n[t];if(!i){const s=e.classed(Pa.colorPattern,!0).style("background-image");e.classed(Pa.colorPattern,!1),s.indexOf(";")>-1&&(i=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[t]=i)}return i}const og=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var rg={generateColor(){const e=this,{$el:t,config:n}=e,i=[],a=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=bt(n.color_pattern)?n.color_pattern:[...sg(t.chart)||og];const o=s;if(z(n.color_tiles)){const r=n.color_tiles.bind(e.api)(),l=s.map((c,d)=>{const u=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${u}-${d}`;return ag(r[d%r.length],c,h)});s=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=n.data_colors,d=n.data_color,u=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(u,["line","spline","step"])||!n.data_types[u];let f;if(z(c[u]))f=c[u].bind(e.api)(r);else if(c[u])f=c[u];else{let g=i.indexOf(u);g<0&&(i.push(u),g=i.length-1),f=h?o[g%o.length]:s[g%s.length],c[u]=f}if(f=z(d)?d.call(e.api,f,r):f,a&&t.defs){const g=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(u)}'] stop`);let p;g.each(function(_,x){p=x===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&g.attr("stop-color",f)}return f}},generateLevelColor(){const e=this,{config:t}=e,n=t.color_pattern,i=t.color_threshold,a=i.unit==="value",s=i.max||100,o=i.values&&i.values.length?i.values:[];return bt(i)?function(r){const l=a?r:r*100/s;let c=n[n.length-1];for(let d=0,u=o.length;d<u;d++)if(l<=o[d]){c=n[d];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:i},state:a}=n;if(e){let s=[];Q(e)?s.push(""):tt(e)?s=Object.keys(e):z(e)&&(s=n.mapToTargetIds()),s.forEach(o=>{const r=`${a.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${Q(e)?n.getTargetSelectorSuffix(e):""}`,l=Se(o===""?e:(e==null?void 0:e[o])||"");if(i.select(`#${r}`).empty()){const c=i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r);c.append("feFlood").attr("flood-color",l),c.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:n},state:{datetimeId:i},$el:{defs:a}}=e;n.forEach(s=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(s.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(s)&&"area"||e.isBarType(s)&&"bar";if((r||l)&&a.select(`#${o}`).empty()){const c=e.color(s),d={defs:null,stops:[]};if(r){const{cx:u=.3,cy:h=.3,r:f=.7,stops:g=[[.1,c,0],[.9,c,1]]}=r;d.stops=g,d.defs=a.append("radialGradient").attr("id",`${o}`).attr("cx",u).attr("cy",h).attr("r",f)}else{const u=t.axis_rotated,{x:h=u?[1,0]:[0,0],y:f=u?[0,0]:[0,1],stops:g=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];d.stops=g,d.defs=a.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",f[0]).attr("y2",f[1])}d.stops.forEach(u=>{const[h,f,g]=u,p=z(f)?f.bind(e.api)(s.id):f;d.defs&&d.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",g)})}})},setOverColor(e,t){const n=this,{config:i,$el:{main:a}}=n,s=i.color_onover;let o=e?s:n.color;tt(o)?o=({id:r})=>r in s?s[r]:n.color(r):Q(o)?o=()=>s:z(s)&&(o=o.bind(n.api)),a.selectAll(tt(t)?`.${at.arc}${n.getTargetSelectorSuffix(t.id)}`:`.${At.shape}-${t}`).style("fill",o)}},Ri=wt(7);function Lr(e){const{event:t,$el:n}=e,i=n.subchart.main||n.main;let a;return t&&t.type==="brush"?a=t.selection:i&&(a=i.select(".bb-brush").node())&&(a=(0,Ri.brushSelection)(a)),a}function Rr(e){const t=Lr(e);return t?t[0]===t[1]:!0}function Er(e,t){return t.map(n=>{var i,a,s,o,r,l,c,d,u;const{values:h}=n,f=h[0],g=h[h.length-1],p=f?(a=(i=e.getXCacheKey)==null?void 0:i.call(e,f.x))!=null?a:f.x:"",_=g?(o=(s=e.getXCacheKey)==null?void 0:s.call(e,g.x))!=null?o:g.x:"",x=(l=(r=e.getTargetType)==null?void 0:r.call(e,n))!=null?l:"",m=(u=(d=(c=e.state)==null?void 0:c.subchartSourceTypes)==null?void 0:d[n.id])!=null?u:"";return`${n.id}:${x}:${m}:${h.length}:${p}:${_}`}).join("|")}function Pr(e,t){var n;const i=(n=e.data)==null?void 0:n.targets;if(!i)return!1;for(let a=0;a<t.length;a++){const s=t[a],o=i.find(r=>r.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Xa(e,t){bt(t)&&((e.min===void 0||t<e.min)&&(e.min=t),(e.max===void 0||t>e.max)&&(e.max=t))}function Dr(e,t){for(let n=0;n<t.length;n++)Xa(e,t[n])}function lg(e,t){var n,i,a,s;const o={min:void 0,max:void 0},r=e.state.hasAxis;for(let l=0;l<t.length;l++){const c=t[l],d=(n=e.isCandlestickType)==null?void 0:n.call(e,c),u=!d&&!!((i=e.isSubchartSourceTypeOf)!=null&&i.call(e,c,O.CANDLESTICK)),{values:h}=c;for(let f=0;f<h.length;f++){const g=h[f];let p=g.value;if(!(q(p)||p===null))continue;const _=u?(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,g,!0):void 0;$(_)?p=_:p!==null&&(d||u)&&(p=Array.isArray(p)?p.slice(0,4):[p.open,p.high,p.low,p.close]),Array.isArray(p)?Dr(o,p):tt(p)&&"high"in p?Dr(o,Object.values(p)):(s=e.isBubbleZType)!=null&&s.call(e,g)?Xa(o,r&&e.getBubbleZData(p,"y")):Xa(o,p)}}return[o.min,o.max]}function cg(e,t){let n;for(let i=0;i<e.length;i++){const{values:a}=e[i];for(let s=0;s<a.length;s++){const{x:o}=a[s];bt(o)&&(n===void 0||(t==="min"?o<n:o>n))&&(n=o)}}return n}var ug={getYDomainMinMaxBoth(e){const t=this,{axis:n,cache:i,config:a,state:s}=t,r=Pr(t,e)?`${W.domainMinMax}_y_${Er(t,e)}`:null,l=r&&i.get(r);if(l&&l.generation===s.dataGeneration)return l.value;const c=a.data_groups,d=t.mapToIds(e),u=Ds(d);let h;if(c.length>0){const f=t.getValuesAsIdKeyed(e),g=e.some(y=>y.values.some(T=>T.value<0)),p=e.some(y=>y.values.some(T=>T.value>0)),_=new Map(d.map(y=>[y,n.getId(y)])),x={},m={};for(const y in f)x[y]=f[y].slice(),m[y]=f[y].slice();c.forEach(y=>{const T=y.filter(w=>u.has(w));if(T.length){const w=T[0],C=_.get(w);x[w]&&g&&(x[w]=x[w].map(k=>k<0?k:0)),m[w]&&p&&(m[w]=m[w].map(k=>k>0?k:0)),T.filter((k,S)=>S>0).forEach(k=>{if(x[k]){const S=_.get(k);x[k].forEach((A,L)=>{const E=+A;S===C&&!(g&&E>0)&&(x[w][L]+=E)})}if(m[k]){const S=_.get(k);m[k].forEach((A,L)=>{const E=+A;S===C&&!(p&&E<0)&&(m[w][L]+=E)})}})}});const v=[],b=[];for(const y in x)v.push(ue("min",x[y])),b.push(ue("max",m[y]));h=[ue("min",v),ue("max",b)]}else h=lg(t,e);return r&&i.add(r,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(e){const t=this;for(const n of t.state.hiddenTargetIds)if(t.axis.getId(n)===e)return!0;return!1},getYDomain(e,t,n){const i=this,{axis:a,config:s,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(D=>a.getId(D.id)===t).map(D=>D.id).some(D=>i.isGrouped(D)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(L=>a.getId(L.id)===t),d=n?i.filterByXDomain(c,n):c;if(d.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",n);const u=s[`${r}_min`],h=s[`${r}_max`],f=s[`${r}_center`],g=s[`${r}_inverted`],p=i.hasDataLabel()&&s.axis_rotated,_=i.hasDataLabel()&&!s.axis_rotated,[x,m]=i.getYDomainMinMaxBoth(d);let v=x,b=m,y=[O.BAR,O.BUBBLE,O.SCATTER,...ce.Line].some(L=>{const E=L.indexOf("area")>-1?"area":L;return i.hasType(L,d,!0)&&s[`${E}_zerobased`]});v=q(u)?u:q(h)?v<=h?v:h-10:v,b=q(h)?h:q(u)?u<=b?b:u+10:b,isNaN(v)&&(v=0),isNaN(b)&&(b=v),v===b&&(v<0?b=0:v=0);const T=v>=0&&b>=0,w=v<=0&&b<=0;(q(u)&&T||q(h)&&w)&&(y=!1),y&&(T&&(v=0),w&&(b=0));const C=Math.abs(b-v);let k={top:C*.1,bottom:C*.1};if(ct(f)){const L=Math.max(Math.abs(v),Math.abs(b));b=f+L,v=f-L}if(p){const L=en(o.y.range()),E=i.getDataLabelLength(v,b,"width").map(D=>{const R=D/L;return isFinite(R)?R:0});["bottom","top"].forEach((D,R)=>{k[D]+=C*(E[R]/(1-E[0]-E[1]))})}else if(_){const L=i.getDataLabelLength(v,b,"height");["bottom","top"].forEach((E,D)=>{k[E]+=i.convertPixelToScale("y",L[D],C)})}k=i.getResettedPadding(k);const S=s[`${r}_padding`];bt(S)&&["bottom","top"].forEach(L=>{k[L]=a.getPadding(S,L,k[L],C)}),y&&(T&&(k.bottom=v),w&&(k.top=-b));const A=l?[v,b].map(L=>L<0?0:L):[v-k.bottom,b+k.top];return g?A.reverse():A},getXDomainMinMax(e,t){var n;const i=this,{cache:a,state:s}=i,o=i.config[`axis_x_${t}`],l=Pr(i,e)?`${W.domainMinMax}_x_${t}_${Er(i,e)}`:null,c=l&&a.get(l);let d=(c==null?void 0:c.generation)===s.dataGeneration?c.value:void 0;d===void 0&&(d=cg(e,t),l&&a.add(l,{generation:s.dataGeneration,value:d}));let u=tt(o)?o.value:o;return u=ct(u)&&((n=i.axis)!=null&&n.isTimeSeries())?Vt.bind(this)(u):u,tt(o)&&o.fit&&(t==="min"&&u<d||t==="max"&&u>d)&&(u=void 0),ct(u)?u:d},getXDomainPadding(e,t){const n=this,{axis:i,config:a}=n,s=a.axis_x_padding,o=i.isTimeSeries()&&t,r=en(e);let l;if(i.isCategorized()||o)l=0;else if(n.hasType("bar")){const u=n.getMaxDataCount();l=u>1?r/(u-1)/2:.5}else l=n.getResettedPadding(r*.01);let{left:c=l,right:d=l}=$(s)?{left:s,right:s}:s;if(s.unit==="px"){const u=Math.abs(r+r*.2);c=i.getPadding(s,"left",l,u),d=i.getPadding(s,"right",l,u)}else{const u=r+c+d;if(o&&u){const h=r/t/u;c=c/u/h,d=d/u/h}}return{left:c,right:d}},getXDomain(e){const t=this,{axis:n,config:i,scale:{x:a}}=t,s=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(a.type!=="log"){const c=n.isCategorized(),d=n.isTimeSeries(),u=t.getXDomainPadding(o);let[h,f]=o;h-f===0&&!c&&(d?(h=new Date(h.getTime()*.5),f=new Date(f.getTime()*1.5)):(h=h===0?1:h*.5,f=f===0?-1:f*1.5)),(h||h===0)&&(r=d?new Date(h.getTime()-u.left):h-u.left),(f||f===0)&&(l=d?new Date(f.getTime()+u.right):f+u.right)}return s?[l,r]:[r,l]},updateXDomain(e,t,n,i,a){var s;const o=this,{config:r,org:l,scale:{x:c,subX:d}}=o,u=r.zoom_enabled;if(n&&(c.domain(a||pn(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),d.domain(c.domain()),(s=o.brush)==null||s.scale(d)),t){const h=a||!o.brush||Rr(o)?l.xDomain:Lr(o).map(d.invert);c.domain(h)}return(n||t)&&u&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,n=t.config.axis_x_inverted,i=t.getZoomDomain(),[a,s]=i;return(n?e[0]>=a:e[0]<=a)&&(e[1]=+e[1]+(a-e[0]),e[0]=a),(n?e[1]<=s:e[1]>=s)&&(e[0]=+e[0]-(e[1]-s),e[1]=s),e},getZoomDomain(e="zoom",t=!1){const n=this,{config:i,scale:a,org:s}=n;let[o,r]=t&&a[e]?a[e].domain():s.xDomain;return e==="zoom"&&(ct(i.zoom_x_min)&&(o=ue("min",[o,i.zoom_x_min])),ct(i.zoom_x_max)&&(r=ue("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:n,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const a=n.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+a:+!a))}return e},convertPixelToScale(e,t,n){const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",n*(t/s[r])},withinRange(e,t=[0,0],n){const a=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(e)){const r=a?e[1]:e[0],l=a?e[0]:e[1];if(r<l)return e.every((c,d)=>(d===0?a?+c<=s:+c>=s:a?+c>=o:+c<=o)&&!e.every((u,h)=>u===t[h]))}return!1}};function Ir(e,t,n){const{config:i}=e,a=`axis_${t}_tick_format`;return(i[a]?i[a]:e.defaultValueFormat).call(e.api,n)}var dg={yFormat(e){return Ir(this,"y",e)},y2Format(e){return Ir(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:n,y2Format:i}=e,a=e.hasArcType(null,["gauge","polar","radar"]);return function(s,o,r){return(a?t:e.axis&&e.axis.getId(r)==="y2"?i:n).call(e,s,o)}},defaultValueFormat(e){return ot(e)?e.join("~"):q(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,n=t.config.data_labels,i=s=>{let r=s;return ot(s)?r=s.join("~"):tt(s)&&(r=Object.values(s).join("~")),r};let a=i;return z(n.format)?a=n.format:Ut(n.format)&&(n.format[e]?a=n.format[e]===!0?i:n.format[e]:a=()=>""),a.bind(t.api)}};const Mr=10,hg=750;function Ei(e){const t=this,n=t.getDataById(e);return t.levelColor?t.levelColor(n.values[0].value):t.color(n)}function fg(e,t=!0){var n;const{config:i}=this;let a=(n=i.data_names[e])!=null?n:e;return t&&z(i.legend_format)&&(a=i.legend_format(a,e!==a?e:void 0)),a}function gg(e,t){var n;if(!t||t.empty())return;const i=(n=e.$el.legend)==null?void 0:n.selectAll(`.${j.legendItem}`);i&&!i.empty()&&(t=i);const a=[];t.each(function(o){a.push({id:o,node:this})});const s=Is(a,o=>o.id,o=>o.node);e.cache.add(W.legendItemMap,s)}function Fr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function pg(e,t,n){const i=Fr(n);e.state.legendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Or(e,t){const n=e.state.legendTouch,i=n&&Fr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Mr||Math.abs(i.clientY-n.y)>Mr)}function _g(e,t,n){Or(e,n);const i=e.state.legendTouch;return e.state.legendTouch=null,!!i&&i.id===t&&!i.moved}function xg(e,t){e.state.legendLastTouchClickId=t,e.state.legendLastTouchClickTime=Date.now()}function mg(e,t){const{state:n}=e,i=n.legendLastTouchClickId===t&&Date.now()-(n.legendLastTouchClickTime||0)<hg;return i&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),i}function vg(e){var t;const n=(t=e.config.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}var bg={initLegend(){var e;const t=this,{config:n,$el:i}=t;if(t.legendItemTextBox={},t.state.legendHasRendered=!1,t.state.isCanvasMode){n.legend_show?(e=t.updateHtmlLegend)==null||e.call(t):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets));return}n.legend_show?(n.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(j.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets))},updateLegend(e,t,n){var i;const a=this,{config:s,state:o,scale:r,$el:l}=a,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=Ne(c,"withTransition",!0),c.withTransitionForTransform=Ne(c,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?a.updateLegendTemplate():o.hasTreemap||a.updateLegendElement(e||a.mapToIds(a.data.targets),c),(i=l.legend)==null||i.selectAll(`.${j.legendItem}`).classed(j.legendItemHidden,function(d){const u=!a.isTargetToShow(d);return u&&(this.style.opacity=null),u}),a.updateScales(!1,!r.zoom),a.updateSvgSize(),a.transformAll(c.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:n}=e,i=(0,F.select)(t.legend_contents_bindto),a=t.legend_contents_template;if(!i.empty()){const s=e.mapToIds(e.data.targets),o=[];let r="";s.forEach(c=>{const d=z(a)?Se(a.call(e.api,c,e.color(c),e.api.data(c)[0].values)):an(a,{COLOR:e.color(c),TITLE:c});d&&(o.push(c),r+=d)});const l=i.html(r).selectAll(function(){return this.childNodes}).data(o);e.setLegendItem(l),n.legend=i}},updateSizeForLegend(e){const t=this,{config:n,state:{isLegendTop:i,isLegendLeft:a,isLegendRight:s,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,d={top:i?t.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:a?t.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};t.state.margin3={top:s?0:o?d.top:r.height-c,right:NaN,bottom:0,left:s?r.width-l:o?d.left:0}},transformLegend(e){const t=this,{$el:{legend:n},$T:i}=t;i(n,e).attr("transform",t.getTranslate("legend"))},updateLegendItemColor(e,t){const n=this,{legend:i}=n.$el;if(i){const a=n.getLegendItemById(e);a&&(0,F.select)(a).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:n,isLegendInset:i,legendItemWidth:a,legendStep:s}=e.state;return e.config.legend_show?n||i?a*(s+1):t:0},getLegendHeight(){var e;const t=this,{current:n,isLegendRight:i,legendItemHeight:a,legendStep:s}=t.state,r=((e=t.config.padding)==null?void 0:e.mode)==="fit"?10:20;return t.config.legend_show?i?n.height:Math.max(r,a)*(s+1):0},opacityForUnfocusedLegend(e){return e.classed(j.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const n=this,{$el:{legend:i},$T:a}=n,s=n.mapToTargetIds(e);i&&a(i.selectAll(`.${j.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(lt.legendItemFocused,t)).style("opacity",function(){return t?null:n.opacityForUnfocusedLegend.call(n,(0,F.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:n}=e;t&&n(t.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:n,$el:i,$T:a}=t;n.legend_show||(n.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),a(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:n,$el:{legend:i}}=t;n.legend_show&&se(e)&&(n.legend_show=!1,i==null||i.style("visibility","hidden")),t.addHiddenLegendIds(e),i==null||i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const n=this,{cache:i,state:a}=n;let s;const o=W.legendItemTextBox;return e&&(s=!a.redrawing&&i.get(o)||{},s[e]||(s[e]=n.getTextRect(t,j.legendItem),i.add(o,s)),s=s[e]),s},setLegendItem(e){const t=this,{$el:n,api:i,config:a,state:s}=t,o=s.inputType==="touch",r=t.hasType("gauge"),l=a.boost_useCssRule,c=a.legend_item_interaction,d=c.dblclick?"dblclick":"click",u=c||z(a.legend_item_onclick),h=o?vg(t):void 0,f=function(g,p){var _;if(!H(a.legend_item_onclick,i,p,!s.hiddenTargetIds.has(p))){const{altKey:x,type:m}=g,v=(0,F.select)(this);m==="dblclick"||x?s.hiddenTargetIds.size&&!v.classed(j.legendItemHidden)?i.show():(i.hide(),i.show(p)):(i.toggle(p),v.classed(lt.legendItemFocused,!1))}o&&(t.hideTooltip(),(_=t.hideGridFocus)==null||_.call(t,!0))};e.attr("class",function(g){const p=(0,F.select)(this);return(!p.empty()&&p.attr("class")||"")+t.generateClass(j.legendItem,g)}).style("visibility",g=>t.isLegendToShow(g)?null:"hidden"),a.interaction_enabled&&(l&&[[`.${j.legendItem}`,"cursor:pointer"],[`.${j.legendItem} text`,"pointer-events:none"],[`.${j.legendItemPoint} text`,"pointer-events:none"],[`.${j.legendItemTile}`,"pointer-events:none"],[`.${j.legendItemEvent}`,"fill-opacity:0"]].forEach(g=>{const[p,_]=g;t.setCssRule(!1,p,[_])(n.legend)}),e.on(d,u?function(g,p){o&&g.type==="click"&&mg(t,p)||f.call(this,g,p)}:null),o&&d==="click"&&u&&e.on("touchstart",function(g,p){pg(t,p,g)},h).on("touchmove",g=>{Or(t,g)},h).on("touchend",function(g,p){_g(t,p,g)&&(xg(t,p),f.call(this,g,p))},h),!o&&e.on("mouseout",c||z(a.legend_item_onout)?function(g,p){H(a.legend_item_onout,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(lt.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${ae.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||z(a.legend_item_onover)?function(g,p){H(a.legend_item_onover,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(lt.legendItemFocused,!0),r&&t.markOverlapped(p,t,`.${ae.gaugeValue}`),!s.transiting&&t.isTargetToShow(p)&&i.focus(p))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),gg(t,e)},getLegendItemById(e){var t;const n=this,i=n.cache.get(W.legendItemMap);if(i&&i instanceof Map)return i.get(e)||null;const a=(t=n.$el.legend)==null?void 0:t.selectAll(`.${j.legendItem}`).filter(s=>s===e);return(a==null?void 0:a.node())||null},updateLegendElement(e,t){const n=this,{config:i,state:a,$el:{legend:s},$T:o}=n,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,d={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},u={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:d.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,g,p;const _=e.filter(C=>!ct(i.data_names[C])||i.data_names[C]!==null),x=t.withTransition,m=a.isLegendRight||a.isLegendInset,v=fg.bind(n),b=n.getUpdateLegendPositions(_,u,h,m);a.isLegendInset&&(u.step=i.legend_inset_step?i.legend_inset_step:_.length,a.legendStep=u.step),a.isLegendRight?(f=C=>u.max.width*h.steps[C],g=C=>h.margins[h.steps[C]]+h.offsets[C]):a.isLegendInset?(f=C=>u.max.width*h.steps[C]+10,g=C=>h.margins[h.steps[C]]+h.offsets[C]):(f=C=>h.margins[h.steps[C]]+h.offsets[C],g=C=>u.max.height*h.steps[C]);const y={xText:(C,k)=>f(C,k)+4+d.width,xRect:(C,k)=>f(C,k),x1Tile:(C,k)=>f(C,k)-2,x2Tile:(C,k)=>f(C,k)-2+d.width,yText:(C,k)=>g(C,k)+9,yRect:(C,k)=>g(C,k)-5,yTile:(C,k)=>g(C,k)+4};n.generateLegendItem(_,d,b,y,m,v),p=s.select(`.${j.legendBackground} rect`),a.isLegendInset&&u.max.width>0&&p.size()===0&&(p=s.insert("g",`.${j.legendItem}`).attr("class",j.legendBackground).append("rect")),i.legend_tooltip&&s.selectAll("title").data(_).text(C=>v(C,!1));const T=s.selectAll("text").data(_).text(C=>v(C)).each(function(C,k){b(this,C,k)});o(T,x).attr("x",y.xText).attr("y",y.yText);const w=s.selectAll(`rect.${j.legendItemEvent}`).data(_);o(w,x).attr("width",C=>h.widths[C]).attr("height",C=>h.heights[C]).attr("x",y.xRect).attr("y",y.yRect),n.updateLegendItemPos(_,x,y),p&&o(p,x).attr("height",n.getLegendHeight()-12).attr("width",u.max.width*(u.step+1)+10),a.legendItemWidth=u.max.width,a.legendItemHeight=u.max.height,a.legendStep=u.step},getUpdateLegendPositions(e,t,n,i){const a=this,{config:s,state:o}=a;return function(r,l,c){const d=c===0,u=c===e.length-1,h=a.getLegendItemTextBox(l,r),f=h.width+t.tileWidth+(u&&!i?0:t.padding.right)+s.legend_padding,g=h.height+t.padding.top,p=i?g:f,_=i?a.getLegendHeight():a.getLegendWidth();let x;const m=function(b,y){y||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),n.steps[b]=t.step,n.margins[t.step]=o.isLegendInset?10:x,n.offsets[b]=t.totalLength,t.totalLength+=p};if(d&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),s.legend_show&&!a.isLegendToShow(l)){n.widths[l]=0,n.heights[l]=0,n.steps[l]=0,n.offsets[l]=0;return}n.widths[l]=f,n.heights[l]=g,(!t.max.width||f>=t.max.width)&&(t.max.width=f),(!t.max.height||g>=t.max.height)&&(t.max.height=g);const v=i?t.max.height:t.max.width;if(s.legend_equally){for(const b in n.widths)n.widths[b]=t.max.width;for(const b in n.heights)n.heights[b]=t.max.height;x=(_-v*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach(b=>m(b))):m(l,!0)}else m(l)}},generateLegendItem(e,t,n,i,a,s){const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.legend_usePoint,u=r.legend_item_tile_r,h=r.legend_item_tile_type,f=h!=="circle",g=-200,p=c.selectAll(`.${j.legendItem}`).data(e).enter().append("g");if(o.setLegendItem(p),r.legend_tooltip&&p.append("title").text(_=>_),p.append("text").text(_=>s(_)).each(function(_,x){n(this,_,x)}).style("pointer-events",o.getStylePropValue("none")).attr("x",a?i.xText:g).attr("y",a?g:i.yText),p.append("rect").attr("class",j.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",a?i.xRect:g).attr("y",a?g:i.yRect),d){const _=[],x=o.getValidPointPattern();p.append(m=>{_.indexOf(m)===-1&&_.push(m);let v=x[_.indexOf(m)%x.length];return v==="rectangle"&&(v="rect"),nt.createElementNS(F.namespaces.svg,"hasValidPointType"in o&&o.hasValidPointType(v)?v:"use")}).attr("class",j.legendItemPoint).style("fill",Ei.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",(m,v,b)=>{const T=b[v].nodeName.toLowerCase(),w=o.getTargetSelectorSuffix(m);return T==="use"?`#${l.datetimeId}-point${w}`:void 0})}else p.append(f?"line":h).attr("class",j.legendItemTile).style("stroke",Ei.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(_=>{h==="circle"?_.attr("r",u).style("fill",Ei.bind(o)).attr("cx",a?i.x2Tile:g).attr("cy",a?g:i.yTile):f&&_.attr("stroke-width",t.height).attr("x1",a?i.x1Tile:g).attr("y1",a?g:i.yTile).attr("x2",a?i.x2Tile:g).attr("y2",a?g:i.yTile)})},updateLegendItemPos(e,t,n){const i=this,{config:a,$el:{legend:s},$T:o}=i,r=a.legend_usePoint,l=a.legend_item_tile_type,c=l!=="circle";if(r){const d=s.selectAll(`.${j.legendItemPoint}`).data(e),u=a.legend_item_tile_type!=="circle",h=u?a.legend_item_tile_width:a.legend_item_tile_r*2,f=u?a.legend_item_tile_height:a.legend_item_tile_r*2,g=h*.75,p=f*.75,_=h/8,x=f/8;o(d,t).each(function(){const m=this.nodeName.toLowerCase();let v="x",b="y",y=null,T=null,w=null;m==="circle"?(v="cx",b="cy",y=Math.min(g,p)/2):m==="rect"&&(T=g,w=p);const C=(0,F.select)(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",y).attr("width",T).attr("height",w);m==="use"?C.attr("transform",k=>`translate(${n.x1Tile(k)} ${n.yTile(k)-f/2}) scale(${_} ${x})`):C.attr(v,k=>n.x1Tile(k)+(h-(T||0))/2).attr(b,k=>n.yTile(k)-(w||0)/2)})}else{const d=s.selectAll(`.${j.legendItemTile}`).data(e);o(d,t).style("stroke",Ei.bind(i)).call(u=>{l==="circle"?u.attr("cx",h=>{const f=n.x2Tile(h);return f-(f-n.x1Tile(h))/2}).attr("cy",n.yTile):c&&u.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},yg=wt(8),Tg={redraw(e={}){var t,n,i,a,s,o,r,l,c,d;const u=this,{config:h,state:f,$el:g}=u,{main:p,treemap:_}=g;f.redrawing=!0,f.redrawGeneration++,(f.dirty.data||f.dirty.visibility||e.initializing)&&f.dataGeneration++,(e.initializing||f.dirty.size||f.dirty.data||!f.rendered)&&u.cache.remove([W.svgLeft]);const x=u.filterTargetsToShow(u.data.targets);f._targetsToShow=x;const m={data:f.dirty.data,visibility:f.dirty.visibility,size:f.dirty.size};f.dirty.data=!1,f.dirty.visibility=!1,f.dirty.size=!1;const{flow:v,initializing:b}=e,y=u.getWithOption(e),T=y.Transition?h.transition_duration:0,w=y.TransitionForExit?T:0,C=y.TransitionForAxis?T:0,k=(t=u.axis)==null?void 0:t.generateTransitions(C),S=m.data||m.visibility||b;if(f.isCanvasMode&&(u.setContainerSize(),(n=u.updateHtmlLegend)==null||n.call(u)),u.updateSizes(b),f.isCanvasMode){const A=u.scale.zoom,L=A==null?void 0:A.domain();A&&(u.scale.zoom=null),u.updateScales(b,y.UpdateXDomain),A&&(A.range(u.scale.x.range()),L&&A.domain(L),u.scale.zoom=u.getCustomizedXScale(A),u.axis.x.scale(u.scale.zoom),u.scale.x.domain(h.zoom_rescale?L:u.org.xDomain),u.scale.subX.domain(u.org.xDomain)),f.hasAxis&&u.axis.syncAxisDomains(x,y,v),f.hasAxis&&((i=u.applyCanvasSubchartDomain)==null||i.call(u));const E=S?u.getDrawShape():f._cachedDrawShape||u.getDrawShape();S&&(f._cachedDrawShape=E),h.legend_show&&g.legend&&!(h.legend_contents_bindto&&h.legend_contents_template)&&((a=u.positionHtmlLegend)==null||a.call(u)),(s=u.resizeCanvas)==null||s.call(u),f.canvasFocusKey=null,u.renderCanvasFrame(E,null,!0),b&&u.updateTypesElements(),u.callPluginHook("$redraw",e,0),f.redrawing=!1,f._targetsToShow=null,f._cachedDrawShape=null,u.mapToIds(u.data.targets).forEach(D=>{f.withoutFadeIn[D]=!0}),H(h.onrendered,u.api);return}y.Legend&&h.legend_show?(e.withTransition=!!T,!_&&u.updateLegend(u.mapToIds(u.data.targets),e,k)):y.Dimension&&u.updateDimension(!0),h.data_empty_label_text&&p.select(`text.${Et.text}.${U.empty}`).attr("x",f.width/2).attr("y",f.height/2).text(h.data_empty_label_text).style("display",x.length?"none":null),(o=u.redrawTitle)==null||o.call(u),f.hasAxis?(u.axis.redrawAxis(x,y,k,v,b),(r=u.hasGrid)!=null&&r.call(u)&&u.updateGrid(),h.regions.length&&((l=u.updateRegion)==null||l.call(u)),["bar","candlestick","line","area"].forEach(A=>{const L=Ot(A);(/^(line|area)$/.test(A)&&u.hasTypeOf(L)||u.hasType(A))&&S&&u[`update${L}`](y.TransitionForExit)}),g.text&&p.selectAll(`.${ut.selectedCircles}`).filter(u.isBarType.bind(u)).selectAll("circle").remove(),h.interaction_enabled&&!v&&y.EventRect&&(u.redrawEventRect(),(c=u.bindZoomEvent)==null||c.call(u))):(g.arcs&&u.redrawArc(T,w,y.Transform),g.radar&&u.redrawRadar(),g.polar&&u.redrawPolar(),g.funnel&&u.redrawFunnel(),_&&u.updateTreemap(w)),!f.resizing&&!_&&(u.hasPointType()||f.hasRadar)?S&&u.updateCircle():(d=u.hasLegendDefsPoint)!=null&&d.call(u)&&u.data.targets.forEach(u.point("create",this)),u.hasDataLabel()&&!u.hasArcType(null,["radar"])&&S&&u.updateText(),b&&u.updateTypesElements(),u.generateRedrawList(x,v,T,y.Subchart,S),u.updateTooltipOnRedraw(),u.callPluginHook("$redraw",e,T)},generateRedrawList(e,t,n,i,a=!0){const s=this,{config:o,state:r}=s,l=a?s.getDrawShape():r._cachedDrawShape||s.getDrawShape();a&&(r._cachedDrawShape=l),r.hasAxis&&o.subchart_show&&s.redrawSubchart(i,n,l);const c=t&&s.generateFlow({targets:e,flow:t,duration:t.duration,shape:l,xv:s.xv.bind(s)}),d=(n||c)&&Zn(),u=s.getRedrawList(l,t,c,d),h=()=>{c&&c(),r.redrawing=!1,r._targetsToShow=null,r._cachedDrawShape=null,H(o.onrendered,s.api)};if(d&&u.length){const f=fr();(0,yg.transition)().duration(n).each(()=>{u.flatMap(g=>g).forEach(g=>f.add(g))}).call(f,h)}else r.transiting||h();s.mapToIds(s.data.targets).forEach(f=>{r.withoutFadeIn[f]=!0})},getRedrawList(e,t,n,i){const a=this,{config:s,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=a,{cx:d,cy:u,xForText:h,yForText:f}=e.pos,g=[];if(o){a.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&g.push(a.redrawGrid(i)),a.redrawRegion&&s.regions.length&&g.push(a.redrawRegion(i));for(const p in e.type){const _=Ot(p),x=e.type[p];(/^(area|line)$/.test(p)&&a.hasTypeOf(_)||a.hasType(p))&&g.push(a[`redraw${_}`](x,i))}!t&&c.main&&a.updateGridFocus&&g.push(a.updateGridFocus())}return(!a.hasArcType()||r)&&bt(s.data_labels)&&s.data_labels!==!1&&g.push(a.redrawText(h,f,t,i)),(a.hasPointType()||r)&&!a.isPointFocusOnly()&&a.redrawCircle&&g.push(a.redrawCircle(d,u,i,n)),l&&g.push(a.redrawTreemap(i)),g},updateAndRedraw(e={}){const t=this,{config:n,state:i}=t;let a;e.withTransition=Ne(e,"withTransition",!0),e.withTransform=Ne(e,"withTransform",!1),e.withLegend=Ne(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=Ne(e,"withTransitionForTransform",e.withTransition),e.withLegend&&n.legend_show||(i.hasAxis&&(a=t.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,a)),t.redraw(e)}},wg={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentRectValue("width")},getCurrentHeight(){var e,t;const n=this,{config:i,state:a,$el:s}=n;let o=i.size_height;if(!o){const r=a.isCanvasMode?(e=s.chart)==null?void 0:e.node():null,l=r==null?void 0:r.style.minHeight;l&&(r.style.minHeight=""),o=n.getParentHeight(),l&&(r.style.minHeight=l);const c=r&&parseFloat((t=n.canvasEngine)==null?void 0:t.canvas.style.height)||0,d=a.current.height-c;d>0&&Math.round(o)===Math.round(c)&&(o+=d)}return o>0?o:320/(n.hasType("gauge")&&!i.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${Ot(e)}`;let n=this.$el.chart.node(),i=0;for(;i<30&&n&&n.tagName!=="BODY";){try{i=ht(n,!0)[e]}catch(s){t in n&&(i=n[t])}n=n.parentNode}const a=nt.body[t];return i>a&&(i=a),i},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){var t,n,i;const a=this,{cache:s,config:o,state:{hasAxis:r},$el:l}=a;if(e){const k=s.get(W.svgLeft);if(k!==null)return k}const c=o.axis_rotated,d=c||!c&&!o.axis_y_inner,u=c?It.axisX:It.axisY,h=l.main.select(`.${u}`).node(),f=r&&o[`axis_${c?"x":"y"}_label`],p=r&&(Q(f)||Q(f.text)||/^inner-/.test(f==null?void 0:f.position))?l.main.select(`.${u}-label`):null,_=p&&!p.empty()?p.node():null,x=!e,m={label:_?ht(_,x):null,leftAxis:h&&d?ht(h,x):null,chart:ht(l.chart.node(),x)},v=(n=(t=m.label)==null?void 0:t.left)!=null?n:0,b=(i=m.leftAxis)!=null?i:{right:0},y=m.chart.left+v,T=a.hasArcType(),w=b.right-y-(T?0:a.getCurrentPaddingByDirection("left",e)),C=w>0?w:0;return s.add(W.svgLeft,C),C},previewResize(){var e,t,n;const i=this,{state:a,$el:s}=i,{current:o}=a,r=i.getCurrentWidth(),l=i.getCurrentHeight();if(!(!r||!l||!o.width||!o.height||r===o.width&&l===o.height)){if(a.isCanvasMode){const c=(e=i.canvasEngine)==null?void 0:e.canvas;if(!c)return;s.chart.style("min-height",`${l}px`),c.style.width=`${r}px`,c.style.height=`${Math.max(0,l-((n=(t=i.getCanvasBottomLegendHeight)==null?void 0:t.call(i))!=null?n:0))}px`}else if(s.svg)s.svg.attr("viewBox",`0 0 ${o.width} ${o.height}`).attr("preserveAspectRatio","none").attr("width",r).attr("height",l);else return;a.resizePreview=!0}},clearResizePreview(){const e=this,{config:t,state:n,$el:i}=e;n.resizePreview&&(n.resizePreview=!1,!n.isCanvasMode&&i.svg&&t.resize_auto!=="viewBox"&&i.svg.attr("viewBox",null).attr("preserveAspectRatio",null))},updateDimension(e){var t,n;const i=this,{config:a,state:{hasAxis:s,isCanvasMode:o},$el:r}=i;if(s&&!e&&i.axis.x&&a.axis_rotated&&((t=i.axis.subX)==null||t.create(r.axis.subX)),i.updateScales(e),o){(n=i.resizeCanvas)==null||n.call(i);return}i.updateSvgSize(),i.transformAll(!1)},updateSvgSize(){var e;const t=this,{config:n,state:{clip:i,current:a,hasAxis:s,width:o,height:r},$el:{svg:l}}=t;if(!l){(e=t.resizeCanvas)==null||e.call(t);return}if(t.clearResizePreview(),n.resize_auto==="viewBox"?l.attr("viewBox",`0 0 ${a.width} ${a.height}`):l.attr("width",a.width).attr("height",a.height),s){const c=l.select(`.${nr.brush} .overlay`),d={width:0,height:0};c.size()&&(d.width=+c.attr("width"),d.height=+c.attr("height")),l.selectAll([`#${i.id}`,`#${i.idGrid}`]).select("rect").attr("width",o).attr("height",r),l.select(`#${i.idXAxis}`).select("rect").call(t.setXAxisClipPath.bind(t)),l.select(`#${i.idYAxis}`).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&l.select(`#${i.idSubchart}`).select("rect").attr("width",o).attr("height",d.height)}},getCurrentPaddingByDirection(e,t=!1,n=!1){var i;const a=this,{config:s,$el:o,state:{hasAxis:r,isCanvasMode:l}}=a,c=s.axis_rotated,d=((i=s.padding)==null?void 0:i.mode)==="fit",u=$(s[`padding_${e}`])?s[`padding_${e}`]:void 0,h=r?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[e]:null,f=/^(left|right)$/.test(e),g=h&&s[`axis_${h}_inner`],p=h&&s[`axis_${h}_show`],_=h?s[`axis_${h}_axes`].length:0;let x=h?f?a.getAxisWidthByAxisId(h,t):a.getHorizontalAxisHeight(h):0;const m=20;let v=0;!d&&f&&(x=eu(x));let b=r&&f&&(g||Ct(u)&&!p)?0:d?(p?x:0)+(u!=null?u:0):Ct(u)?x:u;return f&&r?(h&&(d||g)&&s[`axis_${h}_label`].text&&(b+=a.axis.getAxisLabelPosition(h).isOuter?m:0),e==="right"?(b+=c?!d&&Ct(u)?10:2:!p||g?d?2:1:0,b+=n?a.axis.getXAxisTickTextY2Overflow(m):0):e==="left"&&c&&Ct(u)&&(b=s.axis_x_show?d?x:Math.max(x,40):1)):e==="top"?((o.title&&o.title.node()||l&&s.title_text)&&(b+=a.getTitlePadding()),v=c&&!g?_:0):e==="bottom"&&r&&c&&!p&&(b+=1),b+x*_-v},getCurrentPadding(e=!1){const t=this,[n,i,a,s]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:n,bottom:i,left:a,right:s}},getResettedPadding(e){const t=this,{config:n}=t,i=$(e);let a=i?0:{};return n.padding===!1?!i&&Object.keys(e).forEach(s=>{a[s]=!se(n.data_labels)&&n.data_labels!==!1&&s==="top"?e[s]:0}):a=e,a},updateSizes(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.axis_rotated,u=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const f=c?o.getLegendWidth():0,g=c?o.getLegendHeight():0,p={width:f,height:g};!u&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const _={right:r.legend_show&&l.isLegendRight?f+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g},x=d||u?0:o.getHorizontalAxisHeight("x"),m=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?x:30,v=r.subchart_show&&!u?r.subchart_size_height+m:0,b=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!u&&d?{top:y.top,right:u?0:y.right+_.right,bottom:_.bottom+y.bottom,left:v+(u?0:y.left)}:{top:(h?0:4)+y.top,right:u?0:y.right+_.right,bottom:b+v+_.bottom+y.bottom,left:u?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=d?{top:l.margin.top,right:NaN,bottom:20+_.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-v-_.bottom,right:NaN,bottom:m+_.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,p),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=d?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=d?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const T=o.hasType("gauge"),w=r.legend_show&&l.isLegendRight,C=(i=l.hasRadar&&o.cache.get(W.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(w?p.width+10:0)-C,l.arcHeight=l.height-(w&&!T?0:10),(a=r.arc_rangeText_values)!=null&&a.length&&(T?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),T&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}l.isLegendRight&&u&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},Cg={setCssRule(e,t,n,i){const a=this,{config:s,state:{cssRule:o,style:r}}=a;return s.boost_useCssRule?l=>{l.each(c=>{const d=i&&(i==null?void 0:i.call(a,c)),u=`${e?`.${At.shapes+a.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[u]),a.state.cssRule[u]=wf(r,u,n.filter(Boolean).map(h=>Q(d)&&h.indexOf(":")===-1?`${h}: ${d}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:z(e)?e.bind(this):e}};function Sg(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function kg(e,t,n,i,a){var s;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=$(r)&&r<0||l&&!((s=o.getCandlestickData(e))!=null&&s._isUp);let{x:d,y:u}=t;const h=4,f=h*2;return i?n==="start"?(d+=c?0:f,u+=h):n==="middle"?(d+=f,u-=f):n==="end"&&(c&&(d-=f),u+=h):(n==="start"?(d+=h,c&&(u+=f*2)):n==="middle"?u-=f:n==="end"&&(d-=h,c&&(u+=f*2)),a&&(u+=c?-17:l?13:7)),{x:d,y:u}}function $r(e,t){var n;const i=this.config.data_labels_position,{id:a,index:s,value:o}=e;return(n=z(i)?i.bind(this.api)(t,o,a,s,this.$el.text):(a in i?i[a]:i)[t])!=null?n:0}function Ag(e,t,n){var i,a;const s=this,{config:o,$T:r}=s,l=o.axis_rotated,{border:{padding:c="3 5",radius:d=10,stroke:u="#000",strokeWidth:h=1,fill:f="none"}}=o.data_labels,g=Es(c),p=o.data_labels.border!==!0,_=Ue(e);let x=(0,F.select)(e.previousElementSibling);(x.empty()||((i=x.node())==null?void 0:i.tagName)!=="rect"||!((a=x.attr("class"))!=null&&a.includes(n)))&&(x=(0,F.select)(e.parentNode).insert("rect",()=>e).attr("class",`${Et.textBorderRect} ${n}`).attr("width",_.width+(p?g.left+g.right:0)).attr("height",_.height+(p?g.top+g.bottom:0)),p&&x.style("fill",f).style("stroke",u).style("stroke-width",`${h}px`).attr("rx",d).attr("ry",d)),r(x).attr("x",t.x-(p?g.left:0)-(l?0:_.width/2)).attr("y",t.y-(p?g.top:0)-_.height/4*3.2)}function Ga(e=0,t){const n=this,{config:i}=n,a=i[`${t}_label_threshold`]||0;return e>=a}function Br(){const e=this,{$el:{text:t},config:n}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):n.data_labels.image)&&t.filter(function(){const a=this.previousElementSibling;return a?a.tagName!=="image"||!a.classList.contains(Et.textLabelImage):!0}).each(function(a){var s,o,r,l;const c=Lg.call(e,a);if(!c)return;const{url:d,width:u,height:h,pos:f}=c;if(d){const g=(0,F.select)(this.parentNode);g==null||g.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",p=>an(d,{ID:"id"in p?p.id:p.data.id})).attr("class",Et.textLabelImage).style("pointer-events","none").attr("width",u).attr("height",h).attr("transform",f?`translate(${(r=f.x)!=null?r:0} ${(l=f.y)!=null?l:0})`:null)}})}function Lg(e){var t;const n=this,{config:i,state:a}=n,s=a.arcWidth?n.getArcLabelConfig("image"):i.data_labels.image;if(z(s))return(t=s.call(n.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:r=0,height:l=0,pos:c}=s;return{url:o,width:r,height:l,pos:c}}return null}function zr(e,t,n){var i;const a=this,{config:s,state:{arcWidth:o,hasTreemap:r}}=a,l=s.axis_rotated,c=(0,F.select)(e.previousElementSibling),d=u=>{var h;const f=u.style.opacity!=="0"&&u.style.fillOpacity!=="0";return(o?u.textContent:f)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!c.empty()&&((i=c.node())==null?void 0:i.tagName)==="image"){const u=n||ht(e),h=+c.attr("width")/2,f=+c.attr("height")/2;let g=t.x-h,p=t.y-f-u.height/2;l?t.x+=h:(r&&(g=-h,p=-(f*2+u.height)),a.hasType("pie")||a.hasType("polar")||(t.y+=f)),a.$T(c).style("opacity",d(e)?null:"0").attr("x",g).attr("y",p)}}function Rg(e){return Is(e,t=>t,t=>Ue(t,!0))}var Eg={opacityForText(e){const t=this;return t.isBarType(e)&&!Ga.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel()?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${U.chart}`).append("g").attr("class",Et.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,n=t.getChartClass("Text"),i=t.getClass("texts","id"),a=t.classFocus.bind(t);t.$el.main.select(`.${Et.chartTexts}`).selectAll(`.${Et.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${n(r)}${a(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(t.setCssRule(!0,` .${Et.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:n,config:i,axis:a}=e,s=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${Et.texts}`).selectAll(`.${Et.text}`).data(e.labelishData.bind(e));n(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",s).attr("text-anchor",l=>{let d=i[`axis_${a==null?void 0:a.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const u=e.getCandlestickData(l);d=!(u!=null&&u._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?d?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,d){const u=(0,F.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);f&&(h=f.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(u):e.dataLabelFormat(l.id)(h,l.id,l.index,d),$(h)?this.textContent=h:Cn(u,h,void 0,!0)}),Br.call(e)},updateTextColor(e){const t=this,{config:n}=t,i=n.data_labels_colors,a=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let s;if(Q(i))s=i;else if(tt(i)){const{id:o}=e.data||e;s=i[o]}else z(i)&&(s=i.bind(t.api)(a,e));if(t.isCandlestickType(e)&&!z(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=n.candlestick_color_down;s=tt(r)?r[e.id]:r}}return s||a},updateTextBGColor(e,t){const n=this,{$el:{defs:i}}=n;let a="";if(t){const s=Q(t)?"":n.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(a=`url(#${o.attr("id")})`),z(t)){n.generateTextBGColorFilter(t);const r=n.color(e),l=t.bind(n.api)(r,e);l?o.select("feFlood").attr("flood-color",l):a=""}}return a||null},redrawText(e,t,n,i){const a=this,{$T:s,axis:o,config:r,state:{hasTreemap:l}}=a,c=xe(!0),d=r.axis_rotated,u=r.data_labels.rotate,h=Sg(u),f=u?`rotate(${u})`:"",g=a.$el.text.style("fill",a.getStylePropValue(a.updateTextColor)).attr("filter",x=>a.updateTextBGColor.bind(a)(x,r.data_labels_backgroundColors)).style("fill-opacity",n?0:a.opacityForText.bind(a)),p=new Map,_=[];return g.each(function(x){const m=this;p.set(m,{rect:ht(m)}),r.data_labels.centered&&(a.isBarType(x)||a.isTreemapType(x))&&_.push(m)}),_.length>0&&Rg(_).forEach((x,m)=>{const v=p.get(m);v&&(v.bbox=x)}),g.each(function(x,m){const v=p.get(this),b=s(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),y=r[`axis_${o==null?void 0:o.getId(x.id)}_inverted`];let T={x:e.call(this,x,m,v),y:t.call(this,x,m,v)};u&&(T=kg.bind(a)(x,T,h,d,y),b.attr("text-anchor",h)),zr.call(a,this,T,v==null?void 0:v.rect),this.childElementCount||u?b.attr("transform",`translate(${T.x} ${T.y}) ${f}`):b.attr("x",T.x).attr("y",T.y),r.data_labels.border&&Ag.call(a,b.node(),T,`${Et.textBorderRect}-${m}`)}),!0},getTextRect(e,t){var n,i;const a=this;let s,o,r;Array.isArray(e)?s=`${W.textRect}-${e.join("_")}`:(o=(i=(n=e.node)==null?void 0:n.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,s=`${W.textRect}-${r.replace(/\W/g,"_")}`);const l=a.cache.get(s)||[];return l.length===0&&((a.$el.svg||a.$el.chart.select("svg")).selectAll(`.${U.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,F.select)(o).style("font"):null).classed(t||U.dummy,!0).text(c=>c).each(function(c,d){l[d]=ht(this)}).remove(),a.cache.add(s,l)),l.length>1?l:l[0]},generateXYForText(e,t){const n=this,{state:{hasRadar:i,hasFunnel:a,hasTreemap:s}}=n,o=Object.keys(e),r={},l=t?n.getXForText:n.getYForText;return a&&o.push("funnel"),i&&o.push("radar"),s&&o.push("treemap"),o.forEach(c=>{r[c]=n[`generateGet${Ot(c)}Points`](e[c],!1)}),function(c,d,u){const h=n.isAreaType(c)&&"area"||n.isBarType(c)&&"bar"||n.isCandlestickType(c)&&"candlestick"||n.isFunnelType(c)&&"funnel"||n.isRadarType(c)&&"radar"||n.isTreemapType(c)&&"treemap"||"line";return l.call(n,r[h](c,d),c,this,u)}},getCenteredTextPos(e,t,n,i,a){const s=this,{config:o}=s,r=o.axis_rotated,l=s.isBarType(e),c=s.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const d=(a==null?void 0:a.bbox)||Ue(n);if(l){const u=s.getRangedData(e,null,"bar")>=0;if(r){const h=(u?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+d.width/2;return u?-h-3:h+2}else{const h=(u?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+d.height/2;return u?h:-h-2}}else if(c)return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-d.y-d.height/2}return 0},getXForText(e,t,n,i){var a,s,o;const r=this,{config:l}=r,c=l.axis_rotated,d=r.isFunnelType(t),u=r.isTreemapType(t);let h=e?e[0][0]:0;if(r.isCandlestickType(t))c?h=(a=r.getCandlestickData(t))!=null&&a._isUp?e[2][2]+4:e[2][1]-4:h+=(e[1][0]-h)/2;else if(d)if(e)h=(o=(s=e[2])==null?void 0:s[0])!=null?o:h;else return Ma(n,"x");else if(u)h+=l.data_labels.centered?0:5;else if(c){const f=l[`axis_${r.axis.getId(t.id)}_inverted`],g=r.isBarType(t)?4:6,p=t.value;h=e[2][1],h+=g*((f?p>0:p<0)?-1:1)}else h=r.hasType("bar")?(e[2][0]+e[0][0])/2:h;return(c||u||d)&&(h+=r.getCenteredTextPos(t,e,n,"x",i)),h+$r.call(this,t,"x")},getYForText(e,t,n,i){var a,s;const o=this,{axis:r,config:l,state:c}=o,d=l.axis_rotated,u=l[`axis_${r==null?void 0:r.getId(t.id)}_inverted`],h=o.isBarType(t),f=o.isFunnelType(t),g=o.isTreemapType(t),p=l.point_r,_=(i==null?void 0:i.rect)||ht(n);let{value:x}=t,m=3,v;if(o.isCandlestickType(t))x=o.getCandlestickData(t),d?(v=e[0][0],v+=(e[1][0]-v)/2+m):(v=x&&x._isUp?e[2][2]-m:e[2][1]+m*4,u&&(v+=15*(x._isUp?1:-1)));else if(f)if(e)v=((s=(a=e[2])==null?void 0:a[1])!=null?s:e[0][1])+_.height/2-3;else return Ma(n,"y");else if(g)v=e[0][1]+(l.data_labels.centered?0:_.height+5);else if(d)v=(e[0][0]+e[2][0]+_.height*.6)/2;else if(v=e[2][1],$(p)&&p>5&&(o.isLineType(t)||o.isScatterType(t))&&(m+=l.point_r/2.3),x<0||x===0&&!c.hasPositiveValue&&c.hasNegativeValue)v+=u?h?-3:-5:_.height+(h?-m:m);else{let b=-m*2;h?b=-m:o.isBubbleType(t)&&(b=m),u&&(b=h?10:15),v+=b}return(!d||g)&&(v+=o.getCenteredTextPos(t,e,n,"y",i)),v+$r.call(this,t,"y")},markOverlapped(e,t,n){const i=t.$el.arcs.selectAll(n),a=i.filter(d=>d.data.id!==e),s=i.filter(d=>d.data.id===e),o=Ia(s.node()),r=(d,u)=>Math.sqrt(d*d+u*u);if(!s.node())return;const l=parseInt(s.style("font-size"),10),c=[];a.each(function(){const d=Ia(this),u=r(o.e,o.f)>r(d.e,d.f)?s:(0,F.select)(this),h=Math.ceil(Math.abs(o.e-d.e))<Math.ceil(u.node().getComputedTextLength()),f=Math.ceil(Math.abs(o.f-d.f))<l;c.push({node:this,overlaps:h&&f})}),c.forEach(({node:d,overlaps:u})=>{(0,F.select)(d).classed(Et.TextOverlapping,u)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,F.selectAll)([this,this.previousSibling]).classed(Et.TextOverlapping,!1)})}};function Nr(e="left",t){const n=$(t);return e.includes("center")?n?t/2:"middle":e.includes("right")?n?t:"end":n?0:"start"}function Pg(e){var t,n,i,a,s,o,r,l;const{config:c,$el:d}=e,u=((i=(n=(t=e.canvasTheme)==null?void 0:t.style)==null?void 0:n.title)==null?void 0:i.font)||((o=(s=(a=e.canvasTheme)==null?void 0:a.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(l=(r=d.chart)==null?void 0:r.node)==null?void 0:l.call(r),f=h==null?void 0:h.ownerDocument;if(h&&f&&c.title_text){const g=f.createElementNS("http://www.w3.org/2000/svg","svg"),p=f.createElementNS("http://www.w3.org/2000/svg","text");g.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",p.setAttribute("class",Et.title),p.style.font=u,p.textContent=String(c.title_text),g.appendChild(p),h.appendChild(g);const _=ht(p).height;if(g.remove(),_)return _}return c.title_text?parseFloat(u)||14:0}var Dg={initTitle(){const e=this,{config:t,$el:n}=e;if(t.title_text){n.title=n.svg.append("g");const i=n.title.append("text").style("text-anchor",Nr(t.title_position)).attr("class",Et.title);Cn(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:n},$el:{title:i}}=e;if(i){const a=Nr(t.title_position,n.width),s=(t.title_padding.top||0)+e.getTextRect(e.$el.title,Et.title).height;i.attr("transform",`translate(${a}, ${s})`)}},getCanvasTitleHeight(){return Pg(this)},getTitlePadding(){const e=this,{$el:{title:t},config:n,state:i}=e,a=n.title_padding.top||0,s=n.title_padding.bottom||0;if(i.isCanvasMode&&n.title_text)return a+e.getCanvasTitleHeight()+s;if(!(t!=null&&t.node()))return a+s;const o=t.node(),r=Ma(o,"y");if(r){const l=Ue(o);return r+l.y+l.height+s}return a+e.getTextRect(t,Et.title).height+s}};const Ig=/(\r?\n|\t)/g,Mg=/{{(.*)}}/;var Fg={initTooltip(){const e=this,{config:t,$el:n}=e;n.tooltip=(0,F.select)(t.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",Si.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:n,$el:i,state:{hasAxis:a,hasRadar:s}}=t;if(n.tooltip_init_show){const o=!(a||s);(e=t.axis)!=null&&e.isTimeSeries()&&Q(n.tooltip_init_x)&&(n.tooltip_init_x=Vt.call(t,n.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const r=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!se(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",Q(l)?l:`${l}px`).style("left",Q(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:n,config:i}=t;return Se(z(i.tooltip_contents)?i.tooltip_contents.bind(n)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,n,i){var a;const s=this,{api:o,config:r,state:l,$el:c}=s,d=r.tooltip_format_title,u=r.tooltip_format_name,h=r.tooltip_format_value,f=z(d)?d.bind(o):t,g=z(u)?u.bind(o):(D=>D),p=z(h)?h.bind(o):null,_=(D,R,P,B)=>{let I=p;return I||(l.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(P))?I=(X,G)=>`${(G*100).toFixed(2)}%`:I=n),I(D,R,P,B)},x=r.tooltip_order,m=D=>s.axis&&s.isBubbleZType(D)?s.getBubbleZData(D.value,"z"):s.getBaseValue(D),v=s.levelColor?D=>s.levelColor(D.value):D=>i(D),b=r.tooltip_contents,y=b.template,T=s.mapToTargetIds();if(x===null&&r.data_groups.length){const D=s.orderTargets(s.data.targets).map(R=>R.id).reverse();e.sort((R,P)=>{let B=R?R.value:null,I=P?P.value:null;return B>0&&I>0&&(B=R.id?D.indexOf(R.id):null,I=P.id?D.indexOf(P.id):null),B-I})}else if(/^(asc|desc)$/.test(x)){const D=x==="asc";e.sort((R,P)=>{const B=R?m(R):null,I=P?m(P):null;return D?B-I:I-B})}else z(x)&&e.sort(x.bind(o));const w=s.getTooltipContentTemplate(y),C=e.length;let k,S,A,L,E;for(E=0;E<C;E++){S=e[E];const D=S&&m(S);if(!(!S||!(D||D===0))){if(Ct(k)){const R=(l.hasAxis||l.hasRadar)&&f(S.x);k=an(w[0],{CLASS_TOOLTIP:Si.tooltip,TITLE:q(R)?y?R:`<tr><th colspan="2">${R}</th></tr>`:""})}if(!S.ratio&&c.arcs&&(A=["arc",s.$el.arcs.select(`path.${at.arc}-${S.id}`).data()[0]],S.ratio=s.getRatio(...A)),A=[S.ratio,S.id,S.index],s.isAreaRangeType(S)){const[R,P]=["high","low"].map(I=>_(s.getRangedData(S,I),...A));L=`<b>Mid:</b> ${_(m(S),...A)} <b>High:</b> ${R} <b>Low:</b> ${P}`}else if(s.isCandlestickType(S)){const[R,P,B,I,X]=["open","high","low","close","volume"].map(G=>s.getRangedData(S,G,"candlestick")?_(s.getRangedData(S,G,"candlestick"),...A):void 0);L=`<b>Open:</b> ${R} <b>High:</b> ${P} <b>Low:</b> ${B} <b>Close:</b> ${I}${X?` <b>Volume:</b> ${X}`:""}`}else if(s.isBarRangeType(S)){const{value:R,id:P,index:B}=S;L=`${_(R,void 0,P,B)}`}else L=_(m(S),...A);if(L!==void 0){if(S.name===null)continue;const R=g((a=S.name)!=null?a:S.id,...A),P=v(S),B={CLASS_TOOLTIP_NAME:Si.tooltipName+s.getTargetSelectorSuffix(S.id),COLOR:y||!s.patterns?P:`<svg><rect style="fill:${P}" width="10" height="10"></rect></svg>`,NAME:R,VALUE:L};if(y&&tt(b.text)){const I=T.indexOf(S.id);Object.keys(b.text).forEach(X=>{B[X]=b.text[X][I]})}k+=an(w[1],B)}}}return`${k}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
				{=TITLE}
				{{<tr class="{=CLASS_TOOLTIP_NAME}">
					<td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
					<td class="value">{=VALUE}</td>
				</tr>}}
			</tbody></table>`).replace(Ig,"").split(Mg)},setTooltipPosition(e,t){var n,i;const a=this,{config:s,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:d}}=a,{bindto:u}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!u&&f){const g=e!=null?e:f.data,[p,_]=Zt(r.event,t!=null?t:l==null?void 0:l.node()),x={x:p,y:_};if(r.hasAxis&&o.x&&f&&"x"in f){const y=(T=0,w,C="y")=>{var k;const S=o[w?(k=a.axis)==null?void 0:k.getId(w):C];return S?S(T)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(f.x)+(s.tooltip_position?h?r.margin.top:r.margin.left:0),g.length===1?x.yAxis=y(g[0].value,g[0].id):x.yAxis=y}const{width:m=0,height:v=0}=f,b=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,m,v,l==null?void 0:l.node(),x))!=null?i:d&&Fa(d)?a.getTooltipPositionViewBox.bind(a)(m,v,x):a.getTooltipPosition.bind(a)(m,v,x);["top","left"].forEach(y=>{const T=b[y];c.style(y,`${T}px`),y==="left"&&!f.xPosInPercent&&(f.xPosInPercent=T/r.current.width*100)})}},getTooltipPositionViewBox(e,t,n){var i,a;const s=this,{$el:{eventRect:o,svg:r},config:l,state:c}=s,d=l.axis_rotated,u=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=u?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=d?f:n.xAxis,g=d?n.xAxis:g);const p=ki(h,f,g,!1),_=ht(h),x=ki(h,20,0,!1).x;let m=p.y,v=p.x+e/2+x;return u&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(v-=e/2+x,m+=t):(m+=_.height/2,v+=_.width/2-(e-x))),v+e>_.width&&(v=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:v}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:d,height:u,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,v=r.axis_rotated,b=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:k}=n;if(g)C+=C>=d/2?15:-(e+15),k+=15;else if(b){if(x!=="touch"){let L=(a=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?a:0;L&&m&&((s=r.arc_rangeText_values)!=null&&s.length)&&(L+=10),C+=(d-(_?o.getLegendWidth():0))/2,k+=(m?u:u/2+t)+L}}else if(f||p)k+=t;else{const A={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};v?(C+=y+A.left+w,k=A.top+n.xAxis+w,T-=y):(C=y+A.left+w+(l.zoom?C:n.xAxis),k+=A.top-5)}if(C+e+15>T&&(C-=e+(f||p||b?0:v?w*2:38)),k+t>h.height){const A=p?t+10:30;k-=m?t*1.5:t+A}const S={top:k,left:C};return S.top<0&&(S.top=0),S.left<0&&(S.left=0),S},showTooltip(e,t){const n=this,{config:i,$el:{tooltip:a}}=n;if(!a||!i.tooltip_show)return;let s=null,o=0,r=`${n.data.targets.length}:`,l;for(let u=0;u<e.length;u++){const h=e[u];u>0&&(r+=","),r+=`${h==null?void 0:h.index}|${h==null?void 0:h.id}|${h==null?void 0:h.value}`,!l&&h&&(l=h),h&&q(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,u))}if(o===0||!l)return;const c=a.datum();let d=s;if(!c||c.current!==r){const{index:u,x:h}=l;d||(d=e.slice()),H(i.tooltip_onshow,n.api,e),a.html(n.getTooltipHTML(e,n.axis?n.axis.getXAxisTickFormat():n.categoryName.bind(n),n.getDefaultValueFormat(),n.color)).style("display",null).style("visibility",null),a.datum({index:u,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),H(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,u)}n.setTooltipPosition(d||e,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:n,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:a}=n,{width:s,xPosInPercent:o}=i.datum();let r=a.width/100*o;const l=a.width-(r+s);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const n=this,{api:i,config:a,$el:{tooltip:s}}=n;if(s&&s.style("display")!=="none"&&(!a.tooltip_doNotHide||e)){const o=(t=s.datum().data)!=null?t:[];H(a.tooltip_onhide,i,o),s.style("display","none").datum(null),H(a.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const n=this,{charts:i,config:a,state:{event:s}}=n;if(s!=null&&s.isTrusted&&a.tooltip_linked&&i.length>1){const o=a.tooltip_linked_name;i.filter(r=>r!==n.api).forEach(r=>{var l,c;const{config:d,$el:u,state:h}=r.internal,f=d.tooltip_linked,g=d.tooltip_linked_name,p=nt.body.contains(u.chart.node());if(f&&o===g&&p){const _=u.tooltip.data()[0],x=t!==(_==null?void 0:_.index);try{e&&x&&h.isCanvasMode?(c=(l=r.internal).showCanvasLinkedTooltip)==null||c.call(l,t):r.tooltip[e&&x?"show":"hide"]({index:t})}catch(m){}}})}},updateTooltipOnRedraw(e,t){var n;const i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:d,hasTreemap:u}}=i;if(!i.state.isCanvasMode&&(r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(n=d?o:s)==null?void 0:n.node();if(c||d)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const f=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,f),i.setExpand(f,null,!0))}else{const{clientX:f,clientY:g}=l;setTimeout(()=>{let p=[f,g].every(Number.isFinite)&&nt.elementFromPoint(f,g);const _=p&&(0,F.select)(p).datum();if(_){const x=i.hasArcType()?i.convertToArcData(i.updateAngle(_)):_==null?void 0:_.data;u&&(p=o.node()),x&&i.showTooltip([x],p)}else i.api.tooltip.hide()},a.transition_duration)}}}},Og={getTranslate(e,t=0){var n;const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=gn(s.margin.left),c=gn(s.margin.top);else if(e==="context")l=gn(s.margin2.left),c=gn(s.margin2.top);else if(e==="legend")l=s.margin3.left,c=s.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:s.height+r;else if(e==="y")l=o?0:-r,c=o?s.height+r:0;else if(e==="y2")l=o?0:s.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:s.height2;else if(e==="subY")l=0,c=o?s.height2:0;else if(e==="subY2")l=o?0:s.width2,c=o?-1:0;else if(e==="arc")l=s.arcWidth/2,c=s.arcHeight/2,(n=a.arc_rangeText_values)!=null&&n.length&&(c+=5+(i.hasType("gauge")&&a.title_text?10:0));else if(e==="polar")l=s.arcWidth/2,c=s.arcHeight/2;else if(e==="radar"){const[d,u]=i.getRadarSize();l=s.width/2-d,c=s.height/2-u}return`translate(${l}, ${c})`},transformMain(e,t){const n=this,{$el:{main:i},$T:a}=n,s=t!=null&&t.axisX?t.axisX:a(i.select(`.${It.axisX}`),e),o=t!=null&&t.axisY?t.axisY:a(i.select(`.${It.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:a(i.select(`.${It.axisY2}`),e);a(i,e).attr("transform",n.getTranslate("main")),s.attr("transform",n.getTranslate("x")),o.attr("transform",n.getTranslate("y")),r.attr("transform",n.getTranslate("y2")),i.select(`.${at.chartArcs}`).attr("transform",n.getTranslate("arc"))},transformAll(e,t){const n=this,{config:i,state:{hasAxis:a,hasFunnel:s,hasTreemap:o,isCanvasMode:r},$el:l}=n;r||(!s&&!o&&n.transformMain(e,t),a&&i.subchart_show&&n.transformContext(e,t),l.legend&&n.transformLegend(e))}};const $g=new Set(["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"]);var Bg={isValidChartType(e){return!!(e&&Object.values(O).indexOf(e)>-1)},getSubchartTargetType(e){const t=this,{config:n}=t,i=Q(e)?e:e==null?void 0:e.id,a=n.subchart_types||{},s=n.subchart_type,o=n.data_types||{},r=i&&a[i];return r&&t.isValidChartType(r)?r:s&&t.isValidChartType(s)?s:i&&o[i]||n.data_type||O.LINE},getTargetType(e){var t;const{config:n}=this,i=Q(e)?e:e==null?void 0:e.id;return i&&((t=n.data_types)==null?void 0:t[i])||n.data_type||O.LINE},getSubchartSourceTargetType(e){const{state:t}=this,n=Q(e)?e:e==null?void 0:e.id,i=t.subchartSourceTypes;return n&&(i==null?void 0:i[n])||this.getTargetType(e)},isSubchartSourceTypeOf(e,t){const n=this.getSubchartSourceTargetType(e);return ot(t)?t.indexOf(n)>=0:n===t},withSubchartTypeContext(e){const t=this,{config:n,data:i,state:a}=t,s=n.data_type,o=n.data_types,r=a.current.types,l=a.subchartSourceTypes,c={},d={},u=n.subchart_type;t.mapToIds(i.targets).forEach(h=>{d[h]=t.getTargetType(h),c[h]=t.getSubchartTargetType(h)}),n.data_type=u&&t.isValidChartType(u)?u:s,n.data_types=c,a.current.types=[],a.subchartSourceTypes=d;try{return e()}finally{n.data_type=s,n.data_types=o,a.current.types=r,a.subchartSourceTypes=l}},setTargetType(e,t){const n=this,{config:i,state:{withoutFadeIn:a}}=n;n.mapToTargetIds(e).forEach(s=>{a[s]=t===i.data_types[s],i.data_types[s]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(O).forEach(n=>{const i=O[n],a=e.hasType(i,null,!0),s=t.types.indexOf(i);s===-1&&a?t.types.push(i):s>-1&&!a&&t.types.splice(s,1)}),e.setChartElements()},hasType(e,t,n=!1){var i;const a=this,{config:s,state:{current:o}}=a,r=s.data_types,l=t||a.data.targets;return!n&&((i=o.types)==null?void 0:i.indexOf(e))>-1?!0:l!=null&&l.length?l.some(c=>{const d=r[c.id];return d===e||!d&&e==="line"}):Object.keys(r).length?Object.values(r).some(c=>c===e):s.data_type===e},hasTypeOf(e,t,n=[]){return e in ce?!ce[e].filter(i=>n.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){const n=Q(e)?e:e.id,i=this.config&&this.getTargetType(n);return ot(t)?t.indexOf(i)>=0:i===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=Q(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,ce.Line)},isStepType(e){return this.isTypeOf(e,ce.Step)},isSplineType(e){return this.isTypeOf(e,ce.Spline)},isAreaType(e){return this.isTypeOf(e,ce.Area)},isAreaRangeType(e){return this.isTypeOf(e,ce.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,n=t.point_pattern;return(e==null?void 0:e.tagName)==="circle"||t.point_type==="circle"&&(!n||ot(n)&&n.length===0)},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>$(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return $g.has(e)}};const zg={basis:pt.curveBasis,"basis-closed":pt.curveBasisClosed,"basis-open":pt.curveBasisOpen,bundle:pt.curveBundle,cardinal:pt.curveCardinal,"cardinal-closed":pt.curveCardinalClosed,"cardinal-open":pt.curveCardinalOpen,"catmull-rom":pt.curveCatmullRom,"catmull-rom-closed":pt.curveCatmullRomClosed,"catmull-rom-open":pt.curveCatmullRomOpen,"monotone-x":pt.curveMonotoneX,"monotone-y":pt.curveMonotoneY,natural:pt.curveNatural,"linear-closed":pt.curveLinearClosed,linear:pt.curveLinear,step:pt.curveStep,"step-after":pt.curveStepAfter,"step-before":pt.curveStepBefore};function Va(e,t){var n,i;return e.isLineType(t)||((n=e.isScatterType)==null?void 0:n.call(e,t))||((i=e.isBubbleType)==null?void 0:i.call(e,t))}function Xr(e){return t=>Va(e,t)}function Wa(e,t,n){var i,a,s;const o=n?Pi(e,t,n):void 0;return $(o)?o:(i=e.isCandlestickType)!=null&&i.call(e,t)?(s=(a=e.getCandlestickData)==null?void 0:a.call(e,t))==null?void 0:s.close:e.getBaseValue(t)}function Pi(e,t,n){var i,a,s;if(!n||(i=e.isCandlestickType)!=null&&i.call(e,t)||!((a=e.isSubchartSourceTypeOf)!=null&&a.call(e,t,O.CANDLESTICK)))return;const o=(s=e.getCandlestickData)==null?void 0:s.call(e,t);if(o)return e.isBarType(t)?$(o.open)&&$(o.close)?o._isUp?o.close:o.open:void 0:$(o.close)?o.close:void 0}function Gr(e,t,n){const i=Pi(e,t,n);return $(i)&&e.isBarType(t)}function Ng(e,t,n){var i;if(!Gr(e,t,n))return null;const a=(i=e.getCandlestickData)==null?void 0:i.call(e,t);if(a!=null&&a._isUp)return e.color(t);const s=e.config.candlestick_color_down;return(s&&typeof s=="object"?s[t.id]:s)||e.color(t)}function Xg(e){var t,n;const i=this;let a;if(Va(i,e)){const s=Xr(i);a=i.generateGetLinePoints(i.getShapeIndices(s),!1,s)}else i.isBarType(e)?a=i.generateGetBarPoints(i.getShapeIndices(i.isBarType)):(t=i.isCandlestickType)!=null&&t.call(i,e)&&(a=(n=i.generateGetCandlestickPoints)==null?void 0:n.call(i,i.getShapeIndices(i.isCandlestickType)));return a}function Vr(e,t,n){return this.config[t]?this.getGradienColortUrl(e.id):n(e)}function Wr(e){const{$el:t}=this,{elKey:n,className:i,cssRules:a,position:s}=e,o=t.main.select(`.${V.chart}`);t[n]=s==="first"?o.insert("g",":first-child"):o.append("g"),t[n].attr("class",i),a!=null&&a.length&&t[n].call(this.setCssRule(!1,`.${i}`,a))}function Ya(e,t){const n=this,{$el:i}=n,{type:a,elKey:s,containerClass:o,itemClass:r,initFn:l,withFocus:c=!0,withStyles:d=!0}=t;i[s]||l.call(n);const u=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>u(p)+h(p)).enter().append("g").attr("class",u);return d&&g.style("opacity","0").style("pointer-events",n.getStylePropValue("none")),g}var Gg={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:n,hasTreemap:i}=e.state,a={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(s=>{const o=Ot(s);if(e.hasType(s)||e.hasTypeOf(o)||s==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];a.indices[s]=r,a.type[s]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||n||i){let s,o,r,l;i||(s=n?e.radarCircleX:t?e.circleY:e.circleX,o=n?e.radarCircleY:t?e.circleX:e.circleY),i&&e.state.isCanvasMode?r=l=function(){}:(r=e.generateXYForText(a.indices,!0),l=e.generateXYForText(a.indices,!1)),a.pos={xForText:r,yForText:l,cx:(s||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return a},getShapeIndices(e){const t=this,{config:n}=t,i=n.data_xs,a=bt(i),s={};let o=a?{}:0;return a&&qi(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,s[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",d=c?s[c]:s;for(let u=0,h;h=n.data_groups[u];u++)if(!(h.indexOf(r.id)<0))for(let f=0,g;g=h[f];f++){if(g in d){d[r.id]=d[g];break}r.id!==g&&c&&(d[g]=(l=d[r.id])!=null?l:o[c])}Ct(d[r.id])&&(d[r.id]=c?o[c]++:o++,d.__max__=(c?o[c]:o)-1)}),s},getIndices(e,t,n){const i=this,{data_xs:a,bar_indices_removeNull:s}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&s){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,d)=>{l[c.id]=d,l.__max__=d}),l}return bt(a)?e[a[o]]:e},getIndicesMax(e){if(!bt(this.config.data_xs))return e.__max__;let t=0;for(const n in e)t+=e[n].__max__||0;return t},getShapeX(e,t,n){const i=this,{config:a,scale:s}=i,o=n?s.subX:s.zoom||s.x,r=a.bar_overlap,l=a.bar_padding,c=(h,f)=>h+f,d=Ut(e)&&(e._$total.length?e._$total.reduce(c)/2:0),u=[];if(d&&Ut(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,u.push(h)}return h=>{var f;const g=i.getIndices(t,h,"getShapeX"),p=h.id in g?g[h.id]:0,_=(g.__max__||0)+1;let x=0;if(bt(h.x)){const m=o(h.x,!0);if(d){const v=e[h.id]||e._$width;x=r?m-v/2:m-v+((f=u[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-d}else x=m-($(e)?e:e._$width)*(_/2-(r?1:p))}return e&&x&&_>1&&l&&(p&&(x+=l*p),_>2?x-=(_-1)*l/2:_===2&&(x-=l/2)),x}},getShapeY(e){const t=this,n=t.isStackNormalized();return i=>{let{value:a}=i;const s=e?Pi(t,i,e):void 0;return $(i)?a=i:$(s)?a=s:t.isAreaRangeType(i)?a=t.getBaseValue(i,"mid"):n?a=t.getRatio("index",i,!0):t.isBubbleZType(i)?a=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(a=a[1]),t.getYScaleById(i.id,e)(a)}},getShapeYMin(e,t=!1){const n=this,i=n.axis.getId(e),a=n.getYScaleById(e,t),[s]=a.domain(),o=n.config[`axis_${i}_inverted`];return!n.isGrouped(e)&&!o&&s>0?s:0},getShapeOffsetData(e,t){const n=this,i=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(e,n))),a=n.state.dataGeneration,s=i.map(h=>h.id).join("_"),o=`${W.shapeOffset}_${t?"sub":"main"}_${s}`,r=n.cache.get(o);if((r==null?void 0:r.generation)===a)return r;const l=n.isStackNormalized(),c=i.map(h=>{let f=h.values;const g={};n.isStepType(h)&&(f=n.convertValuesToStep(f));const p=f.reduce((_,x)=>{const m=Number(x.x),v=Wa(n,x,t);return _[m]=x,g[m]=l?n.getRatio("index",x,!0):v,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:p,values:g}}),d=i.reduce((h,{id:f},g)=>(h[f]=g,h),{}),u={generation:a,indexMapByTargetId:d,shapeOffsetTargets:c};return n.cache.add(o,u),u},getShapeOffset(e,t,n){const i=this,{shapeOffsetTargets:a,indexMapByTargetId:s}=i.getShapeOffsetData(e,n),o=i.config.data_groupsZeroAs;let r=null;if(!i.config.bar_indices_removeNull){r=new Map;for(const l of a){const c=i.getIndices(t,{id:l.id,index:0});r.set(l.id,a.filter(d=>d.id!==l.id&&c[d.id]===c[l.id]))}}return(l,c)=>{var d;const{id:u,value:h,x:f}=l,g=Wa(i,l,n),p=i.getIndices(t,l),_=i.getYScaleById(u,n);if(i.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:i.getShapeYMin(u,n));let v=m;const b=(d=r==null?void 0:r.get(u))!=null?d:a.filter(y=>y.id!==u&&p[y.id]===p[u]);for(const y of b){const{id:T,rowValueMapByXValue:w,rowValues:C,values:k}=y;if(s[T]<s[u]){const S=k[x];let A=C[c];(!A||Number(A.x)!==x)&&(A=w[x]);const L=A&&Wa(i,A,n);$(L)&&$(g)&&L*g>=0&&$(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(v+=_(S)-m)}}return v}},generateGetLinePoints(e,t,n){const i=this,{config:a}=i,s=i.getShapeX(0,e,t),o=i.getShapeY(t),r=i.getShapeOffset(n||i.isLineType,e,t),l=i.getYScaleById.bind(i),c=new Map;return(d,u)=>{let h=c.get(d.id);h===void 0&&(h=l.call(i,d.id,t)(i.getShapeYMin(d.id,t)),c.set(d.id,h));const f=r(d,u)||h,g=s(d);let p=o(d);a.axis_rotated&&(d.value>0&&p<h||d.value<0&&h<p)&&(p=h);const _=[g,p-(h-f)];return[_,_,_,_]}},generateGetAreaPoints(e,t){const n=this,{config:i}=n,a=n.getShapeX(0,e,t),s=n.getShapeY(!!t),o=n.getShapeOffset(n.isAreaType,e,t),r=n.getYScaleById.bind(n),l=new Map;return function(c,d){let u=l.get(c.id);u===void 0&&(u=r.call(n,c.id,t)(n.getShapeYMin(c.id,t)),l.set(c.id,u));const h=o(c,d)||u,f=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<u||g<0&&u<p)&&(p=u),[[f,h],[f,p-(u-h)],[f,p-(u-h)],[f,h]]}},generateGetBarPoints(e,t){const n=this,{config:i}=n,a=t?n.axis.subX:n.axis.x,s=n.getIndicesMax(e)+1,o=n.getBarW("bar",a,s),r=n.getShapeX(o,e,!!t),l=n.getShapeY(!!t),c=n.getShapeOffset(n.isBarType,e,!!t),d=n.getYScaleById.bind(n),u=new Map;return(h,f)=>{const{id:g}=h;let p=u.get(g);p||(p={y0:d.call(n,g,t)(n.getShapeYMin(g,t)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},u.set(g,p));const{y0:_,isInverted:x}=p,m=c(h,f)||_,v=$(o)?o:o[h.id]||o._$width,b=h.value,y=r(h);let T=l(h);i.axis_rotated&&!x&&(b>0&&T<_||b<0&&_<T)&&(T=_),n.isBarRangeType(h)||(T-=_-m);const w=y+v;return[[y,m],[y,T],[w,T],[w,m]]}},circleY(e,t){const n=this,i=e.id;let a;return n.isGrouped(i)&&(a=Xg.bind(n)(e)),a?a(e,t)[0][1]:n.getYScaleById(i)(n.getBaseValue(e))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,n=Xr(t),i=t.generateGetLinePoints(t.getShapeIndices(n),e,n),a=t.getShapeY(e);return(s,o)=>{const r=s.id;return t.isGrouped(r)&&Va(t,s)?i(s,o)[0][1]:a(s)}},getSubchartCandlestickShapeValue(e,t){return Pi(this,e,t)},isSubchartCandlestickBarValue(e,t){return Gr(this,e,t)},getSubchartCandlestickBarColor(e,t){return Ng(this,e,t)},pointR(e){const t=this,{config:n}=t,i=n.point_r;let a=i;return t.isBubbleType(e)?a=t.getBubbleR(e):z(i)&&(a=i.bind(t.api)(e)),e.r=a,a},pointExpandedR(e){const t=this,{config:n}=t,i=t.isBubbleType(e)?1.15:1.75;return n.point_focus_expand_enabled?n.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,n=t.config.point_select_r;return z(n)?n(e):n||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},getPointSensitivity(e){const t=this;let n=t.config.point_sensitivity;if(e)z(n)?n=n.call(t.api,e):n==="radius"&&(n=e.r);else return n;return n},getBarW(e,t,n){var i,a,s,o,r;const l=this,{config:c,org:d,scale:u,state:h}=l,f=l.getMaxDataCount(),g=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:_}=(s=(a=l.getZoomTransform)==null?void 0:a.call(l))!=null?s:{k:1},x=[(o=c.axis_x_min)!=null?o:d.xDomain[0],(r=c.axis_x_max)!=null?r:d.xDomain[1]].map(y=>l.axis.isTimeSeries()?Vt.call(l,y):Number(y));let m=t.tickInterval(f);if(u.zoom&&!l.axis.isCategorized()&&_>1){const y=x.every((T,w)=>T===d.xDomain[w]);m=d.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(x[w]);return u.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const v=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],k=$(T)?T:z(T)?T.call(l,h.width,n,f):n?m*w/n:0;return C&&k>C?C:k};let b=v();return!g&&Ut(c[p])&&(b={_$width:b,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(b[y.id]=v(y.id),b._$total.push(b[y.id]||b._$width))})),b},getShapeByIndex(e,t,n){const i=this,{$el:a}=i,s=q(t)?`-${t}`:"";let o=a[e];return o&&!o.empty()?o=o.filter(r=>n?r.id===n:!0).filter(r=>q(t)?r.index===t:!0):o=(n?a.main.selectAll(`.${V[`${e}s`]}${i.getTargetSelectorSuffix(n)}`):a.main).selectAll(`.${V[e]}${s}`),o},isWithinShape(e,t){var n;const i=this,a=(0,F.select)(e);let s;return i.isTargetToShow(t.id)?(n=i.hasValidPointType)!=null&&n.call(i,e.nodeName)?s=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(s=a.classed(V.bar)?i.isWithinBar(e):!0):s=!1,s},getInterpolate(e){const n=this.getInterpolateType(e);return zg[n]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const a=t.getInterpolate(e)(i);return a.orgPoint=a.point,a.pointRotated=function(s,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(s,r),this._x=s,this._y=o},a.point=function(s,o){this._point===0?this.orgPoint(s,o):this.pointRotated(s,o)},a}:t.getInterpolate(e)},getInterpolateType(e){const t=this,{config:n}=t,i=n.spline_interpolation_type,a=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?a:t.isStepType(e)?n.line_step_type:"linear"},isWithinBar(e){const t=Zt(this.state.event,e),n=cr(e),[i,a,s]=n,o=Math.min(i.x,a.x),r=Math.min(i.y,a.y),l=this.config.bar_sensitivity,c=Math.abs(s.x-a.x),d=Math.abs(i.y-a.y),u=o-l,h=o+c+l,f=r+d+l,g=r-l;return u<t[0]&&t[0]<h&&g<t[1]&&t[1]<f}},Vg=Object.defineProperty,Wg=(e,t,n)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xt=(e,t,n)=>Wg(e,typeof t!="symbol"?t+"":t,n);function Yr(){var e,t,n;return(n=(t=(e=N.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function Yg(e){return e.hasArcType()?"arc charts":e.hasType("funnel")?"funnel chart":null}function Hg(e){var t,n;const{config:i}=e,a=i.render_mode==="canvas"?Yg(e):null;a&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] render.mode='canvas' is ignored for ${a}; falling back to SVG.`),i.render_mode="svg")}class ge{constructor(t){Xt(this,"api"),Xt(this,"config"),Xt(this,"cache"),Xt(this,"$el"),Xt(this,"state"),Xt(this,"charts"),Xt(this,"data",{xs:{},targets:[]}),Xt(this,"axis"),Xt(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),Xt(this,"org",{xScale:null,xDomain:null}),Xt(this,"color"),Xt(this,"patterns"),Xt(this,"levelColor"),Xt(this,"point"),Xt(this,"brush"),Xt(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const n=this;n.api=t,n.config=new cn,n.cache=new mf;const i=new gf;n.$el=i.getStore("element"),n.state=i.getStore("state"),n.$T=n.$T.bind(n)}$T(t,n,i){const{config:a,state:s}=this,o=a.transition_duration,r=a.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,F.select)(l)),l=(n!==!1&&o||n)&&(!s.zooming||s.dragging)&&!s.resizing&&s.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),H(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),H(t.config.onafterinit,t.api)}init(){const t=this,{config:n,state:i,$el:a}=t,{boost_useCssRule:s,bindto:o}=n;vf(t),Hg(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*xe()}`,s){const c=nt.createElement("style");c.type="text/css",nt.head.appendChild(c),i.style={rootSelector:`.${i.datetimeId}`,sheet:c.sheet},a.style=c}const l={element:o,classname:"bb"};tt(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),a.chart=z(l.element.node)?o.element:(0,F.select)(l.element||[]),a.chart.empty()&&(a.chart=(0,F.select)(nt.body.appendChild(nt.createElement("div")))),a.chart.html("").classed(l.classname,!0).classed(i.datetimeId,s).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const n=this,{config:i,state:a,$el:{chart:s}}=n,o=()=>Sf(s,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=N.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,d)=>{o()||(d.disconnect(),!a.rendered&&n.initToRender(!0))}).observe(s.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&n.convertData(i,c=>{n.initWithData(c),n.afterInit()})}initParams(){var t,n;const i=this,{config:a,format:s,state:o}=i;if(a.render_mode==="canvas"&&((t=i.prepareCanvasConfig)==null||t.call(i)),i.color=i.generateColor(),i.levelColor=i.generateLevelColor(),a.padding===!1&&(a.axis_x_show=!1,a.axis_y_show=!1,a.axis_y2_show=!1,a.subchart_show=!1),a.render_mode!=="canvas"&&(i.hasPointType()||(n=i.hasLegendDefsPoint)!=null&&n.call(i))&&(i.point=i.generatePoint()),o.hasAxis){i.initClip(),s.extraLineClasses=i.generateExtraLineClass(),s.dataTime=a.data_xLocaltime?wi.timeParse:wi.utcParse,s.axisTime=a.axis_x_localtime?wi.timeFormat:wi.utcFormat;const d=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=u=>{const{x:h,zoom:f}=i.scale,g=d?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=u.getMilliseconds()&&".%L"||u.getSeconds()&&".:%S"||u.getMinutes()&&"%I:%M"||u.getHours()&&"%I %p"||u.getDate()!==1&&"%b %d"||g&&u.getDate()===1&&"%b'%y"||u.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(u)}}const{legend_position:r,legend_inset_anchor:l,axis_rotated:c}=a;o.isLegendRight=r==="right",o.isLegendInset=r==="inset",o.isLegendTop=l==="top-left"||l==="top-right",o.isLegendLeft=l==="top-left"||l==="bottom-left",o.rotatedPadding.top=i.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=c&&!a.axis_x_show?0:30,o.inputType=kf(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:d,state:u,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,hasTreemap:_}=u,x=c.interaction_enabled,m=l.hasType("polar"),v=c.data_labels_backgroundColors;if(g&&(l.axis=l.getAxisInstance(),c.zoom_enabled&&l.initZoom()),l.data.xs={},l.data.targets=l.convertDataToTargets(t),c.data_filter&&(l.data.targets=l.data.targets.filter(c.data_filter.bind(l.api))),c.data_hide&&l.addHiddenTargetIds(c.data_hide===!0?l.mapToIds(l.data.targets):c.data_hide),c.legend_hide&&l.addHiddenLegendIds(c.legend_hide===!0?l.mapToIds(l.data.targets):c.legend_hide),l.updateSizes(),l.updateScales(!0),g){const{x:T,y:w,y2:C,subX:k,subY:S,subY2:A}=d;T&&(T.domain(pn(l.getXDomain(l.data.targets),!c.axis_x_inverted)),k.domain(T.domain()),f.xDomain=T.domain()),w&&(w.domain(l.getYDomain(l.data.targets,"y")),S.domain(w.domain())),C&&(C.domain(l.getYDomain(l.data.targets,"y2")),A&&A.domain(C.domain()))}if(c.render_mode==="canvas"){if(!l.initCanvas)throw Error("[billboard.js] Please import and call canvas() to use render.mode='canvas'.");if(l.bindResize(),l.initCanvas(),c.tooltip_show&&l.initTooltip(),l.callPluginHook("$init"),H(c.oninit,l.api),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();H(c.data_onmin,l.api,T.min),H(c.data_onmax,l.api,T.max)}u.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&u.inputType){const T=u.inputType==="touch",{onclick:w,onover:C,onout:k}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,A=tn(S)&&S||!1,L=!isNaN(S)&&S||null,E=T?{passive:!A&&L===null}:void 0;h.svg.on("click",(w==null?void 0:w.bind(l.api))||null).on(T?"touchstart":"mouseenter",(C==null?void 0:C.bind(l.api))||null,E).on(T?"touchend":"mouseleave",(k==null?void 0:k.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=z(c.color_tiles)&&l.patterns;(g||b||m||_||v||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idGrid"].forEach(T=>{l.appendClip(h.defs,u.clip[T])}),l.generateTextBGColorFilter(v),b&&l.patterns.forEach(T=>h.defs.append(()=>T.node))),l.updateSvgSize(),l.bindResize();const y=h.svg.append("g").classed(U.main,!0).attr("transform",p||_?null:l.getTranslate("main"));if(h.main=y,c.subchart_show&&l.initSubchart(),c.tooltip_show&&l.initTooltip(),c.title_text&&l.initTitle(),!_&&c.legend_show&&l.initLegend(),c.data_empty_label_text&&y.append("text").attr("class",`${Et.text} ${U.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),g&&(c.regions.length&&((a=l.initRegion)==null||a.call(l)),!c.clipPath&&l.axis.init()),y.append("g").classed(U.chart,!0).attr("clip-path",g?u.clip.path:null),l.callPluginHook("$init"),l.initChartElements(),g&&(x&&((s=l.initEventRect)==null||s.call(l)),(o=l.initGrid)==null||o.call(l),c.clipPath&&((r=l.axis)==null||r.init())),l.updateTargets(l.data.targets),l.updateDimension(),H(c.oninit,l.api),l.setBackground(),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();H(c.data_onmin,l.api,T.min),H(c.data_onmax,l.api,T.max)}c.tooltip_show&&l.initShowTooltip(),u.rendered=!0}initChartElements(){const t=this,{hasAxis:n,hasRadar:i,hasTreemap:a}=t.state,s=[];if(n){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=Ot(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&s.push(l)}}else if(a)s.push("Treemap");else if(t.hasType("funnel"))s.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||s.push("Arc","Pie"),r?s.push("Gauge"):i?s.push("Radar"):o&&s.push("Polar")}for(const o of s)t[`init${o}`]();bt(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:n,svg:i,defs:a,main:s,tooltip:o,legend:r,title:l,canvas:c,eventOverlay:d,grid:u,needle:h,arcs:f,circle:g,bar:p,candlestick:_,line:x,area:m,text:v}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:d,defs:a,main:s,tooltip:o,legend:r,title:l,grid:u,arc:f,circles:g,bar:{bars:p},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:v}}}setBackground(){const t=this,{config:{background:n},state:i,$el:{svg:a}}=t;if(bt(n)){const s=a.select("g").insert(n.imgUrl?"image":"rect",":first-child");n.imgUrl?s.attr("href",n.imgUrl):n.color&&s.style("fill",n.color).attr("clip-path",i.clip.path),s.attr("class",n.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var n,i;const a=this,{hasAxis:s,hasFunnel:o,hasRadar:r,hasTreemap:l}=a.state,c=u=>a[`updateTargetsFor${u}`](t.filter(a[`is${u}Type`].bind(a)));if(a.updateTargetsForText(t),s){const u=["bar","candlestick","line"];for(const h of u){const f=Ot(h);(h==="line"&&a.hasTypeOf(f)||a.hasType(h))&&c(f)}(n=a.updateTargetsForSubchart)==null||n.call(a,t)}else if(a.hasArcType(t)){let u="Arc";r?u="Radar":a.hasType("polar")&&(u="Polar"),c(u)}else o?c("Funnel"):l&&c("Treemap");const d=a.hasType("bubble")||a.hasType("scatter");d&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(d)}filterTargetsToShowAtInit(t=!1){const n=this,{$el:{svg:i},$T:a}=n;let s=`.${U.target}`;t&&(s+=`, .${Nt.chartCircles} > .${Nt.circles}`),a(i.selectAll(s).filter(o=>n.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,a]of Object.entries(n)){const s=Q(a)?n[a]:a;n[i]=Ne(t,`with${i}`,s)}return n}initialOpacity(t){const n=this,{withoutFadeIn:i}=n.state;return n.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){var t,n;const i=this,{$el:a,config:s,state:o}=i,{resize_auto:r,resize_live:l}=s,c=/^(true|parent)$/.test(r),d=[],u=()=>{var g;const p=o.current.width,_=o.current.height;return i.setContainerSize(),!o.resizePreview&&p===o.current.width&&_===o.current.height?!1:(o.resizing=!0,o.dirty.size=!0,s.legend_show&&(i.updateSizes(),o.isCanvasMode?(g=i.updateHtmlLegend)==null||g.call(i):i.updateLegend()),i.api.flush(!1),!0)},h=()=>{if(o.resizeLiveScale===null&&(o.resizeLiveScale=o.resizeRedrawTime>ms),o.resizeLiveScale){i.previewResize();return}const g=Yr();u()&&(o.resizeRedrawTime=Yr()-g,o.resizeLiveScale=o.resizeRedrawTime>ms)},f=Rf(s.resize_timer,c&&l?h:void 0);d.push(()=>H(s.onresize,i.api)),c&&d.push(u),d.push(()=>{H(s.onresized,i.api),o.resizing=!1,o.resizeLiveScale=null}),d.forEach(g=>f.add(g)),i.resizeFunction=f,r==="parent"&&N.ResizeObserver?(i.resizeFunction.resizeObserver=new N.ResizeObserver(i.resizeFunction.bind(i))).observe(a.chart.node().parentNode):(r==="parent"&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.")),N.addEventListener("resize",i.resizeFunction))}callPluginHook(t,...n){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...n)})}}St(ge.prototype,[Zf,Jf,Qf,eg,ig,rg,ug,tg,dg,bg,Tg,Eu,Gg,wg,Cg,Eg,Dg,Fg,Og,Bg]);const Ha=[he,ee,Wt,Qi],Hr=10,jg=750,jr=6,Ug=2,Kg=1e5,Zg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Di=new WeakMap;function Ur(e){var t,n;(n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] ${e}`)}function Ii(e,t){var n;const{config:i}=e,a=(n=i.data_names[t])!=null?n:t;return z(i.legend_format)?i.legend_format(a,t!==a?t:void 0):a}function qg(e){return`${e}`.replace(/[&<>"']/g,t=>Zg[t])}function Jg(e,t){var n,i;const{config:a}=e,s=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],o=((i=e.getValidPointPattern)==null?void 0:i.call(e))||(Array.isArray(a.point_pattern)&&a.point_pattern.length?a.point_pattern:[a.point_type]),r=Math.max(0,s.indexOf(t));return o[r%o.length]||"circle"}function Qg(e,t){const n=qg(e.color(t)),i=Jg(e,t),a='viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"',s=`fill="${n}" stroke="${n}"`;return/^rect(angle)?$/i.test(i)?`<svg ${a}><rect x="1" y="1" width="6" height="6" ${s}></rect></svg>`:!i||/^circle$/i.test(i)?`<svg ${a}><circle cx="4" cy="4" r="3" ${s}></circle></svg>`:`<svg ${a}><g ${s}>${Se(i)}</g></svg>`}function tp(e,t){const n=new Map;t.each(function(i){n.set(i,this)}),e.cache.add(W.legendItemMap,n)}function Kr(e,t){const{config:n}=e;t.attr("class",function(i){const s=`${(0,F.select)(this).attr("class")||""} ${e.generateClass(j.legendItem,i)}`;return Array.from(new Set(s.trim().split(/\s+/).filter(Boolean))).join(" ")}).style("visibility",i=>e.isLegendToShow(i)?null:"hidden").classed(j.legendItemHidden,i=>!e.isTargetToShow(i)).classed(oe.legendItemInteractive,!!n.interaction_enabled),tp(e,t)}function ep(e,t){var n;const{legend:i}=e.$el,a=((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t];i==null||i.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,s=>a.indexOf(s)>=0).style("opacity",function(s){return a.indexOf(s)>=0?null:e.opacityForUnfocusedLegend.call(e,(0,F.select)(this))})}function np(e){const{legend:t}=e.$el;t==null||t.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,!1).style("opacity",null)}function ip(e,t){var n,i,a;const{state:s}=e,r=(((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t]).filter(e.isTargetToShow,e),l=new Set(r),c=(((i=e.mapToTargetIds)==null?void 0:i.call(e))||[]).filter(d=>!l.has(d)&&e.isTargetToShow(d));s.focusedTargetIds=l,s.defocusedTargetIds=new Set(c),(a=e.renderCanvasFrame)==null||a.call(e,void 0,null,!1)}function Zr(e){var t,n,i;const{state:a}=e,s=!!((t=a.focusedTargetIds)!=null&&t.size)||!!((n=a.defocusedTargetIds)!=null&&n.size);a.focusedTargetIds=new Set,a.defocusedTargetIds=new Set,s&&((i=e.renderCanvasFrame)==null||i.call(e,void 0,null,!1))}function qr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function ap(e,t,n){const i=qr(n);e.state.canvasLegendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Jr(e,t){const n=e.state.canvasLegendTouch,i=n&&qr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Hr||Math.abs(i.clientY-n.y)>Hr)}function sp(e,t,n){Jr(e,n);const i=e.state.canvasLegendTouch;return e.state.canvasLegendTouch=null,!!i&&i.id===t&&!i.moved}function op(e,t){e.state.canvasLegendLastTouchClickId=t,e.state.canvasLegendLastTouchClickTime=Date.now()}function rp(e,t){const{state:n}=e,i=n.canvasLegendLastTouchClickId===t&&Date.now()-(n.canvasLegendLastTouchClickTime||0)<jg;return i&&(n.canvasLegendLastTouchClickId=null,n.canvasLegendLastTouchClickTime=0),i}function Qr(e,t){const{api:n,config:i,state:a}=e;if(t.on("click dblclick mouseover mouseout touchstart touchmove touchend",null),!i.interaction_enabled)return;const s=i.legend_item_interaction,o=typeof s=="object"&&(s!=null&&s.dblclick)?"dblclick":"click",r=a.inputType==="touch",l=s||z(i.legend_item_onclick),c=r?ol(i):void 0,d=function(u,h){var f;if(!H(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,F.select)(this);u.type==="dblclick"||u.altKey?a.hiddenTargetIds.size&&!g.classed(j.legendItemHidden)?n.show():(n.hide(),n.show(h)):(n.toggle(h),g.classed(lt.legendItemFocused,!1)),Zr(e)}r&&((f=e.hideTooltip)==null||f.call(e))};t.on(o,l?function(u,h){r&&u.type==="click"&&rp(e,h)||d.call(this,u,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(u,h){ap(e,h,u)},c).on("touchmove",u=>{Jr(e,u)},c).on("touchend",function(u,h){sp(e,h,u)&&(op(e,h),d.call(this,u,h))},c),!r&&t.on("mouseover",s||z(i.legend_item_onover)?function(u,h){H(i.legend_item_onover,n,h,!a.hiddenTargetIds.has(h))||!a.transiting&&e.isTargetToShow(h)&&(ep(e,h),ip(e,h))}:null).on("mouseout",s||z(i.legend_item_onout)?function(u,h){H(i.legend_item_onout,n,h,!a.hiddenTargetIds.has(h))||(np(e),Zr(e))}:null)}function lp(e,t){var n,i;const a=(i=(n=e.$el.chart)==null?void 0:n.node)==null?void 0:i.call(n),s=a==null?void 0:a.ownerDocument;if(!a||!s)return null;const o=s.createElementNS("http://www.w3.org/2000/svg","svg"),r=s.createElementNS("http://www.w3.org/2000/svg","g"),l=s.createElementNS("http://www.w3.org/2000/svg","text");o.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",r.setAttribute("class",j.legendItem),l.textContent=t,r.appendChild(l),o.appendChild(r),a.appendChild(o);const c=ht(l);return o.remove(),c}function tl(e){return/^(indexed|category|log|timeseries)$/.test(e)}function Mi(e){return/^(indexed|log|timeseries)$/.test(e)}function cp(e){var t,n;const i=e;return((t=i.changedTouches)==null?void 0:t[0])||((n=i.touches)==null?void 0:n[0])||("clientX"in e?e:null)}function up(e,t,n=!1){var i,a;const s=Jn(e,t);return s?n?(a=(i=e.hitDetector).findNearestShape)==null?void 0:a.call(i,s[0],s[1]):e.hitDetector.findNearest(s[0],s[1]):null}function dp(e,t){var n;const{config:i,state:a}=e,{height:s,margin:o,width:r,xAxisHeight:l}=a,[c,d]=t,u=o.left,h=o.left+r,f=o.top,g=o.top+s,p=i.axis_x_show?Math.max(l||0,24):0;return(n=e.isMultipleX)!=null&&n.call(e)||a.hasTreemap?!1:i.axis_rotated?d>=f&&d<=g&&c>=u-p&&c<=h:c>=u&&c<=h&&d>=f&&d<=g+p}function hp(e,t){const{state:{height:n,margin:i,width:a}}=e,[s,o]=t;return s>=i.left&&s<=i.left+a&&o>=i.top&&o<=i.top+n}function fp(e,t){var n,i;return e.hitDetector.findNearest(t[0],t[1])||(dp(e,t)?(i=(n=e.hitDetector).findNearestIndexByCoord)==null?void 0:i.call(n,t[0],t[1]):null)}function el(e,t){var n;const{config:i,state:a}=e,s=e.filterTargetsToShow(e.data.targets),o=sl(e,t),r=i.tooltip_grouped&&!a.hasTreemap&&!o?(n=e.filterByX)==null?void 0:n.call(e,s,t.x):null;return(a.hasTreemap?[t]:o?[t]:i.tooltip_grouped?r!=null&&r.length?r:s.map(l=>l.values[t.index]).filter(Boolean):[t]).map(l=>{var c;return((c=e.addName)==null?void 0:c.call(e,l))||l})}function gp(e,t,n){var i,a;return(i=e.isMultipleX)!=null&&i.call(e)&&!sl(e,t)?[((a=e.addName)==null?void 0:a.call(e,t))||t]:n}function Jn(e,t){const n=cp(t);if(!n)return null;const i=e.$el.canvas.node(),a=ht(i,!0);return[n.clientX-a.left,n.clientY-a.top]}function ja(e,t){var n,i;if(!Array.isArray(t)||t.length<2)return null;const a=t.slice(0,2);return(i=(n=e.axis)==null?void 0:n.isTimeSeries)!=null&&i.call(n)?a.map(s=>Vt.call(e,s)):a}function Qn(e){const{config:t,state:n}=e;return!t.subchart_show||!n.hasAxis||n.width2<=0||n.height2<=0?null:{x:n.margin2.left,y:n.margin2.top,w:n.width2,h:n.height2}}function nl(e,t){const n=Qn(e);return!!n&&t[0]>=n.x&&t[0]<=n.x+n.w&&t[1]>=n.y&&t[1]<=n.y+n.h}function pp(e,t){const{config:n,state:i}=e,a=Qn(e);if(n.subchart_brush_enabled!==!1||!a||!nl(e,t))return null;const s=so(e,n.axis_rotated?t[1]-a.y:t[0]-a.x);return s===null?null:n.axis_rotated?[i.margin.left+i.width/2,i.margin.top+s]:[i.margin.left+s,i.margin.top+i.height/2]}function Fi(e){var t,n;const i=Qn(e),a=i?e.config.axis_rotated?i.h:i.w:0,s=(n=(t=e.axis)==null?void 0:t.getExtent)==null?void 0:n.call(t),o=Array.isArray(s)?s.slice(0,2):[];if(o.length===2&&o.every(Number.isFinite)){const r=Math.max(0,Math.min(a,o[0])),l=Math.max(0,Math.min(a,o[1]));return[Math.min(r,l),Math.max(r,l)]}return[0,a]}function Ua(e,t,n=!1){const i=Jn(e,t),a=i&&Qn(e);if(!i||!a||!nl(e,i))return null;const s=e.config.axis_rotated?i[1]-a.y:i[0]-a.x,[o,r]=Fi(e);return!n&&(s<o||s>r)?null:Math.max(o,Math.min(r,s))}function _p(e,t,n){const i=Math.min(t,n),a=Math.max(t,n);return[e.scale.subX.invert(i),e.scale.subX.invert(a)]}function il(e){const{scale:t,state:n}=e,i=n.domain;if(!(i!=null&&i.length)||!t.subX)return null;const a=Qn(e),s=t.subX(i[0]),o=t.subX(i[1]);if(!a||!Number.isFinite(s)||!Number.isFinite(o))return null;const[r,l]=Fi(e);return[Math.max(r,Math.min(l,Math.min(s,o))),Math.max(r,Math.min(l,Math.max(s,o)))]}function al(e,t){const n=il(e);if(!n)return"select";const[i,a]=n;return Math.abs(t-i)<=jr?"resize-start":Math.abs(t-a)<=jr?"resize-end":t>i&&t<a?"move":"select"}function Ka(e,t,n){const[i,a]=Fi(e);return[Math.max(i,Math.min(a,t)),Math.max(i,Math.min(a,n))]}function xp(e,t){return/^resize/.test(t)?e.config.axis_rotated?"ns-resize":"ew-resize":t==="move"?"move":"crosshair"}function Ke(e){return e?`${e.id}:${e.index}`:null}function mp(e,t){const n=e.state.canvasSelectionDragIncluded,i=Di.get(e)||new Map,a=new Map,s=new Set,o=[];return t.filter(r=>Za(e,r)).forEach(r=>{const l=Ke(r);l&&(s.add(l),!a.has(l)&&a.set(l,r))}),a.forEach((r,l)=>{!n.has(l)&&o.push(r)}),i.forEach((r,l)=>{!s.has(l)&&o.push(r)}),Di.set(e,a),{included:s,rows:o}}function vp(e){return e?Array.isArray(e)?e:[e]:null}function Za(e,t){return t&&Rt(e,t)&&_n(e,t,Ha)&&Ha.some(n=>n(e,t))&&e.config.data_selection_isselectable.bind(e.api)(t)}function qa(e,t){e.filterTargetsToShow(e.data.targets).filter(n=>_n(e,n,Ha)).forEach(n=>{n.values.forEach(i=>{Za(e,i)&&t(i)})})}function sl(e,t){return!(e.config.axis_x_forceAsSingle&&e.config.tooltip_grouped)&&(Ve(e,t)||We(e,t))}function bp(e){return e.interaction_inputType_touch!==!1}function ol(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}function yp(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;let s;return o=>{var r,l;const c=((r=o.changedTouches)==null?void 0:r[0])||((l=o.touches)==null?void 0:l[0]);if(!c)return;const d=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=d):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-d)>=a)&&(s=!0,o.preventDefault())}}function Sn(e,t){return t.pointerType!=="mouse"&&e.state.inputType!=="touch"}function Tp(e,t){const{state:n}=e,i=Ke(t),a=i&&n.canvasLastInputClickKey===i&&Date.now()-(n.canvasLastInputClickTime||0)<750;return a&&(n.canvasLastInputClickKey=null,n.canvasLastInputClickTime=0),!!a}function wp(e,t){e.state.canvasLastInputClickKey=Ke(t),e.state.canvasLastInputClickTime=Date.now()}function Cp(){var e,t,n;return(n=(t=(e=N.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function rl(e,t=!1){return Array.isArray(e)&&e.length>=2&&e.every(n=>Number.isFinite(+n)&&(!t||+n>0))}function Sp(e,t,n,i=!1){return e.slice(0,2).map((a,s)=>{const o=i?Math.exp(Math.log(+a)+(Math.log(+t[s])-Math.log(+a))*n):+a+(+t[s]-+a)*n;return a instanceof Date||t[s]instanceof Date?new Date(o):o})}function kp(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function Ap(e){const{scale:t}=e,n=e.filterTargetsToShow(e.data.targets);["y","y2"].forEach(i=>{var a;(a=t[i])==null||a.domain(e.getYDomain(n,i))}),e.withSubchartTypeContext(()=>{var i,a;(i=t.subY)==null||i.domain(e.getYDomain(n,"y")),(a=t.subY2)==null||a.domain(e.getYDomain(n,"y2"))})}const Lp={prepareCanvasConfig(){var e,t;const{config:n,state:i}=this;this.warnUnsupportedCanvasOptions(),(e=i.orgConfig)!=null&&e.transition&&Object.prototype.hasOwnProperty.call(i.orgConfig.transition,"duration")&&i.orgConfig.transition.duration&&Ur("canvas mode: transition.duration is ignored; canvas redraws synchronously."),n.transition_duration=0,tl(n.axis_x_type)||(n.axis_x_type="indexed"),Mi(n.axis_y_type)||(n.axis_y_type="indexed"),Mi(n.axis_y2_type)||(n.axis_y2_type="indexed"),(t=this.hasType)!=null&&t.call(this,"bubble")&&(n.point_show=!0,n.point_type="circle")},applyCanvasSubchartDomain(){const e=this,{axis:t,config:n,scale:i,state:a}=e;if(!n.subchart_show||!a.hasAxis||!i.subX)return;!a.rendered&&!a.domain&&n.subchart_init_range&&(a.domain=ja(e,n.subchart_init_range));const s=ja(e,a.domain);!s||!e.withinRange(s,e.getZoomDomain("subX",!0),e.getZoomDomain("subX"))||(a.domain=s,i.x.domain(s),t.x.scale(i.x))},setCanvasSubchartDomain(e,t=!0,n=!1){const i=this,{config:a,scale:s,state:o}=i,r=ja(i,e);if(!(!a.subchart_show||!r||!i.withinRange(r,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))))return o.domain=r,s.zoom=null,t&&i.redraw({withTransition:!1,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n&&a.subchart_onbrush.bind(i.api)(o.domain),o.domain},clearCanvasSubchartDomain(e=!0,t=!1){var n;const i=this,{axis:a,config:s,org:o,scale:r,state:l}=i;s.subchart_show&&(l.domain=void 0,r.zoom=null,(n=o.xDomain)!=null&&n.length&&(r.x.domain(o.xDomain),a.x.scale(r.x)),e&&i.redraw({withTransition:!1,withUpdateXDomain:!0,withUpdateOrgXDomain:!1,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t&&s.subchart_onbrush.bind(i.api)(r.x.orgDomain()))},flushCanvasFlow(){var e,t;const{state:n}=this;n.canvasFlowFinish&&(n.canvasFlowFrame!==null&&((t=(e=N).cancelAnimationFrame)==null||t.call(e,n.canvasFlowFrame)),n.canvasFlowFrame=null,n.canvasFlowFinish())},animateCanvasFlow(e){var t,n,i,a,s,o,r,l,c,d,u;const h=this,{axis:f,data:g,org:p,scale:_,state:x}=h,{done:m=()=>{},duration:v,length:b,orgDataCount:y}=e,T=(t=N.requestAnimationFrame)==null?void 0:t.bind(N),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!v||!b||!y||kp(h)>Kg)return!1;const C=_.x.domain().slice(0,2),k=(a=(i=p.xDomain)==null?void 0:i.slice)==null?void 0:a.call(i),S=(l=(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:(r=o.call(s)).slice)==null?void 0:l.call(r);if(!rl(C,w))return!1;const A=g.targets.map(I=>I.values.splice(0,b));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=_.x.domain().slice(0,2),E=(d=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:d.call(c);if(g.targets.forEach((I,X)=>{I.values.unshift(...A[X])}),!rl(L,w))return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),!1;Ap(h);let D=!1;const R=Cp(),P=()=>{var I,X;D||(D=!0,g.targets.forEach(G=>{G.values.splice(0,b)}),E&&(p.xDomain=E),_.x.domain(L),(X=(I=_.subX)==null?void 0:I.domain)==null||X.call(I,E!=null?E:L),f.x.scale(_.x),x.dirty.data=!0,x._eventRectFingerprint=null,x.canvasShape=null,x._cachedDrawShape=null,h.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),h.updateTypesElements(),x.canvasFlowFrame=null,x.canvasFlowFinish=null,x.flowing=!1,m.call(h.api))},B=I=>{const X=Math.min(1,Math.max(0,(I-R)/v)),G=Sp(C,L,X,w);_.x.domain(G),f.x.scale(_.x),x.canvasShape=null,x._cachedDrawShape=null,x._canvasVisibleRangeCache=null,x._canvasXTickValuesCache=null,h.renderCanvasFrame(void 0,null,!1),X<1?x.canvasFlowFrame=T(B):P()};return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),x.flowing=!0,x.cancelClick=!0,(u=h.hideTooltip)==null||u.call(h),x.canvasFlowFinish=P,x.canvasFlowFrame=T(B),!0},initCanvas(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.chart.node();i.isCanvasMode=!0,i.canvasInlineStyle.minHeight=s.style.minHeight,N.getComputedStyle(s).position==="static"&&a.chart.style("position","relative"),a.chart.style("min-height",`${i.current.height}px`),t.canvasEngine=new wd,t.canvasEngine.init(s,i.current.width,t.getCanvasSurfaceHeight()),a.canvas=(0,F.select)(t.canvasEngine.canvas),t.canvasTheme=new Yh,t.canvasTheme.load(s,n.canvas_theme),t.canvasAxisRenderer=new bd(t.canvasEngine,t.canvasTheme),t.canvasRenderer=new Ph(t.canvasEngine,t.canvasTheme),t.hitDetector=new Zh,t.bindCanvasEvents(),n.zoom_enabled&&((e=t.bindZoomEvent)==null||e.call(t))},warnUnsupportedCanvasOptions(){var e,t,n,i;const{config:a}=this;[[!tl(a.axis_x_type),"axis.x.type other than indexed/category/log/timeseries"],[!Mi(a.axis_y_type),"axis.y.type other than indexed/log/timeseries"],[!Mi(a.axis_y2_type),"axis.y2.type other than indexed/log/timeseries"],[a.boost_useCssRule,"boost.useCssRule"],[(e=this.hasArcType)==null?void 0:e.call(this),"arc charts"],[(t=this.hasType)==null?void 0:t.call(this,"radar"),"radar chart"],[(n=this.hasType)==null?void 0:n.call(this,"polar"),"polar chart"],[(i=this.hasType)==null?void 0:i.call(this,"funnel"),"funnel chart"]].forEach(([o,r])=>{o&&Ur(`canvas mode: ${r} is not yet supported.`)})},bindCanvasEvents(){const e=this,{config:t,state:n,$el:i}=e,a=i.canvas.node(),s=yp(t),o=ol(t);a.addEventListener("mousemove",e.onCanvasMouseMove.bind(e)),a.addEventListener("mouseenter",r=>{var l;n.event=r,(l=t.onover)==null||l.bind(e.api)(r)}),a.addEventListener("mouseout",e.onCanvasMouseOut.bind(e)),a.addEventListener("mouseleave",r=>{var l;n.event=r,(l=t.onout)==null||l.bind(e.api)(r)}),a.addEventListener("mousedown",r=>{var l;(l=e.onCanvasSubchartBrushStart)!=null&&l.call(e,r)||e.onCanvasSelectionDragStart(r)}),a.addEventListener("click",e.onCanvasClick.bind(e)),a.addEventListener("pointerdown",e.onCanvasPointerDown.bind(e)),a.addEventListener("pointerenter",e.onCanvasPointerEnter.bind(e)),a.addEventListener("pointermove",e.onCanvasPointerMove.bind(e)),a.addEventListener("pointerup",e.onCanvasPointerUp.bind(e)),a.addEventListener("pointerleave",e.onCanvasPointerOut.bind(e)),a.addEventListener("pointercancel",e.onCanvasPointerCancel.bind(e)),bp(t)&&(a.addEventListener("touchstart",r=>{s(r),e.onCanvasTouchStart(r)},o),a.addEventListener("touchmove",r=>{s(r),e.onCanvasTouchMove(r)},o),a.addEventListener("touchend",e.onCanvasTouchEnd.bind(e),o),a.addEventListener("touchcancel",e.onCanvasTouchCancel.bind(e),o))},updateHtmlLegend(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();if(!i.legend_show||a.hasTreemap){a.hasTreemap?((e=s.legend)==null||e.remove(),s.legend=null):(t=s.legend)==null||t.style("visibility","hidden"),a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0;return}const r=n.mapToIds(n.data.targets).filter(u=>i.data_names[u]!==null);if(i.legend_contents_bindto&&i.legend_contents_template){n.updateHtmlLegendTemplate(r)?(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0,a.legendHasRendered=!0):(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0);return}s.legend||(s.legend=(0,F.select)(o).append("div").classed(j.legend,!0).classed(oe.legend,!0)),s.legend.style("visibility",null);const l=s.legend.selectAll(`button.${j.legendItem}`).data(r,u=>u);l.exit().remove();const c=l.enter().append("button").attr("type","button").attr("data-id",u=>u);c.append("span").classed(j.legendItemTile,!0),c.append("span").classed(oe.legendItemTitle,!0);const d=c.merge(l).attr("class",u=>n.generateClass(j.legendItem,u).trim());Kr(n,d),d.select(`.${j.legendItemTile}`).classed(oe.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",u=>i.legend_usePoint?null:n.color(u)).html(u=>i.legend_usePoint?Qg(n,u):""),d.select(`.${oe.legendItemTitle}`).text(u=>Ii(n,u)),i.legend_tooltip&&d.attr("title",u=>Ii(n,u)),Qr(n,d),n.updateHtmlLegendSize(r),n.positionHtmlLegend(),a.legendHasRendered=!0},updateHtmlLegendTemplate(e){const t=this,{api:n,config:i,$el:a}=t,s=(0,F.select)(i.legend_contents_bindto),o=i.legend_contents_template,r=[];let l="";if(s.empty())return!1;e.forEach(d=>{const u=z(o)?Se(o.call(n,d,t.color(d),n.data(d)[0].values)):an(o,{COLOR:t.color(d),TITLE:d});u&&(r.push(d),l+=u)});const c=s.html(l).classed(j.legend,!0).classed(oe.legend,!1).style("visibility",null).selectAll(function(){return this.children}).data(r);return Kr(t,c),Qr(t,c),a.legend=s,!0},updateHtmlLegendSize(e){const t=this,{config:n,state:i,$el:a}=t,s=[],o={};let r=0,l=0,c=0;const d=n.legend_contents_bindto&&n.legend_contents_template;if(d)a.legend.selectAll(`.${j.legendItem}`).each(function(u){const h=ht(this,!0),f=`${Ii(t,u)}`,g=Math.max(32,f.length*7+24),p=20,_=Math.ceil(h.width||g),x=Math.ceil(h.height||p);s.push(_),r=Math.max(r,_),l=Math.max(l,x)});else if(e.length){const u=i.isLegendRight||i.isLegendInset,h=n.legend_item_tile_type!=="circle",f={width:h?n.legend_item_tile_width:n.legend_item_tile_r*2,height:h?n.legend_item_tile_height:n.legend_item_tile_r*2},g={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},p={offsets:{},widths:{},heights:{},margins:[0],steps:{}},_=e.map((w,C)=>{const k=`${Ii(t,w)}`,S=lp(t,k),A=Math.max(32,k.length*7),L=12,E=C===e.length-1,D=n.legend_show&&!t.isLegendToShow(w),R=D?0:((S==null?void 0:S.width)||A)+g.tileWidth+(E&&!u?0:g.padding.right)+n.legend_padding,P=D?0:((S==null?void 0:S.height)||L)+g.padding.top;return g.max.width=Math.max(g.max.width,R),g.max.height=Math.max(g.max.height,P),{id:w,hidden:D,width:R,height:P}}),x=u?t.getLegendHeight():t.getLegendWidth(),m=(w,C,k=!1)=>{let S;k||(S=(x-g.totalLength-C)/2,S<g.posMin&&(S=(x-C)/2,g.totalLength=0,g.step++)),p.steps[w]=g.step,p.margins[g.step]=i.isLegendInset?10:S,p.offsets[w]=g.totalLength,g.totalLength+=C};i.isLegendInset&&(g.step=n.legend_inset_step?n.legend_inset_step:e.length,i.legendStep=g.step),_.forEach(({id:w,hidden:C,width:k,height:S})=>{const A=n.legend_equally&&!C?g.max.width:k,L=n.legend_equally&&!C?g.max.height:S,E=u?L:A;if(p.widths[w]=A,p.heights[w]=L,s.push(A),r=Math.max(r,A),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}m(w,E)});const v=i.isLegendRight?w=>g.max.width*p.steps[w]:i.isLegendInset?w=>g.max.width*p.steps[w]+10:w=>p.margins[p.steps[w]]+p.offsets[w],b=i.isLegendRight||i.isLegendInset?w=>p.margins[p.steps[w]]+p.offsets[w]:w=>g.max.height*p.steps[w],y=4+f.width,T=9;_.forEach(({id:w,hidden:C})=>{const k=C?0:v(w),S=C?0:b(w);o[w]={item:{x:k,y:S-5,width:p.widths[w],height:p.heights[w]},title:{x:y,y:0,height:p.heights[w]},tile:{x:-2,y:T-f.height/2,width:f.width,height:f.height}}}),c=g.step}if(!e.length){i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0;return}if(d){const u=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>u?(f++,g=p):g+=(g?h:0)+p}),i.legendStep=Math.max(0,f-1)}else i.legendStep=c;i.legendItemWidth=r,i.legendItemHeight=Math.max(12,l),d||a.legend.selectAll(`button.${j.legendItem}`).each(function(u){const h=o[u],f=(0,F.select)(this);h&&(f.style("left",`${h.item.x}px`).style("top",`${h.item.y}px`).style("width",`${h.item.width}px`).style("height",`${h.item.height}px`),f.select(`.${oe.legendItemTitle}`).style("left",`${h.title.x}px`).style("top",`${h.title.y}px`).style("height",`${h.title.height}px`).style("line-height",`${h.title.height}px`),f.select(`.${j.legendItemTile}`).style("left",`${h.tile.x}px`).style("top",`${h.tile.y}px`).style("width",`${h.tile.width}px`).style("height",`${h.tile.height}px`))})},getCanvasBottomLegendHeight(){var e;const t=this,{config:n,state:i,$el:a}=t;if(!n.legend_show||i.isLegendRight||i.isLegendInset||i.hasTreemap||!a.legend||!i.legendItemHeight)return 0;const s=ht(a.legend.node(),!0).height,o=i.legendItemHeight*(i.legendStep+1);return Math.ceil(Math.max(((e=t.getLegendHeight)==null?void 0:e.call(t))||0,s||o))},getCanvasSurfaceHeight(){const e=this;return Math.max(0,e.state.current.height-e.getCanvasBottomLegendHeight())},positionHtmlLegend(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.legend;if(s.classed(oe.legendBottom,!i.isLegendRight&&!i.isLegendInset).classed(oe.legendRight,i.isLegendRight).classed(oe.legendInset,i.isLegendInset).style("top",null).style("right",null).style("bottom",null).style("left",null).style("width",null).style("height",null).style("min-height",null),i.isLegendRight)s.style("top",`${i.margin3.top}px`).style("right","0").style("bottom",`${i.margin3.bottom}px`).style("width",`${Math.max(0,t.getLegendWidth())}px`);else if(i.isLegendInset){if(i.isLegendInset){const o=i.isLegendTop,r=i.isLegendLeft;s.style(o?"top":"bottom",`${n.legend_inset_y}px`).style(r?"left":"right",`${n.legend_inset_x}px`).style("width",`${Math.max(0,i.legendItemWidth*(i.legendStep+1)+20)}px`)}}else{const o=((e=t.getLegendHeight)==null?void 0:e.call(t))||0;s.style("top",`${Math.max(0,i.current.height-o)}px`).style("right","0").style("bottom","auto").style("left","0")}},getCanvasSelectedData(e){const t=this,n=t.state.canvasSelection,i=[];return!t.config.data_selection_enabled||!(n!=null&&n.size)||qa(t,a=>{(!e||a.id===e)&&n.has(Ke(a))&&i.push(a)}),i},setCanvasSelection(e=!1,t,n,i){var a;const s=this,{config:o,state:r}=s,l=r.canvasSelection,c=o.data_selection_grouped;let d=vp(t),u=!1;const h=e&&!o.data_selection_multiple;let f=!h;if(o.data_selection_enabled){if(h&&(n=n!=null&&n.length?[n[0]]:[0],!c))if(d)d=d.slice(0,1);else{const[g]=s.filterTargetsToShow(s.data.targets);d=g?[g.id]:[]}qa(s,g=>{const p=Ke(g),_=c||!d||d.indexOf(g.id)>=0,x=!n||n.indexOf(g.index)>=0,m=l.has(p);if(e)if(_&&x&&(!m||h)){if(f||(s.setCanvasSelection(!1),f=!0),l.has(p))return;l.add(p),H(o.data_onselected,s.api,g,s.canvasEngine.canvas),u=!0}else(!h||f)&&i&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),u=!0);else _&&x&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),u=!0)}),u&&((a=s.renderCanvasFrame)==null||a.call(s,void 0,null,!1))}},toggleCanvasSelection(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelection;let o=!1;i.data_selection_enabled&&(e.filter(r=>Za(n,r)).forEach(r=>{const l=Ke(r),c=s.has(l);i.data_selection_multiple||qa(n,d=>{const u=Ke(d);(i.data_selection_grouped?d.id===r.id:u!==l)&&s.has(u)&&(s.delete(u),H(i.data_onunselected,n.api,d,n.canvasEngine.canvas),o=!0)}),c&&s.has(l)?(s.delete(l),H(i.data_onunselected,n.api,r,n.canvasEngine.canvas)):(s.add(l),H(i.data_onselected,n.api,r,n.canvasEngine.canvas)),o=!0}),o&&((t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1)))},canStartCanvasSelectionDrag(e){const t=this,{config:n}=t,i=e;return!!(n.interaction_enabled&&n.data_selection_enabled&&n.data_selection_draggable&&n.data_selection_multiple&&!n.zoom_enabled&&(i.button===void 0||i.button===0))},getCanvasSelectionDragData(e){const t=this,{config:n}=t,i=t.hitDetector.findInRect(e,n.data_selection_grouped);if(!n.data_selection_grouped)return i;const a=new Set(i.map(s=>s.index));return t.filterTargetsToShow(t.data.targets).flatMap(s=>s.values.filter(o=>a.has(o.index)))},startCanvasSelectionDrag(e){var t,n;const i=this,{state:a}=i,s=Jn(i,e);return!s||!i.canStartCanvasSelectionDrag(e)?!1:(a.dragStart=s,a.canvasSelectionDragStart=s,a.canvasSelectionDragIncluded=new Set,a.canvasSelectionDragging=!0,a.canvasSelectionDragMoved=!1,Di.set(i,new Map),i.setDragStatus(!0),(t=i.hideTooltip)==null||t.call(i),(n=e.preventDefault)==null||n.call(e),!0)},updateCanvasSelectionDrag(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelectionDragStart,o=Jn(n,e);if(!a.canvasSelectionDragging||!s||!o)return!1;const[r,l]=s,[c,d]=o,u=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,d),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,d),p={x:u,y:f,w:h-u,h:g-f},_=Math.abs(c-r)>4||Math.abs(d-l)>4;if(a.canvasSelectionDragMoved=a.canvasSelectionDragMoved||_,_){const{included:x,rows:m}=mp(n,n.getCanvasSelectionDragData(p));m.length&&n.toggleCanvasSelection(m),a.canvasSelectionDragIncluded=x,a.cancelClick=!0}return n.renderCanvasSelectionDrag(p),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSelectionDrag(e){var t;const n=this,{state:i}=n;return i.canvasSelectionDragging?(n.updateCanvasSelectionDrag(e),i.cancelClick=i.cancelClick||i.canvasSelectionDragMoved,i.dragStart=null,i.canvasSelectionDragStart=null,i.canvasSelectionDragIncluded=new Set,i.canvasSelectionDragging=!1,i.canvasSelectionDragMoved=!1,Di.delete(n),n.setDragStatus(!1),n.clearCanvasFocus(),(t=e.preventDefault)==null||t.call(e),!0):!1},dispatchCanvasDataOut(e){const t=this,{config:n,state:i}=t,a=i.canvasDataHover;a&&(i.canvasDataHover=null,i.canvasDataHoverKey=null,n.interaction_enabled&&H(n.data_onout,t.api,a,e))},dispatchCanvasDataOver(e,t){const n=this,{config:i,state:a}=n,s=Ke(e);a.canvasDataHoverKey!==s&&(n.dispatchCanvasDataOut(t),a.canvasDataHover=e,a.canvasDataHoverKey=s,i.interaction_enabled&&e&&H(i.data_onover,n.api,e,t))},dispatchCanvasDataClick(e,t=!1){var n;const i=this,{config:a,$el:s}=i,o=s.canvas.node(),r=up(i,e,!0);if(!r||Tp(i,r))return r;if(a.interaction_enabled){const l=a.data_selection_grouped?i.filterTargetsToShow(i.data.targets).map(c=>c.values[r.index]).filter(Boolean):[r];(n=i.toggleCanvasSelection)==null||n.call(i,l),l.forEach(c=>H(a.data_onclick,i.api,c,o)),t&&wp(i,r)}return r},updateCanvasSubchartBrush(e){var t,n;const i=this,{config:a,state:s}=i,o=s.canvasSubchartBrushStart,r=s.canvasSubchartBrushOrigin,l=s.canvasSubchartBrushMode,c=Ua(i,e,!0);if(a.subchart_brush_enabled===!1||!s.canvasSubchartBrushDragging||o===null||c===null||!l)return!1;const d=c-o;if(Math.abs(d)>Ug&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let u;if(l==="move"&&r){const[f,g]=Fi(i),p=r[1]-r[0];let _=r[0]+d,x=r[1]+d;_<f&&(x+=f-_,_=f),x>g&&(_-=x-g,x=g),u=[Math.max(f,Math.min(g-p,_)),Math.min(g,Math.max(f+p,x))]}else l==="resize-start"&&r?u=Ka(i,c,r[1]):l==="resize-end"&&r?u=Ka(i,r[0],c):u=Ka(i,o,c);const h=_p(i,u[0],u[1]);return i.setCanvasSubchartDomain(h,!0),s.cancelClick=!0,(n=e.preventDefault)==null||n.call(e),!0},updateCanvasSubchartCursor(e){const t=this,n=t.$el.canvas.node();if(t.config.subchart_brush_enabled===!1)return n.style.cursor="",!1;const i=Ua(t,e);if(i===null)return n.style.cursor="",!1;const a=al(t,i);return n.style.cursor=xp(t,a),!0},startCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;if(n.config.subchart_brush_enabled===!1)return!1;const a=Ua(n,e);if(a===null)return!1;const s=al(n,a);return i.event=e,i.canvasSubchartBrushDragging=!0,i.canvasSubchartBrushMode=s,i.canvasSubchartBrushStart=a,i.canvasSubchartBrushOrigin=il(n),i.canvasSubchartBrushMoved=!1,i.cancelClick=!0,n.setDragStatus(!0),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSubchartBrush(e){var t,n,i;const a=this,{state:s}=a;if(!s.canvasSubchartBrushDragging)return!1;a.updateCanvasSubchartBrush(e);const o=s.canvasSubchartBrushMode==="select"&&!s.canvasSubchartBrushMoved,r=s.canvasSubchartBrushMoved||o;return o?(t=a.clearCanvasSubchartDomain)==null||t.call(a,!0,!0):r&&a.config.subchart_onbrush.bind(a.api)((n=s.domain)!=null?n:a.scale.x.orgDomain()),s.canvasSubchartBrushDragging=!1,s.canvasSubchartBrushMode=null,s.canvasSubchartBrushStart=null,s.canvasSubchartBrushOrigin=null,s.canvasSubchartBrushMoved=!1,a.setDragStatus(!1),(i=e.preventDefault)==null||i.call(e),!0},cancelCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;return i.canvasSubchartBrushDragging?(i.canvasSubchartBrushDragging=!1,i.canvasSubchartBrushMode=null,i.canvasSubchartBrushStart=null,i.canvasSubchartBrushOrigin=null,i.canvasSubchartBrushMoved=!1,n.setDragStatus(!1),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSubchartBrushStart(e){const t=this;if(!t.startCanvasSubchartBrush(e))return!1;const n=a=>{t.updateCanvasSubchartBrush(a)},i=a=>{t.endCanvasSubchartBrush(a),N.removeEventListener("mousemove",n),N.removeEventListener("mouseup",i)};return N.addEventListener("mousemove",n),N.addEventListener("mouseup",i),!0},onCanvasClick(e){var t;const n=this,{config:i,state:a}=n;if(a.event=e,a.flowing||a.cancelClick){a.cancelClick=!1;return}n.dispatchCanvasDataClick(e),(t=i.onclick)==null||t.bind(n.api)(e)},onCanvasSelectionDragStart(e){const t=this,{state:n}=t;if(!t.startCanvasSelectionDrag(e))return;const i=s=>{t.updateCanvasSelectionDrag(s)},a=s=>{t.endCanvasSelectionDrag(s),N.removeEventListener("mousemove",i),N.removeEventListener("mouseup",a),n.canvasSelectionDragMoveHandler=null,n.canvasSelectionDragEndHandler=null};n.canvasSelectionDragMoveHandler=i,n.canvasSelectionDragEndHandler=a,N.addEventListener("mousemove",i),N.addEventListener("mouseup",a)},onCanvasPointerDown(e){var t;if(!Sn(this,e))return;const n=this,i=n.$el.canvas.node();if(!n.startCanvasSubchartBrush(e))return;const a=e.pointerId,s=d=>d.pointerId===a,o=d=>{s(d)&&n.updateCanvasSubchartBrush(d)},r=d=>{s(d)&&(n.endCanvasSubchartBrush(d),c())},l=d=>{s(d)&&(n.cancelCanvasSubchartBrush(d),c())};function c(){var d;N.removeEventListener("pointermove",o),N.removeEventListener("pointerup",r),N.removeEventListener("pointercancel",l);try{(d=i.releasePointerCapture)==null||d.call(i,a)}catch(u){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(d){}N.addEventListener("pointermove",o),N.addEventListener("pointerup",r),N.addEventListener("pointercancel",l)},onCanvasPointerEnter(e){var t;Sn(this,e)&&(this.state.event=e,(t=this.config.onover)==null||t.bind(this.api)(e))},onCanvasPointerMove(e){Sn(this,e)&&(this.updateCanvasSubchartBrush(e)||this.onCanvasMouseMove(e))},onCanvasPointerUp(e){var t;if(Sn(this,e)){if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node())}},onCanvasPointerOut(e){var t;Sn(this,e)&&(this.state.canvasSubchartBrushDragging||(this.state.event=e,this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)))},onCanvasPointerCancel(e){var t;if(Sn(this,e)){if(this.state.event=e,this.cancelCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.onCanvasPointerOut(e)}},onCanvasTouchStart(e){var t;e.touches.length>1||(this.state.event=e,!this.startCanvasSubchartBrush(e)&&(this.startCanvasSelectionDrag(e)||((t=this.config.onover)==null||t.bind(this.api)(e),this.onCanvasMouseMove(e))))},onCanvasTouchMove(e){e.touches.length>1||this.updateCanvasSubchartBrush(e)||this.updateCanvasSelectionDrag(e)||this.onCanvasMouseMove(e)},onCanvasTouchEnd(e){var t,n,i;if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}if(this.endCanvasSelectionDrag(e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node()),(i=this.config.onout)==null||i.bind(this.api)(e)},onCanvasTouchCancel(e){var t;this.state.event=e,this.cancelCanvasSubchartBrush(e),this.endCanvasSelectionDrag(e),this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)},onCanvasMouseMove(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:c}=o,d=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const u=Jn(o,e),h=u&&(pp(o,u)||u),f=h?fp(o,h):null;if(!f){if(o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),u&&r.axis_tooltip&&hp(o,u)){o.renderCanvasAxisTooltip(u),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(f,d);const g=el(o,f),p=gp(o,f,g),_=p.map(x=>`${x.id}:${x.index}`).join("|");(l.canvasFocusKey!==_||r.axis_tooltip)&&(l.canvasFocusKey=_,o.renderCanvasFocus(p,h)),(s=o.showTooltip)==null||s.call(o,g,d)},onCanvasMouseOut(){var e;const t=this.$el.canvas.node();t.style.cursor="",this.dispatchCanvasDataOut(t),this.state.canvasFocusKey?(this.state.canvasFocusKey=null,this.clearCanvasFocus()):this.config.axis_tooltip&&this.clearCanvasFocus(),(e=this.hideTooltip)==null||e.call(this)},showCanvasLinkedTooltip(e){var t,n,i,a;const s=this,{$el:o,state:r}=s,l=(t=o.canvas)==null?void 0:t.node(),d=s.filterTargetsToShow(s.data.targets).map(x=>x.values[e]).find(Boolean);if(!l||!d)return(n=s.hideTooltip)==null||n.call(s),!1;const u=el(s,d),h=u.find(x=>x&&Rt(s,x))||u[0];if(!u.length||!h)return(i=s.hideTooltip)==null||i.call(s),!1;const{left:f,top:g}=ht(l,!0),p=zn(s,h),_=[r.margin.left+p.x,r.margin.top+p.y];return r.event={clientX:f+_[0],clientY:g+_[1],currentTarget:l,target:l},r.canvasFocusKey=u.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(u,_),(a=s.showTooltip)==null||a.call(s,u,l),!0},renderCanvasZoomBrush(e,t){const n=this;n.canvasEngine.withOverlay(i=>{n.canvasRenderer.withContext(i,()=>{n.canvasRenderer.drawZoomBrush(n,e,t)})})},clearCanvasZoomBrush(){this.canvasEngine.clearOverlay()},renderCanvasSelectionDrag(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasRenderer.withContext(n,()=>{t.canvasRenderer.drawSelectionDragArea(t,e)})})},renderCanvasFrame(e,t,n=!1){const i=this,{state:a}=i,s=e||a.canvasShape||i.getDrawShape();a.canvasShape=s,a._canvasVisibleRangeCache=null,a._canvasXTickValuesCache=null,i.canvasEngine.beginFrame(a.current.width,i.getCanvasSurfaceHeight());try{i.canvasRenderer.drawBackground(i),i.canvasAxisRenderer.drawTitle(i),a.hasAxis&&i.canvasAxisRenderer.draw(i),i.canvasRenderer.draw(i,s),a.hasAxis&&i.config.grid_lines_front&&i.canvasAxisRenderer.drawGridLines(i),i.canvasRenderer.drawSubchart(i,s),a.hasAxis&&i.canvasAxisRenderer.drawSubXAxis(i),a.hasAxis&&i.canvasAxisRenderer.drawSubYAxes(i),i.canvasRenderer.drawEmptyLabel(i),n&&i.hitDetector.rebuild(i,s)}finally{i.canvasEngine.endFrame()}i.canvasEngine.clearOverlay(),a.canvasFocusMainRedraw=!1,t&&i.renderCanvasFocus(t)},renderCanvasFocus(e,t){var n,i;const a=this,{state:s}=a,o=(i=(n=a.canvasRenderer).hasExpandedShapeFocus)==null?void 0:i.call(n,a,e);if(o){const r=s.canvasShape||a.getDrawShape();a.canvasEngine.beginFrame(s.current.width,a.getCanvasSurfaceHeight());try{a.canvasRenderer.drawBackground(a),a.canvasAxisRenderer.drawTitle(a),s.hasAxis&&a.canvasAxisRenderer.draw(a),a.canvasRenderer.draw(a,r,e),s.hasAxis&&a.config.grid_lines_front&&a.canvasAxisRenderer.drawGridLines(a),a.canvasRenderer.drawSubchart(a,r),s.hasAxis&&a.canvasAxisRenderer.drawSubXAxis(a),s.hasAxis&&a.canvasAxisRenderer.drawSubYAxes(a),a.canvasRenderer.drawEmptyLabel(a)}finally{a.canvasEngine.endFrame()}}s.canvasFocusMainRedraw=!!o,a.canvasEngine.withOverlay(r=>{a.canvasRenderer.withContext(r,()=>{a.canvasRenderer.drawFocus(a,e)}),a.canvasAxisRenderer.withContext(r,()=>{a.canvasAxisRenderer.drawFocusedXAxisTick(a,e),t&&a.canvasAxisRenderer.drawAxisTooltip(a,t)})})},renderCanvasAxisTooltip(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasAxisRenderer.withContext(n,()=>{t.canvasAxisRenderer.drawAxisTooltip(t,e)})})},clearCanvasFocus(){var e;const t=this;t.state.canvasFocusMainRedraw?(t.state.canvasFocusMainRedraw=!1,t.renderCanvasFrame(void 0,null,!1)):(e=t.canvasEngine)==null||e.clearOverlay()},resizeCanvas(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();n.clearResizePreview(),s.chart.style("min-height",`${a.current.height}px`),(e=n.canvasEngine)==null||e.resize(a.current.width,n.getCanvasSurfaceHeight()),(t=n.canvasTheme)==null||t.reload(o,i.canvas_theme)}};let ll=()=>(St(ge.prototype,Lp),(ll=()=>"canvas")());var cl={category(e,t){const n=this.internal,{config:i}=n;return arguments.length>1&&(i.axis_x_categories[e]=t,n.state.dirty.data=!0,n.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:n}=t;if(!e||!Array.isArray(e)){const i=n.axis_x_categories;return se(i)?Object.values(t.data.xs)[0]:i}return n.axis_x_categories=e,t.state.dirty.data=!0,t.redraw(),n.axis_x_categories}};function Rp(e){const t=this.config;let n,i,a;const s=()=>{const o=i.shift();if(o&&n&&Ut(n)&&o in n)return n=n[o],s();if(!o)return n};Object.keys(t).forEach(o=>{n=e,i=o.split("_"),a=s(),ct(a)&&(t[o]=a)}),this.api&&(this.state.orgConfig=e)}var Ep={resize(e){const t=this.internal,{config:n,state:i}=t;i.rendered&&(n.size_width=e?e.width:null,n.size_height=e?e.height:null,i.resizing=!0,i.dirty.size=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,n;const i=this.internal,{state:a,$el:{zoomResetBtn:s}}=i;a.rendered?(a.resizing?(t=i.brush)==null||t.updateResize():(n=i.axis)==null||n.setOrient(),s==null||s.style("display","none"),i.scale.zoom&&(a.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,a.resizing||(a.dirty.data=!0),e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!a.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),a.current.zoomDomain&&(i.api.zoom(a.current.zoomDomain),a.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e,t,n,i,a,s,o,r,l,c,d,u;const h=this.internal,{state:f,$el:{chart:g,style:p,svg:_}}=h;if(bt(h)){h.callPluginHook("$willDestroy"),(e=h.cache)==null||e.remove(["setOverOut","callOverOutForTouch"]),h.charts.splice(h.charts.indexOf(this),1),h.charts.length===0&&zf(),h.unbindAllEvents(),_==null||_.select("*").interrupt(),f.canvasFlowFrame!==null&&((n=(t=N).cancelAnimationFrame)==null||n.call(t,f.canvasFlowFrame)),f.canvasFlowFrame=null,f.canvasFlowFinish=null,f.pendingRaf!==null&&((a=(i=N).cancelAnimationFrame)==null||a.call(i,f.pendingRaf)),f.pendingRaf=null,(s=h.canvasRenderer)==null||s.destroy(),(o=h.canvasEngine)==null||o.destroy(),(r=h.resizeFunction)==null||r.clear(),(c=(l=h.resizeFunction)==null?void 0:l.clearLive)==null||c.call(l),(u=(d=h.resizeFunction)==null?void 0:d.resizeObserver)==null||u.disconnect(),h.resizeFunction&&N.removeEventListener("resize",h.resizeFunction),g.classed("bb",!1).style("position",null),f.isCanvasMode&&g.style("min-height",f.canvasInlineStyle.minHeight||null),g.selectChildren().remove(),p&&p.parentNode.removeChild(p),Object.keys(this).forEach(x=>{x==="internal"&&Object.keys(h).forEach(m=>{h[m]=null}),this[x]=null,delete this[x]});for(const x in this)this[x]=()=>{}}return null},config(e,t,n){const i=this.internal,{config:a,state:s}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in a?ct(t)?(a[o]=t,r=t,n&&this.flush()):r=a[o]:(arguments.length===0||se(e))&&(r=s.orgConfig),r}},Pp={color(e){return this.internal.color(e)}};const ul=function(e){const{targets:t}=this.internal.data;if(!Ct(e)){const n=ot(e)?e:[e];return t.filter(i=>n.some(a=>a===i.id))}return t};St(ul,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let n=null;if(e){const i=this.data(e);ot(i)&&(n=[],i.forEach(a=>{t?a.values.forEach(s=>n.push(s.value)):n.push(a.values.map(s=>s.value))}))}return n},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var Dp={data:ul},Ip={focus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n),r=new Set(o),l=n.mapToTargetIds().filter(c=>!r.has(c)&&n.isTargetToShow(c));n.revertLegend(),n.toggleFocusLegend(l,!1),n.toggleFocusLegend(o,!0),i.focusedTargetIds=r,i.defocusedTargetIds=new Set(l),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}const s=n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),s.classed(lt.focused,!0).classed(lt.defocused,!1),n.hasArcType()&&!i.hasRadar&&(n.expandArc(a),n.hasType("gauge")&&n.markOverlapped(e,n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!0),i.focusedTargetIds=new Set(a),a.forEach(o=>i.defocusedTargetIds.delete(o))},defocus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n);n.toggleFocusLegend(o,!1),o.forEach(r=>i.focusedTargetIds.delete(r)),i.defocusedTargetIds=new Set(o),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n))).classed(lt.focused,!1).classed(lt.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(a),n.hasType("gauge")&&n.undoMarkOverlapped(n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!1),a.forEach(o=>i.focusedTargetIds.delete(o)),i.defocusedTargetIds=new Set(a)},revert(e){var t,n,i;const a=this.internal,{config:s,state:o,$el:r}=a,l=a.mapToTargetIds(e),c=()=>{s.legend_show&&(a.showLegend(l.filter(a.isLegendToShow.bind(a))),r.legend.selectAll(a.selectorLegends(l)).filter(function(){return(0,F.select)(this).classed(lt.legendItemFocused)}).classed(lt.legendItemFocused,!1))};if(o.isCanvasMode){const u=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,u&&((i=a.renderCanvasFrame)==null||i.call(a,void 0,null,!1));return}r.svg.selectAll(a.selectorTargets(l)).classed(lt.focused,!1).classed(lt.defocused,!1),a.hasArcType(null,["polar"])&&a.unexpandArc(l),c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set}},Mp={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Fp={load(e){const t=this.internal,{config:n}=t;t.state.dirty.data=!0,t.state._eventRectFingerprint=null,e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(s=>{n.data_classes[s]=e.classes[s]}),"categories"in e&&t.axis.isCategorized()&&(n.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(s=>{n.data_axes[s]=e.axes[s]}),"colors"in e&&Object.keys(e.colors).forEach(s=>{n.data_colors[s]=e.colors[s]}),"regions"in e&&(n.data_regions=e.regions||{});const i=["data","columns","rows","json","url"].some(s=>s in e),a="unload"in e&&e.unload!==!1;if("regions"in e&&!i&&!a){t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),Li.call(t,e.done,e.resizeAfter);return}if(a){const s=t.mapToTargetIds(e.unload===!0?null:e.unload);t.unload(s,()=>{!t.config||!t.cache||(t.cache.remove(s),Ts(()=>t.loadFromArgs(e)))})}else t.loadFromArgs(e)},unload(e){const t=this.internal;let n=e||{};se(n)&&this.tooltip.hide(),ot(n)?n={ids:n}:Q(n)&&(n={ids:[n]});const i=t.mapToTargetIds(n.ids);t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.unload(i,()=>{!t.config||!t.cache||(t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),Li.call(t,n.done,n.resizeAfter))})}};function Oi(e,t,n,i=!1){var a;const s=this.internal,o=s.mapToTargetIds(t),r=new Set(o),l=[...s.state.hiddenTargetIds].filter(u=>r.has(u));if(s.state.toggling=!0,s.state.dirty.visibility=!0,s[`${e?"remove":"add"}HiddenTargetIds`](o),s.state.isCanvasMode){e&&l.length?H(s.config.data_onshown,this,l):!e&&l.length===0&&H((a=s.config)==null?void 0:a.data_onhidden,this,o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1;return}const c=s.$el.svg.selectAll(s.selectorTargets(o)),d=e?null:"0";e&&l.length&&(c.style("display",null),H(s.config.data_onshown,this,l)),s.$T(c).style("opacity",d,"important").call(ri,()=>{var u;!e&&l.length===0&&(c.style("display","none"),H((u=s.config)==null?void 0:u.data_onhidden,this,o)),c.style("opacity",d)}),n.withLegend&&s[`${e?"show":"hide"}Legend`](o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1}var Op={show(e,t={}){Oi.call(this,!0,e,t)},hide(e,t={}){Oi.call(this,!1,e,t)},toggle(e,t={}){const n=this.internal,i={show:[],hide:[]};n.mapToTargetIds(e).forEach(a=>i[n.isTargetToShow(a)?"hide":"show"].push(a)),i.show.length&&i.hide.length?(Oi.call(this,!0,i.show,t,!0),Oi.call(this,!1,i.hide,t)):(i.show.length&&this.show(i.show,t),i.hide.length&&this.hide(i.hide,t))}},$p={tooltip:{show:function(e){var t,n,i,a,s,o,r,l,c,d,u,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:_,hasFunnel:x,hasTreemap:m,inputType:v}}=f;let b,y;if(e.mouse&&(y=e.mouse),e.data){const{data:T}=e,w=(t=f.getYScaleById(T.id))==null?void 0:t(T.value);if((x||m)&&T.id){const C=f.selectorTarget(T.id,void 0,`.${At.shape}`);_.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),b=(i=T.index)!=null?i:f.hasArcType()&&T.id?(n=f.getArcElementByIdOrIndex(T.id))==null?void 0:n.datum().index:f.getIndexByX(T.x))}else ct(e.x)?b=f.getIndexByX(e.x):ct(e.index)&&(b=e.index);if(f.state.isCanvasMode){const T=((a=f.filterTargetsToShow)==null?void 0:a.call(f))||f.data.targets,w=(s=e.data)!=null&&s.id&&!p.tooltip_grouped?T.filter(L=>L.id===e.data.id).map(L=>L.values[b!=null?b:e.data.index]).filter(Boolean):T.map(L=>L.values[b]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),k=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],A=y||(S&&((c=k==null?void 0:k.pos)!=null&&c.cx)&&((d=k==null?void 0:k.pos)!=null&&d.cy)?[f.state.margin.left+k.pos.cx(S),f.state.margin.top+k.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(u=f.renderCanvasFocus)==null||u.call(f,w,A),(h=f.showTooltip)==null||h.call(f,w,C);return}(v==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,b,y)})},hide:function(){var e,t,n,i,a;const s=this.internal,{state:{inputType:o,isCanvasMode:r},$el:{tooltip:l}}=s,c=l==null?void 0:l.datum();if(r){s.state.canvasFocusKey=null,s.hideTooltip(!0),(e=s.clearCanvasFocus)==null||e.call(s);return}if((t=c==null?void 0:c.data)!=null&&t[0]){const{index:d}=c.data[0];(o==="mouse"?["mouseout"]:["touchend"]).forEach(u=>{s.dispatchEvent(u,d)})}o==="touch"&&s.callOverOutForTouch(),s.hideTooltip(!0),(n=s.hideGridFocus)==null||n.call(s),(i=s.unexpandCircles)==null||i.call(s),(a=s.expandBarTypeShapes)==null||a.call(s,!1)}}},Bp=Object.defineProperty,zp=(e,t,n)=>t in e?Bp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dl=(e,t,n)=>zp(e,typeof t!="symbol"?t+"":t,n);class Yt{constructor(t){dl(this,"plugins",[]),dl(this,"internal");const n=new ge(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=z(a[r]),c=s!==o,d=bt(a[r]),u=d&&Object.keys(a[r]).length>0;l&&(!c&&u||c)?s[r]=a[r].bind(o):d&&!l?s[r]={}:s[r]=a[r],u&&i(a[r],s[r],o)})})(Yt.prototype,this,this),Rp.call(n,t),n.beforeInit(),n.init()}}St(Yt.prototype,[Ep,Pp,Dp,Ip,Mp,Fp,Op,$p]);let hl=()=>(Yt.prototype.category=cl.category,Yt.prototype.categories=cl.categories,(hl=()=>({}))());const Np=e=>{var t,n;return(n=(t=N).btoa)==null?void 0:n.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,a)=>String.fromCharCode(+`0x${a}`)))};function Xp(e,t,n){const{width:i,height:a}=t||n,s=new XMLSerializer,o=e.cloneNode(!0),r=Cf(nn(nt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",F.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=s.serializeToString(o),c=nt.createElement("style");c.appendChild(nt.createTextNode(r.join(`
`)));const d=s.serializeToString(c),u=`<svg xmlns="${F.namespaces.svg}" width="${i}" height="${a}" 
		viewBox="0 0 ${n.width} ${n.height}" 
		preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
			<foreignObject width="100%" height="100%">
				${d}
				${l.replace(/(url\()[^#]+/g,"$1")}
			</foreignObject></svg>`;return`data:image/svg+xml;base64,${Np(u)}`}function Gp(e,t){const{top:n,left:i}=t,{x:a,y:s}=Ue(e,!0),{a:o,b:r,c:l,d:c,e:d,f:u}=e.getScreenCTM(),{width:h,height:f}=ht(e,!0);return{x:o*a+l*s+d-i,y:r*a+c*s+u-n+(f-Math.round(f/4)),width:h,height:f}}function Vp(e){const{left:t,top:n}=ht(e),i=s=>s.textContent||s.childElementCount,a=[];return nn(e.querySelectorAll("text")).filter(i).forEach(s=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}=N.getComputedStyle(r),{x:f,y:g,width:p,height:_}=Gp(r,{left:t,top:n});return{[r.textContent]:{x:f,y:g,width:p,height:_,fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}}};s.childElementCount>1?nn(s.querySelectorAll("tspan")).filter(i).forEach(r=>{a.push(o(r))}):a.push(o(s))}),a}function Wp(e,t){t.forEach(n=>{Object.keys(n).forEach(i=>{const{x:a,y:s,width:o,height:r,fill:l,fontFamily:c,fontSize:d,transform:u}=n[i];if(e.save(),e.font=`${d} ${c}`,e.fillStyle=l,u==="none")e.fillText(i,a,s);else{const h=u.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(f=>+f==0)?(h.push(a+o-o/4),h.push(s-r+r/3)):(h.push(a),h.push(s)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}function Yp(e,t,n){const{width:i,height:a}=t||n,s=nt.createElement("canvas"),o=s.getContext("2d");if(s.width=i,s.height=a,o){let l=0,c=i,d=a;if((t==null?void 0:t.preserveAspectRatio)!==!1){const u=Math.min(i/n.width,a/n.height);c=n.width*u,d=n.height*u,l=(a-d)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,d)}return s.toDataURL(t.mimeType)}var Hp={export(e,t){var n;const i=this.internal,{state:a,$el:{chart:s,svg:o}}=i,r=(n=i.canvasEngine)==null?void 0:n.canvas,l=a.isCanvasMode&&r?ht(r,!0):null,{width:c,height:d}=l&&l.width&&l.height?{width:l.width,height:l.height}:a.current,u=ke(Object.create(null),{width:c,height:d,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(a.isCanvasMode&&r){const g=Yp(r,u,{width:c,height:d});return t==null||t.bind(this)(g),g}const h=Xp(s.node(),u,{width:c,height:d}),f=u.preserveFontStyle?Vp(o.node()):[];if(t&&z(t)){const g=new Image;g.crossOrigin="Anonymous",g.onload=()=>{const p=nt.createElement("canvas"),_=p.getContext("2d");p.width=u.width||c,p.height=u.height||d,_.drawImage(g,0,0),f.length&&(Wp(_,f),f.length=0),t.bind(this)(p.toDataURL(u.mimeType))},g.src=h}return h}};let fl=()=>(Yt.prototype.export=Hp.export,(fl=()=>({}))());var jp={flow(e){const t=this.internal;let n;(e.json||e.rows||e.columns)&&t.convertData(e,a=>{n=a,i()});function i(){var a,s,o;let r,l=0,c=0,d,u;if(t.state.redrawing||!n||!Zn())return;(a=t.flushCanvasFlow)==null||a.call(t);const h=[],f=t.getMaxDataCount(),g=t.convertDataToTargets(n,!0),p=t.axis.isTimeSeries();t.data.targets.forEach(m=>{let v=!1;for(let b=0;b<g.length;b++)if(m.id===g[b].id){v=!0,m.values[m.values.length-1]&&(c=m.values[m.values.length-1].index+1);const y=g[b].values;l=y.length;for(let T=0;T<l;T++)y[T].index=c+T,p||(y[T].x=c+T),m.values.push(y[T]);g.splice(b,1);break}!v&&h.push(m.id)}),t.data.targets.forEach(m=>{for(let v=0;v<h.length;v++)if(m.id===h[v]){if(!m.values[m.values.length-1])continue;c=m.values[m.values.length-1].index+1;for(let b=0;b<l;b++)m.values.push({id:m.id,index:c+b,x:p?t.getOtherTargetX(c+b):c+b,value:null})}}),t.data.targets.length&&g.forEach(m=>{const v=t.data.targets[0].values[0].index,b=m.values,y=b.length,T=Math.max(c-v,0);if(T){b.length=y+T;for(let w=y-1;w>=0;w--)b[w+T]=b[w];for(let w=0;w<T;w++){const C=v+w;b[w]={id:m.id,index:C,x:p?t.getOtherTargetX(C):C,value:null}}}for(let w=T;w<b.length;w++){const C=b[w];C.index+=c,p||(C.x+=c)}});for(let m=0;m<g.length;m++)t.data.targets.push(g[m]);const _=t.data.targets[0],x=_.values[0];if(ct(e.to)?(l=0,u=p?Vt.call(t,e.to):e.to,_.values.forEach(m=>{m.x<u&&l++})):ct(e.length)&&(l=e.length),f?f===1&&p&&(d=(_.values[_.values.length-1].x-x.x)/2,r=[new Date(+x.x-d),new Date(+x.x+d)]):(p?d=_.values.length>1?_.values[_.values.length-1].x-x.x:x.x-t.getXDomain(t.data.targets)[0]:d=1,r=[x.x-d,x.x]),r&&t.updateXDomain(null,!0,!0,!1,r),t.state.isCanvasMode){const m=q(e.duration)?e.duration:t.config.transition_duration;if((s=t.animateCanvasFlow)==null?void 0:s.call(t,{done:e.done,duration:m,length:l,orgDataCount:f}))return;l&&f&&t.data.targets.forEach(b=>{b.values.splice(0,l)}),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),t.updateTypesElements(),(o=e.done)==null||o.call(t.api);return}t.updateTargets(t.data.targets),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({flow:{index:x.index,length:l,duration:q(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:f},withLegend:!0,withTransition:f>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},Up={generateFlow(e){const t=this,{data:n,state:i,$el:a}=t;return function(){var s;const o=e.flow.length;i.flowing=!0,n.targets.forEach(l=>{l.values.splice(0,o)}),i.dataGeneration++,t.updateXGrid&&t.updateXGrid(!0);const r={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(l=>{const c=l.split(".");let d=a[c[0]];d&&c.length>1&&(d=d[c[1]]),d!=null&&d.size()&&(r[l]=d)}),(s=t.hideGridFocus)==null||s.call(t),t.setFlowList(r,e)}},setFlowList(e,t){const n=this,{flow:i,targets:a}=t,{duration:s=t.duration,index:o,length:r,orgDataCount:l}=i,c=n.getFlowTransform(a,l,o,r),d=fr();let u;d.add(Object.keys(e).map(h=>(u=e[h].transition().ease(f=>+f).duration(s),h==="axis.x"?u=u.call(f=>{n.axis.x.setTransition(f).create(f)}):h==="region.list"?u=u.filter(n.isRegionOnX).attr("transform",c):u=u.attr("transform",c),u))),u.call(d,()=>{n.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const n=this,{config:i,state:a,$el:{svg:s}}=n,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:d,cy:u,xForText:h,yForText:f}=l.pos,{done:g=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(_=>{const x=[];for(let m=0;m<p;m++)x.push(`.${V[_]}-${m}`);s.selectAll(`.${V[`${_}s`]}`).selectAll(x).remove()}),s.select(`.${V.xgrid}`).remove()),Object.keys(e).forEach(_=>{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(a.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?a.width:c),x.select("text").attr("x",o?a.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",f).style("fill-opacity",n.opacityForText.bind(n));else if(_==="circle")if(n.isCirclePoint())x.attr("cx",d).attr("cy",u);else{const m=b=>d(b)-i.point_r,v=b=>u(b)-i.point_r;x.attr("x",m).attr("y",v)}else _==="region.list"&&x.select("rect").filter(n.isRegionOnX).attr("x",n.regionX.bind(n)).attr("width",n.regionWidth.bind(n))}),i.interaction_enabled&&n.redrawEventRect(),g.call(n.api),a.flowing=!1},getFlowTransform(e,t,n,i){const a=this,{data:s,scale:{x:o}}=a,r=s.targets[0].values;let l=a.getValueOnIndex(r,n),c=a.getValueOnIndex(r,n+i),d;const u=o.domain(),h=a.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?d=o(u[0])-o(h[0]):d=a.axis.isTimeSeries()?o(u[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?d=o(u[0])-o(h[0]):a.axis.isTimeSeries()?(l=a.getValueOnIndex(r,0),c=a.getValueOnIndex(r,r.length-1),d=o(l.x)-o(c.x)):d=en(h)/2;const f=en(u)/en(h);return`translate(${d},0) scale(${f},1)`}};let gl=()=>(St(ge.prototype,Up),Yt.prototype.flow=jp.flow,(gl=()=>({}))());function pl(e){return Array.isArray(e)?e:[e]}function _l(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Ja(e,t){const n=this.internal,{config:i}=n,a=i.transition_duration&&Zn(),s=`grid_${t}_lines`;return e?(i[s]=pl(e),n.state.isCanvasMode?(_l(n),i[s]):(n.updateGrid(),n.redrawGrid(a),i[s])):i[s]}function xl(e,t){const n=`grid_${t}_lines`;return Ja.bind(this)(this.internal.config[n].concat(e?pl(e):[]),t)}function ml(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){const a=((n=i.getGridFilterToRemove)==null?void 0:n.call(i,e))||(()=>!0),s=`grid_${t?"x":"y"}_lines`;i.config[s]=i.config[s].filter(o=>!a(o)),_l(i);return}i.removeGridLines(e,t)}const vl=function(e){return Ja.bind(this)(e,"x")};St(vl,{add(e){return xl.bind(this)(e,"x")},remove(e){return ml.bind(this)(e,!0)}});const bl=function(e){return Ja.bind(this)(e,"y")};St(bl,{add(e){return xl.bind(this)(e,"y")},remove(e){return ml.bind(this)(e,!1)}});var yl={xgrids:vl,ygrids:bl};const Kp=`line.${lt.xgridFocus}:not(.${lt.xgridFocusContinuous}), line.${lt.ygridFocus}`,Zp=e=>q(e.position)||"end",qp=e=>e.position==="start"?4:e.position==="middle"?0:-4;function Tl(e){var t;const{state:n,$el:{main:i}}=e,a=n._gridFocusEl,s=i.node(),o=((t=a==null?void 0:a.nodes)==null?void 0:t.call(a))||[];return o.length&&o.every(r=>s==null?void 0:s.contains(r))?a:n._gridFocusEl=i.selectAll(Kp)}function wl(e){e.$el.main.select(`line.${lt.xgridFocusContinuous}`).style("visibility","hidden")}function Cl(e,t,n){return i=>{let a=e?0:t;return i.position==="start"?a=e?-n:0:i.position==="middle"&&(a=(e?-n:t)/2),a}}function Sl(e,t){t==="grid"&&e.each(function(){const n=(0,F.select)(this);["x1","x2","y1","y2"].forEach(i=>n.attr(i,+n.attr(i)))})}var Jp={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:n},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${U.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${kt.grid} ${kt.gridLines}`),i.gridLines.main.append("g").attr("class",kt.xgridLines),i.gridLines.main.append("g").attr("class",kt.ygridLines),i.gridLines.x=(0,F.selectAll)([]))},updateXGrid(e){const t=this,{config:n,scale:i,state:a,$el:{main:s,grid:o}}=t,r=n.axis_rotated,l=t.generateGridData(n.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,d=u=>(i.zoom||i.x)(u)+c*(r?-1:1);a.xgridAttr=r?{x1:0,x2:a.width,y1:d,y2:d}:{x1:d,x2:d,y1:0,y2:a.height},o.x=s.select(`.${kt.xgrids}`).selectAll(`.${kt.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",kt.xgrid).merge(o.x),e||o.x.each(function(){const u=(0,F.select)(this);Object.keys(a.xgridAttr).forEach(h=>{u.attr(h,a.xgridAttr[h])}),u.style("opacity",()=>+u.attr(r?"y1":"x1")===(r?a.height:0)?"0":null)})},updateYGrid(){const e=this,{axis:t,config:n,scale:i,state:a,$el:{grid:s,main:o}}=e,r=n.axis_rotated,l=u=>i.y(u),c=t.y.getGeneratedTicks(n.grid_y_ticks),d=c!=null&&c.length?c:e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${kt.ygrids}`).selectAll(`.${kt.ygrid}`).data(d),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",kt.ygrid).merge(s.y),s.y.attr("x1",r?l:0).attr("x2",r?l:a.width).attr("y1",r?0:l).attr("y2",r?a.height:l),Sl(s.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:n}}=e;!n.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:n,$el:{gridLines:i,main:a},$T:s}=t,o=n.axis_rotated,r=e==="x";n[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=a.select(`.${kt[`${e}gridLines`]}`).selectAll(`.${kt[`${e}gridLine`]}`).data(n[`grid_${e}_lines`]);s(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(d){const u=(0,F.select)(this);u.select("text").empty()&&d.text&&u.append("text").style("opacity","0")}),s(l.attr("class",d=>`${kt[`${e}gridLine`]} ${d.class||""}`.trim()).select("text").attr("text-anchor",Zp).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",qp).attr("dy",-5)).text(function(d){var u;return(u=d.text)!=null?u:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:n},state:{width:i,height:a},$el:{gridLines:s},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=s.x.select("line"),d=s.x.select("text"),u=s.y.select("line"),h=s.y.select("text");return c=o(c,e).attr("x1",n?0:r).attr("x2",n?i:r).attr("y1",n?r:0).attr("y2",n?r:a),d=o(d,e).attr("x",Cl(!n,i,a)).attr("y",r),u=o(u,e).attr("x1",n?l:0).attr("x2",n?l:i).attr("y1",n?0:l).attr("y2",n?a:l),h=o(h,e).attr("x",Cl(n,i,a)).attr("y",l),[c.style("opacity",null),d.style("opacity",null),u.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:n,state:{clip:i},$el:a}=e;n._gridFocusEl=null;const s=t.grid_front,o=`.${s&&a.gridLines.main?kt.gridLines:U.chart}${s?" + *":""}`,r=a.main.insert("g",o).attr("clip-path",i.pathGrid).attr("class",kt.grid);if(a.grid.main=r,t.grid_x_show&&r.append("g").attr("class",kt.xgrids),t.grid_y_show&&r.append("g").attr("class",kt.ygrids),t.axis_tooltip){const l=r.append("g").attr("class","bb-axis-tooltip");l.append("line").attr("class","bb-axis-tooltip-x"),l.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(r.append("g").attr("class",lt.xgridFocus).append("line").attr("class",lt.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",lt.ygridFocus).append("line").attr("class",lt.ygridFocus),t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&a.main.insert("g",o).attr("class",lt.xgridFocusContinuous).append("line").attr("class",`${lt.xgridFocus} ${lt.xgridFocusContinuous}`).style("visibility","hidden"))},showAxisGridFocus(){var e,t;const n=this,{config:i,format:a,state:{event:s,width:o,height:r}}=n,l=i.axis_rotated,[c,d]=Zt(s,(e=n.$el.eventRect)==null?void 0:e.node()),u={x:c,y:d};for(const[h,f]of Object.entries(n.$el.axisTooltip)){const g=h==="x"&&!l||h!=="x"&&l?"x":"y",p=u[g];let _=(t=n.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&n.axis.isTimeSeries()?a.xAxisTick(_):_==null?void 0:_.toFixed(2),f==null||f.attr(g,p).text(_))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,f){const g=(0,F.select)(this);f===0?g.attr("x1",c).attr("x2",c).attr("y1",f?0:r).attr("y2",f?r:0):g.attr("x1",f?0:o).attr("x2",f?o:0).attr("y1",d).attr("y2",d)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${It.axisTooltipX}, line.${It.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const n=this,{config:i,state:{width:a,height:s}}=n,o=i.axis_rotated,r=Tl(n),l=(e||[r.datum()]).filter(u=>u&&q(n.getBaseValue(u)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,d=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(u){const h=(0,F.select)(this),f={x:d(u),y:n.getYScaleById(u.id)(u.value)};let g;if(h.classed(lt.xgridFocus))g=o?[null,f.x,c?f.y:a,f.x]:[f.x,c?f.y:null,f.x,s];else{const p=n.axis.getId(u.id)==="y2";g=o?[f.y,c&&!p?f.x:null,f.y,c&&p?f.x:s]:[c&&p?f.x:null,f.y,c&&!p?f.x:a,f.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,g[_]))}),Sl(r,"grid"),(t=n.showCircleFocus)==null||t.call(n,e)},hideGridFocus(e=!1){var t;const n=this,{state:{inputType:i,resizing:a}}=n;(e||i==="mouse"||!a)&&(Tl(n).style("visibility","hidden"),wl(n),(t=n.hideCircleFocus)==null||t.call(n))},updateGridFocus(){var e;const t=this,{state:{inputType:n,width:i,height:a,resizing:s},$el:{grid:o}}=t,r=o.main.select(`line.${lt.xgridFocus}`);if(n==="touch")r.empty()?s&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:a),wl(t)}return!0},generateGridData(e,t){const n=this,i=n.$el.main.select(`.${It.axisX}`).selectAll(".tick").size();let a=[];if(e==="year"){const s=n.getXDomain(n.data.targets),[o,r]=s.map(l=>l.getFullYear());for(let l=o;l<=r;l++)a.push(new Date(`${l}-01-01 00:00:00`))}else a=t.ticks(_e),a.length>i&&(a=a.filter(s=>String(s).indexOf(".")<0));return a},getGridFilterToRemove(e){return e?t=>{let n=!1;return(ot(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(n=!0)}),n}:()=>!0},removeGridLines(e,t){const n=this,{config:i,$T:a}=n,s=n.getGridFilterToRemove(e),o=d=>!s(d),r=t?kt.xgridLines:kt.ygridLines,l=t?kt.xgridLine:kt.ygridLine;a(n.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(s)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},Qp={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0};let kl=()=>(St(ge.prototype,Jp),Yt.prototype.xgrids=yl.xgrids,Yt.prototype.ygrids=yl.ygrids,cn.setOptions([Qp]),(kl=()=>({}))());function Al(e,t,n,i){const a=this,{config:s,$el:{main:o}}=a,r=s.data_selection_grouped,l=s.data_selection_isselectable.bind(a.api),c=ct(t)?[].concat(t):null,d=e&&!s.data_selection_multiple;let u=!d;const h=(f,g,p)=>{a.unselectPoint(f,g,p),f.interrupt().remove()};a.getTargetsToShow().forEach(f=>{const{id:g}=f,p=r||!c||c.indexOf(g)>=0,_=o.select(`.${ut.selectedCircles}${a.getTargetSelectorSuffix(g)}`);f.values.forEach(x=>{const{index:m}=x,v=!n||n.indexOf(m)>=0,b=_.selectAll(`.${ut.selectedCircle}-${m}`),y=!b.empty();e?p&&v&&l(x)&&(!y||d)?(u||(Al.call(a,!1),u=!0),a.selectPoint(null,x,m)):(!d||u)&&ct(i)&&i&&y&&h(b,x,m):p&&v&&y&&h(b,x,m)})})}function Qa(e=!1,t,n,i){var a;const s=this,{config:o,$el:{main:r}}=s,l=o.data_selection_grouped,c=o.data_selection_isselectable.bind(s.api),d=e&&!o.data_selection_multiple;let u=!d;if(o.data_selection_enabled){if(d&&(n=n!=null&&n.length?[n[0]]:[0],l||(t=(ct(t)?[].concat(t):s.getTargetsToShow().map(f=>f.id)).slice(0,1))),(a=s.isPointFocusOnly)!=null&&a.call(s)){Al.call(s,e,t,n,i);return}r.selectAll(`.${At.shapes}`).selectAll(`.${At.shape}`).each(function(h){const f=(0,F.select)(this),{id:g,index:p}=h.data?h.data:h,_=l||!t||t.indexOf(g)>=0,x=!n||n.indexOf(p)>=0;if(f.classed(we.line)||f.classed(Ci.area))return;const m=s.getToggle(this,h).bind(s),v=f.classed(ut.SELECTED);e?_&&x&&c(h)&&(!v||d)?(u||(Qa.call(s,!1),u=!0),!f.classed(ut.SELECTED)&&m(!0,f.classed(ut.SELECTED,!0),h,p)):(!d||u)&&ct(i)&&i&&v&&m(!1,f.classed(ut.SELECTED,!1),h,p):_&&x&&c(h)&&v&&m(!1,f.classed(ut.SELECTED,!1),h,p)})}}var t_={selected(e){var t,n;const i=this.internal,a=[];return i.state.isCanvasMode?((t=i.getCanvasSelectedData)==null?void 0:t.call(i,e))||a:(n=i.isPointFocusOnly)!=null&&n.call(i)?(i.$el.main.selectAll(`.${ut.selectedCircles+i.getTargetSelectorSuffix(e)}`).selectAll(`.${ut.selectedCircle}`).each(s=>a.push(s)),a):(i.$el.main.selectAll(`.${At.shapes+i.getTargetSelectorSuffix(e)}`).selectAll(`.${At.shape}`).filter(function(){return(0,F.select)(this).classed(ut.SELECTED)}).each(s=>a.push(s)),a)},select(e,t,n){var i;const a=this.internal;if(a.state.isCanvasMode){(i=a.setCanvasSelection)==null||i.call(a,!0,e,t,n);return}Qa.bind(a)(!0,e,t,n)},unselect(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){(n=i.setCanvasSelection)==null||n.call(i,!1,e,t);return}Qa.bind(i)(!1,e,t)}},e_={drag(e){const t=this,{config:n,state:i,$el:{main:a}}=t,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(t.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!t.zoom.altDomain||!n.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,d]=e,u=Math.min(r,c),h=Math.max(r,c),f=s?i.margin.top:Math.min(l,d),g=s?i.height:Math.max(l,d),p=()=>{!t||!t.$el||!t.$el.main||(a.select(`.${ln.dragarea}`).attr("x",u).attr("y",f).attr("width",h-u).attr("height",g-f),a.selectAll(`.${At.shapes}`).selectAll(`.${At.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,F.select)(this),v=m.classed(ut.SELECTED),b=m.classed(ln.INCLUDED);let y,T;if(m.classed(Nt.circle)){const w=+m.attr("cx"),C=+m.attr("cy");T=t.togglePoint,y=u<w&&w<h&&f<C&&C<g}else if(m.classed(ie.bar)){const{x:w,y:C,width:k,height:S}=ur(this);T=t.togglePath,y=!(h<w||w+k<u)&&!(g<C||C+S<f)}else return;y^b&&(m.classed(ln.INCLUDED,!b),m.classed(ut.SELECTED,!v),T.call(t,!v,m,_,x))}))};hr(t.state,p)},dragstart(e){const t=this,{config:n,state:i,$el:{main:a}}=t;t.hasArcType()||!n.data_selection_enabled||(i.dragStart=e,a.select(`.${U.chart}`).append("rect").attr("class",ln.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:n},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(n.select(`.${ln.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${At.shape}`).classed(ln.INCLUDED,!1),e.setDragStatus(!1))}},n_=Object.defineProperty,i_=Object.defineProperties,a_=Object.getOwnPropertyDescriptors,Ll=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,o_=Object.prototype.propertyIsEnumerable,Rl=(e,t,n)=>t in e?n_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r_=(e,t)=>{for(var n in t||(t={}))s_.call(t,n)&&Rl(e,n,t[n]);if(Ll)for(var n of Ll(t))o_.call(t,n)&&Rl(e,n,t[n]);return e},l_=(e,t)=>i_(e,a_(t)),c_=l_(r_({},e_),{selectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i,r=a.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),d=i.pointSelectR.bind(i);H(a.data_onselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(ut.selectedCircle,n)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",u=>i.pointSelectR(u)*1.4)).attr("r",d)},unselectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i;H(a.data_onunselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(e,t,n,i){this[`${e?"":"un"}selectPoint`](t,n,i)},selectPath(e,t){const n=this,{config:i}=n;H(i.data_onselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const n=this,{config:i}=n;H(i.data_onunselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,n,i){this[`${e?"":"un"}selectPath`](t,n,i)},getToggle(e,t){const n=this;return e.nodeName==="path"?n.togglePath:n.isStepType(t)?()=>{}:n.togglePoint},toggleShape(e,t,n){var i;const a=this,{config:s,$el:{main:o}}=a;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(a.api)(t)){const r=(0,F.select)(e),l=r.classed(ut.SELECTED),c=a.getToggle(e,t).bind(a);let d;if(!s.data_selection_multiple){const u=(i=a.isPointFocusOnly)==null?void 0:i.call(a);let h=`.${u?ut.selectedCircles:At.shapes}`;s.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(u?`.${ut.selectedCircle}`:`.${At.shape}.${ut.SELECTED}`).classed(ut.SELECTED,!1).each(function(f){const g=(0,F.select)(this);d=g,c(!1,g,f,f.index)})}(!d||d.node()!==r.node())&&(r.classed(ut.SELECTED,!l),c(!l,r,t,n))}}}),u_={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}};let El=()=>(St(ge.prototype,c_),St(Yt.prototype,t_),cn.setOptions([u_]),(El=()=>!0)());const Pl=function(e){var t,n;const i=this.internal,{axis:a,brush:s,config:o,scale:{x:r,subX:l},state:c}=i;let d;return c.isCanvasMode?(o.subchart_show&&(d=e,Array.isArray(d)?(d=a.isTimeSeries()?d.map(u=>Vt.bind(i)(u)):d,d=i.setCanvasSubchartDomain(d)||c.domain):d=(t=c.domain)!=null?t:r.orgDomain()),d):(o.subchart_show&&(d=e,Array.isArray(d)?(a.isTimeSeries()&&(d=d.map(h=>Vt.bind(i)(h))),i.withinRange(d,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(c.domain=d.slice(),s.move(s.getSelection(),d.map(l)))):d=(n=c.domain)!=null?n:r.orgDomain()),d)};St(Pl,{show(){var e,t,n;const i=this.internal,{$el:{subchart:a},config:s}=i,o=s.subchart_show;if(!o){if(i.state.isCanvasMode){(e=i.unbindZoomEvent)==null||e.call(i),s.subchart_show=!0,this.resize();return}i.unbindZoomEvent(),s.subchart_show=!o,!a.main&&i.initSubchart();let r=a.main.selectAll(`.${U.target}`);i.data.targets.length!==r.size()&&(i.updateSizes(),i.updateTargetsForSubchart(i.data.targets),r=(t=a.main)==null?void 0:t.selectAll(`.${U.target}`)),r==null||r.style("opacity",null),(n=a.main)==null||n.style("display",null),this.resize()}},hide(){var e;const t=this.internal,{$el:{subchart:{main:n}},config:i}=t;if(t.state.isCanvasMode){i.subchart_show&&(i.subchart_show=!1,this.resize(),(e=t.bindZoomEvent)==null||e.call(t));return}i.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(i.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){var e;const t=this.internal,{brush:n}=t;if(t.state.isCanvasMode){(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1);return}n.clear(n.getSelection())}});var d_={subchart:Pl};const Dl=["bar","line","bubble","candlestick","scatter"],h_=["opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"];function Il(e,t){var n,i;const a=(i=(n=e.$el.grid)==null?void 0:n.main)==null?void 0:i.select(`line.${V.xgridFocus}`).node();if(!a||!N.getComputedStyle)return;const s=N.getComputedStyle(a);h_.forEach(o=>{const r=s.getPropertyValue(o);r&&t.style(o,r)})}function kn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function f_(e){var t,n;if(!_a(e))return!1;const{config:i,state:a,$el:s}=e,o=(n=(t=s.grid)==null?void 0:t.main)==null?void 0:n.select(`line.${V.xgridFocus}:not(.${V.xgridFocusContinuous})`),r=s.main.select(`line.${V.xgridFocusContinuous}`);if(!(o!=null&&o.node())||!r.node())return!1;const l=a.margin2.left-a.margin.left+a.width2,c=a.margin2.top-a.margin.top+a.height2;return Il(e,r),i.axis_rotated?r.attr("x1",kn(o.attr("x1"),0)).attr("x2",l).attr("y1",kn(o.attr("y1"),-10)).attr("y2",kn(o.attr("y2"),-10)):r.attr("x1",kn(o.attr("x1"),-10)).attr("x2",kn(o.attr("x2"),-10)).attr("y1",kn(o.attr("y1"),0)).attr("y2",c),r.style("visibility",null),o.style("visibility","hidden"),!0}function g_(e){var t;(t=e.$el.main)==null||t.select(`line.${V.xgridFocusContinuous}`).style("visibility","hidden")}function p_(e,t,n){const{config:i,state:a}=e,[s,o]=Zt(t,n),r=so(e,i.axis_rotated?o:s);return r===null?null:i.axis_rotated?[a.width/2,r]:[r,a.height/2]}function ts(e,t,n,i){var a,s;const o=(s=(a=e.$el.eventRect)==null?void 0:a.node)==null?void 0:s.call(a);if(!o)return;const r=p_(e,n,i)||[0,0],l=ht(o,!0),c=l.left+r[0],d=l.top+r[1],u={bubbles:!0,cancelable:!0,screenX:c,screenY:d,clientX:c,clientY:d};/^touch/.test(t)?Oa.touch(o,t,u):Oa.mouse(o,t,u)}var __={isSubchartBrushEnabled(){const{config:e}=this;return e.subchart_show&&e.subchart_brush_enabled!==!1},bindSubchartEventRect(e){const t=this,{config:n,state:i}=t;e.on("mouseover mousemove mouseout touchstart touchmove touchend",null),n.interaction_enabled&&(i.inputType==="mouse"?e.on("mouseover mousemove",function(a){t.isSubchartBrushEnabled()||ts(t,a.type,a,this)}).on("mouseout",function(a){t.isSubchartBrushEnabled()||ts(t,"mouseout",a,this)}):i.inputType==="touch"&&e.on("touchstart touchmove touchend",function(a){var s;t.isSubchartBrushEnabled()||((s=a.touches)==null?void 0:s.length)>1||ts(t,a.type,a,this)}))},initBrush(){const e=this,{config:t,scale:n,$el:{subchart:i},state:a}=e,s=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(s?(0,Ri.brushY)():(0,Ri.brushX)()).handleSize(5),e.brush.on("start brush end",d=>{const{selection:u,sourceEvent:h,target:f,type:g}=d;g==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?u:null),/(start|brush)/.test(g)&&(g==="brush"&&h&&a.domain&&(l==null||l.forEach((p,_)=>{p!==u[_]&&(a.domain[_]=n.x.orgDomain()[_])})),e.redrawForBrush(g!=="start")),g==="end"&&(r=n.x.orgDomain()),f!=null&&f.handle&&(u===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,_)=>{const x=[u[_],o/2];return`translate(${s?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const d=this.getSelection();r&&(0,Ri.brushSelection)(d.node())&&this.move(d,r.map(n.subX.orgScale()))},0)},e.brush.update=function(){var d;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((d=i.main)==null||d.select(`.${V.brush}`).call(this)),this},e.brush.scale=function(d){const u=t.subchart_size_height;let h=e.axis.getExtent();!h&&d.range?h=[[0,0],[d.range()[1],u]]:ot(h)&&(h=h.map((f,g)=>[f,g>0?u:g])),s&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${V.brush}`):(0,F.select)([])},initSubchart(){const e=this,{config:t,state:{clip:n,hasAxis:i},$el:{defs:a,svg:s,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${n.id}-subchart`,d=e.getClipPath(c);n.idSubchart=c,e.appendClip(a,c),e.initBrush(),o.main=s.append("g").classed(V.subchart,!0).attr("transform",e.getTranslate("context"));const{main:u}=o;u.style("visibility",l),u.append("g").attr("clip-path",d).attr("class",V.chart),e.withSubchartTypeContext(()=>{Dl.forEach(f=>{const g=Ot(/^(bubble|scatter)$/.test(f)?"circle":f);if(e.hasType(f)||e.hasTypeOf(g)){const p=u.select(`.${V.chart}`),_=V[`chart${g}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}})});const h=u.append("g").attr("clip-path",d).attr("class",V.brush).style("pointer-events",e.isSubchartBrushEnabled()?null:"none").call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),o.eventRect=u.append("g").attr("clip-path",d).attr("class",`${V.eventRects} ${V.eventRects}-subchart`).style("fill-opacity","0").style("pointer-events",e.isSubchartBrushEnabled()?"none":"all").append("rect").attr("class",`${V.eventRect} ${V.eventRect}-subchart`).attr("width",e.state.width2).attr("height",e.state.height2),e.bindSubchartEventRect(o.eventRect),u.append("g").attr("clip-path",d).attr("class",V.xgridFocus).append("line").attr("class",V.xgridFocus).style("visibility","hidden"),r.subX=u.append("g").attr("class",V.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":n.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden"),r.subY=u.append("g").attr("class",V.axisY).attr("transform",e.getTranslate("subY")).style("visibility",t.subchart_axis_y_show?l:"hidden"),r.subY2=u.append("g").attr("class",V.axisY2).attr("transform",e.getTranslate("subY2")).style("visibility",t.subchart_axis_y2_show?l:"hidden")},addBrushHandle(e){const t=this,{config:n}=t,i=n.axis_rotated,a=n.subchart_init_range,s="handle--custom",o=bs[i?"y":"x"];t.brush.handle=e.selectAll(`.${s}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[/[se]/.test(r.type)?"end":"start"]).attr("display",a?null:"none")},updateTargetsForSubchart(e){var t;const n=this,{config:i,state:a,$el:{subchart:{main:s}}}=n;i.subchart_show&&(n.withSubchartTypeContext(()=>{Dl.filter(o=>n.hasType(o)||n.hasTypeOf(Ot(o))).forEach(o=>{const r=/^(bubble|scatter)$/.test(o),l=Ot(r?"circle":o),c=n.getChartClass(l,!0),d=n.getClass(r?"circles":`${o}s`,!0),u=s.select(`.${V[`chart${`${l}s`}`]}`);if(r){const h=u.selectAll(`.${V.circles}`).data(e.filter(n[`is${Ot(o)}Type`].bind(n))).attr("class",d);h.exit().remove(),h.enter().append("g").attr("class",d)}else{const h=u.selectAll(`.${V[`chart${l}`]}`).attr("class",c).data(e.filter(n[`is${l}Type`].bind(n))),f=h.enter().append("g").style("opacity","0").attr("class",c).append("g").attr("class",d);h.exit().remove(),o==="line"&&n.hasTypeOf("Area")&&f.append("g").attr("class",n.getClass("areas",!0))}})}),s.selectAll(`.${V.brush} rect`).attr(i.axis_rotated?"width":"height",i.axis_rotated?a.width2:a.height2),(t=n.$el.subchart.eventRect)==null||t.attr("width",a.width2).attr("height",a.height2).style("pointer-events",n.isSubchartBrushEnabled()?"none":"all"))},updateSubchartYDomain(e){var t,n;const i=this,{scale:a}=i,s=e||i.filterTargetsToShow(i.data.targets);(t=a.subY)==null||t.domain(i.getYDomain(s,"y")),(n=a.subY2)==null||n.domain(i.getYDomain(s,"y2"))},redrawSubchart(e,t){var n,i,a,s;const o=this,{config:r,$el:{subchart:{main:l}},state:c}=o,d=!!t;if(l.style("visibility",r.subchart_show?null:"hidden"),l.select(`.${V.brush}`).style("pointer-events",o.isSubchartBrushEnabled()?null:"none"),(n=o.$el.subchart.eventRect)==null||n.style("pointer-events",o.isSubchartBrushEnabled()?"none":"all"),(i=o.$el.axis.subY)==null||i.style("visibility",r.subchart_axis_y_show?null:"hidden"),(a=o.$el.axis.subY2)==null||a.style("visibility",r.subchart_axis_y2_show?null:"hidden"),r.subchart_show&&(((s=c.event)==null?void 0:s.type)==="zoom"&&o.brush.update(),e)){const u=r.subchart_init_range;!Rr(o)&&o.brush.update(),o.withSubchartTypeContext(()=>{const h=c._targetsToShow||o.filterTargetsToShow(o.data.targets);o.updateSubchartYDomain(h);const f=o.getDrawShape();if(Object.keys(f.type).forEach(g=>{const p=Ot(g),_=o[`generateDraw${p}`](f.indices[g],!0);o[`update${p}`](d,!0),o[`redraw${p}`](_,d,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:g}=f.pos,p=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(g,p,d,void 0,!0)}}),!c.rendered&&u&&(c.domain=u,o.brush.move(o.brush.getSelection(),u.map(o.scale.x)))}},showSubchartGridFocus(e){const t=this,{config:n,state:i,$el:{subchart:{main:a}}}=t;if(!a||!n.subchart_show||t.isSubchartBrushEnabled()||n.grid_focus_show===!1||n.subchart_grid_focus===!1||!n.tooltip_show||n.axis_tooltip)return;const o=(Array.isArray(e)?e:[e]).find(c=>c&&t.getBaseValue(c)!=null);if(!o){t.hideSubchartGridFocus();return}const r=t.scale.subX(o.x);if(!Number.isFinite(r)){t.hideSubchartGridFocus();return}const l=a.select(`g.${V.xgridFocus} line.${V.xgridFocus}`);if(f_(t)){l.style("visibility","hidden");return}Il(t,l),n.axis_rotated?l.attr("x1",0).attr("x2",i.width2).attr("y1",r).attr("y2",r):l.attr("x1",r).attr("x2",r).attr("y1",0).attr("y2",i.height2),l.style("visibility",null)},hideSubchartGridFocus(){var e;g_(this),(e=this.$el.subchart.main)==null||e.select(`g.${V.xgridFocus} line.${V.xgridFocus}`).style("visibility","hidden")},redrawForBrush(e=!0){var t;const n=this,{config:{subchart_onbrush:i,zoom_rescale:a},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:a,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(n.api)((t=o.domain)!=null?t:s.x.orgDomain())},transformContext(e,t){const n=this,{$el:{subchart:i},$T:a}=n,s=t!=null&&t.axisSubX?t.axisSubX:a(i.main.select(`.${V.axisX}`),e),o=t!=null&&t.axisSubY?t.axisSubY:a(i.main.select(`.${V.axisY}`),e),r=t!=null&&t.axisSubY2?t.axisSubY2:a(i.main.select(`.${V.axisY2}`),e);i.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX")),o.attr("transform",n.getTranslate("subY")),r.attr("transform",n.getTranslate("subY2"))}},x_={subchart_show:!1,subchart_type:void 0,subchart_types:{},subchart_brush_enabled:!0,subchart_showHandle:!1,subchart_size_height:60,subchart_grid_focus:!0,subchart_grid_focus_continuous:!1,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_count:void 0,subchart_axis_x_tick_values:void 0,subchart_axis_x_tick_culling:void 0,subchart_axis_x_tick_culling_max:void 0,subchart_axis_x_tick_culling_lines:void 0,subchart_axis_x_tick_culling_reverse:void 0,subchart_axis_x_tick_outer:void 0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_axis_y_show:!1,subchart_axis_y_tick_show:!0,subchart_axis_y_tick_count:void 0,subchart_axis_y_tick_values:void 0,subchart_axis_y_tick_culling:void 0,subchart_axis_y_tick_culling_max:void 0,subchart_axis_y_tick_culling_lines:void 0,subchart_axis_y_tick_culling_reverse:void 0,subchart_axis_y_tick_outer:void 0,subchart_axis_y_tick_format:void 0,subchart_axis_y_tick_text_show:!0,subchart_axis_y2_show:!1,subchart_axis_y2_tick_show:!0,subchart_axis_y2_tick_count:void 0,subchart_axis_y2_tick_values:void 0,subchart_axis_y2_tick_culling:void 0,subchart_axis_y2_tick_culling_max:void 0,subchart_axis_y2_tick_culling_lines:void 0,subchart_axis_y2_tick_culling_reverse:void 0,subchart_axis_y2_tick_outer:void 0,subchart_axis_y2_tick_format:void 0,subchart_axis_y2_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}};let Ml=()=>(St(ge.prototype,__),St(Yt.prototype,d_),cn.setOptions([x_]),(Ml=()=>!0)());var re=wt(9);const Fl=function(e){var t,n;const i=this.internal,{axis:a,config:s,org:o,scale:r,state:l}=i;let c;if(!a)return;const d=a.isCategorized();if(s.zoom_enabled)if(c=e,Array.isArray(c)){if(a.isTimeSeries()&&(c=c.map(h=>Vt.bind(i)(h))),i.withinRange(c,i.getZoomDomain("zoom",!0),i.getZoomDomain("zoom"))){if(l.domain=c.slice(),c=i.getZoomDomainValue(c),i.api.tooltip.hide(),s.subchart_show)if(l.isCanvasMode)(t=i.setCanvasSubchartDomain)==null||t.call(i,c,!0,!1);else{const h=r.zoom||r.x;i.brush.getSelection().call(i.brush.move,c.map(h))}else{const h=d?r.x.orgScale():o.xScale||r.x;i.updateCurrentZoomTransform(h,c)}i.setZoomResetButton()}}else c=i.zoom.getDomain();return(n=l.domain)!=null?n:c};St(Fl,{enable(e){var t;const n=this.internal,{axis:i,config:a}=n;if(!i){a.zoom_enabled=!1;return}/^(drag|wheel)$/.test(e)&&(a.zoom_type=e),a.zoom_enabled=!!e,n.zoom?e===!1&&n.bindZoomEvent(!1):n.initZoom(),e!==!1&&(a.zoom_type==="drag"&&!n.zoomBehaviour&&((t=n.initZoomBehaviour)==null||t.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_max=ue("max",[i[1],e])),n.zoom_x_max},min(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_min=ue("min",[i[0],e])),n.zoom_x_min},range(e){const t=this.zoom;if(tt(e)){const{min:n,max:i}=e;ct(n)&&t.min(n),ct(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var m_={zoom:Fl,unzoom(){var e;const t=this.internal,{config:n,$el:{canvas:i,eventRect:a,zoomResetBtn:s},scale:{zoom:o},state:r}=t,l=r.isCanvasMode?i:a;(o||r.isCanvasMode&&n.subchart_show&&r.domain)&&(n.subchart_show?r.isCanvasMode?(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1):t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(re.zoomIdentity),t.updateZoom(!0),s==null||s.style("display","none"),l!=null&&l.node()&&(0,re.zoomTransform)(l.node())!==re.zoomIdentity&&t.zoom.transform(l,re.zoomIdentity),r.domain=void 0)}};function $i(e){return e.state.isCanvasMode?e.$el.canvas:e.$el.eventRect}function Ol(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x+(t.k-1)*n.left,t.y+(t.k-1)*n.top).scale(t.k)}function $l(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x-(t.k-1)*n.left,t.y-(t.k-1)*n.top).scale(t.k)}function Bl(e,t,n){const i=Zt(t,n);if(e.state.isCanvasMode){const{margin:a}=e.state;i[0]-=a.left,i[1]-=a.top}return i}var v_={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:n}=t;n.zoom_enabled&&e?!n.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:n,scale:i}=e,a=(0,re.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));a.orgScaleExtent=()=>{const s=t.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]},a.updateScaleExtent=function(){const s=en(e.scale.x.orgDomain())/en(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},a.updateTransformScale=(s,o)=>{var r,l;const c=t.axis_rotated,d=Ol(e,s);(r=n.xScale)==null||r.range(i.x.range());const u=d[c?"rescaleY":"rescaleX"](n.xScale||i.x);if(u.domain().some(g=>/(Invalid Date|NaN)/.test(g.toString())))return;const h=e.trimXDomain(u.domain()),f=t.zoom_rescale;if(u.domain(h,n.xDomain),o){const g=u(i.x.domain()[0]),p=c?d.x:g,_=c?g:d.y,x=$l(e,re.zoomIdentity.translate(p,_).scale(s.k));(l=$i(e))==null||l.property("__zoom",x)}i.zoom=e.getCustomizedXScale(u),e.axis.x.scale(i.zoom),f?(!n.xScale&&(n.xScale=i.x.copy()),i.x.domain(h)):n.xScale&&(i.x.domain(n.xScale.domain()),n.xScale=null)},a.getDomain=()=>{const s=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(s[1]-=2),s},e.zoom=a},onZoomStart(e){const t=this,{sourceEvent:n}=e;n&&(t.zoom.startEvent=n,t.state.zooming=!0,H(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:n,scale:i,state:a,org:s}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===re.zoomIdentity;if(!n.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!i.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(a.zooming=!0,a.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:d}=e;!l&&c&&i.x.domain().every((g,p)=>g!==s.xDomain[p])&&i.x.domain(s.xDomain),t.zoom.updateTransformScale(d,n.zoom_type==="wheel"&&o);const u=n.transition_duration>0&&!n.subchart_show&&(a.dragging||r||!e.sourceEvent),h=o&&l&&n.zoom_type!=="wheel",f=()=>{var g;t.config&&(t.redraw({withTransition:u,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&H(n.zoom_onzoom,t.api,(g=t.state.domain)!=null?g:t.zoom.getDomain()))};h?hr(t.state,f):f()},onZoomEnd(e){var t,n;const i=this,{config:a,state:s}=i,o=i.zoom;if(!o)return;let{startEvent:r}=o,l=e==null?void 0:e.sourceEvent;const c=(e==null?void 0:e.transform)===re.zoomIdentity;(r==null?void 0:r.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],l=(t=l==null?void 0:l.changedTouches)==null?void 0:t[0]),!(a.zoom_type==="drag"&&l&&r.clientX===l.clientX&&r.clientY===l.clientY)&&(s.zooming=!1,!s.isCanvasMode&&i.redrawEventRect(),i.updateZoom(),!c&&(l||s.dragging)&&H(a.zoom_onzoomend,i.api,(n=i.state.domain)!=null?n:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:n,x:i,zoom:a}=t.scale;if(a){const s=a.domain(),o=n.domain(),r=.015,l=t.config.axis_x_inverted?(s[0]>=o[0]||s[0]+r>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+r):(s[0]<=o[0]||s[0]-r<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-r);(e||l)&&(t.axis.x.scale(n),i.domain(n.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){var n;const i=this,{config:a}=i,s=a.axis_rotated,o=[-e(t[0]),0],r=re.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...s?o.reverse():o);(n=$i(i))==null||n.call(i.zoom.transform,$l(i,r))},bindZoomOnEventRect(){var e,t;const n=this,{config:i,$el:{svg:a}}=n,s=$i(n),o=i.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((e=o==null?void 0:o.touchable)==null||e.call(o,()=>i.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&N.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((t=N.navigator)==null?void 0:t.userAgent)&&a.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:n}=e,i=t.axis_rotated;let a=0,s=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0},c=d=>{const[u,h]=r!=null?r:[0,i?n.height:n.width];return Math.min(Math.max(d,u),h)};e.zoomBehaviour=(0,Ar.drag)().touchable(()=>!n.isCanvasMode||t.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(d){var u;r=e.scale.zoom?null:e.axis.getExtent(),n.event=d,e.setDragStatus(!0),e.unselectRect(),!n.isCanvasMode&&!o&&(o=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",Da.zoomBrush).attr("width",i?n.width:0).attr("height",i?0:n.height)),o==null||o.attr(i?"width":"height",i?n.width:n.height),a=c(Bl(e,d,this)[l.index]),s=a,n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,a).attr(l.attr,0),e.onZoomStart(d)}).on("drag",function(d){var u;s=c(Bl(e,d,this)[l.index]),n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,Math.min(a,s)).attr(l.attr,Math.abs(s-a))}).on("end",d=>{var u;const h=e.scale.zoom||e.scale.x;n.event=d,s=c(s),n.isCanvasMode?(u=e.clearCanvasZoomBrush)==null||u.call(e):o.attr(l.axis,0).attr(l.attr,0),a>s&&([a,s]=[s,a]),a<0&&(s+=Math.abs(a),a=0),a!==s&&e.api.zoom([a,s].map(f=>h.invert(f))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:n}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=e.$el.chart.append("div").classed(U.button,!0).append("span").on("click",function(){z(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(Da.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,t=$i(e),n=t==null?void 0:t.node();return n?Ol(e,(0,re.zoomTransform)(n)):{k:1}}},b_={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let zl=()=>(St(ge.prototype,v_),St(Yt.prototype,m_),cn.setOptions([b_]),(zl=()=>!0)());function Nl(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Xl(e,t=!1){const n=this.internal,{config:i}=n,a=i.transition_duration&&Zn();return e?(i.regions=t?i.regions.concat(e):e,n.state.isCanvasMode?(Nl(n),i.regions):(n.updateRegion(),n.redrawRegion(a),i.regions)):i.regions}const Gl=function(e){return Xl.bind(this)(e)};St(Gl,{add:function(e){return Xl.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:n,$T:i}=t,a=e||{},s=Ne(a,"classes",[Kn.region]);let o=n.regions;if(t.state.isCanvasMode)return Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],Nl(t),n.regions;const r=t.$el.main.select(`.${Kn.regions}`).selectAll(s.map(l=>`.${l}`));return i(r).style("opacity","0").remove(),Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],o}});var y_={regions:Gl},T_={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",Kn.regions)},updateRegion(){const e=this,{config:t,$el:{region:n},$T:i}=e;n.main||e.initRegion(),n.main.style("visibility",e.hasArcType()?"hidden":null);const a=n.main.selectAll(`.${Kn.region}`).data(t.regions);i(a.exit()).style("opacity","0").remove();const s=a.enter().append("g");s.append("rect").style("fill-opacity","0"),n.list=s.merge(a).attr("class",e.classRegion.bind(e)),n.list.each(function(o){var r;(0,F.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,F.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:n},$T:i}=t,a=t.regionX.bind(t),s=t.regionY.bind(t),o=["width","height"];let r=n.list.select("rect"),l=n.list.selectAll("text");return r=i(r,e).attr("x",a).attr("y",s).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var d;return(d=c.label)==null?void 0:d.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var d;const{x:u=0,y:h=0,center:f=!1,rotated:g=!1}=(d=c.label)!=null?d:{},p=this.previousElementSibling,_={x:0,y:0};return Q(f)&&["x","y"].forEach((x,m)=>{f.indexOf(x)>-1&&(_[x]=(+p.getAttribute(o[m])-ht(this)[o[m]])/2)}),`translate(${a(c)+_.x+u}, ${s(c)+_.y+h})${g?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var d;return(d=c==null?void 0:c.color)!=null?d:null}),[r.style("fill-opacity",c=>q(c.opacity)?c.opacity:null).on("end",function(){(0,F.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const n=this,{config:i,scale:a,state:s}=n,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&n[l?"regionX":"regionY"](t);let d=r?"start":"end",u=r?0:s[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?d="start":r&&!l&&(d="end"),(l?o:!o)&&d in t&&(h=a[t.axis])):(l?!o:o)&&d in t&&(h=a.zoom||a.x),h){let f=0;u=t[d],n.axis.isTimeSeries(t.axis)?u=Vt.call(n,u):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(u)&&(u=i.axis_x_categories.indexOf(u),f=n.axis.x.tickOffset()*(d==="start"?-1:1)),u=h(u)+f}return r?u:u<c?0:u-c},isRegionOnX(e){return!e.axis||e.axis==="x"}};let Vl=()=>(St(ge.prototype,T_),Yt.prototype.regions=y_.regions,(Vl=()=>({}))());var An={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Nt.circles:we.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return Vr.call(t,e,"area_linearGradient",t.color)},updateArea(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,state:a,$el:s,$T:o}=n,r=t?s.subchart:s;i.area_linearGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${Ci.areas}`).selectAll(`.${Ci.area}`).data(n.lineData.bind(n));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return a.orgAreaOpacity=(0,F.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",a.orgAreaOpacity),n.setRatioForGroupedData(r.area.data())},redrawArea(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{area:a}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=i.state;return[i.$T(a,t,xe()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(e,t){return vo(this,e,t)}},Ln={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},es={spline_interpolation_type:"cardinal"};function w_(e){return Ut(e)&&z(e.create)&&z(e.update)}function C_(e,t){var n;const i=this,a=(l,c)=>{const d=l.attributes;for(let u=0,h;h=d[u];u++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(Se(e),"image/svg+xml").documentElement,r=nt.createElementNS(F.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",a(o,r),(n=o.childNodes)!=null&&n.length){const l=(0,F.select)(r);"innerHTML"in r?l.html(Se(o.innerHTML)):nn(o.childNodes).forEach(c=>{a(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var Rn={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return bt(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:n}=e,i=[],a=e.getValidPointPattern();return function(s,o,...r){return function(l){var c,d,u,h;const f=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),g=(0,F.select)(this);i.indexOf(f)<0&&i.push(f);let p=a[i.indexOf(f)%a.length];if(e.hasValidPointType(p))p=e[p];else if(!w_(p||n.point_type)){const _=e.getDefsPointId(f);if(t.defs.select(`#${_}`).size()<1&&C_.call(e,p,_),s==="create")return(d=e.custom)==null?void 0:d.create.bind(o)(g,_,...r);if(s==="update")return(u=e.custom)==null?void 0:u.update.bind(o)(g,...r)}return(h=p[s])==null?void 0:h.bind(o)(g,...r)}}}};function S_(e,t,n,i=!1){const a=e?[e,0]:n;for(let s=e||n.reduce((o,r)=>o+r);s<=t;)n.forEach(o=>{s+o<=t&&a.push(o),s+=o});return a.length%2!==0&&a.push(i?n[1]:0),{dash:a.join(" "),length:a.reduce((s,o)=>s+o,0)}}var k_={initLine(){Wr.call(this,{elKey:"line",className:we.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(e){const t=this,{$el:{area:n,main:i}}=t,a=t.getClass("lines",!0),s=e.filter(r=>!(t.isScatterType(r)||t.isBubbleType(r))),o=Ya.call(t,s,{type:"Line",elKey:"line",containerClass:we.chartLines,itemClass:we.chartLine,initFn:t.initLine});if(o.append("g").attr("class",a),t.hasTypeOf("Area")){const r=i.select(`.${we.chartLines}`).selectAll(`.${we.chartLine}`),l=(!n&&o.empty()?r:o).filter(t.isAreaType.bind(t));t.initArea(l)}t.updateTargetForCircle(s,o)},updateLine(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:i},$el:a,$T:s}=n,o=t?a.subchart:a,r=o.main.selectAll(`.${we.lines}`).selectAll(`.${we.line}`).data(n.lineData.bind(n));s(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${n.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",n.color).merge(r).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{$el:a,$T:s}=i,{line:o}=n?a.subchart:a;return[s(o,t,xe()).attr("d",e).style("stroke",this.color).style("opacity",null)]},generateDrawLine(e,t){return mo(this,e,t)},lineWithRegions(e,t,n,i){const a=this,{config:s}=a,o=s.axis_rotated,r=a.axis.isTimeSeries(),l="2 2",c=lo(a,e,i),d=a.hasNullDataValue(e);let u,h,f,g;const p=o?S=>n(S.value):S=>t(S.x),_=o?S=>t(S.x):S=>n(S.value),x=S=>`M${S[0][0]},${S[0][1]}L${S[1][0]},${S[1][1]}`,m=r?(S,A,L,E)=>{const D=S.x.getTime(),R=A.x-S.x,P=new Date(D+R*L),B=new Date(D+R*(L+E)),I=o?[[n(h(L)),t(P)],[n(h(L+f)),t(B)]]:[[t(P),n(h(L))],[t(B),n(h(L+f))]];return x(I)}:(S,A,L,E)=>{const D=t(A.x,!o),R=n(A.value,o),P=L+E,B=t(u(L),!o),I=n(h(L),o);let X=t(u(P),!o),G=n(h(P),o);X>D&&(X=D),S.value>A.value&&(o?G<R:G>R)&&(G=R);const Z=[[B,I],[X,G]];return o&&Z.forEach(et=>et.reverse()),x(Z)},v={x:a.axis.getAxisType("x"),y:a.axis.getAxisType("y")};let b="";if(!e.length)return b;const y=a.$el.line.filter(({id:S})=>S===e[0].id),T=y.clone().style("display","none"),w=(S,A)=>S.attr("d",A).node().getTotalLength(),C={dash:[],lastLength:0};let k=!1;for(let S=0,A;A=e[S];S++){const L=e[S-1],E=L&&q(L.value);let D=a.isWithinRegions(A.x,c);if(q(A.value)){if(Ct(c)||!D||!E)b+=`${S&&E?"L":"M"}${p(A)},${_(A)}`;else if(E)if(D=((D==null?void 0:D.dasharray)||l).split(" ").map(Number),u=Xe(v.x,L.x,A.x),h=Xe(v.y,L.value,A.value),d){const R=t(A.x)-t(L.x),P=n(A.value)-n(L.value),B=Math.sqrt(R*R+P*P);f=D[0]/B,g=f*D[1];for(let I=f;I<=1;I+=g)b+=m(L,A,I,f),I+g>=1&&(b+=m(L,A,1,0))}else{let R;if(k=A.x===e[e.length-1].x,r){const X=+L.x,G=new Date(X),Z=new Date(X+(+A.x-X));R=[[t(G),n(h(0))],[t(Z),n(h(1))]]}else R=[[t(u(0)),n(h(0))],[t(u(1)),n(h(1))]];o&&R.forEach(X=>X.reverse());const P=w(T,b),B=w(T,b+=`L${R[1].join(",")}`),I=S_(P-C.lastLength,B-C.lastLength,D,k);C.lastLength+=I.length,C.dash.push(I.dash)}}}return C.dash.length&&(!k&&C.dash.push(w(T,b)),y.attr("stroke-dasharray",C.dash.join(" "))),T.remove(),b},isWithinRegions(e,t){return co(e,t)},isWithinStep(e,t){return Math.abs(t-Zt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||ot(t)&&t.indexOf(e.id)!==-1}};const En=()=>xe(),Wl=new WeakMap;function Yl(e){const t=e.getAttribute("height"),n=e.getAttribute("width"),i=e.getAttribute("href")||e.getAttribute("xlink:href"),a=Wl.get(e);if(a&&a.attrHeight===t&&a.attrWidth===n&&a.href===i)return a;const{width:s,height:o}=Ue(e),r={attrHeight:t,attrWidth:n,height:o,href:i,width:s};return Wl.set(e,r),r}var Bi={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:n}}=this;let i=t.point_opacity;return Ct(i)&&(i=this.getBaseValue(e)!==null&&n[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:n}=this;let i=n.point_opacity;return Ct(i)&&(i=n.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=q(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${U.chart} > .${Nt.chartCircles}`).empty()&&t.select(`.${U.chart}`).append("g").attr("class",Nt.chartCircles)},updateTargetForCircle(e,t){const n=this,{config:i,data:a,$el:s}=n,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=n.getClass("circles",!0);if(!i.point_show)return;n.initCircle();let c=e,d=t;if(!c){c=n.filterNullish(a.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const u=s.main.select(`.${Nt.chartCircles}`).style("pointer-events","none").selectAll(`.${Nt.circles}`).data(c);u.exit().remove(),d=u.enter()}o&&d.append("g").attr("class",u=>n.generateClass(ut.selectedCircles,u.id)),d.append("g").attr("class",l).call(u=>{n.setCssRule(!0,`.${Nt.circles}`,["cursor:pointer"],r)(u),n.setCssRule(!0,` .${Nt.circle}`,["fill","stroke"],n.color)(u)}).style("opacity",function(){return(0,F.select)(this.parentNode).classed(Nt.chartCircles)?"0":null}),o&&c.forEach(u=>{s.main.selectAll(`.${ut.selectedCircles}${n.getTargetSelectorSuffix(u.id)}`).selectAll(`${ut.selectedCircle}`).each(h=>{h.value=u.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:n,state:i,$el:a}=t,s=t.isPointFocusOnly(),o=e?a.subchart:a;if(n.point_show&&!i.toggling){n.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${Nt.circles}`).selectAll(`.${Nt.circle}`).data(u=>{const h=t.isLineType(u)&&t.shouldDrawPointsForLine(u)||t.isBubbleType(u)||t.isRadarType(u)||t.isScatterType(u)?s?[u.values[0]]:u.values:[];return t.filterNullish(h)});r.exit().remove();const l=t.pointR.bind(t),c=t.generateUpdateCircleColor(),d=t.initialOpacityForCircle.bind(t);r.enter().filter(Boolean).append(t.point("create",this,l,c)),o.circle=o.main.selectAll(`.${Nt.circles} .${Nt.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",d)}},generateUpdateCircleColor(){const e=this,t=e.getStylePropValue(e.color);return n=>e.config.point_radialGradient?e.getGradienColortUrl(n.id):t?t(n):null},updateCircleColor(e){return this.generateUpdateCircleColor()(e)},redrawCircle(e,t,n,i,a=!1){const s=this,{state:{rendered:o},$el:r,$T:l}=s,c=a?r.subchart:r,d=c.main.selectAll(`.${ut.selectedCircle}`);if(!s.config.point_show)return[];const u=s.isCirclePoint()?"c":"",h=xe(),f=s.opacityForCircle.bind(s),g=s.generateUpdateCircleColor();if(s.isCirclePoint()){const x=c.circle;return s.hasType("bubble")&&x.attr("r",s.pointR.bind(s)),n?(i&&x.attr("cx",e),l(x.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",e).attr("cy",t).style("fill",g),x.filter(function(){return!this.getAttribute("cx")}).attr("cx",e).attr("cy",t).style("fill",g)):x.attr("cx",e).attr("cy",t).style("fill",g),[[l(x,n||!o,h).style("opacity",f)],l(d,n).attr("cx",e).attr("cy",t)]}const p=s.point("update",s,e,t,g,n,i,d),_=[];return c.circle.each(function(x){let m=p.bind(this)(x);m=l(m,n||!o,h).style("opacity",f),_.push(m)}),[_,l(d,n).attr(`${u}x`,e).attr(`${u}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:n,resizing:i,toggling:a,transiting:s},$el:o}=t;let{circle:r}=o;if(s===!1&&r&&t.isPointFocusOnly()){const l=(n?t.radarCircleX:t.circleX).bind(t),c=(n?t.radarCircleY:t.circleY).bind(t),d=a||Ct(e),u=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:d);e&&(r=r.filter(function(h){var f;const g=(f=e.filter)==null?void 0:f.call(e,p=>p.id===h.id);return g.length?(0,F.select)(this).datum(g[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:f,index:g,value:p}=h;let _="hidden";q(p)&&(u.bind(this)(h),t.expandCircles(g,f),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},expandCircles(e,t,n){const i=this,a=i.pointExpandedR.bind(i);n&&i.unexpandCircles();const s=i.getShapeByIndex("circle",e,t).classed(U.EXPANDED,!0),o=a(s)/i.config.point_r,r=1-o;i.isCirclePoint()?s.attr("r",a):s.each(function(){const l=(0,F.select)(this);if(this.tagName==="circle")l.attr("r",a);else{const{width:c,height:d}=Yl(this),u=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+d/2);l.attr("transform",`translate(${u} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,n=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,F.select)(this).classed(U.EXPANDED)}).classed(U.EXPANDED,!1);if(i.attr("r",n),!t.isCirclePoint()){const a=n(i)/t.config.point_r;i.attr("transform",a!==1?`scale(${a})`:null)}},isWithinCircle(e,t){const{state:n}=this,i=Zt(n.event,e),a=(0,F.select)(e),s=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(a==null?void 0:a.datum());let r=+a.attr(`${s}x`),l=+a.attr(`${s}y`);if(!(r||l)&&e.nodeType===1){const{x:u,y:h}=ht(e);r=u,l=h}const c=r-i[0],d=l-i[1];return Math.sqrt(c*c+d*d)<(t||o)},updatePointClass(e){const t=this,{circle:n}=t.$el;let i=!1;return(tt(e)||n)&&(i=e===!0?n.each(function(a){let s=t.getClass("circle",!0)(a);this.getAttribute("class").indexOf(U.EXPANDED)>-1&&(s+=` ${U.EXPANDED}`),this.setAttribute("class",s)}):t.getClass("circle",!0)(e)),i},custom:{create(e,t,n){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,{width:l,height:c}=Yl(e.node()),d=f=>q(f.value)?t(f)-l/2:0,u=f=>q(f.value)?n(f)-c/2:0;let h=e;return a&&(s&&h.attr("x",d),h=r.$T(h,a,En()),o&&r.$T(o,a,En())),h.attr("x",d).attr("y",u).style("fill",i)}},circle:{create(e,t,n){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),a&&(s&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,a,En())),o&&r.$T(o,a,En())),l.attr("cx",t).attr("cy",n).style("fill",i)}},rectangle:{create(e,t,n){const i=a=>t(a)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,d=h=>n(h)-l;let u=e;return a&&(s&&u.attr("x",c),u=r.$T(u,a,En()),o&&r.$T(o,a,En())),u.attr("x",c).attr("y",d).style("fill",i)}}},dn={point_show:!0,point_r:2.5,point_radialGradient:!1,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_opacity:void 0,point_pattern:[],point_select_r:void 0,point_type:"circle"},A_={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function Hl(e,t,n){const{config:i}=e,a=(s,o)=>{const r=$(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${s}_${t}`]=r)};ct(n)&&(Ut(n)?Object.keys(n).forEach(s=>{a(s,n[s])}):($(n)||n===!1)&&["y","y2"].forEach(s=>{a(s,n)}),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function jl(e,t){const{config:n}=e;return{x:n[`axis_x_${t}`],y:n[`axis_y_${t}`],y2:n[`axis_y2_${t}`]}}var L_={axis:{labels:function(e){var t;const n=this.internal;let i;return e&&(Object.keys(e).forEach(a=>{n.axis.setLabelText(a,e[a])}),n.state.isCanvasMode?(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(a=>{const s=n.axis.getLabelText(a);s&&(!i&&(i={}),i[a]=s)}),i},min:function(e){const t=this.internal;return q(e)||e===!1?Hl(t,"min",e):jl(t,"min")},max:function(e){const t=this.internal;return q(e)||e===!1?Hl(t,"max",e):jl(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:n,max:i}=e;ct(i)&&t.max(i),ct(n)&&t.min(n)}else return{max:t.max(),min:t.min()}}}},R_={groups(e){const t=this.internal,{config:n}=t;return Ct(e)||(n.data_groups=e,t.state.dirty.data=!0,t.redraw()),n.data_groups}},E_={x(e){const t=this.internal,{axis:n,data:i}=t,a=n.isCustomX()&&n.isCategorized();return ot(e)&&(a?this.categories(e):(t.updateTargetX(i.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():i.xs},xs(e){const t=this.internal;return tt(e)&&(t.updateTargetXs(t.data.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},P_=Object.defineProperty,D_=(e,t,n)=>t in e?P_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t,n)=>D_(e,typeof t!="symbol"?t+"":t,n);class I_{constructor(t){zi(this,"owner"),zi(this,"config"),zi(this,"scale"),zi(this,"charSize",{});const n=Xe(),{config:i,params:a}=t;this.owner=t,this.config=i,this.scale=n,(i.noTransition||!a.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((a.orgXScale||n).range())}getSizeFor1Char(t,n,i=!0){const a={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!n.empty()&&n.text("0").call(s=>{try{const{width:o,height:r}=Ue(s.node(),!0);o&&r&&(a.w=o,a.h=r)}finally{s.text("")}}),this.charSize[t]=a,a)}getTickTransformSetter(t){const{config:n}=this,i=t==="x"?a=>`translate(${a+n.tickOffset},0)`:a=>`translate(0,${a})`;return(a,s)=>{a.attr("transform",o=>{const r=s(o);return q(o)?i(r):null})}}scaleExtent(t){const n=t[0],i=t[t.length-1];return n<i?[n,i]:[i,n]}generateTicks(t,n){const{tickStepSize:i}=this.owner.params,[a,s]=t.domain();let o=[];if(n&&i){let r=Math.round(a);for(;r<=s;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Xe("_log").domain([a>0?a:1,s]).range(t.range());o=l.ticks();for(let c=s.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,a),o.splice(o.length-1,1,s)}else o=t.ticks(...this.config.tickArguments||[])}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const n=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,a=n?n(i):i;return ct(a)?a:""}transitionise(t){const{config:n}=this;let i=t;if(n.withoutTransition)i=t.interrupt();else if(n.transition||!this.owner.params.noTransition)try{i=t.transition(n.transition)}catch(a){}return i}}var M_=Object.defineProperty,F_=(e,t,n)=>t in e?M_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ti=(e,t,n)=>F_(e,typeof t!="symbol"?t+"":t,n);function Ni(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function O_(e){const t=Ni(e);return/^sub/.test(e)?`subchart_axis_${t}`:`axis_${t}`}class Ul{constructor(t={}){ti(this,"helper"),ti(this,"config"),ti(this,"params"),ti(this,"g"),ti(this,"generatedTicks",[]);const n={innerTickSize:dt,outerTickSize:t.outerTick?dt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:tu,tickOffset:0,tickPadding:Je,tickValues:null,transition:null,noTransition:t.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=t,this.helper=new I_(this)}canReuseTickTextOnResize(t){const{config:n,params:i}=this,{config:a,id:s,owner:o}=i,r=/^(x|subX)$/.test(s),l=Ni(s),c=/^sub/.test(s)?a[`subchart_axis_${l}_tick_format`]||a[`axis_${l}_tick_format`]:a[`axis_${l}_tick_format`],d=i.tickMultiline&&i.isCategory&&!t&&!(i.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!z(a.axis_evalTextSize)&&!c&&!i.tickTitle&&!(r&&a.axis_x_tick_autorotate)&&!d&&n.withoutTransition)}canReuseTickNodesOnResize(t,n,i,a){if(a.tick||!a.text||!this.canReuseTickTextOnResize(i)||t.size()!==n.length)return!1;const s=t.nodes();for(let o=0;o<n.length;o++){const r=s[o].__data__,l=n[o];if(r instanceof Date||l instanceof Date){if(+r!=+l)return!1}else if(r!==l)return!1}return!0}create(t){const n=this,{config:i,helper:a,params:s}=n,{scale:o}=a,{orient:r}=i,l=this.splitTickText.bind(n),c=/^(left|right)$/.test(r),d=/^(top|bottom)$/.test(r),u=a.getTickTransformSetter(d?"x":"y"),h=u===a.axisX?"y":"x",f=/^(top|left)$/.test(r)?-1:1,g=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():a.scaleExtent((s.orgXScale||o).range());const{innerTickSize:p,tickLength:_,range:x}=i,m=s.id,v=Ni(m),{isSubAxes:b}=s,y=!b&&v&&/^(x|y|y2)$/.test(v)?s.config[`axis_${v}_tick_text_position`]:{x:0,y:0},T=O_(m),w=s.config[`${T}_show`],C=b?{tick:!0,text:!0}:{tick:w?s.config[`${T}_tick_show`]:!1,text:w?s.config[`${T}_tick_text_show`]:!1},k=s.config.axis_evalTextSize;let S;t.each(function(){const A=(0,F.select)(this);let L=this.__chart__||o,E=a.copyScale();S=A,this.__chart__=E,i.tickOffset=s.isCategory?(E(1)-E(0))/2:0;const D=A.selectAll(".domain").data([0]);if(D.enter().append("path").attr("class","domain").merge(D).attr("d",()=>{const R=i.outerTickSize*f;return d?`M${x[0]},${R}V0H${x[1]}V${R}`:`M${R},${x[0]}H0V${x[1]}H${R}`}),C.tick||C.text){const R=i.tickValues||a.generateTicks(E,c||s.config.axis_rotated);n.generatedTicks=R;let P=A.selectAll(".tick");if(n.canReuseTickNodesOnResize(P,R,c||s.config.axis_rotated,C))u(P,E);else{P=P.data(R,E);const I=P.enter().insert("g",".domain").attr("class","tick"),X=P.exit().remove();P=I.merge(P),C.tick&&I.append("line"),C.text&&I.append("text");const G=!I.empty()||!X.empty(),Z=C.text&&!G&&n.canReuseTickTextOnResize(c||s.config.axis_rotated);let et={w:0,h:0},rt=P.selectAll("text.__bb-empty");if(C.text&&!Z){const gt=P.select("text"),Tt=[];rt=gt,z(k)&&(et=k.bind(n.params.owner.api)(gt.node(),m),this.classList.contains(U.dummy)&&(this.sizeFor1Char=et)),(!et||et.w===0||et.h===0)&&(et=n.helper.getSizeFor1Char(r,gt,!!k));let _t=gt.selectAll("tspan").data((mt,Pt)=>{let Dt;if(s.tickMultiline)Dt=l(mt,E,R,c,et.w);else{const Lt=a.textFormatted(mt);Dt=ot(Lt)?Lt.concat():[Lt]}return Tt[Pt]=Dt.length,Dt.map(Lt=>({index:Pt,splitted:Lt}))});_t.exit().remove(),_t=_t.enter().append("tspan").merge(_t).text(mt=>mt.splitted),_t.attr("x",d?0:_*f).attr("dx",(()=>{let mt=0;return/(top|bottom)/.test(r)&&g&&(mt=8*Math.sin(Math.PI*(g/180))*(r==="top"?-1:1)),mt+(y.x||0)})()).attr("dy",(mt,Pt)=>{const Dt=".71em";let Lt=0;return r!=="top"&&(Lt=et.h,Pt===0&&(Lt=c?-((Tt[mt.index]-1)*(et.h/2)-3):y.y===0?Dt:0)),$(Lt)&&y.y?Lt+y.y:Lt||Dt})}const xt=P.select("line");if(I.select("line").attr(`${h}2`,p*f),I.select("text").attr(h,_*f),n.setTickLineTextPosition(xt,rt,et),s.tickTitle){const gt=rt.select("title"),Tt=s.tickTitle;(gt.empty()?rt.append("title"):gt).text(_t=>Tt[Number(_t)])}if(E.bandwidth){const gt=E,Tt=gt.bandwidth()/2;L=_t=>gt(_t)+Tt,E=L}else L.bandwidth?L=E:u(X,E);P=s.owner.state.flowing?a.transitionise(P):s.owner.$T(P),u(I,L),u(P.style("opacity",null),E)}}}),this.g=S}getGeneratedTicks(t){var n;const i=((n=this.generatedTicks)==null?void 0:n.length)-1;let a=this.generatedTicks;if(i>t){const s=Math.round(i/t+.1);a=this.generatedTicks.map((o,r)=>r%s===0?o:null).filter(o=>o!==null).splice(0,t)}return a}getTickXY(){const{config:t}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=t.tickCentered?0:t.tickOffset,n.y=t.tickCentered?t.tickOffset:0),n}getTickSize(t){const{scale:n}=this.helper,{config:i}=this,{innerTickSize:a,range:s}=i,o=n(t)+(i.tickCentered?0:i.tickOffset);return s[0]<o&&o<s[1]?a:0}setTickLineTextPosition(t,n,i){const a=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,d=this.params.tickTextRotate,u=6,h=i.h/2-u,f=v=>{const b=["start","end"];return o==="top"&&b.reverse(),v?b[v>0?0:1]:"middle"},g=v=>v?`rotate(${v})`:null,p=v=>{const b=v/(o==="bottom"?15:23);return v?11.5-2.5*b*(v>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${Ni(c)}_tick_inner`];switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",v=>this.getTickSize.bind(this)(v)*(m?-1:1)),n.attr("x",0).attr("y",p(d)).style("text-anchor",(v,b,{length:y})=>!_&&b===0&&(x===!0||x.first)?"start":!_&&b===y-1&&(x===!0||x.last)?"end":f(d)).attr("transform",g(d));break;case"top":t.attr("x2",0).attr("y2",m?s:-s),n.attr("x",0).attr("y",-(p(d)+h+u)).style("text-anchor",f(d)).attr("transform",g(d));break;case"left":t.attr("x2",m?s:-s).attr("y1",a.y).attr("y2",a.y),n.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-s:s).attr("y2",0),n.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,n,i,a,s){const{params:o}=this,r=this.helper.textFormatted(t),l=Q(r)&&r.indexOf(`
`)>-1?r.split(`
`):[];if(l.length)return l;if(ot(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=a?95:o.isCategory?(o.isInverted?n(i[0])-n(i[1]):n(i[1])-n(i[0]))-12:110);function d(u,h){let f,g,p;for(let _=1;_<h.length;_++)if(h.charAt(_)===" "&&(g=_),f=h.substr(0,_+1),p=s*f.length,c<p)return d(u.concat(h.substr(0,g||_)),h.slice(g?g+1:_));return u.concat(h)}return d(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:n}=this;return arguments.length?(n.tickFormat=t,this):n.tickFormat}tickCentered(t){const{config:n}=this;return arguments.length?(n.tickCentered=t,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var n,i,a;const{outerTickSize:s,tickOffset:o,tickValues:r}=this.config;let l;if(this.params.isCategory){const c=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;l=o*2||Math.abs(c(1)-c(0))}else{const c=(i=this.params.owner.scale.zoom)!=null?i:this.helper.scale;if(l=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(c.range()[1]-c.range()[0]))/(t||((a=this.g)==null?void 0:a.selectAll("line").size())||1),r)for(let u=0;u<r.length-1;u++){const h=c(r[u+1])-c(r[u]);h&&h<l&&(l=h)}}return l===1/0?0:l}ticks(...t){const{config:n}=this;return t.length?(n.tickArguments=nn(t),this):n.tickArguments}tickCulling(t){const{config:n}=this;return arguments.length?(n.tickCulling=t,this):n.tickCulling}tickValues(t){const{config:n}=this;if(z(t))n.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var $_=Object.defineProperty,B_=Object.defineProperties,z_=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,X_=Object.prototype.propertyIsEnumerable,ns=(e,t,n)=>t in e?$_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G_=(e,t)=>{for(var n in t||(t={}))N_.call(t,n)&&ns(e,n,t[n]);if(Kl)for(var n of Kl(t))X_.call(t,n)&&ns(e,n,t[n]);return e},V_=(e,t)=>B_(e,z_(t)),pe=(e,t,n)=>ns(e,typeof t!="symbol"?t+"":t,n);function is(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function Xi(e){return/^sub/.test(e)}function Ze(e,t,n){const i=is(t),a=e[`subchart_axis_${i}_tick_${n}`];return Xi(t)&&a!==void 0?a:e[`axis_${i}_tick_${n}`]}function W_(e){var t,n;const i=[e[0],e[e.length-1]];let a=0,s=null;for(const r of e){const l=(n=(t=r.textContent)==null?void 0:t.length)!=null?n:0;l>a&&(a=l,s=r)}s&&!i.includes(s)&&i.push(s);const o=e[Math.floor(e.length/2)];return i.includes(o)||i.push(o),i}const Gi=50,as=Symbol("tickWidthFallback");function Y_(e){var t,n,i;const a=e.select("line").node(),s=(n=(t=a==null?void 0:a.ownerDocument)==null?void 0:t.defaultView)!=null&&n.getComputedStyle?parseFloat(a.ownerDocument.defaultView.getComputedStyle(a).strokeWidth):parseFloat((i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function H_(e,t,n){var i;const a=(i=e==null?void 0:e.scale)==null?void 0:i.call(e);if(!a||t.length<2)return!1;const s=Math.max(1,n)/2,o=t.map(l=>+a(l)).filter(Number.isFinite).sort((l,c)=>l-c);if(o.length<2)return!1;let r=o[0]+s;for(let l=1;l<o.length;l++){const c=o[l]-s,d=o[l]+s;if(c<=r+vs)return!0;r=Math.max(r,d)}return!1}function j_(e,t){if(e.length<=Gi)return e;const n=new Map,i=r=>{r>=0&&r<e.length&&n.set(r,e[r])};i(0),i(e.length-1),i(Math.floor(e.length/2));const a=Math.max(1,Math.floor(e.length/(Gi-3)));let s=-1,o=0;for(let r=0;r<e.length;r+=a){i(r);const l=e[r],c=t?t(l):l,d=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;d>s&&(s=d,o=r)}return i(o),Array.from(n.keys()).sort((r,l)=>r-l).map(r=>n.get(r))}function U_(e){return z(e)?ql(e):!Array.isArray(e)||e.length<=Gi?e:{length:e.length,first:e[0],middle:e[Math.floor(e.length/2)],last:e[e.length-1]}}function ss(e){return e[as]}function Vi(e,t){$(t)?Object.defineProperty(e,as,{configurable:!0,value:t,writable:!0}):delete e[as]}function os(e){e.length=0,Vi(e)}function K_(e,t,n){os(e),e.length=t,Vi(e,n)}function Z_(e){const t=[];return t.length=e.length,Object.keys(e).forEach(n=>{const i=+n;t[i]=e[i]}),Vi(t,ss(e)),t}function q_(e,t){os(e),e.length=t.length,Object.keys(t).forEach(n=>{const i=+n;e[i]=t[i]}),Vi(e,ss(t))}function J_(e,t,n){const i=e[t];if($(i))return i;const a=Number(i);return Number.isFinite(a)?a:n}const Zl=new WeakMap;let Q_=0;function ql(e){if(!e||!/^(function|object)$/.test(typeof e))return`${typeof e}:${String(e)}`;let t=Zl.get(e);return t||(t=++Q_,Zl.set(e,t)),`${typeof e}:${t}`}function rs(e){return e instanceof Date?`date:${+e}`:Array.isArray(e)?`[${e.map(t=>rs(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${t}:${rs(e[t])}`).join(",")}}`:typeof e=="function"?ql(e):`${typeof e}:${String(e)}`}function ls(e){return e instanceof Date?new Date(+e):Array.isArray(e)?e.map(t=>ls(t)):e}function tx(e){return{width:e.width,height:e.height,ticks:e.ticks&&Z_(e.ticks),clipPath:e.clipPath,domain:ls(e.domain)}}function ex(e,t){return e.width=t.width,e.height=t.height,e.clipPath=t.clipPath,e.domain=ls(t.domain),e.ticks&&t.ticks&&q_(e.ticks,t.ticks),e}var nx={getAxisInstance:function(){return this.axis||new ix(this)}};class ix{constructor(t){pe(this,"owner"),pe(this,"x"),pe(this,"subX"),pe(this,"subY"),pe(this,"subY2"),pe(this,"y"),pe(this,"y2"),pe(this,"axesList",{}),pe(this,"tick",{x:null,y:null,y2:null}),pe(this,"xs",[]),pe(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom",subY:"left",subY2:"right"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${It.axis} ${It[`axis${Ot(t)}`]}`}isHorizontal(t,n){const i=t.config.axis_rotated;return n?i:!i}isCategorized(){const{config:t,state:n}=this.owner;return t.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||bt(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let n="linear";return this.isTimeSeries(t)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(n="log"),n}getExtent(){const t=this.owner,{config:n,scale:i}=t;let a=n.axis_x_extent;if(a){if(z(a))a=a.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&a.every(isNaN)){const s=Vt.bind(t);a=a.map(o=>i.subX(s(o)))}}return a}init(){const t=this.owner,{config:n,$el:{main:i,axis:a},state:{clip:s}}=t,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);a[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=s.pathXAxis:r==="y"&&(c=s.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",n[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:n,axis_y_inner:i,axis_y2_inner:a}=t.config;this.orient={x:n?"left":"bottom",y:n?i?"top":"bottom":i?"right":"left",y2:n?a?"bottom":"top":a?"left":"right",subX:n?"left":"bottom",subY:n?i?"top":"bottom":i?"right":"left",subY2:n?a?"bottom":"top":a?"left":"right"}}generateAxes(t){const n=this.owner,{config:i}=n,a=[],s=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?"left":"bottom":t==="y"?r=o?"bottom":"left":t==="y2"&&(r=o?"top":"right"),s.length&&s.forEach(l=>{const c=l.tick||{},d=n.scale[t].copy();l.domain&&d.domain(l.domain);const u=new Ul({outerTick:c.outer!==!1,noTransition:!1,config:i,id:t,isSubAxes:!0,owner:n}).scale(d).orient(r).tickFormat(z(c.format)?c.format.bind(n.api):(h=>h));q(c.count)&&u.ticks(c.count),c.values&&u.tickValues(c.values),a.push(u)}),this.axesList[t]=a}updateAxes(){const t=this.owner,{config:n,$el:{main:i},$T:a}=t;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],r=t.scale[s].copy(),l=r.range();this.axesList[s].forEach((c,d)=>{const u=c.scale().range();l.every((g,p)=>g===u[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${d+1}`;let f=i.select(`.${h.replace(/\s/,".")}`);f.empty()?(f=i.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden"),c.create(f)):(o[d].domain&&r.domain(o[d].domain),c.scale(r).create(a(f))),f.attr("transform",t.getTranslate(s,d+1))})})}setAxis(t,n,i,a){const s=this.owner,o=is(t);Xi(t)||(this.tick[o]=this.getTickValues(o)),this[t]=this.getAxis(t,n,i,t==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:a)}getAxis(t,n,i,a,s){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=is(t),d=l&&this.isCategorized(),u=this.orient[t],h=s?0:o.getAxisTickRotate(c);let f;if(l)f=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=Xi(t)?r[`subchart_axis_${c}_tick_format`]||r[`axis_${c}_tick_format`]:r[`axis_${c}_tick_format`];z(m)&&(f=m.bind(o.api))}let g=Xi(t)?this.getTickValues(c,!0):this.tick[c];const p=ke({outerTick:i,noTransition:a,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:d,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:d&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Ul(p).scale(l&&o.scale.zoom||n).orient(u);if(l&&this.isTimeSeries()&&g&&!z(g)){const m=Vt.bind(o);g=g.map(v=>m(v))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),g=null);g&&_.tickValues(g),_.tickFormat(f||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(c)&&(m=>`${m}%`)),d&&(_.tickCentered(r.axis_x_tick_centered),se(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=Ze(r,t,"count");return x&&_.ticks(x),_}updateXAxisTickValues(t,n){var i;const a=this.owner,{config:s}=a,o=s.axis_x_tick_fit,r=(c=s.axis_x_tick_count)=>{let d=c,u;return o&&(u=a.mapTargetsToUniqueXs(t),this.isCategorized()&&d>u.length&&(d=u.length),u=this.generateTickValues(u,d,this.isTimeSeries())),u},l=r();if(n)n.tickValues(l);else if(this.x){const c=this.getTickValues("x",!0),d=Ze(s,"subX","count"),u=c!=null?c:d!==s.axis_x_tick_count?r(d):l;this.x.tickValues(l),(i=this.subX)==null||i.tickValues(u)}return l}getId(t){const{config:n,scale:i}=this.owner;let a=n.data_axes[t];return(!a||!i[a])&&(a="y"),a}getXAxisTickFormat(t){const n=this.owner,{config:i,format:a}=n,s=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return s?z(s)?l=s.bind(n.api):o&&(l=c=>c?a.axisTime(s)(c):""):l=o?a.defaultAxisTime:r?n.categoryName:c=>c<0?c.toFixed(0):c,z(l)?c=>l.apply(n,r?[c,n.categoryName(c)]:[c]):l}getTickValues(t,n=!1){const i=this.owner,a=n?Ze(i.config,`sub${Ot(t)}`,"values"):i.config[`axis_${t}_tick_values`],s=z(a)?a.call(i.api):a,o=i[`${t}Axis`];return n?s!=null?s:void 0:s||(o?o.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const n=this.getLabelOptionByAxisId(t);return Q(n)?n:n?n.text:null}setLabelText(t,n){const i=this.owner,{config:a}=i,s=this.getLabelOptionByAxisId(t);Q(s)?a[`axis_${t}_label`]=n:s&&(s.text=n)}getLabelPosition(t,n){const i=this.owner.config.axis_rotated,a=this.getLabelOptionByAxisId(t),s=Ut(a)&&a.position?a.position:n[+!i],o=r=>!!~s.indexOf(r);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(t){const n=this.owner,{state:{width:i,height:a}}=n,s=this.getAxisLabelPosition(t);let o=s.isMiddle?-a/2:0;return this.isHorizontal(n,t!=="x")?o=s.isLeft?0:s.isCenter?i/2:i:s.isBottom&&(o=-a),o}textAnchorForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isMiddle?"middle":"end";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(a="start"),a}dxForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isBottom?"0.5em":"0";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(a="-0.5em"),a}dyForAxisLabel(t){const n=this.owner,{config:i}=n,a=i.axis_rotated,s=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?n.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;a?l=s?"1.2em":-25-r:s?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],a?s?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=s?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getTickFormatCacheValue(t){const n=this.owner,{config:i}=n;return t==="x"?{format:i.axis_x_tick_format,type:i.axis_x_type,localtime:i.axis_x_localtime,categories:i.axis_x_categories}:{format:i[`axis_${t}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(t),type:i[`axis_${t}_type`]}}getMaxTickSizeFingerprint(t,n,i,a,s,o){var r;const l=this.owner,{config:c,state:d}=l,u=t==="x",h=u?"axis_x":`axis_${t}`,f=a.tickValues();return rs({id:t,withoutRecompute:!!o,dataGeneration:d.dataGeneration,size:[d.current.width,d.current.height],range:(r=n.range)==null?void 0:r.call(n),domain:i,type:n.type,orient:this.orient[t],axisRotated:c.axis_rotated,evalTextSize:c.axis_evalTextSize,format:this.getTickFormatCacheValue(t),ticks:{values:U_(f),rawValues:c[`${h}_tick_values`],arguments:a.ticks(),count:c[`${h}_tick_count`],rotate:s,show:c[`${h}_tick_show`],textShow:c[`${h}_tick_text_show`],textPosition:c[`${h}_tick_text_position`],inner:c[`${h}_tick_inner`],culling:c[`${h}_tick_culling`],cullingMax:c[`${h}_tick_culling_max`],cullingLines:c[`${h}_tick_culling_lines`],cullingReverse:c[`${h}_tick_culling_reverse`],stepSize:!u&&c[`${h}_tick_stepSize`],timeValue:!u&&c[`${h}_tick_time_value`],fit:u&&c.axis_x_tick_fit,autorotate:u&&c.axis_x_tick_autorotate,centered:u&&c.axis_x_tick_centered,inverted:u&&c.axis_x_inverted,multiline:u&&c.axis_x_tick_multiline,width:u&&c.axis_x_tick_width}})}getMaxTickSize(t,n){var i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:d}=o,u=c.maxTickSize[t],h=`${W.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return u;const g=`axis_${t}`,p={width:0,height:0};let _;if(d||n||!s[`${g}_show`]||u.width>0&&a.filterTargetsToShow().length===0)return u;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const x=/^y2?$/.test(t),m=a.getTargetsToShow(),v=a.scale[t].copy().domain(a[`get${x?"Y":"X"}Domain`](m,t)),b=v.domain(),y=b[0]===b[1]&&b.every(I=>I>0),T=ot(u.domain)&&u.domain[0]===u.domain[1]&&u.domain.every(I=>I>0);if(y||T)return u;u.domain=b,x||os(u.ticks);const w=this.getAxis(t,v,!1,!1,!0),C=s[`${g}_tick_rotate`],k=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&k&&w.tickValues(this.generateTickValues(b,k,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,v,b,w,C,n),(f==null?void 0:f.fingerprint)===_)return a.cache.add(h,V_(G_({},f),{generation:o.redrawGeneration})),ex(u,f.value);const A=w.tickValues(),L=!x&&Array.isArray(A)&&A.length>Gi;L&&w.tickValues(j_(A,w.tickFormat()));const E=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),D=E.append("g").attr("class",`${It[`axis${Ot(t)}`]} ${U.dummy}`);w.create(D);const{sizeFor1Char:R}=D.node(),P=E.selectAll("text").attr("transform",$(C)?`rotate(${C})`:null),B=L?A.length:P.size();if(R)P.each(function(I,X){const G=this.textContent.length*R.w,Z=R.h;p.width=Math.max(p.width,G),p.height=Math.max(p.height,Z),x||(u.ticks[X]=G)});else{const I=[];if(P.each(function(){I.push(this)}),(I.length<=5?I:W_(I)).map(G=>ht(G,!0)).forEach(G=>{p.width=Math.max(p.width,G.width),p.height=Math.max(p.height,G.height)}),!x)for(let G=0;G<I.length;G++)u.ticks[G]=p.width}!x&&L&&K_(u.ticks,B,p.width),E.remove()}return Object.keys(p).forEach(x=>{p[x]>0&&(u[x]=p[x])}),a.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:tx(u)}),u}getXAxisTickTextY2Overflow(t){const n=this.owner,{axis:i,config:a,state:{current:s,isLegendRight:o,legendItemWidth:r}}=n,l=n.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&a.axis_x_tick_fit&&(!a.axis_x_tick_culling||se(a.axis_x_tick_culling))&&!a.axis_x_tick_multiline&&c){const d=a.axis_y2_show&&s.maxTickSize.y2.width||0,u=o&&r||0,h=s.width-n.getCurrentPaddingByDirection("left"),f=this.getXAxisTickMaxOverflow(l,h-t)-d-u,g=Math.max(0,f)+t;return Math.min(g,h/2)}return 0}getXAxisTickMaxOverflow(t,n){var i;const a=this.owner,{axis:s,config:o,state:r}=a,l=s.isTimeSeries(),c=r.current.maxTickSize.x.ticks,d=c.length,u=(i=ss(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=d-(l&&o.axis_x_tick_fit?.5:0);for(let m=0;m<d;m++){const v=m+1,b=Math.cos(Math.PI*t/180)*J_(c,m,u),y=v-(l?1:.5)+h;if(y<=0)continue;const w=(n-b)/y,C=p-v,k=f*w,S=C*w+k,A=b-w/2-S;g=Math.max(g,A)}const _=a.getTargetsToShow();let x=0;if(!l&&o.axis_x_tick_count<=_.length&&_[0].values.length){const m=Xe(a.axis.getAxisType("x"),0,n-g).domain([h*-1,a.getXDomainMax(a.data.targets)+1+f]);x=(m(1)-m(0))/2}return g+x}updateLabels(t){const n=this.owner,{config:i,$el:{main:a},$T:s}=n,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${Ot(r)}`,d=It[`${c}Label`];if(l){let u=a.select(`text.${d}`);u.empty()&&(u=a.select(`g.${It[c]}`).insert("text",":first-child").attr("class",d).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),s(u,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,n,i,a){const s=$(t)?t:t[n];return q(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,a):i}generateTickValues(t,n,i){let a=t;if(n){const s=z(n)?n():n;if(s===1)a=[t[0]];else if(s===2)a=[t[0],t[t.length-1]];else if(s>2){const o=this.isCategorized(),r=s-2,l=t[0],c=t[t.length-1],d=(c-l)/(r+1);let u;a=[l];for(let h=0;h<r;h++)u=+l+d*(h+1),a.push(i?new Date(u):o?Math.round(u):u);a.push(c)}}return i||(a=a.sort((s,o)=>s-o)),a}generateTransitions(t){const n=this.owner,{$el:{axis:i},$T:a}=n,[s,o,r,l,c,d]=["x","y","y2","subX","subY","subY2"].map(u=>a(i[u],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:d}}redraw(t,n,i){const a=this.owner,{config:s,state:o,$el:r}=a,l=n?"0":null;["x","y","y2","subX","subY","subY2"].forEach(c=>{const d=this[c],u=r.axis[c];d&&u&&(!i&&!s.transition_duration&&(d.config.withoutTransition=!0),u.style("opacity",l),d.create(t[`axis${Ot(c)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(t,n,i){var a;const s=this.owner,{config:o,scale:r,$el:l}=s,c=!!r.zoom;let d;if(!c&&this.isCategorized()&&t.length===0&&l.axis.x&&r.x.domain([0,l.axis.x.selectAll(".tick").size()]),r.x&&t.length?(!c&&s.updateXDomain(t,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),o.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(a=this.subX)==null||a.tickValues([])),o.zoom_rescale&&!i&&(d=r.x.orgDomain()),["y","y2"].forEach(u=>{const h=`axis_${u}_`,f=r[u];if(f){const g=o[`${h}tick_values`],p=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,u,d)),!g&&p){const _=s.axis[u],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:p,this.isTimeSeriesY()))}}}),n.Y){const u=()=>{var h,f;(h=r.subY)==null||h.domain(s.getYDomain(t,"y")),(f=r.subY2)==null||f.domain(s.getYDomain(t,"y2")),["y","y2"].forEach(g=>{const p=g==="y2"?"subY2":"subY",_=r[p],x=s.axis[p],m=this.getTickValues(g,!0),v=Ze(o,p,"count");if(!_||!x||m||!v)return;const b=_.domain();x.tickValues(this.generateTickValues(b,b.every(y=>y===0)?1:v,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(u):u()}}redrawAxis(t,n,i,a,s){const o=this.owner;this.syncAxisDomains(t,n,a),this.redraw(i,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&t.length&&this.setCulling()}setCulling(){const t=this.owner,{config:n,state:{clip:i,current:a},$el:s}=t;["subX","x","y","y2","subY","subY2"].forEach(o=>{const r=s.axis[o],l=Ze(n,o,"culling");if(r&&l){const c=r.selectAll(".tick"),d=pn(c.data(),!Ze(n,o,"culling_reverse")),u=d.length,h=Ze(n,o,"culling_max"),g=!Ze(n,o,"culling_lines")||H_(this[o],d,Y_(c));let p;if(u){for(let x=1;x<u;x++)if(u/x<h){p=x;break}p=p!=null?p:u;const _=new Map;for(let x=0;x<d.length;x++)_.set(d[x],x);c.each(function(x){var m;const v=g?this:this.querySelector("text");v&&(v.style.display=((m=_.get(x))!=null?m:0)%p?"none":null)})}else c.style("display",null);if(o==="x"){const _=a.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;s.svg.selectAll(`.${It.axisX} .tick text`).attr("clip-path",_)}}})}setAxisTooltip(){var t;const n=this.owner,{config:{axis_rotated:i,axis_tooltip:a},$el:{axis:s,axisTooltip:o}}=n,r=(t=a.backgroundColor)!=null?t:"black";n.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,d,u;if(Q(r)||r[l])if(o[l]=(c=s[l])==null?void 0:c.append("text").classed(It[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",f=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(d=o[l])==null||d.attr(h,f).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",f=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(u=o[l])==null||u.attr(h,f).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var Jl=Math.pow,ax={initEventRect(){this.$el.main.select(`.${U.chart}`).append("g").attr("class",Ie.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:n,state:i,$el:a}=t,s=t.isMultipleX(),o=n.axis_x_inverted;if(a.eventRect)t.updateEventRect(a.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${Ie.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Ie.eventRectsMultiple,s).classed(Ie.eventRectsSingle,!s).selectAll(`.${Ie.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),a.eventRect=l,t.state.inputType==="touch"&&!a.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(a.eventRect,!0)}if(!s){const r=t.getMaxDataCountTarget();(!n.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:n,$el:{eventRect:i,svg:a}}=e,s=f=>{if(e.isMultipleX())e.selectRectForMultipleXs(f);else{const g=e.getDataIndexFromEvent(n.event);e.callOverOutForTouch(g),g===-1?e.unselectRect():e.selectRectForSingle(f,g)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=tn(r)&&r||!1,c=!isNaN(r)&&r||null;let d;const u=!l&&c===null,h=f=>{const g=f.type,_=f.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];g==="touchstart"?l?f.preventDefault():c!==null&&(d=_):g==="touchmove"&&(l||d===!0||c!==null&&Math.abs(d-_)>=c)&&(d=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:u}).on("touchstart.eventRect touchmove.eventRect",f=>{if(n.event=f,!i.empty()&&i.classed(Ie.eventRect)){if(n.dragging||n.flowing||e.hasArcType()||f.touches.length>1)return;h(f),s(i.node())}else o()},{passive:u}).on("touchend.eventRect",f=>{n.event=f,!i.empty()&&i.classed(Ie.eventRect)&&(e.hasArcType()||!e.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:u}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:u})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,d=e||a.eventRect,u=()=>{if(s){const h=dr(a.chart.node());s.rect=ht(d.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!l||c||t)&&(d.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&d.classed(Ie.eventRect,!0)),u()},updateEventType(e){const t=this,n=tn(e),i=n?t.$el.eventRect:e,a=n?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(a&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:n,state:i}=e,a=n.zoom||n.x,s=t.axis_rotated,o=e.isMultipleX(),r=a==null?void 0:a.domain(),l=r?`${r[0]}_${r[1]}_${i.width}_${i.height}_${e.data.targets.length}_${i.dataGeneration}_${[...i.hiddenTargetIds].join(",")}`:null;if(l&&l===i._eventRectFingerprint)return;i._eventRectFingerprint=l;let c,d,u,h;if(e.updateEventType(o),o)c=0,d=0,u=i.width,h=i.height;else{let p,_;if(e.axis.isCategorized())p=e.getEventRectWidth(),_=x=>a(x.x)-p/2;else{const x=({index:m})=>({prev:e.getPrevX(m),next:e.getNextX(m)});p=m=>{const v=x(m),b=a.domain();let y;return v.prev===null&&v.next===null?y=s?i.height:i.width:v.prev===null?y=(a(v.next)+a(m.x))/2:v.next===null?y=a(b[1])-(a(v.prev)+a(m.x))/2:y=Math.max(0,(a(v.next)-a(v.prev))/2),y},_=m=>{const v=x(m);let b;return v.prev===null&&v.next===null?b=0:v.prev===null?b=a(a.domain()[0]):b=(a(m.x)+a(v.prev))/2,b}}c=s?0:_,d=s?_:0,u=s?i.width:p,h=s?p:i.height}const{eventReceiver:f}=i,g=(p,_)=>z(p)?p(_):p;f.coords.splice(f.data.length),f.data.forEach((p,_)=>{f.coords[_]={x:g(c,p),y:g(d,p),w:g(u,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s,o,r,l;const c=this,{config:d,state:u,$el:{main:h,circle:f}}=c,g=d.data_selection_enabled,p=d.data_selection_grouped,_=d.data_selection_isselectable,x=d.tooltip_grouped,m=c.getAllValuesOnIndex(t);if(x&&(c.showTooltip(m,e),(n=c.showGridFocus)==null||n.call(c,m),(i=c.showSubchartGridFocus)==null||i.call(c,m),!g||p))return;!f&&h.selectAll(`.${U.EXPANDED}:not(.${At.shape}-${t})`).classed(U.EXPANDED,!1);const v=h.selectAll(`.${At.shape}-${t}`).classed(U.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(b){return c.isWithinShape(this,b)});if(v.call(b=>{var y,T,w;const C=b.data();g&&(p||_!=null&&_.bind(c.api)(C))&&(e.style.cursor="pointer"),x||(c.showTooltip(C,e),(y=c.showGridFocus)==null||y.call(c,C),(T=c.showSubchartGridFocus)==null||T.call(c,C),(w=c.unexpandCircles)==null||w.call(c),b.each(k=>c.setExpand(t,k.id)))}),!x&&v.empty()){const b=Zt(u.event,e),y=m.filter(T=>c.isTargetToShow(T.id)?c.dist(T,b)<c.getPointSensitivity(T):!1);if(y.length>0){let T=y[0],w=c.dist(T,b);for(let C=1;C<y.length;C++){const k=y[C],S=c.dist(k,b);S<w&&(w=S,T=k)}c.showTooltip([T],e),(a=c.showGridFocus)==null||a.call(c,[T]),(s=c.showSubchartGridFocus)==null||s.call(c,[T]),(o=c.unexpandCircles)==null||o.call(c),c.setExpand(t,T.id,!0),g&&(p||_!=null&&_.bind(c.api)(T))&&(e.style.cursor="pointer")}else d.interaction_onout&&((r=c.hideGridFocus)==null||r.call(c),(l=c.hideSubchartGridFocus)==null||l.call(c),c.hideTooltip(),!p&&c.setExpand(t))}},selectRectForMultipleXs(e,t=!0){var n,i;const a=this,{config:s,state:o}=a,r=a.getTargetsToShow();if(o.dragging||a.hasArcType(r))return;const l=Zt(o.event,e),c=a.findClosestFromTargets(r,l);if(t&&o.mouseover&&(!c||c.id!==o.mouseover.id)&&(s.data_onout.call(a.api,o.mouseover),o.mouseover=void 0),!c){a.unselectRect();return}const u=(a.isBubbleType(c)||a.isScatterType(c)||!s.tooltip_grouped?[c]:a.filterByX(r,c.x)).map(f=>a.addName(f));a.showTooltip(u,e),a.setExpand(c.index,c.id,!0),(n=a.showGridFocus)==null||n.call(a,u),(i=a.showSubchartGridFocus)==null||i.call(a,u);const h=a.dist(c,l);(a.isBarType(c.id)||h<a.getPointSensitivity(c))&&(a.$el.eventRect.style("cursor","pointer"),t&&(!o.mouseover||o.mouseover.x!==c.x||o.mouseover.id!==c.id)&&(s.data_onover.call(a.api,c),o.mouseover=c))},unselectRect(){var e,t,n,i;const a=this,{state:s,$el:{circle:o,tooltip:r}}=a;if(s._lastTooltipMouse=null,s.isCanvasMode){(e=a.clearCanvasFocus)==null||e.call(a),r&&a.hideTooltip();return}(t=a.$el.eventRect)==null||t.style("cursor",null),(n=a.hideGridFocus)==null||n.call(a),(i=a.hideSubchartGridFocus)==null||i.call(a),r&&(a.hideTooltip(),a._handleLinkedCharts(!1)),o&&!a.isPointFocusOnly()&&a.unexpandCircles(),a.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:n,state:i}=t,{eventReceiver:a}=i,s=e.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=a,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):a.currentIdx;return l>-1?a.data[l]:null};s.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){var l;const c=o(r);if(i.event=r,!c)return;let{index:d}=c;const u=n.line_step_type;if(n.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(u)){const f=t.scale.zoom||t.scale.x,g=t.axis.xs[d],p=f.invert(Zt(r,this)[0]);u==="step-after"&&p<g?d-=1:u==="step-before"&&p>g&&(d+=1)}(l=t.showAxisGridFocus)==null||l.call(t);const h=n.tooltip_grouped&&d===a.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||h){if(n.tooltip_show&&h){const[f,g]=Zt(r,this),p=i._lastTooltipMouse;(!p||Jl(f-p[0],2)+Jl(g-p[1],2)>=9)&&(i._lastTooltipMouse=[f,g],t.setTooltipPosition())}return}d!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=d),d===-1?t.unselectRect():t.selectRectForSingle(this,d),t.setOverOut(d!==-1,d)}).on("mouseout",r=>{var l;i.event=r,!(!t.config||t.hasArcType()||a.currentIdx===-1||!n.interaction_onout)&&((l=t.hideAxisGridFocus)==null||l.call(t),t.unselectRect(),t.setOverOut(!1,a.currentIdx),a.currentIdx=-1)})}return s},clickHandlerForSingleX(e,t){const n=t,{config:i,state:a,$el:{main:s}}=n;if(!e||n.hasArcType()||a.cancelClick){a.cancelClick&&(a.cancelClick=!1);return}const{index:o}=e;s.selectAll(`.${At.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||n.isWithinShape(this,r))&&((l=n.toggleShape)==null||l.call(n,this,r,o),i.data_onclick.bind(n.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:n,state:i}=t;e.on("click",function(a){i.event=a,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(a){i.event=a,t.selectRectForMultipleXs(this)}).on("mouseout",a=>{i.event=a,!(!t.config||t.hasArcType()||!n.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:n,state:i}=t,a=t.getTargetsToShow();if(t.hasArcType(a))return;const s=Zt(i.event,this),o=t.findClosestFromTargets(a,s);if(!o)return;const r=t.getPointSensitivity(o);(t.isBarType(o.id)||t.dist(o,s)<r)&&t.$el.main.selectAll(`.${At.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${At.shape}-${o.index}`).each(function(){var l;(n.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),n.data_onclick.bind(t.api)(o,this))})}},sx={initClip(){const e=this,{clip:t,datetimeId:n}=e.state;t.id=`${n}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:n}=t;return!n.clipPath&&/-clip$/.test(e)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+s+10:i.bottom)+20,c=o?-(1+r):-(r-1),d=-15,u=o?i.left+20:a+10+r;e.attr("x",c).attr("y",d).attr("width",u).attr("height",l)},setYAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=n.axis_y_inner,c=l&&!o?n.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),d=-(o?20:i.top),u=(o?a+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+s)+10;e.attr("x",c).attr("y",d).attr("width",u).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:n,xAxisHeight:i},$el:{defs:a}}=e,s=e.getHorizontalAxisHeight("x");if(a&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;e.appendClip(a,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=e.getClipPath(n.idXAxisTickTexts)}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&s!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=s},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:n}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const a=Math.sin(Math.PI/180*Math.abs(i));n.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/a}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:n},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},ox={getAxisSize(e){const t=this,n=t.config.axis_rotated;return n&&e==="x"||!n&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var n,i;const a=this;if(a.axis){const s=(n=a.axis)==null?void 0:n.getAxisLabelPosition(e),{width:o}=a.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=a.config.padding)==null?void 0:i.mode)==="fit"?s.isInner?10+r:10:s.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,n;const i=this,{config:a,state:s}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=s,c=a.axis_rotated,d=((t=a.padding)==null?void 0:t.mode)==="fit",u=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?u&&!h?e==="y"?1:0:20:30;if(e==="x"&&!a.axis_x_show)return 8;if(e==="x"&&$(a.axis_x_height))return a.axis_x_height;if(e==="y"&&!a.axis_y_show)return a.legend_show&&!r&&!l?10:1;if(e==="y2"&&!a.axis_y2_show)return d?0:o.top;const p=i.axis.getMaxTickSize(e),_=Math.abs(a.axis_x_tick_rotate)>0&&(!a.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(a.axis_x_tick_multiline||_)&&p.height>f&&(g+=p.height-f),g+(i.axis.getAxisLabelPosition(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:n}=e,i=t.axis_x_inverted,a=n.x.tickInterval();return Math.max(0,i?Math.abs(a):a)},getAxisTickRotate(e){const t=this,{axis:n,config:i,state:a,$el:s}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=n.isCategorized()||n.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=a.current.maxTickSize.x.ticks.length;let d=0;if(l?d=l>c?c:l:c&&(d=c),d!==a.axis.x.tickCount){const{targets:u}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(u,"min"),t.getXDomainMinMax(u,"max")],d)}a.axis.x.tickCount=d}(s.svg||a.isCanvasMode)&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:n,isLegendRight:i,legendItemWidth:a}}=e,s=i&&a,o=n.width-s-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},rx={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},lx={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},cx={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},ux=Object.defineProperty,Ql=Object.getOwnPropertySymbols,dx=Object.prototype.hasOwnProperty,hx=Object.prototype.propertyIsEnumerable,tc=(e,t,n)=>t in e?ux(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cs=(e,t)=>{for(var n in t||(t={}))dx.call(t,n)&&tc(e,n,t[n]);if(Ql)for(var n of Ql(t))hx.call(t,n)&&tc(e,n,t[n]);return e},fx=cs(cs(cs({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},rx),lx),cx),gx={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const px=[L_,R_,E_],ec={axis:nx,clip:sx,eventrect:ax,sizeAxis:ox},nc={optDataAxis:gx,optAxis:fx};function ic(e){return Object.keys(e).map(t=>e[t])}function ac(e=[],t=[]){St(ge.prototype,ic(ec).concat(e)),St(Yt.prototype,px),cn.setOptions(ic(nc).concat(t))}function ei(e=[],t=[]){ac(e,t)}function Fe(e,t=[]){const n=Array.isArray(e)?e:e?[e]:[];ac([Rn,Bi,k_].concat(n),[dn,A_].concat(t))}let sc=()=>(Fe(An,[Ln]),(sc=()=>O.AREA)()),oc=()=>(Fe(An,[Ln]),(oc=()=>O.AREA_LINE_RANGE)()),rc=()=>(Fe(An,[Ln]),(rc=()=>O.AREA_STEP_RANGE)()),lc=()=>(Fe(An,[Ln,es]),(lc=()=>O.AREA_SPLINE)()),cc=()=>(Fe(An,[Ln,es]),(cc=()=>O.AREA_SPLINE_RANGE)()),uc=()=>(Fe(An,[Ln]),(uc=()=>O.AREA_STEP)());function us(e){const t=this.config.bar_connectLine,n=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(n)?n:null}var _x={initBar(){const{$el:e,config:t,state:{clip:n}}=this;e.bar=e.main.select(`.${U.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",ie.chartBars).call(this.setCssRule(!1,`.${ie.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(e){const t=this,{config:n}=t,i=t.getClass("bars",!0),a=n.interaction_enabled&&n.data_selection_isselectable;Ya.call(t,e,{type:"Bar",elKey:"bar",containerClass:ie.chartBars,itemClass:ie.chartBar,initFn:t.initBar}).append("g").attr("class",i).style("cursor",o=>{var r;return(r=a==null?void 0:a.bind)!=null&&r.call(a,t.api)(o)?"pointer":null}).call(o=>{t.setCssRule(!0,` .${ie.bar}`,["fill"],t.color)(o),o.each(function(r){us.call(t,r.id)&&(0,F.select)(this).append("path").attr("class",ie.barConnectLine)})})},updateBar(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,$el:a,$T:s}=n,o=t?a.subchart:a,r=n.getClass("bar",!0),l=n.initialOpacity.bind(n);i.bar_linearGradient&&n.updateLinearGradient();const c=o.main.selectAll(`.${ie.bars}`).selectAll(`.${ie.bar}`).data(n.labelishData.bind(n));s(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",n.generateUpdateBarColor()).merge(c).style("opacity",l),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const e=this,t=e.getStylePropValue(e.color)||(()=>null);return n=>Vr.call(e,n,"bar_linearGradient",t)},updateBarColor(e){return this.generateUpdateBarColor()(e)},redrawBar(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{bar:a}=n?i.$el.subchart:i.$el,s=[],o=new Map,r=_i(i),l=i.generateUpdateBarColor(),c=function(u,h,f){var g;const _=$(u.value)||i.isBarRangeType(u)||((g=i.isSubchartCandlestickBarValue)==null?void 0:g.call(i,u,n))?e(u,h):[""];let x=o.get(u.id);if(x===void 0&&(x=us.call(i,u.id),o.set(u.id,x)),_.length>1&&s.push(_[1]),h===f.length-1&&s.length){const m=i.$T((0,F.select)(this.parentNode.querySelector(`.${ie.barConnectLine}`)),t,xe());i.updateConnectLine(m,x,s),s.splice(0)}return _[0]},d=i.$T(a,t,xe());return r&&typeof d.attrTween=="function"?d.attrTween("d",function(u,h,f){var g;const p=c.call(this,u,h,f);return Sd((g=this.getAttribute("d"))!=null?g:"",p)}):d.attr("d",c),[d.style("fill",u=>{var h;return((h=i.getSubchartCandlestickBarColor)==null?void 0:h.call(i,u,n))||l(u)}).style("clip-path",u=>u.clipPath).style("opacity",null)]},generateDrawBar(e,t){const n=this,{config:i}=n,a=n.generateGetBarPoints(e,t),s=_i(n),o=s?ma(n):new Set,r=new Map;return(l,c)=>{const d=a(l,c),{indexX:u,indexY:h,isNegative:f,pos:g,radius:p,clipPath:_}=va(n,l,d,s,o,n.isStackingRadiusData.bind(n)),x=["",""];if(l.clipPath=_,s){const y=`a${p} ${p} ${f?"1 0 0":"0 0 1"} `;x[h]=`${y}${p},${p}`,x[u]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=i.axis_rotated?`H${g} ${x[0]}V${d[2][h]-p} ${x[1]}H${d[3][u]}`:`V${g} ${x[0]}H${d[2][u]-p} ${x[1]}V${d[3][h]}`,v=[`M${d[0][u]},${d[0][h]}${m}z`];let b=r.get(l.id);return b===void 0&&(b=us.call(n,l.id),r.set(l.id,b)),b&&v.push(i.axis_rotated?{x:d[0][u],y:d[0][h],width:d[0][u]-g,height:d[2][h]-d[0][h]}:{x:d[0][u],y:g,width:d[2][u]-d[0][u],height:d[3][h]-g}),v}},isStackingRadiusData(e){const t=this,{$el:n,config:i,data:a,state:s}=t,{id:o,index:r,value:l}=e;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(f=>f.id===o&&f.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),u=t.orderTargets(t.filterTargetsToShow(a.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>{const f=h.values[r];if(f&&($(l)&&l>0?f.value>0:f.value<0))return f}).filter(Boolean).map(h=>h.id);return l!==0&&u.indexOf(o)===u.length-1},updateConnectLine(e,t,n){const i=n.map((a,s,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),d=[],u=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?d.push(`${u},${h}`):(d.push(r?`L${a.x-(/\w+-end$/.test(t)?a.width:0)},${a.y}`:`L${a.x},${a.y+(/\w+-start$/.test(t)?a.height:0)}`),s<o.length-1&&d.push(`M${u},${h}`)),d.join(" ")});e.attr("d",`M${i.join("")}z`)}},xx={bar_connectLine:!1,bar_front:!1,bar_indices_removeNull:!1,bar_label_threshold:0,bar_linearGradient:!1,bar_overlap:!1,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0};let dc=()=>(ei([_x,Rn],[xx,dn]),(dc=()=>O.BAR)());var mx={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:n}=e.state,i=W.bubbleBaseLength;let a=e.cache.get(i);return a||e.cache.add(i,a=ue("min",[t,n])),a},getBubbleR(e){const t=this;let n=t.config.bubble_maxR;z(n)?n=n.bind(t.api)(e):$(n)||(n=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=W.bubbleMaxValue;let a=t.cache.get(i);a===null&&t.cache.add(i,a=ue("max",t.getMinMaxData().max.map(r=>t.isBubbleZType(r)?t.getBubbleZData(r.value,"y"):tt(r.value)?r.value.mid:r.value)));const s=n*n*Math.PI,o=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(s/a);return Math.sqrt(o/Math.PI)},getBubbleZData(e,t){return tt(e)?e[t]:e[t==="y"?0:1]}},vx=mx,bx={bubble_maxR:35,bubble_zerobased:!1};let hc=()=>(ei([Rn,Bi,vx],[bx,dn]),(hc=()=>O.BUBBLE)());var yx=Object.defineProperty,fc=Object.getOwnPropertySymbols,Tx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,gc=(e,t,n)=>t in e?yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cx=(e,t)=>{for(var n in t||(t={}))Tx.call(t,n)&&gc(e,n,t[n]);if(fc)for(var n of fc(t))wx.call(t,n)&&gc(e,n,t[n]);return e},Sx={generateGetCandlestickPoints(e,t=!1){const n=this,i=t?n.axis.subX:n.axis.x,a=n.getIndicesMax(e)+1,s=n.getBarW("candlestick",i,a),o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t),l=n.getShapeOffset(n.isCandlestickType,e,!!t),c=n.getYScaleById.bind(n);return(d,u)=>{const h=c.call(n,d.id,t)(n.getShapeYMin(d.id,t)),f=l(d,u)||h,g=$(s)?s:s[d.id]||s._$width,p=n.getCandlestickData(d);let _;if(p&&$(p.open)&&$(p.close)){const x={start:o(d),end:0};x.end=x.start+g;const m={start:r(p.open),end:r(p.close)},v={x:x.start+g/2,high:r(p.high),low:r(p.low)},b=h-f;m.start-=b,m.end-=b,v.high-=b,v.low-=b,_=[[x.start,m.start],[x.end,m.end],[v.x,v.low,v.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},getCandlestickData({value:e}){let t;if(ot(e)){const[n,i,a,s,o=!1]=e;t={open:n,high:i,low:a,close:s},o!==!1&&(t.volume=o)}else tt(e)&&(t=Cx({},e));return t&&(t._isUp=t.close>=t.open),t||null}},kx=Object.defineProperty,Ax=Object.defineProperties,Lx=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Px=(e,t)=>{for(var n in t||(t={}))Rx.call(t,n)&&_c(e,n,t[n]);if(pc)for(var n of pc(t))Ex.call(t,n)&&_c(e,n,t[n]);return e},Dx=(e,t)=>Ax(e,Lx(t)),Ix=Dx(Px({},Sx),{initCandlestick(){Wr.call(this,{elKey:"candlestick",className:De.chartCandlesticks})},updateTargetsForCandlestick(e){Ya.call(this,e,{type:"Candlestick",elKey:"candlestick",containerClass:De.chartCandlesticks,itemClass:De.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(e,t=!1){const n=this,{$el:i,$T:a}=n,s=t?i.subchart:i,o=n.getClass("candlestick",!0),r=n.initialOpacity.bind(n),l=s.main.selectAll(`.${De.chartCandlestick}`).selectAll(`.${De.candlestick}`).data(n.labelishData.bind(n));a(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(d=>d.value).append("g").attr("class",o);c.append("line"),c.append("path"),s.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const n=this,{config:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const d=a(r,l),u=n.getCandlestickData(r),h=u==null?void 0:u._isUp,f=+s,g=+!f;c.classed&&c.classed(De[h?"valueUp":"valueDown"],!0);const p=s?`H${d[1][1]} V${d[1][0]} H${d[0][1]}`:`V${d[1][1]} H${d[1][0]} V${d[0][1]}`;c.select("path").attr("d",`M${d[0][f]},${d[0][g]}${p}z`).style("fill",m=>(h?n.color(m):tt(o)?o[m.id]:o)||n.color(m));const _=c.select("line"),x=s?{x1:d[2][1],x2:d[2][2],y1:d[2][0],y2:d[2][0]}:{x1:d[2][0],x2:d[2][0],y1:d[2][1],y2:d[2][2]};for(const m in x)_.attr(m,x[m])}},redrawCandlestick(e,t,n=!1){const i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=xe(!0);return[o.each(function(l,c){const d=s((0,F.select)(this),t,r);e(l,c,d)}).style("opacity",null)]}}),Mx={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let xc=()=>(ei([Ix,Rn],[Mx,dn]),(xc=()=>O.CANDLESTICK)());var Wi={arc_cornerRadius:0,arc_cornerRadius_ratio:0,arc_needle_show:!1,arc_needle_color:void 0,arc_needle_value:void 0,arc_needle_path:void 0,arc_needle_length:100,arc_needle_top_rx:0,arc_needle_top_ry:0,arc_needle_top_width:0,arc_needle_bottom_rx:1,arc_needle_bottom_ry:1,arc_needle_bottom_width:15,arc_needle_bottom_len:0,arc_rangeText_values:void 0,arc_rangeText_unit:"absolute",arc_rangeText_fixed:!1,arc_rangeText_format:void 0,arc_rangeText_position:void 0},Fx={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_line:!1,donut_label_image:void 0,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0},mc=wt(10);const Ox=15,vc=20,bc=.35;function $x(e=!1){const t=this;return["donut","pie","polar","gauge"].find(n=>t.hasType(n)&&!(n==="gauge"&&e&&t.hasMultiArcGauge()))}function yc(){const e=this,{config:t}=e,n=$x.call(e,!0),i=n&&t[`${n}_label_line`],a=Ut(i),s=(l,c,d)=>d,o={show:i===!0||a&&(i==null?void 0:i.show)!==!1,distance:a&&(i==null?void 0:i.distance)||vc};if(i===!0)return{chartType:n,line:o,text:{formatter:s}};if(!a)return{chartType:n,line:{show:!1,distance:vc},text:{formatter:null}};let r=s;return z(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:n,line:o,text:{formatter:r}}}function Bx(e,t){const n=this,{state:i}=n,a=n.updateAngle(e);if(!a)return null;let{outerRadius:s}=n.getRadius(e),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(e,s),s=i.radius);let r=(a.startAngle+a.endAngle)/2;Math.abs(a.endAngle-a.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),d=-Math.cos(r),u={x:c*o,y:d*o},h=s+Ox,f={x:c*h,y:d*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:u,breakPoint:f,endPoint:p,isRight:g,midAngle:r}}function Tc(){return yc.call(this).line.show}function zx(e){const t=this,{$el:{arcs:n},$T:i}=t,{line:a,text:s}=yc.call(t),o=a.distance;let r=null;n.selectAll(`.${at.chartArc}`).each(function(l){var c,d,u;const h=(0,F.select)(this),f=Bx.call(t,l,o),{ratio:g,meetsThreshold:p,updated:_}=(c=l._cache)!=null?c:{};if(!_||!f)return;const x=t.isTargetToShow(l.data.id)&&p,{startPoint:m,breakPoint:v,endPoint:b,isRight:y}=f,T=`${m.x},${m.y} ${v.x},${v.y} ${b.x},${b.y}`;if(a.show){let C=h.select(`.${at.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",at.arcLabelLine)),i(C,e).attr("points",T).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let w=h.select(`.${at.arcLabelLineText}`);if(w.empty()&&(w=h.append("text").attr("class",at.arcLabelLineText).style("pointer-events","none")),x){const{value:C}=_,{id:k}=l.data,S=((u=(d=s.formatter)!=null?d:t.getArcLabelConfig("format"))!=null?u:t.defaultArcValueFormat)(C,g,k).toString();Cn(w,S,[-1,1],!1);const A={x:b.x+5*(y?1:-1),y:b.y};w.style("text-anchor",y?"start":"end");const L=w.node(),E=L==null?void 0:L.querySelectorAll("tspan");if(r===null&&(r=parseFloat(N.getComputedStyle(L).fontSize)||12),E&&E.length>1){const R=(E.length-3)/2;A.y+=(-R+bc)*r}else A.y+=bc*r;i(w,e).attr("transform",`translate(${A.x},${A.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(w,e).style("opacity","0")})}var Nx=Object.defineProperty,Xx=Object.defineProperties,Gx=Object.getOwnPropertyDescriptors,wc=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Cc=(e,t,n)=>t in e?Nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yx=(e,t)=>{for(var n in t||(t={}))Vx.call(t,n)&&Cc(e,n,t[n]);if(wc)for(var n of wc(t))Wx.call(t,n)&&Cc(e,n,t[n]);return e},Hx=(e,t)=>Xx(e,Gx(t));const ds=["donut","gauge","pie","polar"];function jx(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function Ux(e,t,n,i){var a,s;const{config:o,state:{radiusExpanded:r}}=e,l=n.endAngle-Math.PI/2,c=Math.sin(l),d={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const u=o.arc_rangeText_position;if(u){const h=o.arc_rangeText_values,f=z(u)?u(h[t.index]):u;d.x+=(a=f==null?void 0:f.x)!=null?a:0,d.y+=(s=f==null?void 0:f.y)!=null?s:0}}return d}function Kx(e,t,n,i){const{config:a}=e,s=jx(e);let o=s?a[`${s}_label_ratio`]:void 0;if(o)o=z(o)?o.bind(e.api)(t,n,i):o;else{const u=36/n,h=u>.375;o=n&&i?(h?1.175-u:.8)*n/i:0}return o}function Zx(e,t,n){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[a,s]=e.svgArc.centroid(n).map(l=>isNaN(l)?0:l),o=Math.sqrt(a*a+s*s),r=Kx(e,t,i,o);return{pos:{x:a,y:s},ratio:r}}function Sc(e=0){const t=this,{config:n,state:i}=t,a=t.hasMultiArcGauge(),s=i.gaugeArcWidth/t.getTargetsToShow().length,o=e?Math.min(i.radiusExpanded*e-i.radius,s*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return a?i.radius-s*(r.index+1):$(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(a)c=i.radius-s*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:d}=i;i.radius!==l&&(d-=Math.abs(i.radius-l)),c=d*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:d=0}=n,{data:{id:u},value:h}=r;let f;return c?f=c*l:f=$(d)?d:d.call(t.api,u,h,l),f}}}function hs(e){return function(t){const n=({startAngle:a=0,endAngle:s=0,padAngle:o=0})=>({startAngle:a,endAngle:s,padAngle:o}),i=(0,mc.interpolate)(n(this._current),n(t));return this._current=t,function(a){const s=i(a),{data:o,index:r,value:l}=t;return e(Hx(Yx({},s),{data:o,index:r,value:l}))}}}var qx={initPie(){const e=this,{config:t}=e,n=t.data_type,i=t[`${n}_padding`],a=t[`${n}_startingAngle`]||0,s=(i?i*.01:t[`${n}_padAngle`])||0;e.pie=(0,pt.pie)().startAngle(a).endAngle(a+2*Math.PI).padAngle(s).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,d)=>c+d.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:n}=e,i=t.data_type,a=t[`${i}_padding`],s=t.gauge_width||t.donut_width,o=e.getTargetsToShow().length*t.gauge_arcs_minWidth,r=.85,l=Tc.call(e)?r:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),n.radius=n.radiusExpanded*.95,n.innerRadiusRatio=s?(n.radius-s)/n.radius:.6,n.gaugeArcWidth=s||(o<=n.radius-n.innerRadius?n.radius-n.innerRadius:o<=n.radius?o:n.radius);const c=t.pie_innerRadius||(a?a*(n.innerRadiusRatio+.1):0);n.outerRadius=t.pie_outerRadius,n.innerRadius=e.hasType("donut")||e.hasType("gauge")?n.radius*n.innerRadiusRatio:c},getRadius(e){const t=this,n=e==null?void 0:e.data;let{innerRadius:i,outerRadius:a}=t.state;return!$(i)&&n&&(i=i[n.id]||0),tt(a)&&n&&n.id in a?a=a[n.id]:$(a)||(a=t.state.radius),{innerRadius:i,outerRadius:a}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,n=t.gauge_arcLength*3.6;let i=2*(n/360);return n<-360?i=-2:n>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,n=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,a=-1*Math.PI/2,s=Math.PI/2;let o=t[`${n}_startingAngle`]||0;return!i&&o<=a?o=a:!i&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var n;const i=this,{config:a,state:s}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!a)return null;const d=i.getStartingAngle(),u=a.gauge_fullCircle||t&&!o?i.getArcLength():d*-2,h=l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge();if(h){const{gauge_min:f,gauge_max:g}=a,p=i.getTotalDataSum(s.rendered),_=u*((p-f)/(g-f));r=r.startAngle(d).endAngle(_+d)}if(t===!1){let f;if(h)f=r(i.filterTargetsToShow());else{const g="$arcPieLayout";let p=i.cache.get(g);(!p||p.generation!==s.redrawGeneration)&&(p={generation:s.redrawGeneration,layout:r(i.filterTargetsToShow())},i.cache.add(g,p)),f=p.layout}f.forEach((g,p)=>{var _;!c&&g.data.id===((_=l.data)==null?void 0:_.id)&&(c=!0,l=g,l.index=p)})}if(isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(a.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:f,gauge_max:g}=a,p=t&&!o?i.getTotalDataSum(s.rendered):g,_=u/(p-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<p?x-f:p-f;l.startAngle=d,l.endAngle=d+_*m}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:n,corner:i}=Sc.call(e),a=(0,pt.arc)().innerRadius(t).outerRadius(n),s=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const d=r?o:(l=e.updateAngle(o))!=null?l:null;d&&(c=a.cornerRadius(i(d,n(d)))(d))}return c};return s.centroid=a.centroid,s},getSvgArcExpanded(e=1){const t=this,{inner:n,outer:i,corner:a}=Sc.call(t,e),s=(0,pt.arc)().innerRadius(n).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=a(r,l)),r&&s.cornerRadius(c)(r)||"M 0 0"}},getArc(e,t,n){return n||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:n},state:i,$T:a}=e,s=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const d=e.pie(r).map((h,f)=>(h.index=f,h));let u=n.selectAll(`.${at.arcRange}`).data(r);u.exit().remove(),u=a(u.enter().append("text").attr("class",at.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const f=l?h/c*100:h;return z(s)?s(f):`${f}${l?"%":""}`}).merge(u)),(!i.rendered||i.rendered&&!o)&&c>0&&u.attr("transform",function(h,f){return e.transformForArcLabel(this,d[f],!0)}),u.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,n=!1){const i=this,a=i.updateAngle(t,n);if(!a)return"";let s,o=1;if(n||i.hasMultiArcGauge())s=Ux(i,t,a,n);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=Zx(i,t,a);s=r.pos,o=r.ratio}else return"";return zr.call(i,e,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const n=this,i=n.hasType("gauge"),a=(t=ds.filter(n.hasType.bind(n)))==null?void 0:t[0];n.shouldShowArcLabel()&&e.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=(0,F.select)(this),r=n.updateAngle(s),l=n.getRatio("arc",r),c=Ga.call(n,l,a);if(s._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:d}=r||s,u=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(d,l,s.data.id).toString();Cn(o,u,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:n},$el:i}=t;if(n){const s=setInterval(()=>{t.state.transiting||(clearInterval(s),i.legend.selectAll(`.${lt.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const a=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).each(function(s){if(!t.shouldExpand(s.data.id))return;const o=t.getExpandConfig(s.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(s.data.id,"rate"));(0,F.select)(this).selectAll("path").transition().duration(o).attrTween("d",hs(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",hs(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:n},$el:{svg:i}}=t;if(n)return;const a=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).selectAll("path").transition().duration(s=>t.getExpandConfig(s.data.id,"duration")).attrTween("d",hs(t.svgArc.bind(t))),i.selectAll(`${at.arc}`).style("opacity",null)},getExpandConfig(e,t){const n=this,{config:i}=n,a={duration:50,rate:.98};let s;return n.isDonutType(e)?s="donut":n.isGaugeType(e)?s="gauge":n.isPieType(e)&&(s="pie"),s?i[`${s}_expand_${t}`]:a[t]},shouldExpand(e){const t=this,{config:n}=t,i=t.isDonutType(e)?"donut":t.isGaugeType(e)?"gauge":t.isPieType(e)?"pie":null;return i?!!n[`${i}_expand`]:!1},shouldShowArcLabel(){const e=this,{config:t}=e;return ds.some(n=>e.hasType(n)&&t[`${n}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:n}=t;let i=a=>a;return ds.filter(t.hasType.bind(t)).forEach(a=>{i=n[`${a}_label_${e}`]}),e==="format"&&z(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:n}=t,i=t.hasType("gauge"),a=t.getChartClass("Arc"),s=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=n.main.select(`.${at.chartArcs}`),l=r.selectAll(`.${at.chartArc}`).data(t.pie(e)).attr("class",d=>a(d)+o(d.data)),c=l.enter().append("g").attr("class",a).call(this.setCssRule(!1,`.${at.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",s).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),n.text=r.selectAll(`.${U.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${U.chart}`).append("g").attr("class",at.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,n=e||t.getArcTitle(),i=t.hasType("gauge");if(n){const a=i?ae.chartArcsGaugeTitle:at.chartArcsTitle;let s=t.$el.arcs.select(`.${a}`);s.empty()&&(s=t.$el.arcs.append("text").attr("class",a).style("text-anchor","middle")),i&&s.attr("dy","-0.3em"),Cn(s,n,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:n}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let a=n.current.needle;return $(a)||(a=t.arc_needle_value),an(i,{NEEDLE_VALUE:~~a})}return!1},redrawArc(e,t,n){const i=this,{config:a,state:s,$el:{main:o}}=i,r=a.interaction_enabled,l=r&&a.data_selection_isselectable;let c=o.selectAll(`.${at.arcs}`).selectAll(`.${at.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",d=>i.color(d.data)).style("cursor",d=>{var u;return(u=l==null?void 0:l.bind)!=null&&u.call(l,i.api)(d)?"pointer":null}).style("opacity","0").each(function(d){i.isGaugeType(d.data)&&(d.startAngle=a.gauge_startingAngle,d.endAngle=a.gauge_startingAngle),this._current=d}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",d=>!i.isGaugeType(d.data)&&n?"scale(0)":"").style("opacity",function(d){return d===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(e).attrTween("d",function(d){const u=i.updateAngle(d);if(!u)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,mc.interpolate)(this._current,u);return this._current=h(0),function(f){const g=h(f);return g.data=d.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",d=>{let u;return i.levelColor?(u=i.levelColor(d.data.values[0].value),a.data_colors[d.data.id]=u):u=i.color(d.data),u}).style("opacity",null).call(ri,function(){if(i.levelColor){const d=(0,F.select)(this),u=d.datum(this._current);i.updateLegendItemColor(u.data.id,d.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),H(a.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),a.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:n,state:{hiddenTargetIds:i,radius:a}}=e,s=(a-1)/100*n.arc_needle_length,o=i.size!==e.data.targets.length;let r=e.$el.arcs.select(`.${at.needle}`);const l=n.arc_needle_path,c=n.arc_needle_bottom_width/2,d=n.arc_needle_top_width/2,u=n.arc_needle_top_rx,h=n.arc_needle_top_ry,f=n.arc_needle_bottom_len,g=n.arc_needle_bottom_rx,p=n.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(at.needle,!0),t.needle=r,t.needle.updateHelper=(m,v=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(ri,()=>{v&&(n.arc_needle_value=m),x()})}),o){const m=z(l)?l.call(e,s):`M-${c} ${f} A${g} ${p} 0 0 0 ${c} ${f} L${d} -${s} A${u} ${h} 0 0 0 -${d} -${s} L-${c} ${f} Z`;e.$T(r).attr("d",m).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:n,state:i}=t,a=t.getArcLength(),s=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=ct(e)?e:n.arc_needle_value,l=n[`${n.data_type}_startingAngle`]||0,c;if($(r)||(r=s&&t.data.targets.length===1?o:0),i.current.needle=r,s){l=t.getStartingAngle();const d=n.gauge_fullCircle?a:l*-2,{gauge_min:u,gauge_max:h}=n;c=d*((r-u)/(h-u))}else c=o?a*(r/o):0;return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:n}=e,i=e.hasMultiArcGauge(),a=t.gauge_fullCircle,s=e.getTargetsToShow().length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=a?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${at.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${at.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(d,u)=>`${at.chartArcsBackground} ${at.chartArcsBackground}-${u}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:d})=>{if(s||n.hiddenTargetIds.has(d))return"M 0 0";const u={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(u,!0,!0)}),l.exit().remove()}else l.attr("d",s?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:n,state:i}=t,a=i.inputType==="touch",s=i.inputType==="mouse",o=c=>{const d=t.updateAngle(c);return d?t.convertToArcData(d):null};function r(c,d,u){t.expandArc(u),t.api.focus(u),t.toggleFocusLegend(u,!0),t.showTooltip([d],c)}function l(c){const d=(c==null?void 0:c.id)||void 0;t.unexpandArc(d),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(c,d,u){var h;const f=o(d);f&&((h=t.toggleShape)==null||h.call(t,this,f,u),n.data_onclick.bind(t.api)(f,this))}),s&&e.on("mouseover",function(c,d){if(i.transiting)return;i.event=c;const u=o(d),h=(u==null?void 0:u.id)||void 0;r(this,u,h),t.setOverOut(!0,u)}).on("mouseout",(c,d)=>{if(i.transiting||!n.interaction_onout)return;i.event=c;const u=o(d);l(),t.setOverOut(!1,u)}).on("mousemove",function(c,d){const u=o(d);i.event=c,t.showTooltip([u],this)}),a&&t.hasArcType()&&!t.radars){const c=d=>{var u,h;const{clientX:f,clientY:g}=(h=(u=d.changedTouches)==null?void 0:u[0])!=null?h:{clientX:0,clientY:0};return(0,F.select)(nt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(d){if(i.transiting)return;i.event=d;const h=c(d).datum(),f=h!=null&&h.data&&h.data.id?t.updateAngle(h):null,g=f?t.convertToArcData(f):null,p=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),Ct(p)?l():r(this,g,p)},{passive:!0})}},redrawArcText(e){const t=this,{config:n,state:i,$el:{main:a,arcs:s}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&n.gauge_title||(l=a.selectAll(`.${at.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?ae.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),Br.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),a.select(`.${at.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=n.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),n.gauge_label_show&&(s.select(`.${ae.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(n.gauge_units),s.select(`.${ae.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_min,!1)),!c&&s.select(`.${ae.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_max,!0)))}Tc.call(t)&&zx.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:n}}=t,i=$(e)?a=>a.index===e:a=>a.data.id===e;return n==null?void 0:n.selectAll(`.${U.target} path`).filter(i)}};function Pn(e,t){St(ge.prototype,[qx,Rn].concat(e||[])),cn.setOptions([dn].concat(t||[]))}let kc=()=>(Pn(void 0,[Wi,Fx]),(kc=()=>O.DONUT)());var Jx=Object.defineProperty,Ac=Object.getOwnPropertySymbols,Qx=Object.prototype.hasOwnProperty,tm=Object.prototype.propertyIsEnumerable,Lc=(e,t,n)=>t in e?Jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,em=(e,t)=>{for(var n in t||(t={}))Qx.call(t,n)&&Lc(e,n,t[n]);if(Ac)for(var n of Ac(t))tm.call(t,n)&&Lc(e,n,t[n]);return e};function Dn(e=!1){const t=this,{config:n,state:{current:{width:i,height:a}}}=t,s=t.getCurrentPadding(),o=em({width:i-s.left-s.right,height:a-(n.legend_show?t.getLegendHeight()+10:0)-s.top-s.bottom},s);if(e){const r=fs.call(t,o),l=n.funnel_rotated;o.width=Math.max(o.width,l?r.height:r.width),o.height=Math.max(o.height,l?r.width:r.height)}return o}function fs(e){const t=this,{config:n}=t,i=n.funnel_rotated,[a,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,r)=>tt(o)?e[i!==!r?"width":"height"]*o.ratio:o);return{width:a,height:s}}function nm(e){const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=[];return e.forEach((o,r)=>{const{ratio:l=0}=o,c=r>0?s[r-1][2][n?0:1]:0,d=l+c;s.push(o.coords=n?[[c,0],[d,0],[d,a],[c,a],[c,0]]:[[0,c],[i,c],[i,d],[0,d],[0,c]])}),s}function im(){const e=this,t=e.config.funnel_rotated,{width:n,height:i}=Dn.call(e,!0),a=fs.call(e,{width:n,height:i});let s;if(t){const o=(i-a.width)/2,r=n-a.height;s=[[r,o],[n,o],[n,i-o],[r,i-o],[0,i]]}else{const o=(n-a.width)/2,r=i-a.height;s=[[n,0],[n-o,r],[n-o,i],[o,i],[o,r]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function am(e){const t=this,{config:n}=t,i=e.map(a=>({id:a.id,value:a.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),Rc.call(t,i)}function Rc(e){const t=this,{width:n,height:i}=Dn.call(t),a=t.getTotalDataSum(!0),s=t.config.funnel_rotated?n:i;return e.forEach(o=>{o.ratio=o.value/a*s}),e}function sm(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ec(e,t,n,i,a){const s=[];for(let r=0;r<=20;r++){const l=r/20,c=e+(t-e)*l,d=n+(i-n)*sm(l);s.push(a?[c,d]:[d,c])}return s}function om(){var e;const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=fs.call(t,{width:i,height:a}),o=(0,pt.line)().x(f=>f[0]).y(f=>f[1]).curve(pt.curveLinear),r=(n?a-s.width:i-s.width)/2,l=n?i-s.height:a-s.height,c=Ec(0,l,n?0:i,n?r:i-r,n),d=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),d.push(n?[i,a-r]:[r,a])),d.push(...Ec(l,0,n?a-r:r,n?a:0,n)),c.length>1){const[f,g]=n?[1,0]:[0,1];c.splice(1,0,[c[f][0],c[g][1]]);const p=d.length-1;p>0&&d.splice(p,0,[d[p-f][0],d[p-g][1]])}const u=o(c)||"",h=((e=o(d))==null?void 0:e.replace(/^M/,"L"))||"";return n?`${u}${h}z`:`M0,0${u.replace(/^M/,"L")}${h}z`}var rm={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${U.chart}`).append("g").classed(Un.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(Un.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:n,state:i}=e;if(!n.interaction_enabled)return;const a=o=>{var r;const l=o.isTrusted?o.target:(r=i.eventReceiver.rect)==null?void 0:r.node();if(l&&/^path$/i.test(l.tagName))return i.event=o,(0,F.select)(l).datum()},s=i.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})},updateTargetsForFunnel(e){const t=this,{$el:{funnel:n}}=t;n||t.initFunnel();const i=t.getChartClass("Funnel"),a=t.getClass("funnel",!0),s=am.call(t,e.filter(t.isFunnelType.bind(t))),o=t.filterNullish(s),r=n.selectAll(`.${Un.chartFunnel}`).data(o);r.exit().remove();const l=r.enter().insert("g",`.${Un.funnelBackground}`);l.append("path"),n.path=l.merge(r).attr("class",i).select("path").attr("class",a).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:n}}=t,i=e.map(({id:a})=>a);n.path=n.path.filter(a=>i.includes(a.id))},generateGetFunnelPoints(){const e=this,{config:t,$el:{funnel:n}}=e,i=t.funnel_rotated,a=e.filterTargetsToShow(n.path),{top:s,left:o,width:r,height:l}=Dn.call(e),c={};let d=0;return a.each(u=>{const h=d,{ratio:f}=u;d+=f;const g=i?o:s,p=g+h,_=g+d,x=(p+_)/2,m=i?s+l/2:o+r/2;c[u.id]=i?[[p,m],[_,m],[x,m]]:[[m,p],[m,_],[m,x]]}),u=>c[u.id]},redrawFunnel(){const e=this,{config:t,$T:n,$el:{funnel:i}}=e,a=e.filterTargetsToShow(i.path),s=nm.call(e,Rc.call(e,a.data())),{top:o,left:r}=Dn.call(e),l=(t.funnel_spline?om:im).call(e);i.attr("transform",`translate(${r}, ${o})`).attr("clip-path",`path('${l}')`),i.background.attr("d",l),n(a).attr("d",(c,d)=>`M${s[d].join("L")}z`).style("opacity","1"),i.selectAll("g").style("opacity",null)}},lm={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Pc=()=>(Pn([rm],[lm]),(Pc=()=>O.FUNNEL)());var cm={initGauge(){const e=this,{config:t,$el:{arcs:n}}=e,i=(a=null,s="")=>{n.append("text").attr("class",a).style("text-anchor","middle").style("pointer-events","none").text(s)};if(e.hasType("gauge")){const a=e.hasMultiArcGauge();n.append(a?"g":"path").attr("class",at.chartArcsBackground).style("fill",!a&&t.gauge_background||null),t.gauge_units&&i(ae.chartArcsGaugeUnit),t.gauge_label_show&&(i(ae.chartArcsGaugeMin),!t.gauge_fullCircle&&i(ae.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:n}=e,a=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(n.rendered);!t.gauge_enforceMinMax&&a+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=a-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:n,$el:i}=e,{hiddenTargetIds:a}=e.state,s=i.main.selectAll(`.${at.arcs}`).selectAll(`.${at.arcLabelLine}`).data(e.arcData.bind(e));s.enter().append("rect").attr("class",r=>`${at.arcLabelLine} ${U.target} ${U.target}-${r.data.id}`).merge(s).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let d=0,u=0,h="";if(!a.has(r.data.id)){const f=e.updateAngle(r),g=n.gaugeArcWidth/e.getTargetsToShow().length*(f.index+1),p=f.endAngle-Math.PI/2,_=n.radius-g,x=p-(_===0?0:1/_);l=n.radiusExpanded-n.radius+g,d=Math.cos(x)*_,u=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${d}, ${u})`}(0,F.select)(this).attr("x",d).attr("y",u).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const n=this,{config:i}=n,a=i.gauge_label_extents;return z(a)?a.bind(n.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},um={gauge_background:"",gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_extents:void 0,gauge_label_format:void 0,gauge_label_ratio:void 0,gauge_label_threshold:0,gauge_label_line:!1,gauge_label_image:void 0,gauge_enforceMinMax:!1,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_arcLength:100,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50};let Dc=()=>(Pn([cm],[Wi,um]),(Dc=()=>O.GAUGE)()),Ic=()=>(Fe(),(Ic=()=>O.LINE)()),Mc=()=>(Fe(void 0,[es]),(Mc=()=>O.SPLINE)()),Fc=()=>(Fe(),(Fc=()=>O.STEP)());var dm={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,pie_label_line:!1,pie_label_image:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_outerRadius:void 0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0};let Oc=()=>(Pn(void 0,[Wi,dm]),(Oc=()=>O.PIE)());function $c(e){const t=e.config.polar_level_max;let n=e.getMinMaxData().max[0].value;return t&&t>n&&(n=t),n}var hm={initPolar(){const e=this,{$el:{arcs:t},config:n}=e,i=n.polar_level_text_show,a=n.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",Me.levels),i&&a&&e.generateTextBGColorFilter(a)},getPolarOuterRadius(e,t){var n;const i=$c(this);return((n=e==null?void 0:e.data.values[0].value)!=null?n:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:n,$el:{arcs:{levels:i}}}=e,a=t.polar_level_depth,s=$c(e),o=li(0,a),r=n.radius,l=o.map(h=>r*((h+1)/a)),c=(t.polar_level_text_format||function(){}).bind(e.api),d=i.selectAll(`.${Me.level}`).data(o);d.exit().remove();const u=d.enter().append("g").attr("class",(h,f)=>`${Me.level} ${Me.level}-${f}`);if(u.append("circle"),u.merge(d).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,f=`#${n.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;u.append("text").style("text-anchor","middle"),u.merge(d).selectAll("text").attr("dy",g=>-l[g]+5).attr("filter",h?`url(${f})`:null).text(g=>c(s/o.length*(g+1)))}}},fm={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,polar_label_line:!1,polar_label_image:void 0,polar_label_ratio:void 0,polar_level_depth:3,polar_level_max:void 0,polar_level_show:!0,polar_level_text_backgroundColor:"#fff",polar_level_text_format:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Bc=()=>(Pn([hm],[Wi,fm]),(Bc=()=>O.POLAR)());function gm(e,t,n,i,a,s){const o=e&&i>0?n-i:i,r=2*Math.PI;return a*(1-s*(t==="x"?Math.sin:Math.cos)(o*r/n))}const In=W.radarPoints,zc=W.radarTextWidth;var pm={initRadar(){const e=this,{config:t,state:{current:n},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${U.chart}`).append("g").attr("class",er.chartRadars),i.radar.levels=i.radar.append("g").attr("class",Me.levels),i.radar.axes=i.radar.append("g").attr("class",It.axis),i.radar.shapes=i.radar.append("g").attr("class",At.shapes),n.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:n,arcHeight:i}}=e,a=t.axis_x_categories.length<4?-20:10,s=(Math.min(n,i)-a)/2;return[s,s]},updateTargetsForRadar(e){const t=this,{config:n}=t;se(n.axis_x_categories)&&(n.axis_x_categories=li(0,ue("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,n,i){const a=this,{config:s}=a,[o,r]=a.getRadarSize(),l=s.axis_x_categories.length,c=s.radar_direction_clockwise,d=nn(e).map(u=>gm(c,u,l,t,ct(n)?n:e==="x"?o:r,$(i)?i:s.radar_size_ratio));return d.length===1?d[0]:d},generateRadarPoints(){const e=this,t=e.data.targets,[n,i]=e.getRadarSize(),a=e.cache.get(In)||{},s=a._size;(!s||s.width!==n&&s.height!==i)&&(t.forEach(o=>{a[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),a._size={width:n,height:i},e.cache.add(In,a))},redrawRadar(){const e=this,{radar:t,main:n}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),n.select(`.${Et.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(In);return(t,n)=>{const i=e[t.id][n];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:n,$el:{radar:i}}=e,[a,s]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,d=li(0,o),u=t.radar_size_ratio*Math.min(a,s),h=d.map(x=>u*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=d.map(x=>{const m=h[x];return li(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Me.level}`).data(d);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${Me.level} ${Me.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>f(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>f(n.current.dataMax/d.length*(x+1)))),_.merge(p).attr("transform",x=>`translate(${a-h[x]}, ${s-h[x]})`).selectAll("polygon").attr("points",x=>g[x]),l&&c.selectAll("text").attr("x",x=>Ct(x)?a:g[x].split(",")[0]).attr("y",x=>Ct(x)?s:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:n}}=e,[i,a]=e.getRadarSize(),s=t.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${It.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",a).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,d=e.cache.get(zc)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(u=>{u.each(function(h){Cn((0,F.select)(this),String(h),[-.6,1.2])})}).datum((u,h)=>({index:h})).attr("transform",function(u){Ct(this.width)&&(this.width=ht(this,!0).width/2);let h=e.getRadarPosition("x",u.index,void 0,1),f=Math.round(e.getRadarPosition("y",u.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),f>a?(f/2===a&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),f+=c):f<a&&(f-=c),`translate(${h} ${f})`}),!d){const u=[n.axes,n.levels].map(h=>ur(h.node()).width);u.every(h=>h>0)&&e.cache.add(zc,u[0]-u[1])}}},bindRadarEvent(){const e=this,{config:t,state:n,$el:{radar:i,svg:a}}=e,s=e.isPointFocusOnly(),{inputType:o,transiting:r}=n,l=o==="mouse",c=d=>{if(n.event=d,!t.interaction_onout)return;const u=e.getDataIndexFromEvent(d),h=Ct(u);(l||h)&&(e.hideTooltip(),s?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,u):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",d=>{if(r)return;n.event=d;const u=e.getDataIndexFromEvent(d);e.selectRectForSingle(a.node(),u),l?e.setOverOut(!0,u):e.callOverOutForTouch(u)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||a.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(s=>e.isRadarType(s)),n=e.cache.get(In),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),a=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),a.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",s=>n[s.id].join(" ")),e.updateTargetForCircle(t,a)},radarCircleX(e){return this.cache.get(In)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(In)[e.id][e.index][1]}},_m={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let Nc=()=>(Pn([ec.eventrect,Bi,pm],[dn,_m,{axis_x_categories:nc.optAxis.axis_x_categories}]),(Nc=()=>O.RADAR)());var xm={scatter_zerobased:!1};let Xc=()=>(ei([Rn,Bi],[dn,xm]),(Xc=()=>O.SCATTER)());var Oe=wt(11);function mm(e){const t=this;return e.map(n=>{const{id:i,values:a}=n,{value:s}=a[0];return{name:i,id:i,value:s,ratio:t.getRatio("treemap",a[0])}})}var vm={initTreemapLayout(){this.treemap=(0,Oe.treemap)().tile(this.getTreemapTile())},getTreemapTile(){var e,t;const n=this,{config:i,state:{current:{width:a,height:s}}}=n,o=(t={binary:Oe.treemapBinary,dice:Oe.treemapDice,slice:Oe.treemapSlice,sliceDice:Oe.treemapSliceDice,squarify:Oe.treemapSquarify,resquarify:Oe.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Oe.treemapBinary;return(r,l,c,d,u)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(d-l),h.x1=l+h.x1/a*(d-l),h.y0=c+h.y0/s*(u-c),h.y1=c+h.y1/s*(u-c)}},getTreemapData(e){const t=this;return{name:"root",children:mm.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},getTreemapRoot(e){const t=this,n=t.getTreemapData(e!=null?e:t.data.targets),i=(0,Oe.hierarchy)(n).sum(s=>s.value),a=t.getSortCompareFn(!0);return t.treemap||t.initTreemapLayout(),t.treemap(a?i.sort(a):i)}},bm=Object.defineProperty,ym=Object.defineProperties,Tm=Object.getOwnPropertyDescriptors,Gc=Object.getOwnPropertySymbols,wm=Object.prototype.hasOwnProperty,Cm=Object.prototype.propertyIsEnumerable,Vc=(e,t,n)=>t in e?bm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sm=(e,t)=>{for(var n in t||(t={}))wm.call(t,n)&&Vc(e,n,t[n]);if(Gc)for(var n of Gc(t))Cm.call(t,n)&&Vc(e,n,t[n]);return e},km=(e,t)=>ym(e,Tm(t));function Am(e,t){const n=this;e.selectAll("g").attr("transform",i=>{const a=vn(n,i,t);return`translate(${a.x},${a.y})`}).select("rect").attr("width",i=>vn(n,i,t).w).attr("height",i=>vn(n,i,t).h)}var Lm=km(Sm({},vm),{initTreemap(){const e=this,{$el:t,state:{current:{width:n,height:i},clip:a,datetimeId:s}}=e;a.id=`${s}-clip`,e.initTreemapLayout(),t.defs.append("clipPath").attr("id",a.id).append("rect").attr("width",n).attr("height",i),t.treemap=t.main.select(`.${U.chart}`).attr("clip-path",`url(#${a.id})`).append("g").classed(ir.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:n,state:i}=e,a=s=>{var o;const r=s.isTrusted?s.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return r&&/^rect$/i.test(r.tagName)&&(i.event=s,l=(0,F.select)(r).datum()),l==null?void 0:l.data};if(n.interaction_enabled){const s=i.inputType==="touch";t.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:n}}=t,i=[t.getTreemapRoot(e!=null?e:t.data.targets)];n.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:n,$T:i}=t,a=n.treemap.datum(),s=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=n.treemap.selectAll("g").data(a.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t}=e,n={};return t.treemap.selectAll("g").each(i=>{const a=vn(e,i);n[i.data.name]=[[a.x,a.y],[a.x+a.w,a.y+a.h]]}),i=>n[i.id]},redrawTreemap(e){const t=this,{$el:n,state:{current:{width:i,height:a}}}=t;return n.defs.select("rect").attr("width",i).attr("height",a),[t.$T(n.treemap,e,xe()).call(Am.bind(t),n.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:n},config:i,scale:{x:a,y:s}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),d=(c*100).toFixed(2),u=i.treemap_label_show&&Ga.call(t,c,"treemap")?null:"0",h=n.selectAll("g").filter(p=>p.data.id===o).datum();let f=0,g=0;if(h){const{x0:p,x1:_,y0:x,y1:m}=h;f=a(_)-a(p),g=s(m)-s(x)}return function(p){return p.style("opacity",u),z(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
${d}%`}}}),Rm={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let Wc=()=>(ei([Lm],[Rm]),(Wc=()=>O.TREEMAP)()),gs=Object.create(null);const Yc={version:"4.1.1",generate(e){const t=ke(Object.create(null),gs,e),n=new Yt(t);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(e){return tt(e)&&(gs=e),gs},instance:[],plugin:{}};Object.keys(Qt).forEach(e=>Qt[e]()),Object.keys(J).forEach(e=>J[e]()),fl(),gl(),kl(),Vl(),hl(),ll()})(),ji})()});