UNPKG

billboard.js

Version:

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

17 lines (16 loc) 261 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 3.16.0 */(function(ht,qt){if(typeof exports=="object"&&typeof module=="object")module.exports=qt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),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-axis","d3-brush","d3-drag","d3-dsv","d3-ease","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],qt);else{var pe=typeof exports=="object"?qt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),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")):qt(ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3,ht.d3);for(var xe in pe)(typeof exports=="object"?exports:ht)[xe]=pe[xe]}})(this,function(Qe,ht,qt,pe,xe,Ni,Gi,Vi,Yi,ji,Hi,Wi,Ui){return function(){"use strict";var Zi=[,,function(D){D.exports=Yi},function(D){D.exports=Hi},function(D){D.exports=ht},function(D){D.exports=pe},function(D){D.exports=qt},function(D){D.exports=Vi},function(D){D.exports=Wi},function(D){D.exports=ji},function(D){D.exports=Ui},function(D){D.exports=Qe},function(D){D.exports=xe},function(D){D.exports=Gi},function(D){D.exports=Ni}],ts={};function U(D){var mt=ts[D];if(mt!==void 0)return mt.exports;var R=ts[D]={exports:{}};return Zi[D](R,R.exports,U),R.exports}(function(){U.d=function(D,mt){for(var R in mt)U.o(mt,R)&&!U.o(D,R)&&Object.defineProperty(D,R,{enumerable:!0,get:mt[R]})}})(),function(){U.o=function(D,mt){return Object.prototype.hasOwnProperty.call(D,mt)}}(),function(){U.r=function(D){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(D,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(D,"__esModule",{value:!0})}}();var Le={};return function(){U.r(Le),U.d(Le,{bb:function(){return Xi},default:function(){return Xi}});var D={};U.r(D),U.d(D,{selection:function(){return Bs},subchart:function(){return Ns},zoom:function(){return Gs}});var mt={};U.r(mt),U.d(mt,{area:function(){return $i},areaLineRange:function(){return yi},areaSpline:function(){return vi},areaSplineRange:function(){return Ti},areaStep:function(){return Ai},areaStepRange:function(){return bi},bar:function(){return Oi},bubble:function(){return Ii},candlestick:function(){return Di},donut:function(){return Ci},funnel:function(){return Fi},gauge:function(){return Ei},line:function(){return wi},pie:function(){return ki},polar:function(){return Li},radar:function(){return Pi},scatter:function(){return zi},spline:function(){return Si},step:function(){return Ri},treemap:function(){return Mi}});var R=U(2),_e=U(3),qi=Object.defineProperty,es=Object.getOwnPropertySymbols,Ki=Object.prototype.hasOwnProperty,Ji=Object.prototype.propertyIsEnumerable,ss=(e,t,s)=>t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Z=(e,t)=>{for(var s in t||(t={}))Ki.call(t,s)&&ss(e,s,t[s]);if(es)for(var s of es(t))Ji.call(t,s)&&ss(e,s,t[s]);return e};const I={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},V={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",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"},me={area:"bb-area",areas:"bb-areas"},at={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"},$t={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},kt={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},gt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Pe={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Nt={dragarea:"bb-dragarea",INCLUDED:"_included_"},le={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},yt={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"},Y={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"},Lt={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},At={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},q={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},et={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"},Dt={level:"bb-level",levels:"bb-levels"},is={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},ce={region:"bb-region",regions:"bb-regions"},Q={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},st={shape:"bb-shape",shapes:"bb-shapes"},ns={brush:"bb-brush",subchart:"bb-subchart"},xt={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",TextOverlapping:"text-overlapping"},$e={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},as={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Oe={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var B=Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z({},I),V),me),at),$t),kt),gt),Pe),Nt),yt),Y),Lt),At),q),le),et),is),ce),Q),st),ns),xt),$e),as),Oe),Qi={boost_useCssRule:!1,boost_useWorker:!1},tn={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},en={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},sn={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,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:{},regions:[]},nn={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},an={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},on={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_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:""},rn={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},ye=U(4);function ln(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function cn(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",s=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=a=>setTimeout(a,1),n=a=>clearTimeout(a);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:n,s?e.requestIdleCallback:i,s?e.cancelIdleCallback:n]}const j=ln(),ot=j==null?void 0:j.document,[dn,zr,os,Fr]=cn(j);var un=Object.defineProperty,rs=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,gn=Object.prototype.propertyIsEnumerable,ls=(e,t,s)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,cs=(e,t)=>{for(var s in t||(t={}))hn.call(t,s)&&ls(e,s,t[s]);if(rs)for(var s of rs(t))gn.call(t,s)&&ls(e,s,t[s]);return e};const M=e=>e||e===0,P=e=>typeof e=="function",N=e=>typeof e=="string",O=e=>typeof e=="number",it=e=>typeof e=="undefined",H=e=>typeof e!="undefined",Ie=e=>typeof e=="boolean",fn=e=>Math.ceil(e/10)*10,be=e=>Math.ceil(e)+.5,Gt=e=>e[1]-e[0],Rt=e=>typeof e=="object",wt=e=>it(e)||e===null||N(e)&&e.length===0||Rt(e)&&!(e instanceof Date)&&Object.keys(e).length===0||O(e)&&isNaN(e),nt=e=>!wt(e),G=e=>Array.isArray(e),X=e=>e&&!(e!=null&&e.nodeType)&&Rt(e)&&!G(e);function zt(e,t,s){return H(e[t])?e[t]:s}function pn(e,t){let s=!1;return Object.keys(e).forEach(i=>e[i]===t&&(s=!0)),s}function K(e,t,...s){const i=P(e);return i&&e.call(t,...s),i}function ve(e,t){let s=0;const i=function(...n){!--s&&t.apply(this,...n)};"duration"in e?e.each(()=>++s).on("end",i):(++s,e.call(i))}function De(e){return N(e)?e.replace(/<(script|img)?/ig,"&lt;").replace(/(script)?>/ig,"&gt;"):e}function de(e,t,s=[-1,1],i=!1){if(!(!e||!N(t)))if(t.indexOf(` `)===-1)e.text(t);else{const n=[e.text(),t].map(a=>a.replace(/[\s\n]/g,""));if(n[0]!==n[1]){const a=t.split(` `),o=i?a.length-1:1;e.html(""),a.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?s[0]*o:s[1]}em`).text(r)})}}}function ds(e){const{x:t,y:s,width:i,height:n}=e.getBBox();return[{x:t,y:s+n},{x:t,y:s},{x:t+i,y:s},{x:t+i,y:s+n}]}function us(e){const{width:t,height:s}=rt(e),i=ds(e),n=i[0].x,a=Math.min(i[0].y,i[1].y);return{x:n,y:a,width:t,height:s}}function bt(e,t){var s;const i=e&&((s=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:s[0]);let n=[0,0];try{n=(0,R.pointer)(i||e,t)}catch(a){}return n.map(a=>isNaN(a)?0:a)}function hs(e){const{event:t,$el:s}=e,i=s.subchart.main||s.main;let n;return t&&t.type==="brush"?n=t.selection:i&&(n=i.select(".bb-brush").node())&&(n=(0,ye.brushSelection)(n)),n}function gs(e,t,s=!1){const i=n=>n[e?"getBoundingClientRect":"getBBox"]();return s?i(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=i(t):t.rect}function rt(e,t=!1){return gs(!0,e,t)}function ue(e,t=!1){return gs(!1,e,t)}function Ct(e=!0,t=0,s=1e4){const i=j.crypto||j.msCrypto,n=i?t+i.getRandomValues(new Uint32Array(1))[0]%(s-t+1):Math.floor(Math.random()*(s-t)+t);return e?String(n):n}function ze(e,t,s,i,n){if(s>i)return-1;const a=Math.floor((s+i)/2);let{x:o,w:r=0}=e[a];return n&&(o=e[a].y,r=e[a].h),t>=o&&t<=o+r?a:t<o?ze(e,t,s,a-1,n):ze(e,t,a+1,i,n)}function fs(e){const t=hs(e);return t?t[0]===t[1]:!0}function xn(...e){const t=s=>{if(X(s)&&s.constructor){const i=new s.constructor;for(const n in s)i[n]=t(s[n]);return i}return s};return e.map(s=>t(s)).reduce((s,i)=>cs(cs({},s),i))}function lt(e={},t){G(t)&&t.forEach(s=>lt(e,s));for(const s in t)/^\d+$/.test(s)||s in e||(e[s]=t[s]);return e}const ft=e=>e.charAt(0).toUpperCase()+e.slice(1);function _n(e,t="-"){return e.split(t).map((s,i)=>i?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():s.toLowerCase()).join("")}const Vt=e=>[].slice.call(e);function mn(e,t,s){const{rootSelector:i="",sheet:n}=e,o=`${i} ${(r=>r.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${s.join(";")}}`;return n[n.insertRule?"insertRule":"addRule"](o,n.cssRules.length)}function $n(e){let t=[];return e.forEach(s=>{var i;try{s.cssRules&&s.cssRules.length&&(t=t.concat(Vt(s.cssRules)))}catch(n){(i=j.console)==null||i.warn(`Error while reading rules from ${s.href}: ${n.toString()}`)}}),t}function ps(e){var t,s,i,n,a,o;return{x:((s=(t=j.pageXOffset)!=null?t:j.scrollX)!=null?s:0)+((i=e.scrollLeft)!=null?i:0),y:((a=(n=j.pageYOffset)!=null?n:j.scrollY)!=null?a:0)+((o=e.scrollTop)!=null?o:0)}}function Te(e,t=0,s=0,i=!0){const n=new DOMPoint(t,s),a=e.getScreenCTM(),o=n.matrixTransform(i?a==null?void 0:a.inverse():a);if(i===!1){const r=rt(e);o.x-=r.x,o.y-=r.y}return o}function xs(e){const t=e?e.transform:null,s=t&&t.baseVal;return s&&s.numberOfItems?s.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Fe(e){const t=e[0]instanceof Date,s=(t?e.map(Number):e).filter((i,n,a)=>a.indexOf(i)===n);return t?s.map(i=>new Date(i)):s}function _s(e){return e&&e.length?e.reduce((t,s)=>t.concat(s)):[]}function Kt(e,...t){if(!t.length||t.length===1&&!t[0])return e;const s=t.shift();return X(e)&&X(s)&&Object.keys(s).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const n=s[i];X(n)?(!e[i]&&(e[i]={}),e[i]=Kt(e[i],n)):e[i]=G(n)?n.concat():n}}),Kt(e,...t)}function Jt(e,t=!0){let s;return e[0]instanceof Date?s=t?(i,n)=>i-n:(i,n)=>n-i:t&&!e.every(isNaN)?s=(i,n)=>i-n:t||(s=(i,n)=>i>n&&-1||i<n&&1||i===n&&0),e.concat().sort(s)}function St(e,t){let s=t.filter(i=>nt(i));return s.length?O(s[0])?s=Math[e](...s):s[0]instanceof Date&&(s=Jt(s,e==="min")[0]):s=void 0,s}const Ae=(e,t,s=1)=>{const i=[],n=Math.max(0,Math.ceil((t-e)/s))|0;for(let a=e;a<n;a++)i.push(e+a*s);return i},yn={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,s,i=e())=>{t.dispatchEvent(new MouseEvent(s,i))}}catch(t){return(s,i,n=e())=>{const a=ot.createEvent("MouseEvent");a.initMouseEvent(i,n.bubbles,n.cancelable,j,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),s.dispatchEvent(a)}}})(),touch:(e,t,s)=>{const i=new Touch(Kt({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},s));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}};function we(e,t){let s=e;for(const i in t)s=s.replace(new RegExp(`{=${i}}`,"g"),t[i]);return s}function vt(e){var t;let s;if(e instanceof Date)s=e;else if(N(e)){const{config:i,format:n}=this;s=(t=n.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else O(e)&&!isNaN(e)&&(s=new Date(+e));return(!s||isNaN(+s))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),s}function Me(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function bn(e,t,s=!1){const i=!!e.node;let n=!1;for(const[a,o]of Object.entries(t))if(n=i?e.style(a)===o:e.style[a]===o,s===!1&&n)break;return n}function he(){var e,t;return((e=ot)==null?void 0:e.hidden)===!1||((t=ot)==null?void 0:t.visibilityState)==="visible"}function vn(e,t){const{DocumentTouch:s,matchMedia:i,navigator:n}=j,a=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(n&&"maxTouchPoints"in n)o=n.maxTouchPoints>0;else if("ontouchmove"in j||s&&ot instanceof s)o=!0;else if(a)o=!0;else{const l=n.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!a&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function ms(e,t){t()===!1?dn(()=>ms(e,t)):e()}var Tn=Object.defineProperty,$s=Object.getOwnPropertySymbols,An=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Xe=(e,t,s)=>t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ys=(e,t)=>{for(var s in t||(t={}))An.call(t,s)&&Xe(e,s,t[s]);if($s)for(var s of $s(t))wn.call(t,s)&&Xe(e,s,t[s]);return e},Sn=(e,t,s)=>Xe(e,typeof t!="symbol"?t+"":t,s);const bs=class Bi{static setOptions(t){this.data=t.reduce((s,i)=>ys(ys({},s),i),this.data)}constructor(){return xn(sn,Qi,on,tn,rn,en,nn,an,Bi.data)}};Sn(bs,"data",{});let Yt=bs;class Rn{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX: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 Cn{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,cssRule:{},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,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,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:[],hiddenLegendIds:[],focusedTargetIds:[],defocusedTargetIds:[],radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null}}}}const vs={element:Rn,state:Cn};class En{constructor(){Object.keys(vs).forEach(t=>{this[t]=new vs[t]})}getStore(t){return this[t]}}var kn=Object.defineProperty,Ln=(e,t,s)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Pn=(e,t,s)=>Ln(e,typeof t!="symbol"?t+"":t,s);const _t={bubbleBaseLength:"$baseLength",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",legendItemTextBox:"legendItemTextBox",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect"};class On{constructor(){Pn(this,"cache",{})}add(t,s,i=!1){return this.cache[t]=i?this.cloneTarget(s):s,this.cache[t]}remove(t){(N(t)?[t]:t).forEach(s=>delete this.cache[s])}get(t,s=!1){if(s&&Array.isArray(t)){const i=[];for(let n=0,a;a=t[n];n++)a in this.cache&&i.push(this.cloneTarget(this.cache[a]));return i}else{const i=this.cache[t];return M(i)?i:null}}reset(t){const s=this;for(const i in s.cache)(t||/^\$/.test(i))&&(s.cache[i]=null)}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(s=>({x:s.x,value:s.value,id:s.id}))}}}const E={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"},Be={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"},Ft={Area:[E.AREA,E.AREA_SPLINE,E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.AREA_STEP,E.AREA_STEP_RANGE],AreaRange:[E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.AREA_STEP_RANGE],Arc:[E.PIE,E.DONUT,E.GAUGE,E.POLAR,E.RADAR],Line:[E.LINE,E.SPLINE,E.AREA,E.AREA_SPLINE,E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.STEP,E.AREA_STEP,E.AREA_STEP_RANGE],Step:[E.STEP,E.AREA_STEP,E.AREA_STEP_RANGE],Spline:[E.SPLINE,E.AREA_SPLINE,E.AREA_SPLINE_RANGE]};function In(e){const t=e,{config:s}=t;let i="";if(wt(s.data_type||s.data_types)&&!t[Be.LINE])i="line";else for(const n in Be){const a=E[n];if(t.hasType(a)&&!t[Be[n]]){i=a;break}}i&&Dn(`Please, make sure if %c${_n(i)}`,"module has been imported and specified correctly.","https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality")}function Dn(e,t,s){var i;const n="[billboard.js]";if((i=j.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${n} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),s&&console.info("%c\u2139\uFE0F","font-size:15px",s)}throw Error(`${n} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const{setTimeout:zn,clearTimeout:Fn}=j;function Mn(e){const t=[];let s;const i=function(){i.clear(),e===!1?os(()=>{t.forEach(n=>n())},{timeout:200}):s=zn(()=>{t.forEach(n=>n())},O(e)?e:200)};return i.clear=()=>{s&&(Fn(s),s=null)},i.add=n=>t.push(n),i.remove=n=>t.splice(t.indexOf(n),1),i}function Ts(){let e=[];const t=function(s,i){function n(){var a;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(a=l.empty)!=null&&a.call(l)){o++;continue}if(he()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}ms(()=>{i==null||i()},n)};return t.add=function(s){G(s)?e=e.concat(s):e.push(s)},t}const Ne={};function Xn(e,t){var s;const i=e.toString(),n=i.replace(/(function|[\s\W\n])/g,"").substring(0,15);return n in Ne||(Ne[n]=new j.Blob([`${(s=t==null?void 0:t.map(String).join(";"))!=null?s:""} self.onmessage=function({data}) { const result = (${i}).apply(null, data); self.postMessage(result); };`],{type:"text/javascript"})),j.URL.createObjectURL(Ne[n])}function Bn(e){const t=new j.Worker(e);return t.onerror=function(s){console.error?console.error(s):console.log(s)},t}function Ge(e=!0,t,s,i){let n=function(...a){const o=t(...a);s(o)};if(j.Worker&&e){const a=Xn(t,i),o=Bn(a);n=function(...r){o.postMessage(r),o.onmessage=function(l){return j.URL.revokeObjectURL(a),s(l.data)}}}return n}var Se=U(5);function Ve(e){const t=[];return e.forEach(function(s,i){const n=s[0];s.forEach(function(a,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof a=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][n]=a}})}),t}function Ye(e){const t=e[0],s=[];return e.forEach(function(i,n){if(n>0){const a={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${n}, ${r})!`);a[t[r]]=o}),s.push(a)}}),s}function As(e,t){const s=[];let i,n;if(Array.isArray(e)){const a=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let u=o;return c.some(function(d){return!(u=u&&d in u?u[d]:void 0)}),u};t.x?i=t.value.concat(t.x):i=t.value,s.push(i),e.forEach(function(o){const r=i.map(function(l){let c=a(o,l);return typeof c=="undefined"&&(c=null),c});s.push(r)}),n=Ye(s)}else Object.keys(e).forEach(function(a){var o;const r=e[a].concat();(o=r.unshift)==null||o.call(r,a),s.push(r)}),n=Ve(s);return n}function Nn(e,t="csv",s,i,n){const a=new XMLHttpRequest,o={csv:Gn,tsv:Vn,json:As};a.open("GET",e),s&&Object.keys(s).forEach(function(r){a.setRequestHeader(r,s[r])}),a.onreadystatechange=function(){if(a.readyState===4)if(a.status===200){const r=a.responseText;r&&n.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},a.send()}function ws(e,t){const s=e.rows(t);let i;return s.length===1?(i=[{}],s[0].forEach(n=>{i[0][n]=null})):i=e.parse(t),i}function Gn(e){return ws({rows:Se.csvParseRows,parse:Se.csvParse},e)}function Vn(e){return ws({rows:Se.tsvParseRows,parse:Se.tsvParse},e)}function Ss(e,t){const s=e||(t==null?void 0:t.data_keys);return s!=null&&s.x&&(t.data_x=s.x),s}function Yn(e,t,s){const i=this,{config:n}=i;let a;e.forEach(o=>{const r=i.getXKey(o);if(s.customX||s.timeSeries?s.xs.indexOf(r)>=0?a=(s.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const u=M(l[r]);return u?i.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):n.data_x?a=this.getOtherTargetXs():nt(n.data_xs)&&(a=i.getXValuesOfXKey(r,i.data.targets)):a=t.map((l,c)=>c),a)i.data.xs[o]=a;else throw new Error(`x is not defined for id = "${o}".`)})}var jn={convertData(e,t){const{config:s}=this,i=s.boost_useWorker;let n=e;if(e.bindto&&(n={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(a=>{const o=`data_${a}`;o in e&&(n[a]=e[o])})),n.url&&t)Nn(n.url,n.mimeType,n.headers,Ss(n.keys,s),t);else if(n.json)Ge(i,As,t,[Ve,Ye])(n.json,Ss(n.keys,s));else if(n.rows)Ge(i,Ye,t)(n.rows);else if(n.columns)Ge(i,Ve,t)(n.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const s=this,{axis:i,config:n,state:a}=s,o=n.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((h,g)=>(s.isX.call(s,g)?h.xs.push(g):s.isNotX.call(s,g)&&h.ids.push(g),h),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,idConverter:n.data_idConverter.bind(s.api),categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};Yn.bind(s)(l,e,u);const d=l.map((h,g)=>{const f=n.data_idConverter.bind(s.api)(h),p=s.getXKey(h),_=u.customX&&u.categorized,x=_&&(()=>{const b=new Set(n.axis_x_categories);return e.every(v=>b.has(v.x))})(),m=e.__append__,$=p===null&&m?s.api.data.values(h).length:0;return{id:f,id_org:h,values:e.map((b,v)=>{const y=b[p];let T=b[h],C;return T=T!==null&&!isNaN(T)&&!X(T)?+T:G(T)||X(T)?T:null,(_||a.hasRadar)&&g===0&&!it(y)?(!x&&g===0&&v===0&&!m&&(n.axis_x_categories=[]),C=n.axis_x_categories.indexOf(y),C===-1&&(C=n.axis_x_categories.length,n.axis_x_categories.push(y))):C=s.generateTargetX(y,h,$+v),(it(T)||s.data.xs[h].length<=v)&&(C=void 0),{x:C,value:T,id:f,index:-1}}).filter(b=>H(b.x))}});if(d.forEach(h=>{var g;n.data_xSort&&(h.values=h.values.sort((f,p)=>{const _=f.x||f.x===0?f.x:1/0,x=p.x||p.x===0?p.x:1/0;return _-x})),h.values.forEach((f,p)=>f.index=p),(g=s.data.xs[h.id])==null||g.sort((f,p)=>f-p)}),a.hasNegativeValue=s.hasNegativeValueInTargets(d),a.hasPositiveValue=s.hasPositiveValueInTargets(d),o&&s.isValidChartType(o)){const h=s.mapToIds(d).filter(g=>!(g in n.data_types)||!s.isValidChartType(n.data_types[g]));s.setTargetType(h,o)}return d.forEach(h=>s.cache.add(h.id_org,h,!0)),d}},Hn={isX(e){const t=this,{config:s}=t,i=s.data_x&&e===s.data_x,n=nt(s.data_xs)&&pn(s.data_xs,e);return i||n},isNotX(e){return!this.isX(e)},isStackNormalized(){const{config:e}=this;return!!(e.data_stack_normalize&&e.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(s=>s.indexOf(e)>=0&&s.length>1):t.length>0},getXKey(e){const t=this,{config:s}=t;return s.data_x?s.data_x:nt(s.data_xs)?s.data_xs[e]:null},getXValuesOfXKey(e,t){const s=this,i=t&&nt(t)?s.mapToIds(t):[];let n;return i.forEach(a=>{s.getXKey(a)===e&&(n=s.data.xs[a])}),n},getIndexByX(e,t){const s=this;return t?t.indexOf(N(e)?e:+e):(s.filterByX(s.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const s=this;return e in s.data.xs&&s.data.xs[e]&&M(s.data.xs[e][t])?s.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:s}=t;Object.keys(e).forEach(i=>{s.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(nt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:s}=t;let i;return e&&(i=s.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const s=this;let i=s.filterTargetsToShow(s.data.targets).map(n=>s.addName(s.getValueOnIndex(n.values,e)));return t&&(i=i.filter(n=>n&&"value"in n&&M(n.value))),i},getValueOnIndex(e,t){const s=e.filter(i=>i.index===t);return s.length?s[0]:null},updateTargetX(e,t){const s=this;e.forEach(i=>{i.values.forEach((n,a)=>{n.x=s.generateTargetX(t[a],i.id,a)}),s.data.xs[i.id]=t})},updateTargetXs(e,t){const s=this;e.forEach(i=>{t[i.id]&&s.updateTargetX([i],t[i.id])})},generateTargetX(e,t,s){const i=this,{axis:n}=i;let a=n!=null&&n.isCategorized()?s:e||s;if(n!=null&&n.isTimeSeries()){const o=vt.bind(i);a=o(e||i.getXValue(t,s))}else n!=null&&n.isCustomX()&&!(n!=null&&n.isCategorized())&&(a=M(e)?+e:i.getXValue(t,s));return a},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return H(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return H(t)?t:null},getBaseValue(e){const t=this,{hasAxis:s}=t.state;let{value:i}=e;return i&&s&&(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 s,i;return(e||this.data.targets.map(n=>n.values)).forEach((n,a)=>{const o=n.map(t).filter(O);s=Math.min(a?s:1/0,...o),i=Math.max(a?i:-1/0,...o)}),{min:s,max:i}},getMinMaxData(){const e=this,t=_t.dataMinMax;let s=e.cache.get(t);if(!s){const i=e.data.targets.map(c=>c.values),n=e.getMinMaxValue(i);let a=[],o=[];const{min:r,max:l}=n;i.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);u.length&&(a=a.concat(u)),d.length&&(o=o.concat(d))}),e.cache.add(t,s={min:a,max:o})}return s},getTotalPerIndex(){const e=this,t=_t.dataTotalPerIndex;let s=e.cache.get(t);return(e.config.data_groups.length||e.isStackNormalized())&&!s&&(s=[],e.data.targets.forEach(i=>{i.values.forEach((n,a)=>{s[a]||(s[a]=0),s[a]+=~~n.value})})),s},getTotalDataSum(e){const t=this,s=_t.dataTotalSum;let i=t.cache.get(s);return O(i)||(i=t.data.targets.reduce((n,a)=>n+a.values.reduce((o,r)=>o+~~r.value,0),0),t.cache.add(s,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:s}}=e;let i=0;return s.length&&(i=t.data.values.bind(t)(s).reduce((n,a)=>n+a)),i},getFilteredDataByValue(e,t){return e.filter(s=>this.getBaseValue(s)===t)},getMaxDataCount(){return Math.max(...this.data.targets.map(e=>e.values.length),0)},getMaxDataCountTarget(){let e=this.filterTargetsToShow()||[];const t=e.length,s=this.config.axis_x_inverted;return t>1?(e=e.map(i=>i.values).reduce((i,n)=>i.concat(n)).map(i=>i.x),e=Jt(Fe(e)).map((i,n,a)=>({x:i,index:s?a.length-n-1:n}))):t&&(e=e[0].values.concat()),e},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?G(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const s=this.mapToIds(e);for(let i=0,n;n=s[i];i++)if(n===t)return!0;return!1},isTargetToShow(e){return this.state.hiddenTargetIds.indexOf(e)<0},isLegendToShow(e){return this.state.hiddenLegendIds.indexOf(e)<0},filterTargetsToShow(e){const t=this;return(e||t.data.targets).filter(s=>t.isTargetToShow(s.id))},mapTargetsToUniqueXs(e){const t=this,{axis:s}=t;let i=[];return e!=null&&e.length&&(i=Fe(_s(e.map(n=>n.values.map(a=>+a.x)))),i=s!=null&&s.isTimeSeries()?i.map(n=>new Date(+n)):i.map(Number)),Jt(i)},addTargetIds(e,t){const{state:s}=this;(G(t)?t:[t]).forEach(n=>{s[e].indexOf(n)<0&&s[e].push(n)})},removeTargetIds(e,t){const{state:s}=this;(G(t)?t:[t]).forEach(n=>{const a=s[e].indexOf(n);a>=0&&s[e].splice(a,1)})},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:s}=t.state,i={},n=t.isMultipleX(),a=n?t.mapTargetsToUniqueXs(e).map(o=>N(o)?o:+o):null;return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>M(l)||l===null).forEach(l=>{let{value:c}=l;c!==null&&t.isCandlestickType(l)&&(c=G(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),G(c)?r.push(...c):X(c)&&"high"in c?r.push(...Object.values(c)):t.isBubbleZType(l)?r.push(s&&t.getBubbleZData(c,"y")):n?r[t.getIndexByX(l.x,a)]=c:r.push(c)}),i[o.id]=r}),i},checkValueInTargets(e,t){return Object.keys(e).some(s=>e[s].values.some(i=>t(i.value)))},hasMultiTargets(){return this.filterTargetsToShow().length>1},hasNegativeValueInTargets(e){return this.checkValueInTargets(e,t=>t<0)},hasPositiveValueInTargets(e){return this.checkValueInTargets(e,t=>t>0)},orderTargets(e){const t=this,s=[...e],i=t.getSortCompareFn();return i&&s.sort(i),s},getSortCompareFn(e=!1){const t=this,{config:s}=t,i=s.data_order,n=/asc/i.test(i),a=/desc/i.test(i);let o;if(n||a){const r=(c,u)=>c+Math.abs(u.value),l=c=>O(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,u)=>{const d=l(c),h=l(u);return e?n?d-h:h-d:n?h-d:d-h}}else P(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return _s(e.map(s=>s.values)).filter(s=>s.x-t===0)},filterNullish(e){const t=s=>M(s.value);return e&&e.filter(s=>"value"in s?t(s):s.values.some(t))},filterRemoveNull(e){return e.filter(t=>M(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(s=>({id:s.id,id_org:s.id_org,values:s.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return Ie(e)&&e||Rt(e)&&nt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:s,config:i,state:{hasRadar:n,inputType:a,eventReceiver:{coords:o,rect:r}}}=t;let l;if(n){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const u=(0,R.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=i.axis_rotated,u=ps(s.chart.node()),d=a==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Me(s.svg)){const g=[h,0];c&&g.reverse(),h=Te(s.eventRect.node(),...g)[c?"y":"x"]}else h-=c?r.top:r.left;l=ze(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,s){var i;const n=this,a=1.3;return((i=n.getTextRect([e,t].map(o=>n.dataLabelFormat()(o))))==null?void 0:i.map(o=>o[s]*a))||[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 s=e[t].x,i=[];let n;for(n=t-1;n>=0&&s===e[n].x;n--)i.push(e[n]);for(n=t;n<e.length&&s===e[n].x;n++)i.push(e[n]);return i},findClosestFromTargets(e,t){const s=this,i=e.map(n=>s.findClosest(n.values,t));return s.findClosest(i,t)},findClosest(e,t){const s=this,{$el:{main:i}}=s,n=e.filter(r=>r&&M(r.value));let a,o;return n.filter(r=>s.isBarType(r.id)||s.isCandlestickType(r.id)).forEach(r=>{const l=s.isBarType(r.id)?`.${$t.chartBar}.${I.target}${s.getTargetSelectorSuffix(r.id)} .${$t.bar}-${r.index}`:`.${kt.chartCandlestick}.${I.target}${s.getTargetSelectorSuffix(r.id)} .${kt.candlestick}-${r.index} path`;!o&&s.isWithinBar(i.select(l).node())&&(o=r)}),n.filter(r=>!s.isBarType(r.id)&&!s.isCandlestickType(r.id)).forEach(r=>{const l=s.dist(r,t);a=s.getPointSensitivity(r),l<a&&(a=l,o=r)}),o},dist(e,t){const s=this,{config:{axis_rotated:i},scale:n}=s,a=+i,o=+!i,r=s.circleY(e,e.index),l=(n.zoom||n.x)(e.x);return Math.sqrt(Math.pow(l-t[a],2)+Math.pow(r-t[o],2))},convertValuesToStep(e){const t=this,{axis:s,config:i}=t,n=i.line_step_type,a=s?s.isCategorized():!1,o=G(e)?e.concat():[e];if(!(a||/step\-(after|before)/.test(n)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:u}=r;o.unshift({x:--u,value:r.value,id:c}),a&&n==="step-after"&&o.unshift({x:--u,value:r.value,id:c}),u=l.x,o.push({x:++u,value:l.value,id:c}),a&&n==="step-before"&&o.push({x:++u,value:l.value,id:c})}return o},convertValuesToRange(e){const t=G(e)?e.concat():[e],s=[];return t.forEach(i=>{const{x:n,id:a}=i;s.push({x:n,id:a,value:i.value[0]}),s.push({x:n,id:a,value:i.value[2]})}),s},updateDataAttributes(e,t){const s=this,{config:i}=s,n=i[`data_${e}`];return it(t)||(Object.keys(t).forEach(a=>{n[a]=t[a]}),s.redraw({withLegend:!0})),n},getRangedData(e,t="",s="areaRange"){const i=e==null?void 0:e.value;if(G(i)){if(s==="bar")return i.reduce((n,a)=>a-n);{const n={areaRange:["high","mid","low"],candlestick:["open","high","low","close","volume"]}[s].indexOf(t);return n>=0&&i?i[n]:void 0}}else if(i&&t)return i[t];return i},setRatioForGroupedData(e){const t=this,{config:s}=t;if(s.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=n=>t.getRatio("index",n,!0);e.forEach(n=>{"values"in n?n.values.forEach(i):i(n)})}},getRatio(e,t,s=!1){const i=this,{config:n,state:a}=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=n.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=o.data.values.bind(o);let c=this.getTotalPerIndex();if(a.hiddenTargetIds.length){let d=l(a.hiddenTargetIds,!1);d.length&&(d=d.reduce((h,g)=>h.map((f,p)=>~~f+g[p])),c=c.map((h,g)=>h-d[g]))}const u=c[t.index];t.ratio=O(t.value)&&c&&u?t.value/u:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/a.current.dataMax*n.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return s&&r?r*100:r},updateDataIndexByX(e){const t=this,s=e.reduce((i,n,a)=>(i[Number(n.x)]=a,i),{});t.data.targets.forEach(i=>{i.values.forEach((n,a)=>{let o=s[Number(n.x)];o===void 0&&(o=a),n.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(X(e.value)&&("z"in e.value||"y"in e.value)||G(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:s}=e;return t.isBarType(e)&&G(s)&&s.length>=2&&s.every(O)},getDataById(e){var t;const s=this.cache.get(e)||this.api.data(e);return(t=s==null?void 0:s[0])!=null?t:s}};function Rs(e,t=!1){const s=this,{api:i}=s;t&&s.api.flush(!0),e==null||e.call(i)}var Wn={load(e,t){const s=this,{axis:i,data:n,org:a,scale:o}=s,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;c&&(t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var d;const h=((d=t.types)==null?void 0:d[u.id])||t.type;s.setTargetType(u.id,h)}),n.targets.forEach(u=>{for(let d=0;d<c.length;d++)if(u.id===c[d].id){u.values=r?u.values.concat(c[d].values):c[d].values,c.splice(d,1);break}}),n.targets=n.targets.concat(c)),s.updateTargets(n.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(a.xScale||o.x).copy(),l.domain=s.getXDomain(n.targets),l.x.domain(l.domain),l.currentDomain=s.zoom.getDomain(),s.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,s.$el.eventRect.property("__zoom",null))),s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(a.xDomain=l.domain,a.xScale=l.x,i.isCategorized()&&(l.currentDomain=s.getZoomDomainValue(l.currentDomain),a.xDomain=s.getZoomDomainValue(a.xDomain),a.xScale=l.x.domain(a.xDomain)),s.updateCurrentZoomTransform(l.x,l.currentDomain)):a.xScale&&a.xScale.domain(a.xDomain),s.updateTypesElements(),Rs.call(s,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(),t.convertData(e,s=>{const i=e.data||s;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets(i),e)}))},unload(e,t){var s;const i=this,{state:n,$el:a,$T:o}=i,r=!!((s=i.hasLegendDefsPoint)!=null&&s.call(i));let l=t,c=e;if(i.cache.reset(),l||(l=()=>{}),c=c.filter(d=>i.hasTarget(i.data.targets,d)),!c||c.length===0){l();return}const u=a.svg.selectAll(c.map(d=>i.selectorTarget(d)));o(u).style("opacity","0").remove().call(ve,l),c.forEach(d=>{var h;const g=i.getTargetSelectorSuffix(d);n.withoutFadeIn[d]=!1,a.legend&&a.legend.selectAll(`.${Y.legendItem}${g}`).remove(),i.data.targets=i.data.targets.filter(f=>f.id!==d),r&&((h=a.defs)==null||h.select(`#${i.getDefsPointId(g)}`).remove())}),n.hasFunnel&&i.updateFunnel(i.data.targets),n.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements()}},Cs=U(6),Un={setExpand(e,t,s){const i=this,{config:n,$el:{circle:a}}=i;a&&n.point_focus_expand_enabled&&i.expandCircles(e,t,s),i.expandBarTypeShapes(!0,e,t,s)},expandBarTypeShapes(e=!0,t,s,i){const n=this;["bar","candlestick"].filter(a=>n.$el[a]).forEach(a=>{i&&n.$el[a].classed(I.EXPANDED,!1),n.getShapeByIndex(a,t,s).classed(I.EXPANDED,e)})},setOverOut(e,t){const s=this,{config:i,state:{hasFunnel:n,hasRadar:a,hasTreemap:o},$el:{main:r}}=s,l=X(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(s.api);if(i.color_onover&&s.setOverColor(e,t,l),l){const u=s.getTargetSelectorSuffix(t.id),d=n||o?`${I.target+u} .${st.shape}`:V.arc+u;c(t,r.select(`.${d}`).node())}else if(i.tooltip_grouped)e&&(a&&s.isPointFocusOnly()?s.showCircleFocus(s.getAllValuesOnIndex(t,!0)):s.setExpand(t,null,!0)),!s.isMultipleX()&&r.selectAll(`.${st.shape}-${t}`).each(function(u){c(u,this)});else{const u=s.cache.get(_t.setOverOut)||[],d=r.selectAll(`.${st.shape}-${t}`).filter(function(g){return s.isWithinShape(this,g)}),h=d.filter(function(){return u.every(g=>g!==this)});if(!e||d.empty()||u.length===h.size()&&h.nodes().every((g,f)=>g!==u[f]))for(;u.length;){const g=u.pop();i.data_onout.bind(s.api)((0,R.select)(g).datum(),g)}h.each(function(){e&&(c((0,R.select)(this).datum(),this),u.push(this))}),s.cache.add(_t.setOverOut,u)}}},callOverOutForTouch(e){const t=this,s=t.cache.get(_t.callOverOutForTouch);(X(e)&&s?e.id!==s.id:e!==s)&&((s||O(s))&&t.setOverOut(!1,s),(e||O(e))&&t.setOverOut(!0,e),t.cache.add(_t.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:s}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,Cs.drag)().on("drag",function(i){s.event=i,e.drag(bt(i,this))}).on("start",function(i){s.event=i,e.dragstart(bt(i,this))}).on("end",i=>{s.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,s){var i,n,a;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:u,hasRadar:d,hasTreemap:h},$el:{eventRect:g,funnel:f,radar:p,svg:_,treemap:x}}=o;let m=(a=(n=(u||h)&&l.rect||d&&p.axes.select(`.${at.axis}-${t} text`)||g||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:n.node)==null?void 0:a.call(n);if(m){const $=o.isMultipleX(),b=r.axis_rotated;let{width:v,left:y,top:T}=rt(m);if(c&&!d&&!$){const S=l.coords[t];S?(v=S.w,y+=S.x,T+=S.y):(v=0,y=0,T=0)}let C=y+(s?s[0]:0)+($||b?0:v/2),A=T+(s?s[1]:0)+(b?4:0);if(Me(_)){const S=Te(o.$el.eventRect.node(),C,A,!1);C=S.x,A=S.y}const w={screenX:C,screenY:A,clientX:C,clientY:A,bubbles:d};(u||h)&&(m=(f!=null?f:x).node()),yn[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,w)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{eventRect:t,zoomResetBtn:s}}=e;t==null||t.on(".zoom wheel.zoom .drag",null),s==null||s.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:s,eventRect:i,legend:n,region:a,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,a==null?void 0:a.list,l==null?void 0:l.getSelection(),s==null?void 0:s.selectAll("path"),n==null?void 0:n.selectAll("g"),r].forEach(u=>u==null?void 0:u.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},Zn={categoryName(e){var t;const{axis_x_categories:s}=this.config;return(t=s==null?void 0:s[e])!=null?t:e}},qn={generateClass(e,t){return` ${e} ${e+this.getTargetSelectorSuffix(t)}`},getClass(e,t){const s=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),n=s?"id":"index";return a=>{const o=a.data||a;return((t?this.generateClass(B[s?"shapes":"shape"],o[n]):"")+this.generateClass(B[e],o[i?"id":n])).trim()}},getChartClass(e){return t=>B[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],s=[];return function(i){var n;const a=i.id||((n=i.data)==null?void 0:n.id)||i;return s.indexOf(a)<0&&s.push(a),t[s.indexOf(a)%t.length]}},classRegion(e,t){return`${this.generateClass(B.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let s="";return t&&(s=` ${B.target}-${t}`),this.generateClass(B.target,e)+s},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.indexOf(e.id)>=0?B.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.indexOf(e.id)>=0?B.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-")},selectorTarget(e,t="",s=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${B.target+i} ${s}, ${t}.${B.circles+i} ${s}`},selectorTargets(e,t){const s=e||[];return s.length?s.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${B.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}},Mt=U(7);const Kn=(e,t,s)=>{const i=(0,R.select)(e.cloneNode(!0));return i.attr("id",s).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:s,node:i.node()}};function Jn(e){const t=_t.colorPattern,{body:s}=ot;let i=s[t];if(!i){const n=";",a=e.classed(Pe.colorPattern,!0).style("background-image");e.classed(Pe.colorPattern,!1),a.indexOf(n)>-1&&(i=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(n).map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),s[t]=i)}return i}const Qn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var ta={generateColor(){const e=this,{$el:t,config:s}=e,i=[];let n=nt(s.color_pattern)?s.color_pattern:(0,Mt.scaleOrdinal)(Jn(t.chart)||Qn).range();const a=n;if(P(s.color_tiles)){const o=s.color_tiles.bind(e.api)(),r=n.map((l,c)=>{const u=l.replace(/[#\(\)\s,]/g,""),d=`${e.state.datetimeId}-pattern-${u}-${c}`;return Kn(o[c%o.length],l,d)});n=r.map(l=>`url(#${l.id})`),e.patterns=r}return function(o){var r;const l=s.data_colors,c=s.data_color,u=o.id||((r=o.data)==null?void 0:r.id)||o,d=e.isTypeOf(u,["line","spline","step"])||!s.data_types[u];let h;return P(l[u])?h=l[u].bind(e.api)(o):l[u]?h=l[u]:(i.indexOf(u)<0&&i.push(u),h=d?a[i.indexOf(u)%a.length]:n[i.indexOf(u)%n.length],l[u]=h),P(c)?c.bind(e.api)(h,o):h}},generateLevelColor(){const e=this,{config:t}=e,s=t.color_pattern,i=t.color_threshold,n=i.unit==="value",a=i.max||100,o=i.values&&i.values.length?i.values:[];return nt(i)?function(r){const l=n?r:r*100/a;let c=s[s.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=s[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const s=this,{$el:i,state:n}=s;if(e){let a=[];N(e)?a.push(""):X(e)&&(a=Object.keys(e)),a.forEach(o=>{const r=`${n.datetimeId}-labels-bg${s.getTargetSelectorSuffix(o)}${N(e)?s.getTargetSelectorSuffix(e):""}`;i.defs.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r).html(`<feFlood flood-color="${o===""?e:e[o]}" /> <feComposite in="SourceGraphic" />`)})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:s},state:{datetimeId:i},$el:{defs:n}}=e;s.forEach(a=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(a.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(a)&&"area"||e.isBarType(a)&&"bar";if((r||l)&&n.select(`#${o}`).empty()){const c=e.color(a),u={defs:null,stops:[]};if(r){const{cx:d=.3,cy:h=.3,r:g=.7,stops:f=[[.1,c,0],[.9,c,1]]}=r;u.stops=f,u.defs=n.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",g)}else{const d=t.axis_rotated,{x:h=d?[1,0]:[0,0],y:g=d?[0,0]:[0,1],stops:f=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];u.stops=f,u.defs=n.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",g[0]).attr("y2",g[1])}u.stops.forEach(d=>{const[h,g,f]=d,p=P(g)?g.bind(e.api)(a.id):g;u.defs&&u.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",f)})}})},setOverColor(e,t){const s=this,{config:i,$el:{main:n}}=s,a=i.color_onover;let o=e?a:s.color;X(o)?o=({id:r})=>r in a?a[r]:s.color(r):N(o)?o=()=>a:P(a)&&(o=o.bind(s.api)),n.selectAll(X(t)?`.${V.arc}${s.getTargetSelectorSuffix(t.id)}`:`.${st.shape}-${t}`).style("fill",o)}},ea={getYDomainMinMax(e,t){cons