@evergis/charts
Advanced tools
Comparing version 2.0.22 to 2.0.23
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("styled-components"),r=t(a),l=require("react"),n=t(l),o=require("d3"),i=t(require("react-dom/server")),s=require("react-dom");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t}).apply(this,arguments)}function d(t,e){if(null==t)return{};var a,r,l={},n=Object.keys(t);for(r=0;r<n.length;r++)e.indexOf(a=n[r])>=0||(l[a]=t[a]);return l}function p(t,e){return e||(e=t.slice(0)),t.raw=e,t}const u=r.div(e||(e=p(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n"])));function h(){const[t,e]=l.useState(null);return[l.useCallback(e,[e]),t]}const m=(t,e,a)=>{const r=l.useMemo(()=>e?function(t,e){let a=!1;return function(){a||(t(...arguments),a=!0,setTimeout((function(){a=!1}),e))}}(e,a||44):void 0,[e,a]);l.useEffect(()=>(r&&"number"!=typeof t&&window.addEventListener("resize",r),()=>r&&window.removeEventListener("resize",r)),[t,r])},b=(t,e,a)=>(o.select(t).select("svg").remove(),o.select(t).append("svg").attr("width",e).attr("height",a));var g;const C=r.div(g||(g=p(["\n width: 100%;\n overflow: hidden;\n user-select: none;\n"]))),x=t=>t*(2-t),f=(t,e,a)=>Math.min(Math.max(t,e),a),y={animation:0,speed:0,timestamp:0,startX:0,currentX:0},v=["children","width","onSwipe"],T=t=>{let{children:e,width:a,onSwipe:r}=t,i=d(t,v);const[s,p]=h();return((t,e)=>{let{width:a,duration:r,animationFunc:n,onSwipe:i}=e;const s=o.select(t),c=o.select("body"),d=o.select(document),p=l.useRef(y);l.useEffect(()=>{a&&p.current.animation&&(cancelAnimationFrame(p.current.animation),p.current=y)},[a]);const u=l.useCallback(e=>{const{width:r}=t?t.getBoundingClientRect():{width:0},[l]=o.pointer(e.type.includes("touch")?e.touches[0]:e),n=f(l-p.current.startX,-(a-r),0);if(s.style("transform","translateX("+n+"px)"),p.current.currentX){const t=100,e=Date.now(),a=Math.round((n-p.current.currentX)/(e-p.current.timestamp)*t);p.current.speed=a,p.current.timestamp=e}p.current.currentX=n,i&&i(n,s)},[i,a,t,s]),h=l.useCallback(()=>{const{width:e}=t?t.getBoundingClientRect():{width:0};d.on("mousemove.swipe touchmove.swipe mouseup.swipe touchend.swipe",null),c.style("cursor",null),s.style("cursor",a>e?"grab":null),Date.now()-p.current.timestamp<44&&function(t){let{duration:e,timing:a,draw:r}=t;const l=performance.now();let n;requestAnimationFrame((function t(o){let i=(o-l)/e;i<1&&(n=requestAnimationFrame(t)),i>1&&cancelAnimationFrame(n);const s=a(i);r(s,n)}))}({duration:r,timing:n||x,draw:(t,r)=>{p.current.animation=r;const l=Math.round(2*p.current.speed*t),n=p.current.currentX+l,o=a-e,c=f(n,-o,0),d=Math.max(Math.min(n,o),0);p.current.currentX!==d&&(s.style("transform","translateX("+c+"px)"),i&&i(c,s))}})},[c,n,i,s,r,t,a,d]),m=l.useCallback(e=>{const a=e.type.includes("touch"),[r]=o.pointer(a?e.touches[0]:e,t),{left:l}=t&&t.parentElement?t.parentElement.getBoundingClientRect():{left:0};c.style("cursor","grabbing"),s.style("cursor","grabbing"),p.current.animation&&(cancelAnimationFrame(p.current.animation),p.current=y),p.current.startX=Math.max(r+l,0),d.on("mousemove.swipe touchmove.swipe",u),d.on("mouseup.swipe touchend.swipe",h)},[s,c,t,h,u,d]);l.useEffect(()=>{if(t){const{width:e}=t.getBoundingClientRect();a>e&&(s.style("cursor","grab"),s.on("mousedown.swipe touchstart.swipe",m))}},[s,m,t,a])})(p,c({width:a,onSwipe:r},i)),n.createElement(C,Object.assign({},i),n.createElement("div",{ref:s},e))};var L;T.defaultProps={duration:1400};const S=t=>{let{anchor:e,index:a,translateX:r,translateY:l}=t;return 0===a&&"middle"===e?"translate(calc(-50% + "+r+"px), calc(-100% + "+l+"px))":"middle"===e?"translate(calc(-50% + "+r+"px), calc("+l+"px))":"start"===e?"translate(calc("+r+"px), calc(-50% + "+l+"px))":"end"===e?"translate(calc(-100% + "+r+"px), calc(-50% + "+l+"px))":"translate("+r+"px, "+l+"px)"},k=r.div.attrs(t=>({style:{transform:S(t)}}))(L||(L=p(["\n position: absolute;\n"])));var M,A,w,N,B,E;const G=r.div(M||(M=p(["\n display: flex;\n align-items: center;\n font-size: 12px;\n"]))),z=r.div(A||(A=p(["\n text-align: center;\n max-width: 120px;\n"]))),Y=a.css(w||(w=p(["\n position: absolute;\n top: 50%;\n right: 0;\n transform: translate(calc(100% + 6px), -50%);\n"]))),X=r.div(N||(N=p(["\n display: flex;\n align-items: center;\n padding: 2px 4px;\n border-radius: 4px;\n color: rgb(255, 255, 255);\n background-color: rgb(144, 197, 61);\n margin-left: 8px;\n"]))),R=r(X)(B||(B=p(["\n ","\n"])),Y),I=r.div(E||(E=p(["\n margin-left: 4px;\n font-size: 10px;\n color: rgba(255, 255, 255, 0.54);\n"])));var P;const D={radar:"radar",radarAxis:"radarAxis",radarAxisTextGlobal:"radarAxisTextGlobal",radarAxisText:"radarAxisText",radarPolygon:"radarPolygon",radarLabel:"radarLabel",radarLabelName:"radarLabelName",radarLabelBadge:"radarLabelBadge",radarLabelBadgePrefix:"radarLabelBadgePrefix",radarCircle:"radarCircle"},F=r(u)(P||(P=p(["\n ."," {\n path,\n line,\n circle {\n fill: none;\n stroke-width: 1px;\n stroke: rgba(149, 149, 149, 0.18);\n }\n }\n ."," {\n font-size: 12px;\n fill-opacity: 0.56;\n }\n ."," {\n fill-opacity: 0.06;\n stroke-width: 2px;\n fill: rgb(144, 197, 61);\n stroke: rgb(144, 197, 61);\n }\n ."," {\n fill: rgb(144, 197, 61);\n }\n"])),D.radarAxis,D.radarAxisText,D.radarPolygon,D.radarCircle),O=(t,e)=>{const{data:a,curve:r,polar:l,formatValue:s,badgePrefix:d,labelOffset:p,circleRadius:u,svgElements:h,renderLabel:m,customize:g,formatAxisValue:C,radarStyles:x,labelIndex:f,selectLabel:y}=e;if(null!==t&&a.length){const v=10,T="number"==typeof e.bleedLength?e.bleedLength:v,{width:L}=t.getBoundingClientRect(),S=e.width||L,M=400,A=e.height||M,w=e.minValue||Math.min(0,o.min(a,t=>o.min(t.map(t=>{let{value:e}=t;return e})))),N=(e.maxValue||Math.max(0,o.max(a,t=>o.max(t.map(t=>{let{value:e}=t;return e})))))-w,B=e.paddingY||0,E=Math.min((S-2*(e.paddingX||0)-2*T)/2,(A-2*B-2*T)/2),Y=4,P=o.scaleLinear().domain([0,N||1]).range([]).ticks(e.levels||Y),F=P[P.length-1],O=F+(P[1]-P[0]);F<N&&P.push(O);const V=e.levels||P.length-1,j=P[P.length-1],W=2*Math.PI/a[0].length,q=o.scaleLinear().range([0,E]).domain([0,j]),Z=o.lineRadial().curve(o.curveLinearClosed).radius(t=>{let{value:e}=t;return q(e)}).angle((t,e)=>e*W),U=o.lineRadial().curve(r||o.curveLinearClosed).radius(t=>{let{value:e}=t;return q(e)}).angle((t,e)=>e*W),_=b(t,S,A),H=_.append("g"),J=o.range(1,V+1).reverse(),K=t=>-t*E/V,Q=t=>j*t/V,$=H.append("g").attr("class",D.radarAxis).selectAll().data([a[0]]).enter(),tt=H.append("g").attr("class",D.radar),et=$.selectAll().data(a[0].map(t=>{let{name:e}=t;return e})).enter();let at=0;l?J.forEach(t=>{const e=$.append("circle").attr("cx",0).attr("cy",0).attr("r",()=>E/V*t).node().getBoundingClientRect().height;at=Math.max(at,e)}):J.map(Q).forEach(t=>{const e=$.append("path").attr("d",()=>Z(Array.from({length:a[0].length},()=>({value:t})))).node().getBoundingClientRect().height;at=Math.max(at,e)});const rt=q(j)+T;et.append("line").attr("x1",0).attr("y1",0).attr("x2",(t,e)=>Math.round(rt*Math.cos(W*e-Math.PI/2))).attr("y2",(t,e)=>Math.round(rt*Math.sin(W*e-Math.PI/2))),tt.selectAll("path").data(a).join("path").attr("class",D.radarPolygon).attr("style",(t,e)=>(null==x?void 0:x[e])||"").attr("d",t=>U(t.map(t=>c({},t,{value:t.value-w}))));const lt=o.format(",");H.append("g").attr("class",D.radarAxisTextGlobal).selectAll("text").data(J).enter().append("text").attr("class",D.radarAxisText).attr("x","4").attr("y",K).attr("dy",0).attr("dominant-baseline","central").text((t,e)=>{const a=Q(t)+w;return C?C(a,e):lt(a)}),u&&a.forEach(t=>{const e=H.append("g").attr("class",D.radarCircle);t.forEach((t,a)=>{let{value:r}=t;e.append("circle").attr("cx",Math.round(q(r)*Math.cos(W*a-Math.PI/2))).attr("cy",Math.round(q(r*Math.sin(W*a-Math.PI/2)))).attr("r",u)})});const nt=8,ot=A-T-B,it=S/2,st=ot/2+(ot-at)/2,ct=T+(p||nt);if(H.attr("transform","translate("+it+","+st+")"),(t=>{let{node:e,dataLength:a,radiusScale:r,maxValue:l,angleSlice:s,radius:c,xOffset:d,yOffset:p,translateX:u,translateY:h,renderLabel:m,selectLabel:b}=t;const g=o.select(e);g.selectAll(".d3-chart-label").remove();const C=t=>l/c*t,x=t=>r((l+C(p||0))*Math.sin(s*t-Math.PI/2));Array.from({length:a},(t,e)=>{return{x:Math.ceil((a=e,r(l+C(d||0))*Math.cos(s*a-Math.PI/2))),y:Math.ceil(x(e))};var a}).forEach((t,e)=>{let{x:r,y:l}=t;const o=((t,e)=>{const a=((t,e)=>360/e*t)(t,e),r=180;return[0,r].includes(a)?"middle":a<r?"start":"end"})(e,a),s=i.renderToString(n.createElement(k,{anchor:o,translateX:u||0,translateY:h||0,index:e,style:{left:r,top:l}},"function"==typeof m?m(o,e):m)),c=g.append("div").attr("class","d3-chart-label").html(s);b(c,o,e)})})({node:t,maxValue:j,translateX:it,translateY:st,dataLength:a[f||0].length,angleSlice:W,radius:E,radiusScale:q,xOffset:ct,yOffset:ct,renderLabel:(t,e)=>{const r=a.map(t=>t[e]),l="middle"===t?R:X,o=a[f||0][e],{name:i,value:c}=o;return m?m({item:o,items:r,anchor:t,index:e}):n.createElement(G,{className:D.radarLabel},n.createElement(z,{className:D.radarLabelName},i),n.createElement(l,{className:D.radarLabelBadge},s?s(c,e):lt(c),d&&n.createElement(I,{className:D.radarLabelBadgePrefix},d)))},selectLabel:(t,e,r)=>{if(y){const l=a.map(t=>t[r]);y(t,{index:r,item:a[f||0][r],items:l,anchor:e})}}}),h){const t=i.renderToString(h);_.append("g").html(t)}g&&g(_)}},V=t=>{const{className:e,style:a}=t,[r,o]=h();return l.useEffect(()=>{o&&O(o,t)},[o,t]),m(t.width,()=>O(o,t)),n.createElement("div",{className:e,style:a},n.createElement(F,{ref:r}))};function j(t){return t*(Math.PI/180)}var W;V.defaultProps={height:400,data:[],curve:o.curveLinearClosed};const q={pieGlobal:"pieGlobal",pieSlice:"pieSlice",pieSliceLabel:"pieSliceLabel",pieSliceLabelValue:"pieSliceLabelValue",pieSliceLabelName:"pieSliceLabelName",pieRadialLabel:"pieRadialLabel",pieRadialLink:"pieRadialLink",pieTooltipContainer:"pieTooltipContainer",pieTooltipFlex:"pieTooltipFlex",pieTooltip:"pieTooltip",pieTooltipItem:"pieTooltipItem",pieTooltipName:"pieTooltipName",pieTooltipValue:"pieTooltipValue",pieTooltipColorBox:"pieTooltipColorBox",pieFullChartTooltipCircle:"pieFullChartTooltipCircle"},Z=r(u)(W||(W=p(["\n ."," {\n fill: #4a4a4a;\n }\n ."," {\n position: absolute;\n max-width: 128px;\n }\n ."," {\n stroke: #000;\n }\n ."," {\n fill: transparent;\n cursor: pointer;\n }\n"])),q.pieSliceLabel,q.pieRadialLabel,q.pieRadialLink,q.pieFullChartTooltipCircle),U=t=>t.startAngle+(t.endAngle-t.startAngle)/2<Math.PI?1:-1,_=t=>t.startAngle+(t.endAngle-t.startAngle)/2<Math.PI?"start":"end";var H,J,K,Q,$,tt,et,at,rt,lt,nt,ot,it,st;const ct=r.div(H||(H=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n pointer-events: none;\n white-space: nowrap;\n"]))),dt=r(ct)(J||(J=p([""]))),pt=r(dt)(K||(K=p(["\n align-items: center;\n"]))),ut=r.div(Q||(Q=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n margin-bottom: 8px;\n padding: 4px 6px;\n background-color: rgba(48, 69, 79, 1);\n border-radius: 4px;\n box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);\n :before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 100%);\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 4px 3px 0 3px;\n border-color: rgba(48, 69, 79, 1) transparent transparent transparent;\n }\n"]))),ht=r.div($||($=p(["\n font-size: 14px;\n margin-bottom: 6px;\n"]))),mt=r.div(tt||(tt=p(["\n display: flex;\n align-items: center;\n margin-bottom: 0.25rem;\n &:last-of-type {\n margin-bottom: 0;\n }\n"]))),bt=r.div(et||(et=p(["\n display: flex;\n align-items: center;\n margin-right: 4px;\n"]))),gt=r.div(at||(at=p(["\n margin-right: 4px;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n"]))),Ct=r(gt)(rt||(rt=p(["\n height: 2px;\n border-radius: 0;\n"]))),xt=r.div(lt||(lt=p(["\n margin-right: 4px;\n"]))),ft=r.div(nt||(nt=p(["\n text-align: right;\n flex-shrink: 0;\n flex-grow: 1;\n"]))),yt=r.div(ot||(ot=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n font-weight: bold;\n letter-spacing: 0.52px;\n"]))),vt=r(yt)(it||(it=p(["\n top: 6px;\n"]))),Tt=r(yt)(st||(st=p(["\n bottom: 6px;\n"]))),Lt=(t,e)=>{const{data:a,padAngle:r,onClick:l,outerRadius:s,startAngle:c,endAngle:d,cornerRadius:p,margin:u,enableSlicesLabels:h,formatSliceLabel:m,slicesLabelsSkipAngle:g,enableSlicesLabelsName:C,formatSliceLabelName:x,borderWidth:f,borderColor:y,enableRadialLabels:v,backgroundColor:T,radialLabelsLinkHorizontalLength:L,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:M,svgElements:A,formatSliceTitle:w,radialAngleXOffset:N,withTooltip:B,fullChartTooltip:E,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,tooltipStyle:X}=e;if(null!==t&&a.length){const R=u?u.top:0,I=u?u.right:0,P=u?u.bottom:0,D=u?u.left:0,{width:F}=t.getBoundingClientRect(),O=e.width||F,V=240,W=e.height||V,Z=(Math.min(O,W)-2*(f||0)-(O>W?R+P:I+D))/2,H=b(t,O,W),J=H.append("g").attr("class",q.pieGlobal).attr("transform","translate("+((O-(D+I))/2+D)+","+((W-(P+R))/2+R)+")"),K=45,Q=100,$=360,tt=o.pie().startAngle(-j(c||0)).endAngle(j(d||$)).padAngle(r?Math.max(Math.min(r/Q,K),0):0).sort(null).value(t=>{let{value:e}=t;return e})(a),et=.95,at=o.arc().cornerRadius(p||0).innerRadius(Z).outerRadius(Z*Math.min(Math.max(s||0,0),et));"string"==typeof T&&J.append("path").attr("fill",T).attr("d",()=>at({startAngle:j(0),endAngle:j($)}));const rt=o.format(","),lt=J.selectAll("allSlices").data(tt).enter().append("path").attr("d",at);if(lt.attr("class",q.pieSlice).attr("fill",t=>{let{index:e}=t;return a[e].color||""}).attr("stroke",y||"").attr("stroke-width",f||0).attr("style",l?"cursor: pointer":"").on("click",(t,e)=>l&&l(a[e.index])).append("svg:title").text(t=>w?w(t):E||B?"":(a[t.index].name||"")+" ("+rt(a[t.index].value)+")"),h){const t=J.selectAll("allSlices").data(tt).enter().append("text").attr("class",q.pieSliceLabel).attr("text-anchor","middle").attr("dominant-baseline","central").attr("transform",t=>"translate("+at.centroid(t)+")");t.append("tspan").attr("class",q.pieSliceLabelValue).text(t=>{const e=180*(t.endAngle-t.startAngle)/Math.PI;if(!g||e>g)return m?m(t):t.value}),C&&t.append("tspan").attr("class",q.pieSliceLabelName).text(t=>x?x(t):t.data.name).attr("x","0").attr("dy","1.2em")}if((t=>{let{arc:e,enableRadialLabels:a,global:r,node:l,radius:n,dataReady:s,radialLabelsLinkHorizontalLength:c,formatRadialLabel:d,radialLabelsTextXOffset:p,translateX:u,translateY:h,radialLabelYOffset:m,radialAngleXOffset:b}=t;const g=o.select(l);if(g.selectAll("."+q.pieRadialLabel).remove(),a){const t=4,a=o.arc().innerRadius(n).outerRadius(n);r.selectAll("allPolylines").data(s).enter().append("polyline").attr("class",q.pieRadialLink).style("fill","none").attr("points",r=>{const l=U(r),o=e.centroid(r),i=a.centroid(r),s=a.centroid(r),d=[(n+(c||t))*l,s[1]];return[[o[0],o[1]],[i[0]+(b||0)*l,i[1]-(m||0)*r.index],[d[0],d[1]-(m||0)*r.index]]});const l=e=>{const r=a.centroid(e);return[(n+(c||t))*U(e),r[1]]},C=4;g.selectAll("allLabels").data(s).enter().append("div").html(t=>i.renderToString(d?d(t):t.data.name)).attr("class",q.pieRadialLabel).style("transform",t=>(t=>{let{anchor:e,index:a,translateX:r,translateY:l}=t;return 0===a&&"middle"===e?"translate(calc(-50% + "+r+"px), calc(-100% + "+l+"px))":"middle"===e?"translate(calc(-50% + "+r+"px), calc("+l+"px))":"start"===e?"translate(calc("+r+"px), calc(-50% + "+l+"px))":"end"===e?"translate(calc(-100% + "+r+"px), calc(-50% + "+l+"px))":"translate("+r+"px, "+l+"px)"})({anchor:_(t),index:t.index,translateX:u,translateY:h-(m||0)*t.index})).style("left",t=>l(t)[0]-("start"===_(t)?-(p||C):p||C)+"px").style("top",t=>l(t)[1]+"px").style("text-align",_)}})({arc:at,enableRadialLabels:v,global:J,radius:Z,node:t,dataReady:tt,translateX:(O-(D-I))/2,translateY:(W+(R-P))/2,radialLabelsLinkHorizontalLength:L,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:M,radialAngleXOffset:N}),(B||E)&&(t=>{let{fullChartTooltip:e,global:a,tooltipRoot:r,data:l,tooltipClassName:s,tooltipBind:c,renderTooltip:d,arc:p,allSlices:u,tooltipStyle:h,width:m,height:b,radius:g}=t;const C=r||document.querySelector("body"),x=o.format(","),f=o.select(C).select("."+q.pieTooltipContainer),y=f.empty()?o.select(C).append("div").attr("class",q.pieTooltipContainer+" "+(s||"")).style("position","absolute").style("opacity","0"):f;h&&Object.entries(h).forEach(t=>{let[e,a]=t;return y.style(e,a)}),y.html("");let v=!1;const T=t=>{v=Boolean(t),y.style("opacity",v?"1":"0")},L=(t,r)=>{let[l,n]=o.pointer(t,document);if(!c&&e){const[e,a]=o.pointer(t,t.target);l-=e,n-=a}else if(!c){const t=a.node(),{x:e,y:o,width:i,height:s}=t?t.getBoundingClientRect():{x:0,y:0,width:0,height:0},[c,d]=p.centroid(r);l=e+i/2+c,n=o+s/2+d}y.style("left",l+"px").style("top",n+"px")},S=(t,e)=>{T(!0),L(t,e);const a=e?[e.data]:l;y.html(()=>i.renderToString(n.createElement(ct,{className:q.pieTooltipFlex},n.createElement(ut,{className:q.pieTooltip},d?d(a):n.createElement(n.Fragment,null,a.map((t,e)=>{let{color:a,name:r,value:l}=t;return n.createElement(mt,{key:r+"-"+e,className:q.pieTooltipItem},a&&n.createElement(gt,{className:q.pieTooltipColorBox,style:{backgroundColor:a}}),r&&n.createElement(xt,{className:q.pieTooltipName},r),n.createElement(ft,{className:q.pieTooltipValue},x(l)))}))))))};e?(a.on("mouseover.fulltooltip",t=>S(t)),a.on("mouseout.fulltooltip",()=>{y.html(""),T()}),m&&b&&a.append("circle").attr("class",q.pieFullChartTooltipCircle).attr("r",g).attr("cx",0).attr("cy",0),c||a.on("touchmove.tooltipBind mousemove.tooltipBind",t=>L(t))):(u.on("mouseover.slice",S),c||u.on("touchmove.slice mousemove.slice",L),u.on("mouseout.slice",()=>{y.html(""),T()}))})({fullChartTooltip:E,global:J,data:a,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,allSlices:lt,arc:at,tooltipStyle:X,width:O,height:W,radius:Z}),A){const t=i.renderToString(A);H.append("g").html(t)}}},St=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&Lt(i,t)},[i,t]),m(t.width,()=>Lt(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Z,{ref:o},r))};St.defaultProps={data:[],startAngle:0,endAngle:360,slicesLabelsSkipAngle:0,radialLabelYOffset:16,radialAngleXOffset:8};const kt={legendContainer:"d3-legend-container",legendTitle:"d3-legend-title",legendTick:"d3-legend-tick",legendTickLine:"d3-legend-tick-line",legendTickText:"d3-legend-tick-text"};function Mt(t,e){void 0===e&&(e=256);const a=document.createElement("canvas");a.width=e,a.height=1;const r=a.getContext("2d");for(let a=0;a<e;++a)r.fillStyle=t(a/(e-1)),r.fillRect(a,0,1,1);return a}const At={tickSize:6,height:44,width:320,marginTop:18,marginBottom:16,ticksDivier:64,titleMarginBottom:6};var wt;const Nt=c({calendarChart:"calendarChart",calendarYear:"calendarYear",calendarAxis:"calendarAxis",calendarBody:"calendarBody",calendarHeader:"calendarHeader",calendarYearTitle:"calendarYearTitle",calendarWeekDay:"calendarWeekDay",calendarMonth:"calendarMonth",calendarDays:"calendarDays",calendarDay:"calendarDay"},kt),Bt=r(u)(wt||(wt=p(["\n ."," {\n display: flex;\n margin-bottom: 16px;\n }\n ."," {\n display: inline-flex;\n align-items: flex-end;\n height: ",";\n margin-bottom: 4px;\n font-weight: bold;\n }\n ."," {\n height: ",";\n margin-bottom: 4px;\n position: relative;\n display: flex;\n }\n ."," {\n font-size: 14px;\n bottom: 0;\n position: absolute;\n }\n ."," {\n display: flex;\n flex-direction: column;\n margin-right: 10px;\n }\n ."," {\n font-size: 12px;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n ."," {\n position: relative;\n }\n ."," {\n position: absolute;\n }\n"])),Nt.calendarYear,Nt.calendarYearTitle,"20px",Nt.calendarHeader,"20px",Nt.calendarMonth,Nt.calendarAxis,Nt.calendarWeekDay,Nt.calendarDays,Nt.calendarDay),Et=t=>{const{className:e,style:a,children:r,data:i,startSunday:s,weekdays:d,cellOffset:p,cellSize:u,interpolator:m,monthSpacing:b,colorRange:g,legendProps:C}=t,[x,f]=h();return l.useEffect(()=>{f&&((t,e)=>{const{data:a,startSunday:r,weekdays:l,interpolator:n,monthSpacing:i,onEachDay:s,colorRange:d,legendProps:p}=e;if(null!==t&&a.length){const u=o.group(a,t=>t.date.getUTCFullYear()),h="number"==typeof e.cellOffset?e.cellOffset:0,m=7,b=18,g=e.cellSize||b,C=t=>r?t:(t+(m-1))%m,x=l||["вс","пн","вт","ср","чт","пт","сб"],f=6,y=t=>r?x[t]:t===f?x[0]:x[t+1],v=o.utcFormat("%x"),T=r?o.utcSunday:o.utcMonday,L=(t,e)=>T.count(o.utcYear(t),e),S=t=>t.getUTCMonth()*(i||0),k=o.utcFormat("%b"),M=o.max(a.map(t=>{let{value:e}=t;return e})),A=o.min(a.map(t=>{let{value:e}=t;return e})),w=d?o.scaleLinear().domain([A,M]).range(d):o.scaleSequential(n||o.interpolateGreens).domain([A,+M]);let N=0;u.forEach((t,e)=>{const a=new Date(e,1),r=o.max(t.map(t=>t.date)),l=r.getUTCMonth()-a.getUTCMonth(),n=L(a,r)+1;N=Math.max(N,n*(g+h)+(i||0)*l)}),o.select(t).select("."+Nt.calendarChart).remove();const B=o.select(t).append("div").attr("class",Nt.calendarChart),E=B.selectAll("div").data(u).join("div").attr("class",Nt.calendarYear),G=E.append("div").attr("class",Nt.calendarAxis);G.append("div").attr("class",Nt.calendarYearTitle).text(t=>{let[e]=t;return e}),G.selectAll("span").data(o.range(m)).join("div").attr("class",Nt.calendarWeekDay).style("height",g+"px").style("margin-bottom",h+"px").text(y);const z=E.append("div").attr("class",Nt.calendarBody);if(z.append("div").attr("class",Nt.calendarHeader).selectAll("div").data(t=>{let[e,a]=t;return o.utcMonths(o.utcMonth(new Date(a[0].date.getUTCFullYear(),1,1)),o.utcMonth(new Date(a[0].date.getUTCFullYear(),12,31)))}).join("div").attr("class",Nt.calendarMonth).style("left",t=>L(t,T.ceil(t))*(g+h)+S(t)+"px").text(k),z.append("div").attr("class",Nt.calendarDays).style("height",(g+h)*m+"px").style("width",N+"px").selectAll("div").data(t=>{let[,e]=t;return e}).join("div").each((t,e,a)=>{if(s){const r=a[e],l=w(t.value);s(t,r,l)}}).attr("class",Nt.calendarDay).style("width",g+"px").style("height",g+"px").style("left",t=>L(t.date,t.date)*(g+h)+S(t.date)+"px").style("top",t=>C(t.date.getUTCDay())*(g+h)+"px").style("background-color",t=>w(t.value)).attr("title",t=>v(t.date)+" - "+t.value),"object"==typeof p){const t=(t=>{let{color:e,title:a,tickSize:r=At.tickSize,width:l=At.width,height:n=At.height+r,marginTop:i=At.marginTop,marginRight:s=0,marginBottom:c=At.marginBottom+r,marginLeft:d=0,ticks:p=At.width/At.ticksDivier,tickFormat:u,tickValues:h,titleMarginBottom:m}=t;const b=o.create("svg").attr("width",l).attr("height",n).attr("viewBox",[0,0,l,n]).style("overflow","visible").style("display","block");let g;if(e.interpolate){const t=Math.min(e.domain().length,e.range().length);g=e.copy().rangeRound(o.quantize(o.interpolate(d,l-s),t)),b.append("image").attr("x",d).attr("y",i).attr("class",kt.legendContainer).attr("width",l-d-s).attr("height",n-i-c).attr("preserveAspectRatio","none").attr("xlink:href",Mt(e.copy().domain(o.quantize(o.interpolate(0,1),t))).toDataURL())}else if(e.interpolator&&(g=Object.assign(e.copy().interpolator(o.interpolateRound(d,l-s)),{range:()=>[d,l-s]}),b.append("image").attr("x",d).attr("y",i).attr("width",l-d-s).attr("height",n-i-c).attr("preserveAspectRatio","none").attr("xlink:href",Mt(e.interpolator()).toDataURL()),!g.ticks)){if(void 0===h){const t=Math.round(p+1);h=o.range(t).map(a=>o.quantile(e.domain(),a/(t-1)))}"function"!=typeof u&&(u=o.format(void 0===u?",f":u))}return b.append("g").attr("transform","translate(0,"+(n-c)+")").call(o.axisBottom(g).ticks(p,"string"==typeof u?u:void 0).tickFormat("function"==typeof u?u:void 0).tickSize(r).tickValues(h)).call(t=>{const e=t.selectAll(".tick");return e.selectAll(".tick line").attr("y1",i+c-n).attr("class",kt.legendTickLine),e.selectAll(".tick text").attr("class",kt.legendTickText),e.attr("class",kt.legendTick),e}).call(t=>t.select(".domain").remove()).call(t=>t.append("text").attr("x",d).attr("class",kt.legendTitle).attr("y",i+c-n-(m||At.titleMarginBottom)).attr("fill","currentColor").attr("text-anchor","start").attr("font-weight","bold").text(a)),b})(c({color:w},p)),e=B.node(),a=t.node();e.appendChild(a)}}})(f,t)},[f,i,s,d,p,u,m,b,g,C]),n.createElement(Bt,{ref:x,className:e,style:a},r)};function Gt(t){let e;const a=t.node();return e=a instanceof SVGGraphicsElement?a.getBBox():a.getBoundingClientRect(),e}function zt(){}function Yt(t){return null==t||Number.isNaN(t)}var Xt,Rt;Et.defaultProps={data:[]};const It={lineChartYScaleGlobal:"lineChartYScaleGlobal",lineChartXScaleGlobal:"lineChartXScaleGlobal",lineChartLinesGlobal:"lineChartLinesGlobal",lineChartLine:"lineChartLine",lineChartAreasGlobal:"lineChartAreasGlobal",lineChartArea:"lineChartArea",lineChartDotsGlobalContainer:"lineChartDotsGlobalContainer",lineChartDotsGlobal:"lineChartDotsGlobal",lineChartDot:"lineChartDot",lineChartGridGlobal:"lineChartGridGlobal",lineChartGridLineX:"lineChartGridLineX",lineChartGridLineY:"lineChartGridLineY",lineChartLabelContainer:"lineChartLabelContainer",lineChartLabelFlex:"lineChartLabelFlex",lineChartLabel:"lineChartLabel",lineChartMouseGlobal:"lineChartMouseGlobal",lineChartMouseLine:"lineChartMouseLine",lineChartMouseRect:"lineChartMouseRect",lineChartMouseCircle:"lineChartMouseCircle",lineChartMouseLabelContainer:"lineChartMouseLabelContainer",lineChartMouseLabel:"lineChartMouseLabel"},Pt=r(u)(Xt||(Xt=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n stroke: steelblue;\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n fill-opacity: 0.24;\n }\n .",",\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n .",",\n ."," {\n transition: opacity linear 200ms;\n pointer-events: none;\n stroke-width: 1px;\n }\n ."," {\n stroke: #fff;\n stroke-width: 2px;\n }\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n"])),It.lineChartYScaleGlobal,It.lineChartXScaleGlobal,It.lineChartGridGlobal,It.lineChartLinesGlobal,It.lineChartArea,It.lineChartGridLineX,It.lineChartGridLineY,It.lineChartMouseLine,It.lineChartMouseLine,It.lineChartMouseCircle,It.lineChartDot,It.lineChartMouseLine,It.lineChartMouseRect),Dt=a.createGlobalStyle(Rt||(Rt=p(["\n ."," {\n transition: opacity linear 200ms;\n z-index: 1;\n ."," {\n justify-content: flex-start;\n align-items: center;\n pointer-events: none;\n }\n ."," {\n margin: 0 0 0 10px;\n }\n }\n"])),It.lineChartMouseLabel,It.lineChartLabelFlex,It.lineChartLabel);var Ft,Ot;const Vt=r.div(Ft||(Ft=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),jt=r.div(Ot||(Ot=p(["\n margin-bottom: 4px;\n"]))),Wt=["values"],qt=(t,e)=>{const{data:a,labels:r,margin:l,customYAxisSelection:s,customXAxisSelection:p,customYAxis:u,customXAxis:h,curve:m,yAxisPadding:g,xAxisPadding:C,drawGridY:x,drawGridX:f,withLabels:y,formatLabel:v,eachLabel:T,stacked:L,dynamicTooltipEnable:S,dynamicCircleRadius:k,formatDynamicTooltip:M,renderTooltip:A,stackedTooltip:w,stackedTooltipIndex:N,tooltipLineTop:B,customize:E,customYScale:G,customLine:z,tooltipClassName:Y,xScaleItemWidth:X,areaCurve:R}=e;if(null!==t&&a.length){const I=L?(t=>{const e={};return t.map((t,a)=>(e[a]={},a>0?c({},t,{values:t.values.map((t,r)=>{const l=e[a-1][r];return e[a][r]=Number(("number"!=typeof l?0:Math.abs(l))+("number"!=typeof t?0:Math.abs(t))),e[a][r]})}):(t.values.forEach((t,r)=>{e[a][r]=Number(t)}),t)))})(a):a,P=l?l.top:0,D=l?l.right:0,F=l?l.bottom:0,O=l?l.left:0,{width:V}=t.getBoundingClientRect(),j=e.width||V,W=e.height||0,q="number"==typeof e.min?e.min:o.min(I,t=>{let{values:e}=t;return o.min(e)}),Z="number"==typeof e.max?e.max:o.max(I,t=>{let{values:e}=t;return o.max(e)}),U=b(t,j,W||0),_=o.scaleLinear().domain([q||0,Z||0]).range([W-P-F-(C||0),P]).nice();G&&G(_);const H=8,J=o.axisLeft(_).ticks(H);u&&u(J);const K=J.tickArguments()[0],Q=U.append("g").attr("class",It.lineChartYScaleGlobal).call(J).call(s||zt),{width:$}=Gt(Q);Q.attr("transform","translate("+(O+$)+", 0)");const tt=r&&r.length?r.length-1:I.reduce((t,e)=>{let{values:a}=e;return Math.max(t,a.length)},0)-1,et=o.scaleLinear().domain([0,tt]).range([O+$+(g||0),j-D]),at=o.axisBottom(et).tickFormat(t=>r&&r.length>0?r[t]:0).ticks(tt);if("number"==typeof X){const[t,e]=et.range();at.ticks(Math.round((e-t)/X)).tickSizeOuter(0)}if(h&&h(at),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,lastIndex:n,drawGridX:o,drawGridY:i}=t;if(!i&&!o)return;const s=e.append("g").attr("class",It.lineChartGridGlobal),c=a.ticks(l);o&&s.append("g").selectAll("line").data(c).join("line").attr("class",It.lineChartGridLineX).attr("x1",()=>r(0)).attr("x2",()=>r(n)).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),i&&s.append("g").selectAll("line").data(Array.from({length:n+1},(t,e)=>e)).join("line").attr("class",It.lineChartGridLineY).attr("x1",(t,e)=>Math.round(r(e))).attr("x2",(t,e)=>Math.round(r(e))).attr("y1",()=>Math.round(a(c[0]))).attr("y2",()=>Math.round(a(c[c.length-1])))})({svg:U,yScale:_,xScale:et,yTicksCount:K,lastIndex:tt,drawGridY:x,drawGridX:f}),Array.isArray(r)&&r.length>0){const t=U.append("g").call(p||zt).attr("class",It.lineChartXScaleGlobal).call(at),{height:e}=Gt(t);t.attr("transform","translate(0, "+(W-Math.ceil(e)-F)+")")}const rt=o.line().defined(t=>null!==t).x((t,e)=>et(e)).y(t=>_(t)).curve(m||o.curveLinear);if(z&&z(rt),I.some(t=>{let{fill:e}=t;return e})){let t=-2;const e=e=>{const{minAreaValues:a}=e,r=_.ticks()[0];return o.area().defined(t=>null!==t).x((t,e)=>et(e)).y0((e,l)=>{0===l&&(t+=1);let n=r;a&&"number"==typeof a[l]?n=a[l]||n:a&&(n=_(n-e));const o=I[t];return _(L&&t>-1?"number"!=typeof o.values[l]?0:o.values[l]:n)}).y1(t=>_(t)).curve(R||m||o.curveLinear)};U.append("g").attr("class",It.lineChartAreasGlobal).selectAll("path").data(I.filter(t=>{let{fill:e}=t;return Boolean(e)})).join("path").attr("class",It.lineChartArea).attr("d",t=>e(t)(t.values)).attr("fill",t=>{let{fill:e}=t;return e||"none"}).attr("style",t=>{let{areaStyle:e}=t;return e||""})}U.append("g").attr("class",It.lineChartLinesGlobal).selectAll("path").data(I).join("path").attr("class",It.lineChartLine).attr("d",t=>rt(t.values)).attr("stroke",t=>{let{stroke:e}=t;return e||"steelblue"}).attr("style",t=>{let{style:e}=t;return e||""});const lt=I.filter(t=>{let{dot:e}=t;return e});if(lt.length>0){const t=U.append("g").attr("class",It.lineChartDotsGlobalContainer);lt.forEach(e=>{const{values:a,dot:r}=e,{radius:l,style:n,filter:o}=r,i=t.append("g").attr("class",It.lineChartDotsGlobal);i.selectAll("circle").data(a).join("circle").attr("cx",(t,e)=>et(e)).attr("class",It.lineChartDot).attr("cy",t=>_(t)).attr("r",l||0).attr("style",n||""),o&&i.selectAll("circle").select((t,a,r)=>o(e,a,r)?r[a]:null).remove()})}o.select(t).select(".d3-chart-label").remove(),y&&(t=>{let{node:e,data:a,yScale:r,xScale:l,formatLabel:s,eachLabel:c}=t;const d=o.select(e).append("div").attr("class","d3-chart-label"),p=o.format(",");a.forEach(t=>{let{values:e}=t;d.append("div").selectAll("div").data(e).join("div").attr("class",It.lineChartLabelContainer).style("position","absolute").style("left",(t,e)=>l(e)+"px").style("top",t=>r(t)+"px").html((t,e,a)=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},n.createElement(jt,{className:It.lineChartLabel},s?s(t,e,a):p(t))))).each(c||zt)})})({node:t,eachLabel:T,data:I,yScale:_,xScale:et,formatLabel:v}),S&&(t=>{let{svg:e,node:a,data:r,xScale:l,yScale:s,dynamicCircleRadius:p,formatDynamicTooltip:u,renderTooltip:h,stackedTooltipIndex:m,stackedTooltip:b,tooltipLineTop:g,tooltipRoot:C,tooltipClassName:x}=t;const f=C||document.querySelector("body"),y=o.format(","),v=r.filter(t=>{let{tooltipOff:e}=t;return!e}),T="number"==typeof m?[v[m]]:b?[v[0]]:v,[L,S]=l.range(),[k,M]=s.range(),A=e.append("g").attr("class",It.lineChartMouseGlobal),w=A.append("rect").attr("width",S-L).attr("height",Math.abs(k-M)).attr("class",It.lineChartMouseRect).attr("transform","translate("+L+", "+M+")"),N=A.append("path").attr("class",It.lineChartMouseLine).style("opacity","0"),B=e.selectAll("."+It.lineChartLine).nodes(),E=A.selectAll("circle").data(v.filter(t=>{let{dynamicDotOff:e}=t;return!e})).join("circle").attr("class",It.lineChartMouseCircle).attr("r",p).attr("fill",t=>{let{stroke:e}=t;return e||"none"}).attr("stroke",t=>{let{stroke:e}=t;return e||"none"}).style("opacity","0");let G=o.select("."+It.lineChartMouseLabelContainer);0===G.size()&&(G=o.select(f).append("div").attr("class",It.lineChartMouseLabelContainer));let z=null,Y=!1;const X=t=>{Y=Boolean(t);const e=Y?"1":"0";N.style("opacity",e),E.style("opacity",e),z&&z.style("opacity",e)},R=t=>{const[p,C]=o.pointer(t,document),[x]=o.pointer(t,w),[f,T]=o.pointer(t,a),L=x-(x-f),S=f+(p-f),A=Math.abs(l.invert(L)),G={},R=t=>Yt(t[Math.floor(A+1)])?null:t[Math.floor(A)];B.forEach((t,e)=>{let a={x:0,y:0};if(!t.hasAttribute("d")||r[e].tooltipOff)return void(G[e]=a);let l=0,n=t.getTotalLength(),o=null;for(;o=Math.floor((l+n)/2),a=t.getPointAtLength(o),o!==n&&o!==l||a.x===L;)if(a.x>L)n=o;else{if(!(a.x<L))break;l=o}G[e]=a}),E.attr("transform",(t,e)=>{const a=R(t.values);return G[e]&&a?"translate("+L+","+G[e].y+")":"translate(-9999, -9999)"}).attr("style",t=>{let{dynamicDotStyle:e}=t;return e||""});const I=v.map((t,e)=>{let{values:a}=t;return c({},d(t,Wt),{value:R(a),invertValue:G[e]?s.invert(G[e].y):0})}),P=I.every(t=>{let{value:e}=t;return Yt(e)});P&&Y?X():Y||P||X(!0);const D=Object.keys(G).reduce((t,e,a)=>{var l,n;const o=null==(l=I[Number(t)])?void 0:l.value,i=null==(n=I[Number(e)])?void 0:n.value,s=null==r?void 0:r[a].dynamicDotOff;return 0===a||Yt(i)||s?t:Yt(o)||G[t].y>G[e].y?e:t},"0"),F=z&&z.style("left",S+"px").style("top",(t,e)=>{const a="number"==typeof m?m:b?D:e;return(G[a]&&G[a].y+(C-T))+"px"}).select("."+It.lineChartLabel);h&&z?z.html((a,r)=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},h(I,{indexX:Math.round(A),indexY:r,svg:e,event:t})))):F&&F.text((t,e)=>{const a=I[e].invertValue;return u?u(a,I[e].value):y(a)}),N.attr("d",()=>{var t;let e="M"+L+","+k;return e+=" "+L+","+(g?M:(null==(t=G[D])?void 0:t.y)||0),e})};w.on("mouseover.tooltip",t=>{z=G.selectAll("div").data(T).join("div").attr("class",It.lineChartMouseLabel+" "+(x||"")).style("opacity","0").style("position","absolute").html(()=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},n.createElement(jt,{className:It.lineChartLabel})))),R(t)}),w.on("mouseout.tooltip",()=>{o.select("."+It.lineChartMouseLabelContainer).selectAll("*").remove(),X()}),w.on("touchmove.tooltip mousemove.tooltip",R)})({tooltipLineTop:B,stackedTooltip:w,renderTooltip:A,stackedTooltipIndex:N,formatDynamicTooltip:M,node:t,svg:U,data:I,xScale:et,yScale:_,dynamicCircleRadius:k,tooltipClassName:Y}),E&&E({svg:U,yScale:_,xScale:et})}},Zt=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&qt(i,t)},[i,t]),m(t.width,()=>qt(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Dt,null),n.createElement(Pt,{ref:o},r))};Zt.defaultProps={data:[],labels:[],height:240,yAxisPadding:10,xAxisPadding:20,margin:{top:10,right:10,bottom:10,left:0},dynamicCircleRadius:4,stackedTooltip:!1};const Ut={barChartLinesGlobal:"barChartLinesGlobal",barChartLine:"barChartLine",barChartAreasGlobal:"barChartAreasGlobal",barChartArea:"barChartArea"};var _t,Ht;const Jt=c({barChartBarGlobal:"barChartBarGlobal",barChartYScaleGlobal:"barChartYScaleGlobal",barChartYAxis:"barChartYAxis",barChartXAxis:"barChartXAxis",barChartYAxisZeroTick:"barChartYAxisZeroTick",barChartGridGlobal:"barChartGridGlobal",barChartGridLineX:"barChartGridLineX",barChartGridLineXZero:"barChartGridLineXZero",barChartGridLineYZero:"barChartGridLineYZero",barChartGridLineY:"barChartGridLineY"},{barChartMouseRect:"barChartMouseRect",barChartMouseContainer:"barChartMouseContainer",barChartTooltipFlex:"barChartTooltipFlex",barChartMouseTooltip:"barChartMouseTooltip",barChartTooltip:"barChartTooltip",barChartTooltipItem:"barChartTooltipItem",barChartTooltipColFlex:"barChartTooltipColFlex",barChartTooltipGroupName:"barChartTooltipGroupName",barChartColorBox:"barChartColorBox",barChartColorLine:"barChartColorLine",barChartTooltipName:"barChartTooltipName",barChartTooltipValue:"barChartTooltipValue"},{barChartLabelContainer:"barChartLabelContainer",barChartLabelFlex:"barChartLabelFlex",barChartLabel:"barChartLabel"},Ut),Kt=r(u)(_t||(_t=p(["\n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n .",",\n ."," {\n stroke: rgba(48, 69, 79, 0.06);\n }\n ."," {\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n ."," {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n shape-rendering: auto;\n }\n ."," {\n fill-opacity: 0.24;\n }\n"])),Jt.barChartGridLineX,Jt.barChartGridLineY,Jt.barChartMouseRect,Jt.barChartMouseRect,Jt.barChartLinesGlobal,Jt.barChartLine,Jt.barChartArea),Qt=a.createGlobalStyle(Ht||(Ht=p(["\n ."," {\n z-index: 1;\n transition: all linear 144ms;\n\n ."," {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])),Jt.barChartMouseTooltip,Jt.barChartTooltipItem),$t=["groupName"],te=["groupName"],ee=["values"],ae=["groupName"],re=(t,e)=>{const{data:a,lineData:r=[],barWidth:l,barPadding:s,colors:p,margin:u,xAxisPadding:h,yAxisPadding:m,drawGridY:g,drawGridX:C,customYScale:x,customXScale:f,customYAxisLeft:y,customXAxisBottom:v,customYAxis:T,customXAxis:L,customBars:S,customize:k,dynamicTooltipEnable:M,renderTooltip:A,labelPosition:w,renderLabel:N,tooltipY:B,tooltipBind:E,stackedLine:G,curve:z,formatTooltipValue:Y,formatTooltipName:X,sectionPadding:R,minValuesLine:I,tooltipYDomain:P,marshalledMap:D,minValue:F,maxValue:O,minDomainValue:V,maxDomainValue:j,drawBars:W,setTooltipPosition:q,onLabelItem:Z,isBarTooltip:U,xScaleItemWidth:_,tooltipRoot:H,tooltipClassName:J}=e;if(null!==t&&a.length){const K=u?u.top:0,Q=u?u.right:0,$=u?u.bottom:0,tt=u?u.left:0,et=12,{width:at}=t.getBoundingClientRect(),rt=e.width||at,lt=e.height||0,nt=(t=>{let{data:e,minDomainValue:a,maxDomainValue:r}=t,l=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.forEach(t=>{let e=d(t,$t),a=0,r=0;Object.keys(e).forEach(t=>{const l=e[t];let n=0,o=0;Object.keys(l).forEach(t=>{const e=l[t];e>0?n+=e:o+=e}),a=Math.min(a,o),r=Math.max(r,n)}),l=Math.min(l,a),n=Math.max(n,r)}),0===l&&0===n?{min:"number"==typeof a?a:0,max:"number"==typeof r?r:1}:{min:"number"==typeof a?a:l,max:"number"==typeof r?r:n}})({data:a,minDomainValue:V,maxDomainValue:j}),ot="number"==typeof F?F:Math.min(o.min(r,t=>{let{values:e}=t;return o.min(e)})||Number.POSITIVE_INFINITY,nt.min||0),it="number"==typeof O?O:Math.max(o.max(r,t=>{let{values:e}=t;return o.max(e)})||Number.NEGATIVE_INFINITY,nt.max),st=b(t,rt,lt||0),Lt=6,St=a.map(t=>t.groupName);let kt=l||et;const Mt=o.scaleLinear().domain([ot,it]).range([lt-K-$-(h||0),K]).nice();x&&x(Mt);const At=Mt.ticks(),wt=o.axisLeft(Mt).ticks(Lt);y&&y(wt);const Nt=wt.tickArguments()[0],Bt=st.append("g").attr("class",Jt.barChartYAxis).call(wt);Bt.selectAll(".tick").attr("class",t=>0===t?"tick "+Jt.barChartYAxisZeroTick:"tick"),T&&T(Bt);const{width:Et}=Gt(Bt),zt=[tt+Et+(m||0),rt-Q],Yt=o.scaleBand().domain(o.range(a.length)).range(zt);kt=(t=>{let{data:e,range:a,barWidth:r,barPadding:l,sectionPadding:n}=t;const o="number"==typeof n?n:0,i=a[1]-a[0],s=e.reduce((t,e)=>{let a=d(e,ae);return t+Object.keys(a).reduce((t,e,a)=>a>0?t+(r||0)+(l||0):t+r,0)+o},o);return i<s?Math.floor(r*(i/s)):r})({data:a,sectionPadding:R,range:zt,barWidth:kt,barPadding:s}),f&&f(Yt);const[Xt,Rt]=Yt.range(),It=o.axisBottom(Yt).tickFormat(t=>St[Number(t)]);"number"==typeof _&&It.tickValues(Yt.domain().filter((t,e,a)=>{const r=Math.round((Rt-Xt)/_);return!(e%Math.round(a.length/r))})).tickSizeOuter(0),v&&v(It,{node:t,labels:St});const Pt=st.append("g").call(It).attr("class",Jt.barChartXAxis);L&&L(Pt);const Dt=(t=>{let{data:e,yScale:a,xScale:r,barWidth:l,barPadding:n,colors:o,marginTop:i}=t;return e.map((t,e)=>{let{groupName:s}=t,c=d(t,te);const p=[],u=r.bandwidth(),h=Object.keys(c);return h.forEach((t,r)=>{const d=c[t],m=Object.keys(d),b=(l+n)*h.length-(m.length>1?n:0);let g=0,C=0;m.forEach(t=>{const c=d[t],h=o[t],m=(l+n)*r+u/2-b/2,x=c>0,f=x?Math.abs(100*(a(g-c)-a(g)+Number.EPSILON)/100):Math.abs(100*(a(C-c)-a(C)+Number.EPSILON)/100);x&&(g+=c);const y=x?100*(a(g)+Number.EPSILON)/100:a(C)-a(0)+a(0);p.push({x:m,y:y+(i||0),height:f,color:h,value:c,groupName:s,name:t,stackIndex:r,groupIndex:e}),x||(C+=c)})}),p})})({data:a,yScale:Mt,xScale:Yt,barWidth:kt,barPadding:"number"==typeof s?s:0,colors:p,marginTop:K}),Ft=D?D(Dt):Dt;Bt.attr("transform","translate( "+(tt+Et)+", 0)"),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,drawGridX:n,drawGridY:o}=t;if(!o&&!n)return;const i=e.append("g").attr("class",Jt.barChartGridGlobal),s=a.ticks(l),c=r.range(),d=r.domain();if(n&&i.append("g").selectAll("line").data(s).join("line").attr("class",t=>0===t?Jt.barChartGridLineX+" "+Jt.barChartGridLineXZero:Jt.barChartGridLineX).attr("x1",()=>c[0]).attr("x2",()=>c[1]).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),o){const t=t=>void 0!==d[t]?0===t?c[0]:Math.round(r.step()*t+c[0]-r.step()/2*r.padding()):c[1];i.append("g").selectAll("line").data(Array.from({length:d.length+1},(t,e)=>e)).join("line").attr("class",t=>0===t?Jt.barChartGridLineY+" "+Jt.barChartGridLineYZero:Jt.barChartGridLineY).attr("x1",t).attr("x2",t).attr("y1",()=>Math.round(a(s[0]))).attr("y2",()=>Math.round(a(s[s.length-1])))}})({svg:st,yScale:Mt,xScale:Yt,yTicksCount:Nt,drawGridY:g,drawGridX:C}),Pt.attr("transform","translate(0, "+(Mt(At[0])+(h||0))+")");const Ot=st.append("g").attr("class",Jt.barChartBarGlobal).selectAll("g").data(Ft).enter().append("g").attr("transform",(t,e)=>"translate("+Math.round(Yt(e))+","+-(K||0)+")"),Vt=W?W({groups:Ot,yScale:Mt,marshalledData:Ft,barWidth:kt}):(t=>{let{groups:e,barWidth:a}=t;return e.selectAll("rect").data(t=>t).join("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",a).attr("height",t=>t.height).style("fill",t=>t.color)})({groups:Ot,barWidth:kt});let jt=null;Array.isArray(r)&&r.length>0&&(jt=(t=>{let{svg:e,lineData:a,min:r,yScale:l,xScale:n,curve:i,stackedLine:s}=t,c=null,d=null,p=null;const u=o.line().defined(t=>null!==t).x((t,e)=>n(e)+h/2).y(t=>l(t)).curve(i||o.curveLinear),h=n.bandwidth(),m=a.filter(t=>{let{lineType:e}=t;return"line"===e}),b=a.filter(t=>{let{lineType:e}=t;return"area"===e});if(m.length>0&&(c=e.append("g").attr("class",Ut.barChartLinesGlobal).selectAll("path").data(m).join("path").attr("class",Ut.barChartLine).attr("d",t=>u(t.values)).attr("stroke",t=>{let{stroke:e}=t;return e||""}).attr("fill",t=>{let{fill:e}=t;return e||"none"})),b.length>0){let t=-2;p=o.area().x((t,e)=>n(e)+h/2).y0((e,n)=>(0===n&&(t+=1),l(s&&t>-1?"number"!=typeof a[t].values[n]?0:a[t].values[n]:r))).y1(t=>l(t)).curve(i||o.curveLinear),d=e.append("g").attr("class",Ut.barChartAreasGlobal).selectAll("path").data(b).join("path").attr("class",Ut.barChartArea).attr("d",t=>p&&p(t.values)).attr("fill",t=>{let{fill:e}=t;return e||"none"})}return{areasSelection:d,linesSelection:c,area:p}})({svg:st,lineData:r,xScale:Yt,yScale:Mt,min:"number"==typeof I?I:ot,stackedLine:G,curve:z})),S&&S({bars:Vt,yScale:Mt,lines:jt,marshalledData:Ft,lineData:r}),(M||w)&&(t=>{let{svg:e,node:a,data:r,marshalledData:l,xScale:s,yScale:p,renderTooltip:u,labelPosition:h,marginTop:m,renderLabel:b,barWidth:g,barPadding:C,dynamicTooltipEnable:x,tooltipY:f,tooltipBind:y,lineData:v,formatTooltipValue:T,formatTooltipName:L,tooltipYDomain:S,setTooltipPosition:k,onLabelItem:M,isBarTooltip:A,bars:w,tooltipRoot:N,tooltipClassName:B}=t;o.select(a).select("."+Jt.barChartMouseContainer).remove();const E=s.domain(),[G,z]=s.range(),[Y,X]=p.range(),R=s.bandwidth(),I=o.format(","),P=E.map(t=>{return e=Number(t)+1,void 0!==E[e]?0===e?G:Math.round(s.step()*e+G-s.step()/2*s.padding()):z;var e}),D=S?S({data:l,lineData:v,yScale:p}):l.reduce((t,e,a)=>{const r=o.min(v,t=>{let{values:e}=t;return"number"==typeof e[a]?p((e[a]||0)-X):Number.POSITIVE_INFINITY})||Number.POSITIVE_INFINITY;return t.push(e.reduce((t,e)=>{let{y:a}=e;return Math.min(t,a,r)},Number.POSITIVE_INFINITY)),t},[]),F=e.append("g").attr("class","lineChartMouseGlobal").append("rect").attr("width",z-G).attr("height",Math.abs(Y-X)).attr("class",Jt.barChartMouseRect).attr("transform","translate("+G+", "+X+")");if(x){const t=N||document.querySelector("body");let p=o.select("."+Jt.barChartMouseTooltip);0===p.size()&&(p=o.select(t).append("div").attr("class",Jt.barChartMouseTooltip).style("opacity","0").style("position","absolute").html(()=>i.renderToString(n.createElement(ct,{className:Jt.barChartTooltipFlex}))));const h=p.select("."+Jt.barChartTooltipFlex);let m=!1,b=null;const C=t=>{m=Boolean(t),p.style("opacity",m?"1":"0"),m?(p.attr("class",Jt.barChartMouseTooltip+" "+(B||"")),p.style("transition",null)):(p.attr("class",Jt.barChartMouseTooltip),b=null,p.style("transition","none"),p.style("top",null),p.style("left",null))};F.on("mouseout.tooltip",()=>C()),F.on("touchmove.tooltip mousemove.tooltip",t=>{const[x,S]=o.pointer(t,document),[M]=o.pointer(t,F),[N,B]=o.pointer(t,a),E=M-(M-N),G=x-N,z=S-B,Y=P.findIndex(t=>E<=t);if(A){const e=document.elementsFromPoint(t.clientX,t.clientY),a=o.select(w.nodes()[Y]).selectAll("rect").nodes();if(!e.some(t=>a.includes(t)))return m&&C(!1),void F.style("cursor","default");F.style("cursor","pointer")}const O=("number"==typeof f?f:D[Y]-X)+z,V=(y?(s(Y)||0)+R/2:E)+G;if(y&&b===Y)return;let j=l[Y];if(Array.isArray(j)&&0===j.length)return;if(v){const t=v.map(t=>{let{values:e}=t;return c({},d(t,ee),{value:e[Y],groupName:r[Y]&&r[Y].groupName})});Array.isArray(t)&&Array.isArray(j)&&(j=j.concat(t))}const W=e.node().getBoundingClientRect().width;"function"==typeof k?k({left:V,top:O,tooltip:p,svgWidth:W}):k||p.style("left",V+"px").style("top",O+"px"),u?h.html(()=>i.renderToString(n.createElement(n.Fragment,null,u(j,k?{left:V,top:O,tooltip:p,svgWidth:W}:void 0,g)))):(m||C(!0),h.html(()=>i.renderToString(n.createElement(ut,{className:Jt.barChartTooltip},j&&j[0]&&n.createElement(ht,{className:Jt.barChartTooltipGroupName},j[0].groupName),j&&j.map(t=>{let{name:e,value:a,stroke:r,fill:l,color:o,lineType:i}=t;return n.createElement(mt,{key:e,className:Jt.barChartTooltipItem},n.createElement(bt,{className:Jt.barChartTooltipColFlex},i?n.createElement(Ct,{className:Jt.barChartColorLine,style:{backgroundColor:r||l}}):n.createElement(gt,{className:Jt.barChartColorBox,style:{backgroundColor:o}}),n.createElement(xt,{className:Jt.barChartTooltipName},L?L(e):e)),n.createElement(ft,{className:Jt.barChartTooltipValue},T?T(a):I(a)))}))))),b=Y,m||C(!0)})}const O=o.select(a).append("div").attr("class",Jt.barChartMouseContainer).append("div").attr("class",Jt.barChartLabelContainer).style("position","absolute").style("top",X+"px");if(h){const t=v?l.map((t,e)=>t.concat(v.map(a=>{let{values:r,name:l,stroke:n}=a;const{stacksCount:o}=t.reduce((t,e)=>{let{stackIndex:a}=e;const{indexFlag:r,stacksCount:l}=t;return a!==r?{indexFlag:a,stacksCount:l+1}:t},{indexFlag:-1,stacksCount:0});return{x:t[0].x-g/2+(g*o+(C||0)*(o-1))/2,y:p(r[e])+m,height:0,color:n,value:r[e],groupName:t[0].groupName,name:l,stackIndex:0,groupIndex:e}}))):l,e=O.selectAll("div").data(t).enter().append("div").style("position","absolute").style("transform",(t,e)=>"translate("+Math.round(s(e))+"px,"+-(m||0)+"px)"),a="center"===h?pt:dt,r=(t=>{switch(t){case"top":return vt;case"bottom":return Tt;default:return yt}})(h);e.selectAll("span").data(t=>M?M(t):t).join("div").style("left",t=>Math.round(t.x+g/2)+"px").style("top",t=>((t,e,a)=>{switch(t){case"center":return a.y+a.height/2-e;case"bottom":return a.y+a.height-e;default:return a.y}})(h,X,t)+"px").style("position","absolute").html(t=>i.renderToString(n.createElement(a,{className:Jt.barChartLabelFlex},b?b(c({},t,{barWidth:g})):n.createElement(r,{className:Jt.barChartLabel},I(t.value)))))}})({svg:st,node:t,xScale:Yt,yScale:Mt,marshalledData:Ft,data:a,lineData:r,renderTooltip:A,labelPosition:w,marginTop:K,renderLabel:N,barWidth:kt,barPadding:s,dynamicTooltipEnable:M,tooltipY:B,tooltipBind:E,formatTooltipValue:Y,formatTooltipName:X,tooltipYDomain:P,setTooltipPosition:q,onLabelItem:Z,isBarTooltip:U,bars:Ot,tooltipRoot:H,tooltipClassName:J}),k&&k({svg:st,marshalledData:Ft,yScale:Mt,xScale:Yt,lineData:r})}},le=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&re(i,t)},[i,t]),m(t.width,()=>re(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Qt,null),n.createElement(Kt,{ref:o},r))};le.defaultProps={data:[],colors:{},margin:{top:10,right:10,bottom:10,left:0},barWidth:12,barPadding:0,height:320,yAxisPadding:0,xAxisPadding:0,tooltipBind:!0,sectionPadding:1};const ne=["value"];var oe,ie,se,ce,de,pe,ue,he;const me={horizontalBarChartButtonTd:"horizontalBarChartButtonTd",horizontalBarChartLabelTd:"horizontalBarChartLabelTd",horizontalBarChartLabelCell:"horizontalBarChartLabelCell",horizontalBarChartBarTd:"horizontalBarChartBarTd",horizontalBarChartBarFlex:"horizontalBarChartBarFlex",horizontalBarChartBar:"horizontalBarChartBar",horizontalBarChartBarFirst:"horizontalBarChartBarFirst",horizontalBarChartBarLast:"horizontalBarChartBarLast",horizontalBarChartBarOnly:"horizontalBarChartBarOnly",horizontalBarChartTooltipFlex:"horizontalBarChartTooltipFlex",horizontalBarChartStackWrapper:"horizontalBarChartStackWrapper",horizontalBarChartTooltipContainer:"horizontalBarChartTooltipContainer",horizontalBarChartStackSumContainer:"horizontalBarChartStackSumContainer",horizontalBarChartStackSum:"horizontalBarChartStackSum",horizontalBarChartXScaleTd:"horizontalBarChartXScaleTd",horizontalBarChartXScaleTicks:"horizontalBarChartXScaleTicks",horizontalBarChartXScaleTick:"horizontalBarChartXScaleTick",horizontalBarChartTooltipItem:"horizontalBarChartTooltipItem",horizontalBarChartTooltipName:"horizontalBarChartTooltipName",horizontalBarChartTooltipValue:"horizontalBarChartTooltipValue"},be=r.table(oe||(oe=p(["\n width: 100%;\n"]))),ge=r.div(ie||(ie=p(["\n text-align: right;\n"]))),Ce=r.div(se||(se=p(["\n width: 100%;\n display: flex;\n height: 1rem;\n"]))),xe=r.td(ce||(ce=p(["\n width: 100%;\n position: relative;\n vertical-align: middle;\n"]))),fe=r(ct)(de||(de=p(["\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n will-change: left, top;\n"]))),ye=r.div(pe||(pe=p(["\n position: relative;\n"]))),ve=r.div(ue||(ue=p(["\n white-space: nowrap;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(0, -50%);\n"]))),Te=r.div(he||(he=p(["\n position: absolute;\n top: 0;\n display: flex;\n justify-content: flex-start;\n height: 100%;\n"]))),Le=t=>{let{renderTooltip:e,bars:a,style:r,className:l}=t;const i=o.format(",");return n.createElement(fe,{className:me.horizontalBarChartTooltipFlex+" "+(l||""),style:r},n.createElement(ut,{className:me.horizontalBarChartTooltipContainer},e?e(a):a.map((t,e)=>{let{color:a,name:r,value:l,groupName:o}=t;return n.createElement(mt,{key:(r||"")+"-"+e+"-"+o,className:me.horizontalBarChartTooltipItem},a&&n.createElement(gt,{style:{backgroundColor:a}}),r&&n.createElement(xt,{className:me.horizontalBarChartTooltipName},r),n.createElement(ft,{className:me.horizontalBarChartTooltipValue},i(l)))})))},Se=document.createElement("div"),ke=["item","mouseMove","mouseLeave","tooltipBind"];var Me;const Ae=r.div(Me||(Me=p(["\n position: relative;\n display: inline-flex;\n height: 100%;\n"]))),we=t=>{let{withTooltip:e,bar:a,formatNativeTitle:r,tooltipBind:l,mouseMove:o,mouseLeave:i,pointerEventsNone:s,isFirstChild:c,isLastChild:d,isOnlyChild:p}=t;const{color:u,width:h}=a,m=Math.abs(h),b=e?t=>o(t,[a]):void 0,g=e?()=>i():void 0;return n.createElement(Ae,{className:me.horizontalBarChartBar+" "+(c?me.horizontalBarChartBarFirst:"")+" "+(d?me.horizontalBarChartBarLast:"")+" "+(p?me.horizontalBarChartBarOnly:""),style:{width:m+"%",backgroundColor:u,pointerEvents:s?"none":"auto"},title:r?r(a):"",onMouseOver:b,onMouseMove:l?b:void 0,onMouseOut:g})};var Ne,Be,Ee;const Ge=r.td(Ne||(Ne=p(["\n position: relative;\n"]))),ze=r.div(Be||(Be=p(["\n position: relative;\n height: 1rem;\n"]))),Ye=r.div(Ee||(Ee=p(["\n white-space: nowrap;\n width: 0;\n height: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n"]))),Xe=t=>{let{maxValue:e,scaleTicks:a,renderTicks:r,scaleDomain:i}=t;const s=(t=>{let{maxValue:e,scaleTicks:a,scaleDomain:r}=t;return l.useMemo(()=>{const t=o.scaleLinear().domain([0,e]).range([0,100]),l=t.ticks(a);return(r||l).map(e=>({value:e,x:t(e)}))},[e,a,r])})({maxValue:e,scaleTicks:a,scaleDomain:i}),c=o.format(",");return n.createElement("tr",null,n.createElement("td",null),n.createElement(Ge,{className:me.horizontalBarChartXScaleTd},n.createElement(ze,{className:me.horizontalBarChartXScaleTicks},s.map((t,e,a)=>{const{value:l,x:o}=t;return n.createElement(Ye,{key:l,className:me.horizontalBarChartXScaleTick,style:{left:o+"%",justifyContent:0===e?"flex-start":e===a.length-1?"flex-end":""}},r?r(t):c(l))}))))},Re=t=>{let{data:e,className:a,style:r,children:i,labels:p,fullExtent:u,maxValue:h,formatNativeTitle:m,renderTooltip:b,withTooltip:g,withStackSum:C,tooltipBind:x,scaleTicks:f,renderTicks:y,renderButton:v,tooltipStyle:T,tooltipClassName:L,scaleDomain:S,renderDataTable:k,thead:M,withoutXScale:A,stackedTooltip:w,fullChartTooltip:N,hideTooltip:B}=t;const{fullMax:E,data:G}=(t=>{let{data:e,fullExtent:a,maxValue:r,labels:n}=t;return l.useMemo(()=>{const t=o.max(e,t=>o.sum(t,t=>{let{value:e}=t;return e})),l=o.scaleLinear().domain([0,"number"==typeof r?r:t]).range([0,100]);return{fullMax:t,data:e.map((t,e)=>(a||l.domain([0,"number"==typeof r?r:o.sum(t,t=>{let{value:e}=t;return e})]),t.map(t=>{let{value:a}=t;return c({},d(t,ne),{value:a,width:l(a),groupName:n?n[e]:""})})))}},[e,a,r,n])})({data:e,fullExtent:u,maxValue:h,labels:p}),[z,Y]=(t=>{let{renderTooltip:e,tooltipBind:a,tooltipStyle:r,tooltipRoot:i,tooltipClassName:d,hideTooltip:p}=t;return l.useEffect(()=>{const t=i||document.querySelector("body");return t&&t.appendChild(Se),()=>{s.unmountComponentAtNode(Se)}},[i]),[l.useCallback((t,l)=>{let[i,p]=o.pointer(t,document);if(!a&&"getBoundingClientRect"in t.target){const{width:e,height:a}=t.target.getBoundingClientRect(),[r,l]=o.pointer(t,t.target);i=i-r+e/2,p=p-l+a/2}Se&&(Se.style.visibility="visible"),s.render(n.createElement(Le,{style:c({left:i,top:p},r),bars:l,renderTooltip:e,className:d}),Se)},[d,r,e,a]),l.useCallback(()=>{Se&&(Se.style.visibility="hidden",p&&p())},[p])]})({renderTooltip:b,tooltipBind:x,tooltipStyle:T,tooltipClassName:L,hideTooltip:B}),X=(t=>l.useMemo(()=>t?t=>{let{item:e,mouseMove:a,mouseLeave:r,tooltipBind:l}=t,o=d(t,ke);return n.createElement(Te,Object.assign({className:me.horizontalBarChartStackWrapper,onMouseOver:t=>a(t,e),onMouseMove:l?t=>a(t,e):void 0,onMouseOut:r},o))}:t=>{let{children:e}=t;return n.createElement(l.Fragment,null,e)},[t]))(w);return n.createElement(be,{className:a,style:r,onMouseOver:N?t=>z(t,G.flat()):void 0,onMouseMove:N?t=>z(t,G.flat()):void 0,onMouseOut:N?Y:void 0},M,n.createElement("tbody",null,G.map((t,e)=>{const a=(C||k)&&o.sum(t,t=>{let{value:e}=t;return e}),r=o.sum(t,t=>{let{width:e}=t;return e});return n.createElement("tr",{key:"row-"+e},"function"==typeof v&&n.createElement("td",{className:me.horizontalBarChartButtonTd},v(t,e)),n.createElement("td",{className:me.horizontalBarChartLabelTd},p&&p[e]&&n.createElement(ge,{className:me.horizontalBarChartLabelCell},p[e])),n.createElement(xe,{className:me.horizontalBarChartBarTd,style:{pointerEvents:N?"none":"auto"}},n.createElement(Ce,{className:me.horizontalBarChartBarFlex,style:{pointerEvents:N?"none":"auto"}},n.createElement(X,{style:w?{width:r+"%"}:void 0,item:t,tooltipBind:x,mouseMove:z,mouseLeave:Y}),t.map((t,e,a)=>0!==t.value&&n.createElement(we,{key:"bar-"+(t.name||"")+"-"+e,formatNativeTitle:m,bar:t,tooltipBind:x,pointerEventsNone:w||N,withTooltip:g&&!w,mouseMove:z,mouseLeave:Y,isOnlyChild:1===a.length,isFirstChild:0===e&&a.length>1,isLastChild:a.length-1===e&&a.length>1})),C&&n.createElement(ye,{className:me.horizontalBarChartStackSumContainer},n.createElement(ve,{className:me.horizontalBarChartStackSum},a)))),k&&k(t,a,e))}),!A&&n.createElement(Xe,{maxValue:"number"==typeof h?h:E,scaleTicks:f,renderTicks:y,scaleDomain:S}),i))};var Ie,Pe;Re.defaultProps={fullExtent:!0,withTooltip:!1,withStackSum:!1,tooltipBind:!1,scaleTicks:4,withoutXScale:!1};const De={bubbleChartYAxis:"bubbleChartYAxis",bubbleChartYAxisZeroTick:"bubbleChartYAxisZeroTick",bubbleChartXAxis:"bubbleChartXAxis",bubbleChartGridGlobal:"bubbleChartGridGlobal",bubbleChartGridLineX:"bubbleChartGridLineX",bubbleChartGridLineY:"bubbleChartGridLineY",bubbleChartCircle:"bubbleChartCircle",bubbleChartYScaleLabel:"bubbleChartYScaleLabel",bubbleChartTooltip:"bubbleChartTooltip",bubbleChartTooltipContainer:"bubbleChartTooltipContainer",bubbleChartTooltipFlex:"bubbleChartTooltipFlex",bubbleChartTip:"bubbleChartTip"},Fe=r(u)(Ie||(Ie=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n\n ."," {\n font-size: 10px;\n }\n"])),De.bubbleChartYAxis,De.bubbleChartXAxis,De.bubbleChartGridGlobal,De.bubbleChartGridLineX,De.bubbleChartGridLineY,De.bubbleChartYScaleLabel),Oe=a.createGlobalStyle(Pe||(Pe=p(["\n ."," {\n position: absolute;\n transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);\n pointer-events: none;\n z-index: 1;\n }\n"])),De.bubbleChartTooltipContainer);var Ve;const je=r.div(Ve||(Ve=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),We=(t,e)=>{const{data:a,margin:r,xAxisPadding:l,yAxisPadding:s,customYScale:c,customYAxis:d,customXScale:p,customXAxis:u,minSize:h,maxSize:m,minYValue:g,maxYValue:C,drawGridY:x,drawGridX:f,xScaleItemWidth:y,bubbleStyle:v,customize:T,yScaleLabel:L,yScaleLabelPadding:S,enableTooltip:k,tooltipRoot:M,tooltipClassName:A,renderTooltip:w}=e;if(null!==t&&a.length){const N=r?r.top:0,B=r?r.right:0,E=r?r.bottom:0,G=r?r.left:0,{width:z}=t.getBoundingClientRect(),Y=e.width||z,X=e.height||0,R=6,I="number"==typeof g?g:o.min(a,t=>{let{yValue:e}=t;return e}),P="number"==typeof C?C:o.max(a,t=>{let{yValue:e}=t;return e}),D=b(t,Y,X||0),F=o.scaleLinear().domain([o.min(a,t=>{let{sizeValue:e}=t;return e}),o.max(a,t=>{let{sizeValue:e}=t;return e})]).range([h||Ze.minSize,m||Ze.maxSize]),O=X-N-E-(l||0),V=o.scaleLinear().domain([I,P]).range([O,N]).nice();c&&c(V);const j=V.ticks(),W=o.axisLeft(V).ticks(R),q=W.tickArguments()[0],Z=D.append("g").attr("class",De.bubbleChartYAxis).call(W);let U=S||0;if(L){const t=D.append("text").text(L).attr("class",De.bubbleChartYScaleLabel),{width:e,height:a}=Gt(t);U+=a,t.attr("transform","rotate(-90) translate(-"+(O+E+e)/2+", "+a+")")}Z.selectAll(".tick").attr("class",t=>0===t?"tick "+De.bubbleChartYAxisZeroTick:"tick"),d&&d(Z);const{width:_}=Gt(Z),H=[G+_+(s||0)+U,Y-B],J=o.scaleLinear().domain([o.min(a,t=>{let{xValue:e}=t;return e}),o.max(a,t=>{let{xValue:e}=t;return e})]).range(H);p&&p(J);const K=o.axisBottom(J);if("number"==typeof y){const[t,e]=J.range();K.ticks(Math.round((e-t)/y)).tickSizeOuter(0)}const Q=D.append("g").call(K).attr("class",De.bubbleChartXAxis);u&&u(Q),Z.attr("transform","translate("+(G+_+U)+", 0)"),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,drawGridX:n,drawGridY:o}=t;if(!o&&!n)return;const[i,s]=r.domain(),c=e.append("g").attr("class",De.bubbleChartGridGlobal),d=a.ticks(l);n&&c.append("g").selectAll("line").data(d).join("line").attr("class",De.bubbleChartGridLineX).attr("x1",()=>r(i)).attr("x2",()=>r(s)).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),o&&c.append("g").selectAll("line").data(r.ticks(l)).join("line").attr("class",De.bubbleChartGridLineY).attr("x1",t=>Math.round(r(t))).attr("x2",t=>Math.round(r(t))).attr("y1",()=>Math.round(a(d[0]))).attr("y2",()=>Math.round(a(d[d.length-1])))})({svg:D,yScale:V,xScale:J,yTicksCount:q,drawGridY:x,drawGridX:f}),Q.attr("transform","translate(0, "+(V(j[0])+(l||0))+")");const $=D.append("g").selectAll("dot").data(a).enter().append("circle").attr("class",De.bubbleChartCircle).attr("cx",t=>{let{xValue:e}=t;return J(e)}).attr("cy",t=>{let{yValue:e}=t;return V(e)}).attr("r",t=>{let{sizeValue:e}=t;return F(e)/2}).attr("fill",t=>{let{color:e}=t;return e||"rgba(0, 176, 113, 0.6)"}).attr("stroke",t=>{let{stroke:e}=t;return e||"transparent"}).attr("style",t=>{let{style:e}=t;return e||v||""});k&&(t=>{let{bubbles:e,tooltipRoot:a,tooltipClassName:r,renderTooltip:l}=t;const s=a||document.querySelector("body"),c=o.format(",");let d=o.select(s).select("."+De.bubbleChartTooltip);null===d.node()&&(d=o.select(s).append("div").attr("class",De.bubbleChartTooltip));let p=d.append("div").attr("class",De.bubbleChartTooltipContainer+" "+(r||"")).style("opacity","0");e.on("mouseover.tooltip",(t,e)=>{const{sizeValue:a}=e,r=t.currentTarget,{x:o,y:s,width:d}=r.getBoundingClientRect(),u=window.pageXOffset+o+d/2,h=window.pageYOffset+s;p.style("left",u+"px").style("top",h+"px").html(()=>i.renderToString(n.createElement(je,{className:De.bubbleChartTooltipFlex},n.createElement(ut,{className:De.bubbleChartTip},c(a))))),l&&l({tooltip:p,data:e,circle:r}),p.style("opacity","1")}),e.on("mouseout.tooltip",()=>{p.style("opacity","0")})})({bubbles:$,tooltipRoot:M,tooltipClassName:A,renderTooltip:w}),T&&T({svg:D,bubbles:$,yScale:V,xScale:J,sizeScale:F})}},qe=t=>{const{className:e,style:a,children:r,tooltipRoot:i}=t,[s,c]=h();return l.useEffect(()=>{c&&We(c,t)},[c,t]),l.useEffect(()=>()=>(t=>{const e=t||document.querySelector("body");o.select(e).select("."+De.bubbleChartTooltip).remove()})(i),[i]),m(t.width,()=>We(c,t)),n.createElement("div",{className:e,style:a},n.createElement(Oe,null),n.createElement(Fe,{ref:s},r))},Ze={height:280,minSize:6,maxSize:30,margin:{top:10,right:15,bottom:10,left:0},yAxisPadding:10,xAxisPadding:10,yScaleLabelPadding:10};qe.defaultProps=Ze,exports.BarChart=le,exports.BubbleChart=qe,exports.CalendarChart=Et,exports.ChartWrapper=u,exports.HorizontalBarChart=Re,exports.LineChart=Zt,exports.PieChart=St,exports.RadarChart=V,exports.SwipeScroll=T,exports.appendSvg=b,exports.barChartClassNames=Jt,exports.bubbleChartClassNames=De,exports.calendarChartClassNames=Nt,exports.horizontalBarChartClassNames=me,exports.lineChartClassNames=It,exports.pieChartclassNames=q,exports.radarChartclassNames=D,exports.useNode=h,exports.useResize=m; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("styled-components"),r=t(a),l=require("react"),n=t(l),o=require("d3"),i=t(require("react-dom/server")),s=require("react-dom");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t}).apply(this,arguments)}function d(t,e){if(null==t)return{};var a,r,l={},n=Object.keys(t);for(r=0;r<n.length;r++)e.indexOf(a=n[r])>=0||(l[a]=t[a]);return l}function p(t,e){return e||(e=t.slice(0)),t.raw=e,t}const u=r.div(e||(e=p(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n"])));function h(){const[t,e]=l.useState(null);return[l.useCallback(e,[e]),t]}const m=(t,e,a)=>{const r=l.useMemo(()=>e?function(t,e){let a=!1;return function(){a||(t(...arguments),a=!0,setTimeout((function(){a=!1}),e))}}(e,a||44):void 0,[e,a]);l.useEffect(()=>(r&&"number"!=typeof t&&window.addEventListener("resize",r),()=>r&&window.removeEventListener("resize",r)),[t,r])},b=(t,e,a)=>(o.select(t).select("svg").remove(),o.select(t).append("svg").attr("width",e).attr("height",a));var g;const C=r.div(g||(g=p(["\n width: 100%;\n overflow: hidden;\n user-select: none;\n"]))),x=t=>t*(2-t),f=(t,e,a)=>Math.min(Math.max(t,e),a),y={animation:0,speed:0,timestamp:0,startX:0,currentX:0},v=["children","width","onSwipe"],T=t=>{let{children:e,width:a,onSwipe:r}=t,i=d(t,v);const[s,p]=h();return((t,e)=>{let{width:a,duration:r,animationFunc:n,onSwipe:i}=e;const s=o.select(t),c=o.select("body"),d=o.select(document),p=l.useRef(y);l.useEffect(()=>{a&&p.current.animation&&(cancelAnimationFrame(p.current.animation),p.current=y)},[a]);const u=l.useCallback(e=>{const{width:r}=t?t.getBoundingClientRect():{width:0},[l]=o.pointer(e.type.includes("touch")?e.touches[0]:e),n=f(l-p.current.startX,-(a-r),0);if(s.style("transform","translateX("+n+"px)"),p.current.currentX){const t=100,e=Date.now(),a=Math.round((n-p.current.currentX)/(e-p.current.timestamp)*t);p.current.speed=a,p.current.timestamp=e}p.current.currentX=n,i&&i(n,s)},[i,a,t,s]),h=l.useCallback(()=>{const{width:e}=t?t.getBoundingClientRect():{width:0};d.on("mousemove.swipe touchmove.swipe mouseup.swipe touchend.swipe",null),c.style("cursor",null),s.style("cursor",a>e?"grab":null),Date.now()-p.current.timestamp<44&&function(t){let{duration:e,timing:a,draw:r}=t;const l=performance.now();let n;requestAnimationFrame((function t(o){let i=(o-l)/e;i<1&&(n=requestAnimationFrame(t)),i>1&&cancelAnimationFrame(n);const s=a(i);r(s,n)}))}({duration:r,timing:n||x,draw:(t,r)=>{p.current.animation=r;const l=Math.round(2*p.current.speed*t),n=p.current.currentX+l,o=a-e,c=f(n,-o,0),d=Math.max(Math.min(n,o),0);p.current.currentX!==d&&(s.style("transform","translateX("+c+"px)"),i&&i(c,s))}})},[c,n,i,s,r,t,a,d]),m=l.useCallback(e=>{const a=e.type.includes("touch"),[r]=o.pointer(a?e.touches[0]:e,t),{left:l}=t&&t.parentElement?t.parentElement.getBoundingClientRect():{left:0};c.style("cursor","grabbing"),s.style("cursor","grabbing"),p.current.animation&&(cancelAnimationFrame(p.current.animation),p.current=y),p.current.startX=Math.max(r+l,0),d.on("mousemove.swipe touchmove.swipe",u),d.on("mouseup.swipe touchend.swipe",h)},[s,c,t,h,u,d]);l.useEffect(()=>{if(t){const{width:e}=t.getBoundingClientRect();a>e&&(s.style("cursor","grab"),s.on("mousedown.swipe touchstart.swipe",m))}},[s,m,t,a])})(p,c({width:a,onSwipe:r},i)),n.createElement(C,Object.assign({},i),n.createElement("div",{ref:s},e))};var L;T.defaultProps={duration:1400};const S=t=>{let{anchor:e,index:a,translateX:r,translateY:l}=t;return 0===a&&"middle"===e?"translate(calc(-50% + "+r+"px), calc(-100% + "+l+"px))":"middle"===e?"translate(calc(-50% + "+r+"px), calc("+l+"px))":"start"===e?"translate(calc("+r+"px), calc(-50% + "+l+"px))":"end"===e?"translate(calc(-100% + "+r+"px), calc(-50% + "+l+"px))":"translate("+r+"px, "+l+"px)"},k=r.div.attrs(t=>({style:{transform:S(t)}}))(L||(L=p(["\n position: absolute;\n"])));var M,A,w,N,B,E;const G=r.div(M||(M=p(["\n display: flex;\n align-items: center;\n font-size: 12px;\n"]))),z=r.div(A||(A=p(["\n text-align: center;\n max-width: 120px;\n"]))),Y=a.css(w||(w=p(["\n position: absolute;\n top: 50%;\n right: 0;\n transform: translate(calc(100% + 6px), -50%);\n"]))),X=r.div(N||(N=p(["\n display: flex;\n align-items: center;\n padding: 2px 4px;\n border-radius: 4px;\n color: rgb(255, 255, 255);\n background-color: rgb(144, 197, 61);\n margin-left: 8px;\n"]))),R=r(X)(B||(B=p(["\n ","\n"])),Y),I=r.div(E||(E=p(["\n margin-left: 4px;\n font-size: 10px;\n color: rgba(255, 255, 255, 0.54);\n"])));var P;const D={radar:"radar",radarAxis:"radarAxis",radarAxisTextGlobal:"radarAxisTextGlobal",radarAxisText:"radarAxisText",radarPolygon:"radarPolygon",radarLabel:"radarLabel",radarLabelName:"radarLabelName",radarLabelBadge:"radarLabelBadge",radarLabelBadgePrefix:"radarLabelBadgePrefix",radarCircle:"radarCircle"},F=r(u)(P||(P=p(["\n ."," {\n path,\n line,\n circle {\n fill: none;\n stroke-width: 1px;\n stroke: rgba(149, 149, 149, 0.18);\n }\n }\n ."," {\n font-size: 12px;\n fill-opacity: 0.56;\n }\n ."," {\n fill-opacity: 0.06;\n stroke-width: 2px;\n fill: rgb(144, 197, 61);\n stroke: rgb(144, 197, 61);\n }\n ."," {\n fill: rgb(144, 197, 61);\n }\n"])),D.radarAxis,D.radarAxisText,D.radarPolygon,D.radarCircle),O=(t,e)=>{const{data:a,curve:r,polar:l,formatValue:s,badgePrefix:d,labelOffset:p,circleRadius:u,svgElements:h,renderLabel:m,customize:g,formatAxisValue:C,radarStyles:x,labelIndex:f,selectLabel:y}=e;if(null!==t&&a.length){const v=10,T="number"==typeof e.bleedLength?e.bleedLength:v,{width:L}=t.getBoundingClientRect(),S=e.width||L,M=400,A=e.height||M,w=e.minValue||Math.min(0,o.min(a,t=>o.min(t.map(t=>{let{value:e}=t;return e})))),N=(e.maxValue||Math.max(0,o.max(a,t=>o.max(t.map(t=>{let{value:e}=t;return e})))))-w,B=e.paddingY||0,E=Math.min((S-2*(e.paddingX||0)-2*T)/2,(A-2*B-2*T)/2),Y=4,P=o.scaleLinear().domain([0,N||1]).range([]).ticks(e.levels||Y),F=P[P.length-1],O=F+(P[1]-P[0]);F<N&&P.push(O);const V=e.levels||P.length-1,j=P[P.length-1],W=2*Math.PI/a[0].length,q=o.scaleLinear().range([0,E]).domain([0,j]),Z=o.lineRadial().curve(o.curveLinearClosed).radius(t=>{let{value:e}=t;return q(e)}).angle((t,e)=>e*W),U=o.lineRadial().curve(r||o.curveLinearClosed).radius(t=>{let{value:e}=t;return q(e)}).angle((t,e)=>e*W),_=b(t,S,A),H=_.append("g"),J=o.range(1,V+1).reverse(),K=t=>-t*E/V,Q=t=>j*t/V,$=H.append("g").attr("class",D.radarAxis).selectAll().data([a[0]]).enter(),tt=H.append("g").attr("class",D.radar),et=$.selectAll().data(a[0].map(t=>{let{name:e}=t;return e})).enter();let at=0;l?J.forEach(t=>{const e=$.append("circle").attr("cx",0).attr("cy",0).attr("r",()=>E/V*t).node().getBoundingClientRect().height;at=Math.max(at,e)}):J.map(Q).forEach(t=>{const e=$.append("path").attr("d",()=>Z(Array.from({length:a[0].length},()=>({value:t})))).node().getBoundingClientRect().height;at=Math.max(at,e)});const rt=q(j)+T;et.append("line").attr("x1",0).attr("y1",0).attr("x2",(t,e)=>Math.round(rt*Math.cos(W*e-Math.PI/2))).attr("y2",(t,e)=>Math.round(rt*Math.sin(W*e-Math.PI/2))),tt.selectAll("path").data(a).join("path").attr("class",D.radarPolygon).attr("style",(t,e)=>(null==x?void 0:x[e])||"").attr("d",t=>U(t.map(t=>c({},t,{value:t.value-w}))));const lt=o.format(",");H.append("g").attr("class",D.radarAxisTextGlobal).selectAll("text").data(J).enter().append("text").attr("class",D.radarAxisText).attr("x","4").attr("y",K).attr("dy",0).attr("dominant-baseline","central").text((t,e)=>{const a=Q(t)+w;return C?C(a,e):lt(a)}),u&&a.forEach(t=>{const e=H.append("g").attr("class",D.radarCircle);t.forEach((t,a)=>{let{value:r}=t;e.append("circle").attr("cx",Math.round(q(r)*Math.cos(W*a-Math.PI/2))).attr("cy",Math.round(q(r*Math.sin(W*a-Math.PI/2)))).attr("r",u)})});const nt=8,ot=A-T-B,it=S/2,st=ot/2+(ot-at)/2,ct=T+(p||nt);if(H.attr("transform","translate("+it+","+st+")"),(t=>{let{node:e,dataLength:a,radiusScale:r,maxValue:l,angleSlice:s,radius:c,xOffset:d,yOffset:p,translateX:u,translateY:h,renderLabel:m,selectLabel:b}=t;const g=o.select(e);g.selectAll(".d3-chart-label").remove();const C=t=>l/c*t,x=t=>r((l+C(p||0))*Math.sin(s*t-Math.PI/2));Array.from({length:a},(t,e)=>{return{x:Math.ceil((a=e,r(l+C(d||0))*Math.cos(s*a-Math.PI/2))),y:Math.ceil(x(e))};var a}).forEach((t,e)=>{let{x:r,y:l}=t;const o=((t,e)=>{const a=((t,e)=>360/e*t)(t,e),r=180;return[0,r].includes(a)?"middle":a<r?"start":"end"})(e,a),s=i.renderToString(n.createElement(k,{anchor:o,translateX:u||0,translateY:h||0,index:e,style:{left:r,top:l}},"function"==typeof m?m(o,e):m)),c=g.append("div").attr("class","d3-chart-label").html(s);b(c,o,e)})})({node:t,maxValue:j,translateX:it,translateY:st,dataLength:a[f||0].length,angleSlice:W,radius:E,radiusScale:q,xOffset:ct,yOffset:ct,renderLabel:(t,e)=>{const r=a.map(t=>t[e]),l="middle"===t?R:X,o=a[f||0][e],{name:i,value:c}=o;return m?m({item:o,items:r,anchor:t,index:e}):n.createElement(G,{className:D.radarLabel},n.createElement(z,{className:D.radarLabelName},i),n.createElement(l,{className:D.radarLabelBadge},s?s(c,e):lt(c),d&&n.createElement(I,{className:D.radarLabelBadgePrefix},d)))},selectLabel:(t,e,r)=>{if(y){const l=a.map(t=>t[r]);y(t,{index:r,item:a[f||0][r],items:l,anchor:e})}}}),h){const t=i.renderToString(h);_.append("g").html(t)}g&&g(_)}},V=t=>{const{className:e,style:a}=t,[r,o]=h();return l.useEffect(()=>{o&&O(o,t)},[o,t]),m(t.width,()=>O(o,t)),n.createElement("div",{className:e,style:a},n.createElement(F,{ref:r}))};function j(t){return t*(Math.PI/180)}var W;V.defaultProps={height:400,data:[],curve:o.curveLinearClosed};const q={pieGlobal:"pieGlobal",pieSlice:"pieSlice",pieSliceLabel:"pieSliceLabel",pieSliceLabelValue:"pieSliceLabelValue",pieSliceLabelName:"pieSliceLabelName",pieRadialLabel:"pieRadialLabel",pieRadialLink:"pieRadialLink",pieTooltipContainer:"pieTooltipContainer",pieTooltipFlex:"pieTooltipFlex",pieTooltip:"pieTooltip",pieTooltipItem:"pieTooltipItem",pieTooltipName:"pieTooltipName",pieTooltipValue:"pieTooltipValue",pieTooltipColorBox:"pieTooltipColorBox",pieFullChartTooltipCircle:"pieFullChartTooltipCircle"},Z=r(u)(W||(W=p(["\n ."," {\n fill: #4a4a4a;\n }\n ."," {\n position: absolute;\n max-width: 128px;\n }\n ."," {\n stroke: #000;\n }\n ."," {\n fill: transparent;\n cursor: pointer;\n }\n"])),q.pieSliceLabel,q.pieRadialLabel,q.pieRadialLink,q.pieFullChartTooltipCircle),U=t=>t.startAngle+(t.endAngle-t.startAngle)/2<Math.PI?1:-1,_=t=>t.startAngle+(t.endAngle-t.startAngle)/2<Math.PI?"start":"end";var H,J,K,Q,$,tt,et,at,rt,lt,nt,ot,it,st;const ct=r.div(H||(H=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n pointer-events: none;\n white-space: nowrap;\n"]))),dt=r(ct)(J||(J=p([""]))),pt=r(dt)(K||(K=p(["\n align-items: center;\n"]))),ut=r.div(Q||(Q=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n margin-bottom: 8px;\n padding: 4px 6px;\n background-color: rgba(48, 69, 79, 1);\n border-radius: 4px;\n box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);\n :before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 100%);\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 4px 3px 0 3px;\n border-color: rgba(48, 69, 79, 1) transparent transparent transparent;\n }\n"]))),ht=r.div($||($=p(["\n font-size: 14px;\n margin-bottom: 6px;\n"]))),mt=r.div(tt||(tt=p(["\n display: flex;\n align-items: center;\n margin-bottom: 0.25rem;\n &:last-of-type {\n margin-bottom: 0;\n }\n"]))),bt=r.div(et||(et=p(["\n display: flex;\n align-items: center;\n margin-right: 4px;\n"]))),gt=r.div(at||(at=p(["\n margin-right: 4px;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n"]))),Ct=r(gt)(rt||(rt=p(["\n height: 2px;\n border-radius: 0;\n"]))),xt=r.div(lt||(lt=p(["\n margin-right: 4px;\n"]))),ft=r.div(nt||(nt=p(["\n text-align: right;\n flex-shrink: 0;\n flex-grow: 1;\n"]))),yt=r.div(ot||(ot=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n font-weight: bold;\n letter-spacing: 0.52px;\n"]))),vt=r(yt)(it||(it=p(["\n top: 6px;\n"]))),Tt=r(yt)(st||(st=p(["\n bottom: 6px;\n"]))),Lt=(t,e)=>{const{data:a,padAngle:r,onClick:l,outerRadius:s,startAngle:c,endAngle:d,cornerRadius:p,margin:u,enableSlicesLabels:h,formatSliceLabel:m,slicesLabelsSkipAngle:g,enableSlicesLabelsName:C,formatSliceLabelName:x,borderWidth:f,borderColor:y,enableRadialLabels:v,backgroundColor:T,radialLabelsLinkHorizontalLength:L,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:M,svgElements:A,formatSliceTitle:w,radialAngleXOffset:N,withTooltip:B,fullChartTooltip:E,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,tooltipStyle:X}=e;if(null!==t&&a.length){const R=u?u.top:0,I=u?u.right:0,P=u?u.bottom:0,D=u?u.left:0,{width:F}=t.getBoundingClientRect(),O=e.width||F,V=240,W=e.height||V,Z=(Math.min(O,W)-2*(f||0)-(O>W?R+P:I+D))/2,H=b(t,O,W),J=H.append("g").attr("class",q.pieGlobal).attr("transform","translate("+((O-(D+I))/2+D)+","+((W-(P+R))/2+R)+")"),K=45,Q=100,$=360,tt=o.pie().startAngle(-j(c||0)).endAngle(j(d||$)).padAngle(r?Math.max(Math.min(r/Q,K),0):0).sort(null).value(t=>{let{value:e}=t;return e})(a),et=.95,at=o.arc().cornerRadius(p||0).innerRadius(Z).outerRadius(Z*Math.min(Math.max(s||0,0),et));"string"==typeof T&&J.append("path").attr("fill",T).attr("d",()=>at({startAngle:j(0),endAngle:j($)}));const rt=o.format(","),lt=J.selectAll("allSlices").data(tt).enter().append("path").attr("d",at);if(lt.attr("class",q.pieSlice).attr("fill",t=>{let{index:e}=t;return a[e].color||""}).attr("stroke",y||"").attr("stroke-width",f||0).attr("style",l?"cursor: pointer":"").on("click",(t,e)=>l&&l(a[e.index])).append("svg:title").text(t=>w?w(t):E||B?"":(a[t.index].name||"")+" ("+rt(a[t.index].value)+")"),h){const t=J.selectAll("allSlices").data(tt).enter().append("text").attr("class",q.pieSliceLabel).attr("text-anchor","middle").attr("dominant-baseline","central").attr("transform",t=>"translate("+at.centroid(t)+")");t.append("tspan").attr("class",q.pieSliceLabelValue).text(t=>{const e=180*(t.endAngle-t.startAngle)/Math.PI;if(!g||e>g)return m?m(t):t.value}),C&&t.append("tspan").attr("class",q.pieSliceLabelName).text(t=>x?x(t):t.data.name).attr("x","0").attr("dy","1.2em")}if((t=>{let{arc:e,enableRadialLabels:a,global:r,node:l,radius:n,dataReady:s,radialLabelsLinkHorizontalLength:c,formatRadialLabel:d,radialLabelsTextXOffset:p,translateX:u,translateY:h,radialLabelYOffset:m,radialAngleXOffset:b}=t;const g=o.select(l);if(g.selectAll("."+q.pieRadialLabel).remove(),a){const t=4,a=o.arc().innerRadius(n).outerRadius(n);r.selectAll("allPolylines").data(s).enter().append("polyline").attr("class",q.pieRadialLink).style("fill","none").attr("points",r=>{const l=U(r),o=e.centroid(r),i=a.centroid(r),s=a.centroid(r),d=[(n+(c||t))*l,s[1]];return[[o[0],o[1]],[i[0]+(b||0)*l,i[1]-(m||0)*r.index],[d[0],d[1]-(m||0)*r.index]]});const l=e=>{const r=a.centroid(e);return[(n+(c||t))*U(e),r[1]]},C=4;g.selectAll("allLabels").data(s).enter().append("div").html(t=>i.renderToString(d?d(t):t.data.name)).attr("class",q.pieRadialLabel).style("transform",t=>(t=>{let{anchor:e,index:a,translateX:r,translateY:l}=t;return 0===a&&"middle"===e?"translate(calc(-50% + "+r+"px), calc(-100% + "+l+"px))":"middle"===e?"translate(calc(-50% + "+r+"px), calc("+l+"px))":"start"===e?"translate(calc("+r+"px), calc(-50% + "+l+"px))":"end"===e?"translate(calc(-100% + "+r+"px), calc(-50% + "+l+"px))":"translate("+r+"px, "+l+"px)"})({anchor:_(t),index:t.index,translateX:u,translateY:h-(m||0)*t.index})).style("left",t=>l(t)[0]-("start"===_(t)?-(p||C):p||C)+"px").style("top",t=>l(t)[1]+"px").style("text-align",_)}})({arc:at,enableRadialLabels:v,global:J,radius:Z,node:t,dataReady:tt,translateX:(O-(D-I))/2,translateY:(W+(R-P))/2,radialLabelsLinkHorizontalLength:L,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:M,radialAngleXOffset:N}),(B||E)&&(t=>{let{fullChartTooltip:e,global:a,tooltipRoot:r,data:l,tooltipClassName:s,tooltipBind:c,renderTooltip:d,arc:p,allSlices:u,tooltipStyle:h,width:m,height:b,radius:g}=t;const C=r||document.querySelector("body"),x=o.format(","),f=o.select(C).select("."+q.pieTooltipContainer),y=f.empty()?o.select(C).append("div").attr("class",q.pieTooltipContainer+" "+(s||"")).style("position","absolute").style("opacity","0"):f;h&&Object.entries(h).forEach(t=>{let[e,a]=t;return y.style(e,a)}),y.html("");let v=!1;const T=t=>{v=Boolean(t),y.style("opacity",v?"1":"0")},L=(t,r)=>{let[l,n]=o.pointer(t,document);if(!c&&e){const[e,a]=o.pointer(t,t.target);l-=e,n-=a}else if(!c){const t=a.node(),{x:e,y:o,width:i,height:s}=t?t.getBoundingClientRect():{x:0,y:0,width:0,height:0},[c,d]=p.centroid(r);l=e+i/2+c,n=o+s/2+d}y.style("left",l+"px").style("top",n+"px")},S=(t,e)=>{T(!0),L(t,e);const a=e?[e.data]:l;y.html(()=>i.renderToString(n.createElement(ct,{className:q.pieTooltipFlex},n.createElement(ut,{className:q.pieTooltip},d?d(a):n.createElement(n.Fragment,null,a.map((t,e)=>{let{color:a,name:r,value:l}=t;return n.createElement(mt,{key:r+"-"+e,className:q.pieTooltipItem},a&&n.createElement(gt,{className:q.pieTooltipColorBox,style:{backgroundColor:a}}),r&&n.createElement(xt,{className:q.pieTooltipName},r),n.createElement(ft,{className:q.pieTooltipValue},x(l)))}))))))};e?(a.on("mouseover.fulltooltip",t=>S(t)),a.on("mouseout.fulltooltip",()=>{y.html(""),T()}),m&&b&&a.append("circle").attr("class",q.pieFullChartTooltipCircle).attr("r",g).attr("cx",0).attr("cy",0),c||a.on("touchmove.tooltipBind mousemove.tooltipBind",t=>L(t))):(u.on("mouseover.slice",S),c||u.on("touchmove.slice mousemove.slice",L),u.on("mouseout.slice",()=>{y.html(""),T()}))})({fullChartTooltip:E,global:J,data:a,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,allSlices:lt,arc:at,tooltipStyle:X,width:O,height:W,radius:Z}),A){const t=i.renderToString(A);H.append("g").html(t)}}},St=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&Lt(i,t)},[i,t]),m(t.width,()=>Lt(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Z,{ref:o},r))};St.defaultProps={data:[],startAngle:0,endAngle:360,slicesLabelsSkipAngle:0,radialLabelYOffset:16,radialAngleXOffset:8};const kt={legendContainer:"d3-legend-container",legendTitle:"d3-legend-title",legendTick:"d3-legend-tick",legendTickLine:"d3-legend-tick-line",legendTickText:"d3-legend-tick-text"};function Mt(t,e){void 0===e&&(e=256);const a=document.createElement("canvas");a.width=e,a.height=1;const r=a.getContext("2d");for(let a=0;a<e;++a)r.fillStyle=t(a/(e-1)),r.fillRect(a,0,1,1);return a}const At={tickSize:6,height:44,width:320,marginTop:18,marginBottom:16,ticksDivier:64,titleMarginBottom:6};var wt;const Nt=c({calendarChart:"calendarChart",calendarYear:"calendarYear",calendarAxis:"calendarAxis",calendarBody:"calendarBody",calendarHeader:"calendarHeader",calendarYearTitle:"calendarYearTitle",calendarWeekDay:"calendarWeekDay",calendarMonth:"calendarMonth",calendarDays:"calendarDays",calendarDay:"calendarDay"},kt),Bt=r(u)(wt||(wt=p(["\n ."," {\n display: flex;\n margin-bottom: 16px;\n }\n ."," {\n display: inline-flex;\n align-items: flex-end;\n height: ",";\n margin-bottom: 4px;\n font-weight: bold;\n }\n ."," {\n height: ",";\n margin-bottom: 4px;\n position: relative;\n display: flex;\n }\n ."," {\n font-size: 14px;\n bottom: 0;\n position: absolute;\n }\n ."," {\n display: flex;\n flex-direction: column;\n margin-right: 10px;\n }\n ."," {\n font-size: 12px;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n ."," {\n position: relative;\n }\n ."," {\n position: absolute;\n }\n"])),Nt.calendarYear,Nt.calendarYearTitle,"20px",Nt.calendarHeader,"20px",Nt.calendarMonth,Nt.calendarAxis,Nt.calendarWeekDay,Nt.calendarDays,Nt.calendarDay),Et=t=>{const{className:e,style:a,children:r,data:i,startSunday:s,weekdays:d,cellOffset:p,cellSize:u,interpolator:m,monthSpacing:b,colorRange:g,legendProps:C}=t,[x,f]=h();return l.useEffect(()=>{f&&((t,e)=>{const{data:a,startSunday:r,weekdays:l,interpolator:n,monthSpacing:i,onEachDay:s,colorRange:d,legendProps:p}=e;if(null!==t&&a.length){const u=o.group(a,t=>t.date.getUTCFullYear()),h="number"==typeof e.cellOffset?e.cellOffset:0,m=7,b=18,g=e.cellSize||b,C=t=>r?t:(t+(m-1))%m,x=l||["вс","пн","вт","ср","чт","пт","сб"],f=6,y=t=>r?x[t]:t===f?x[0]:x[t+1],v=o.utcFormat("%x"),T=r?o.utcSunday:o.utcMonday,L=(t,e)=>T.count(o.utcYear(t),e),S=t=>t.getUTCMonth()*(i||0),k=o.utcFormat("%b"),M=o.max(a.map(t=>{let{value:e}=t;return e})),A=o.min(a.map(t=>{let{value:e}=t;return e})),w=d?o.scaleLinear().domain([A,M]).range(d):o.scaleSequential(n||o.interpolateGreens).domain([A,+M]);let N=0;u.forEach((t,e)=>{const a=new Date(e,1),r=o.max(t.map(t=>t.date)),l=r.getUTCMonth()-a.getUTCMonth(),n=L(a,r)+1;N=Math.max(N,n*(g+h)+(i||0)*l)}),o.select(t).select("."+Nt.calendarChart).remove();const B=o.select(t).append("div").attr("class",Nt.calendarChart),E=B.selectAll("div").data(u).join("div").attr("class",Nt.calendarYear),G=E.append("div").attr("class",Nt.calendarAxis);G.append("div").attr("class",Nt.calendarYearTitle).text(t=>{let[e]=t;return e}),G.selectAll("span").data(o.range(m)).join("div").attr("class",Nt.calendarWeekDay).style("height",g+"px").style("margin-bottom",h+"px").text(y);const z=E.append("div").attr("class",Nt.calendarBody);if(z.append("div").attr("class",Nt.calendarHeader).selectAll("div").data(t=>{let[e,a]=t;return o.utcMonths(o.utcMonth(new Date(a[0].date.getUTCFullYear(),1,1)),o.utcMonth(new Date(a[0].date.getUTCFullYear(),12,31)))}).join("div").attr("class",Nt.calendarMonth).style("left",t=>L(t,T.ceil(t))*(g+h)+S(t)+"px").text(k),z.append("div").attr("class",Nt.calendarDays).style("height",(g+h)*m+"px").style("width",N+"px").selectAll("div").data(t=>{let[,e]=t;return e}).join("div").each((t,e,a)=>{if(s){const r=a[e],l=w(t.value);s(t,r,l)}}).attr("class",Nt.calendarDay).style("width",g+"px").style("height",g+"px").style("left",t=>L(t.date,t.date)*(g+h)+S(t.date)+"px").style("top",t=>C(t.date.getUTCDay())*(g+h)+"px").style("background-color",t=>w(t.value)).attr("title",t=>v(t.date)+" - "+t.value),"object"==typeof p){const t=(t=>{let{color:e,title:a,tickSize:r=At.tickSize,width:l=At.width,height:n=At.height+r,marginTop:i=At.marginTop,marginRight:s=0,marginBottom:c=At.marginBottom+r,marginLeft:d=0,ticks:p=At.width/At.ticksDivier,tickFormat:u,tickValues:h,titleMarginBottom:m}=t;const b=o.create("svg").attr("width",l).attr("height",n).attr("viewBox",[0,0,l,n]).style("overflow","visible").style("display","block");let g;if(e.interpolate){const t=Math.min(e.domain().length,e.range().length);g=e.copy().rangeRound(o.quantize(o.interpolate(d,l-s),t)),b.append("image").attr("x",d).attr("y",i).attr("class",kt.legendContainer).attr("width",l-d-s).attr("height",n-i-c).attr("preserveAspectRatio","none").attr("xlink:href",Mt(e.copy().domain(o.quantize(o.interpolate(0,1),t))).toDataURL())}else if(e.interpolator&&(g=Object.assign(e.copy().interpolator(o.interpolateRound(d,l-s)),{range:()=>[d,l-s]}),b.append("image").attr("x",d).attr("y",i).attr("width",l-d-s).attr("height",n-i-c).attr("preserveAspectRatio","none").attr("xlink:href",Mt(e.interpolator()).toDataURL()),!g.ticks)){if(void 0===h){const t=Math.round(p+1);h=o.range(t).map(a=>o.quantile(e.domain(),a/(t-1)))}"function"!=typeof u&&(u=o.format(void 0===u?",f":u))}return b.append("g").attr("transform","translate(0,"+(n-c)+")").call(o.axisBottom(g).ticks(p,"string"==typeof u?u:void 0).tickFormat("function"==typeof u?u:void 0).tickSize(r).tickValues(h)).call(t=>{const e=t.selectAll(".tick");return e.selectAll(".tick line").attr("y1",i+c-n).attr("class",kt.legendTickLine),e.selectAll(".tick text").attr("class",kt.legendTickText),e.attr("class",kt.legendTick),e}).call(t=>t.select(".domain").remove()).call(t=>t.append("text").attr("x",d).attr("class",kt.legendTitle).attr("y",i+c-n-(m||At.titleMarginBottom)).attr("fill","currentColor").attr("text-anchor","start").attr("font-weight","bold").text(a)),b})(c({color:w},p)),e=B.node(),a=t.node();e.appendChild(a)}}})(f,t)},[f,i,s,d,p,u,m,b,g,C]),n.createElement(Bt,{ref:x,className:e,style:a},r)};function Gt(t){let e;const a=t.node();return e=a instanceof SVGGraphicsElement?a.getBBox():a.getBoundingClientRect(),e}function zt(){}function Yt(t){return null==t||Number.isNaN(t)}var Xt,Rt;Et.defaultProps={data:[]};const It={lineChartYScaleGlobal:"lineChartYScaleGlobal",lineChartXScaleGlobal:"lineChartXScaleGlobal",lineChartLinesGlobal:"lineChartLinesGlobal",lineChartLine:"lineChartLine",lineChartAreasGlobal:"lineChartAreasGlobal",lineChartArea:"lineChartArea",lineChartDotsGlobalContainer:"lineChartDotsGlobalContainer",lineChartDotsGlobal:"lineChartDotsGlobal",lineChartDot:"lineChartDot",lineChartGridGlobal:"lineChartGridGlobal",lineChartGridLineX:"lineChartGridLineX",lineChartGridLineY:"lineChartGridLineY",lineChartLabelContainer:"lineChartLabelContainer",lineChartLabelFlex:"lineChartLabelFlex",lineChartLabel:"lineChartLabel",lineChartMouseGlobal:"lineChartMouseGlobal",lineChartMouseLine:"lineChartMouseLine",lineChartMouseRect:"lineChartMouseRect",lineChartMouseCircle:"lineChartMouseCircle",lineChartMouseLabelContainer:"lineChartMouseLabelContainer",lineChartMouseLabel:"lineChartMouseLabel"},Pt=r(u)(Xt||(Xt=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n stroke: steelblue;\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n fill-opacity: 0.24;\n }\n .",",\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n .",",\n ."," {\n transition: opacity linear 200ms;\n pointer-events: none;\n stroke-width: 1px;\n }\n ."," {\n stroke: #fff;\n stroke-width: 2px;\n }\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n"])),It.lineChartYScaleGlobal,It.lineChartXScaleGlobal,It.lineChartGridGlobal,It.lineChartLinesGlobal,It.lineChartArea,It.lineChartGridLineX,It.lineChartGridLineY,It.lineChartMouseLine,It.lineChartMouseLine,It.lineChartMouseCircle,It.lineChartDot,It.lineChartMouseLine,It.lineChartMouseRect),Dt=a.createGlobalStyle(Rt||(Rt=p(["\n ."," {\n transition: opacity linear 200ms;\n z-index: 1;\n ."," {\n justify-content: flex-start;\n align-items: center;\n pointer-events: none;\n }\n ."," {\n margin: 0 0 0 10px;\n }\n }\n"])),It.lineChartMouseLabel,It.lineChartLabelFlex,It.lineChartLabel);var Ft,Ot;const Vt=r.div(Ft||(Ft=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),jt=r.div(Ot||(Ot=p(["\n margin-bottom: 4px;\n"]))),Wt=["values"],qt=(t,e)=>{const{data:a,labels:r,margin:l,customYAxisSelection:s,customXAxisSelection:p,customYAxis:u,customXAxis:h,curve:m,yAxisPadding:g,xAxisPadding:C,drawGridY:x,drawGridX:f,withLabels:y,formatLabel:v,eachLabel:T,stacked:L,dynamicTooltipEnable:S,dynamicCircleRadius:k,formatDynamicTooltip:M,renderTooltip:A,stackedTooltip:w,stackedTooltipIndex:N,tooltipLineTop:B,customize:E,customYScale:G,customLine:z,tooltipClassName:Y,xScaleItemWidth:X,areaCurve:R}=e;if(null!==t&&a.length){const I=L?(t=>{const e={};return t.map((t,a)=>(e[a]={},a>0?c({},t,{values:t.values.map((t,r)=>{const l=e[a-1][r];return e[a][r]=Number(("number"!=typeof l?0:Math.abs(l))+("number"!=typeof t?0:Math.abs(t))),e[a][r]})}):(t.values.forEach((t,r)=>{e[a][r]=Number(t)}),t)))})(a):a,P=l?l.top:0,D=l?l.right:0,F=l?l.bottom:0,O=l?l.left:0,{width:V}=t.getBoundingClientRect(),j=e.width||V,W=e.height||0,q="number"==typeof e.min?e.min:o.min(I,t=>{let{values:e}=t;return o.min(e)}),Z="number"==typeof e.max?e.max:o.max(I,t=>{let{values:e}=t;return o.max(e)}),U=b(t,j,W||0),_=o.scaleLinear().domain([q||0,Z||0]).range([W-P-F-(C||0),P]).nice();G&&G(_);const H=8,J=o.axisLeft(_).ticks(H);u&&u(J);const K=J.tickArguments()[0],Q=U.append("g").attr("class",It.lineChartYScaleGlobal).call(J).call(s||zt),{width:$}=Gt(Q);Q.attr("transform","translate("+(O+$)+", 0)");const tt=r&&r.length?r.length-1:I.reduce((t,e)=>{let{values:a}=e;return Math.max(t,a.length)},0)-1,et=o.scaleLinear().domain([0,tt]).range([O+$+(g||0),j-D]),at=o.axisBottom(et).tickFormat(t=>r&&r.length>0?r[t]:0).ticks(tt);if("number"==typeof X){const[t,e]=et.range();at.ticks(Math.round((e-t)/X)).tickSizeOuter(0)}if(h&&h(at),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,lastIndex:n,drawGridX:o,drawGridY:i}=t;if(!i&&!o)return;const s=e.append("g").attr("class",It.lineChartGridGlobal),c=a.ticks(l);o&&s.append("g").selectAll("line").data(c).join("line").attr("class",It.lineChartGridLineX).attr("x1",()=>r(0)).attr("x2",()=>r(n)).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),i&&s.append("g").selectAll("line").data(Array.from({length:n+1},(t,e)=>e)).join("line").attr("class",It.lineChartGridLineY).attr("x1",(t,e)=>Math.round(r(e))).attr("x2",(t,e)=>Math.round(r(e))).attr("y1",()=>Math.round(a(c[0]))).attr("y2",()=>Math.round(a(c[c.length-1])))})({svg:U,yScale:_,xScale:et,yTicksCount:K,lastIndex:tt,drawGridY:x,drawGridX:f}),Array.isArray(r)&&r.length>0){const t=U.append("g").call(p||zt).attr("class",It.lineChartXScaleGlobal).call(at),{height:e}=Gt(t);t.attr("transform","translate(0, "+(W-Math.ceil(e)-F)+")")}const rt=o.line().defined(t=>null!==t).x((t,e)=>et(e)).y(t=>_(t)).curve(m||o.curveLinear);if(z&&z(rt),I.some(t=>{let{fill:e}=t;return e})){let t=-2;const e=e=>{const{minAreaValues:a}=e,r=_.ticks()[0];return o.area().defined(t=>null!==t).x((t,e)=>et(e)).y0((e,l)=>{0===l&&(t+=1);let n=r;a&&"number"==typeof a[l]?n=a[l]||n:a&&(n=_(n-e));const o=I[t];return _(L&&t>-1?"number"!=typeof o.values[l]?0:o.values[l]:n)}).y1(t=>_(t)).curve(R||m||o.curveLinear)};U.append("g").attr("class",It.lineChartAreasGlobal).selectAll("path").data(I.filter(t=>{let{fill:e}=t;return Boolean(e)})).join("path").attr("class",It.lineChartArea).attr("d",t=>e(t)(t.values)).attr("fill",t=>{let{fill:e}=t;return e||"none"}).attr("style",t=>{let{areaStyle:e}=t;return e||""})}U.append("g").attr("class",It.lineChartLinesGlobal).selectAll("path").data(I).join("path").attr("class",It.lineChartLine).attr("d",t=>rt(t.values)).attr("stroke",t=>{let{stroke:e}=t;return e||"steelblue"}).attr("style",t=>{let{style:e}=t;return e||""});const lt=I.filter(t=>{let{dot:e}=t;return e});if(lt.length>0){const t=U.append("g").attr("class",It.lineChartDotsGlobalContainer);lt.forEach(e=>{const{values:a,dot:r}=e,{radius:l,style:n,filter:o}=r,i=t.append("g").attr("class",It.lineChartDotsGlobal);i.selectAll("circle").data(a).join("circle").attr("cx",(t,e)=>et(e)).attr("class",It.lineChartDot).attr("cy",t=>_(t)).attr("r",l||0).attr("style",n||""),o&&i.selectAll("circle").select((t,a,r)=>o(e,a,r)?r[a]:null).remove()})}o.select(t).select(".d3-chart-label").remove(),y&&(t=>{let{node:e,data:a,yScale:r,xScale:l,formatLabel:s,eachLabel:c}=t;const d=o.select(e).append("div").attr("class","d3-chart-label"),p=o.format(",");a.forEach(t=>{let{values:e}=t;d.append("div").selectAll("div").data(e).join("div").attr("class",It.lineChartLabelContainer).style("position","absolute").style("left",(t,e)=>l(e)+"px").style("top",t=>r(t)+"px").html((t,e,a)=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},n.createElement(jt,{className:It.lineChartLabel},s?s(t,e,a):p(t))))).each(c||zt)})})({node:t,eachLabel:T,data:I,yScale:_,xScale:et,formatLabel:v}),S&&(t=>{let{svg:e,node:a,data:r,xScale:l,yScale:s,dynamicCircleRadius:p,formatDynamicTooltip:u,renderTooltip:h,stackedTooltipIndex:m,stackedTooltip:b,tooltipLineTop:g,tooltipRoot:C,tooltipClassName:x}=t;const f=C||document.querySelector("body"),y=o.format(","),v=r.filter(t=>{let{tooltipOff:e}=t;return!e}),T="number"==typeof m?[v[m]]:b?[v[0]]:v,[L,S]=l.range(),[k,M]=s.range(),A=e.append("g").attr("class",It.lineChartMouseGlobal),w=A.append("rect").attr("width",S-L).attr("height",Math.abs(k-M)).attr("class",It.lineChartMouseRect).attr("transform","translate("+L+", "+M+")"),N=A.append("path").attr("class",It.lineChartMouseLine).style("opacity","0"),B=e.selectAll("."+It.lineChartLine).nodes(),E=A.selectAll("circle").data(v.filter(t=>{let{dynamicDotOff:e}=t;return!e})).join("circle").attr("class",It.lineChartMouseCircle).attr("r",p).attr("fill",t=>{let{stroke:e}=t;return e||"none"}).attr("stroke",t=>{let{stroke:e}=t;return e||"none"}).style("opacity","0");let G=o.select("."+It.lineChartMouseLabelContainer);0===G.size()&&(G=o.select(f).append("div").attr("class",It.lineChartMouseLabelContainer));let z=null,Y=!1;const X=t=>{Y=Boolean(t);const e=Y?"1":"0";N.style("opacity",e),E.style("opacity",e),z&&z.style("opacity",e)},R=t=>{const[p,C]=o.pointer(t,document),[x]=o.pointer(t,w),[f,T]=o.pointer(t,a),L=x-(x-f),S=f+(p-f),A=Math.abs(l.invert(L)),G={},R=t=>Yt(t[Math.floor(A+1)])?null:t[Math.floor(A)];B.forEach((t,e)=>{let a={x:0,y:0};if(!t.hasAttribute("d")||r[e].tooltipOff)return void(G[e]=a);let l=0,n=t.getTotalLength(),o=null;for(;o=Math.floor((l+n)/2),a=t.getPointAtLength(o),o!==n&&o!==l||a.x===L;)if(a.x>L)n=o;else{if(!(a.x<L))break;l=o}G[e]=a}),E.attr("transform",(t,e)=>{const a=R(t.values);return G[e]&&a?"translate("+L+","+G[e].y+")":"translate(-9999, -9999)"}).attr("style",t=>{let{dynamicDotStyle:e}=t;return e||""});const I=v.map((t,e)=>{let{values:a}=t;return c({},d(t,Wt),{value:R(a),invertValue:G[e]?s.invert(G[e].y):0})}),P=I.every(t=>{let{value:e}=t;return Yt(e)});P&&Y?X():Y||P||X(!0);const D=Object.keys(G).reduce((t,e,a)=>{var l,n;const o=null==(l=I[Number(t)])?void 0:l.value,i=null==(n=I[Number(e)])?void 0:n.value,s=null==r?void 0:r[a].dynamicDotOff;return 0===a||Yt(i)||s?t:Yt(o)||G[t].y>G[e].y?e:t},"0"),F=z&&z.style("left",S+"px").style("top",(t,e)=>{const a="number"==typeof m?m:b?D:e;return(G[a]&&G[a].y+(C-T))+"px"}).select("."+It.lineChartLabel);h&&z?z.html((a,r)=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},h(I,{indexX:Math.round(A),indexY:r,svg:e,event:t})))):F&&F.text((t,e)=>{const a=I[e].invertValue;return u?u(a,I[e].value):y(a)}),N.attr("d",()=>{var t;let e="M"+L+","+k;return e+=" "+L+","+(g?M:(null==(t=G[D])?void 0:t.y)||0),e})};w.on("mouseover.tooltip",t=>{z=G.selectAll("div").data(T).join("div").attr("class",It.lineChartMouseLabel+" "+(x||"")).style("opacity","0").style("position","absolute").html(()=>i.renderToString(n.createElement(Vt,{className:It.lineChartLabelFlex},n.createElement(jt,{className:It.lineChartLabel})))),R(t)}),w.on("mouseout.tooltip",()=>{o.select("."+It.lineChartMouseLabelContainer).selectAll("*").remove(),X()}),w.on("touchmove.tooltip mousemove.tooltip",R)})({tooltipLineTop:B,stackedTooltip:w,renderTooltip:A,stackedTooltipIndex:N,formatDynamicTooltip:M,node:t,svg:U,data:I,xScale:et,yScale:_,dynamicCircleRadius:k,tooltipClassName:Y}),E&&E({svg:U,yScale:_,xScale:et})}},Zt=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&qt(i,t)},[i,t]),m(t.width,()=>qt(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Dt,null),n.createElement(Pt,{ref:o},r))};Zt.defaultProps={data:[],labels:[],height:240,yAxisPadding:10,xAxisPadding:20,margin:{top:10,right:10,bottom:10,left:0},dynamicCircleRadius:4,stackedTooltip:!1};const Ut={barChartLinesGlobal:"barChartLinesGlobal",barChartLine:"barChartLine",barChartAreasGlobal:"barChartAreasGlobal",barChartArea:"barChartArea"};var _t,Ht;const Jt=c({barChartBarGlobal:"barChartBarGlobal",barChartYScaleGlobal:"barChartYScaleGlobal",barChartYAxis:"barChartYAxis",barChartXAxis:"barChartXAxis",barChartYAxisZeroTick:"barChartYAxisZeroTick",barChartGridGlobal:"barChartGridGlobal",barChartGridLineX:"barChartGridLineX",barChartGridLineXZero:"barChartGridLineXZero",barChartGridLineYZero:"barChartGridLineYZero",barChartGridLineY:"barChartGridLineY"},{barChartMouseRect:"barChartMouseRect",barChartMouseContainer:"barChartMouseContainer",barChartTooltipFlex:"barChartTooltipFlex",barChartMouseTooltip:"barChartMouseTooltip",barChartTooltip:"barChartTooltip",barChartTooltipItem:"barChartTooltipItem",barChartTooltipColFlex:"barChartTooltipColFlex",barChartTooltipGroupName:"barChartTooltipGroupName",barChartColorBox:"barChartColorBox",barChartColorLine:"barChartColorLine",barChartTooltipName:"barChartTooltipName",barChartTooltipValue:"barChartTooltipValue"},{barChartLabelContainer:"barChartLabelContainer",barChartLabelFlex:"barChartLabelFlex",barChartLabel:"barChartLabel"},Ut),Kt=r(u)(_t||(_t=p(["\n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n .",",\n ."," {\n stroke: rgba(48, 69, 79, 0.06);\n }\n ."," {\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n ."," {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n shape-rendering: auto;\n }\n ."," {\n fill-opacity: 0.24;\n }\n"])),Jt.barChartGridLineX,Jt.barChartGridLineY,Jt.barChartMouseRect,Jt.barChartMouseRect,Jt.barChartLinesGlobal,Jt.barChartLine,Jt.barChartArea),Qt=a.createGlobalStyle(Ht||(Ht=p(["\n ."," {\n z-index: 1;\n transition: all linear 144ms;\n\n ."," {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])),Jt.barChartMouseTooltip,Jt.barChartTooltipItem),$t=["groupName"],te=["groupName"],ee=["values"],ae=["groupName"],re=(t,e)=>{const{data:a,lineData:r=[],barWidth:l,barPadding:s,colors:p,margin:u,xAxisPadding:h,yAxisPadding:m,drawGridY:g,drawGridX:C,customYScale:x,customXScale:f,customYAxisLeft:y,customXAxisBottom:v,customYAxis:T,customXAxis:L,customBars:S,customize:k,dynamicTooltipEnable:M,renderTooltip:A,labelPosition:w,renderLabel:N,tooltipY:B,tooltipBind:E,stackedLine:G,curve:z,formatTooltipValue:Y,formatTooltipName:X,sectionPadding:R,minValuesLine:I,tooltipYDomain:P,marshalledMap:D,minValue:F,maxValue:O,minDomainValue:V,maxDomainValue:j,drawBars:W,setTooltipPosition:q,onLabelItem:Z,isBarTooltip:U,xScaleItemWidth:_,tooltipRoot:H,tooltipClassName:J}=e;if(null!==t&&a.length){const K=u?u.top:0,Q=u?u.right:0,$=u?u.bottom:0,tt=u?u.left:0,et=12,{width:at}=t.getBoundingClientRect(),rt=e.width||at,lt=e.height||0,nt=(t=>{let{data:e,minDomainValue:a,maxDomainValue:r}=t,l=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.forEach(t=>{let e=d(t,$t),a=0,r=0;Object.keys(e).forEach(t=>{const l=e[t];let n=0,o=0;Object.keys(l).forEach(t=>{const e=l[t];e>0?n+=e:o+=e}),a=Math.min(a,o),r=Math.max(r,n)}),l=Math.min(l,a),n=Math.max(n,r)}),0===l&&0===n?{min:"number"==typeof a?a:0,max:"number"==typeof r?r:1}:{min:"number"==typeof a?a:l,max:"number"==typeof r?r:n}})({data:a,minDomainValue:V,maxDomainValue:j}),ot="number"==typeof F?F:Math.min(o.min(r,t=>{let{values:e}=t;return o.min(e)})||Number.POSITIVE_INFINITY,nt.min||0),it="number"==typeof O?O:Math.max(o.max(r,t=>{let{values:e}=t;return o.max(e)})||Number.NEGATIVE_INFINITY,nt.max),st=b(t,rt,lt||0),Lt=6,St=a.map(t=>t.groupName);let kt=l||et;const Mt=o.scaleLinear().domain([ot,it]).range([lt-K-$-(h||0),K]).nice();x&&x(Mt);const At=Mt.ticks(),wt=o.axisLeft(Mt).ticks(Lt);y&&y(wt);const Nt=wt.tickArguments()[0],Bt=st.append("g").attr("class",Jt.barChartYAxis).call(wt);Bt.selectAll(".tick").attr("class",t=>0===t?"tick "+Jt.barChartYAxisZeroTick:"tick"),T&&T(Bt);const{width:Et}=Gt(Bt),zt=[tt+Et+(m||0),rt-Q],Yt=o.scaleBand().domain(o.range(a.length)).range(zt);kt=(t=>{let{data:e,range:a,barWidth:r,barPadding:l,sectionPadding:n}=t;const o="number"==typeof n?n:0,i=a[1]-a[0],s=e.reduce((t,e)=>{let a=d(e,ae);return t+Object.keys(a).reduce((t,e,a)=>a>0?t+(r||0)+(l||0):t+r,0)+o},o);return i<s?Math.floor(r*(i/s)):r})({data:a,sectionPadding:R,range:zt,barWidth:kt,barPadding:s}),f&&f(Yt);const[Xt,Rt]=Yt.range(),It=o.axisBottom(Yt).tickFormat(t=>St[Number(t)]);"number"==typeof _&&It.tickValues(Yt.domain().filter((t,e,a)=>{const r=Math.round((Rt-Xt)/_);return!(e%Math.round(a.length/r))})).tickSizeOuter(0),v&&v(It,{node:t,labels:St});const Pt=st.append("g").call(It).attr("class",Jt.barChartXAxis);L&&L(Pt);const Dt=(t=>{let{data:e,yScale:a,xScale:r,barWidth:l,barPadding:n,colors:o,marginTop:i}=t;return e.map((t,e)=>{let{groupName:s}=t,c=d(t,te);const p=[],u=r.bandwidth(),h=Object.keys(c);return h.forEach((t,r)=>{const d=c[t],m=Object.keys(d),b=(l+n)*h.length-(m.length>1?n:0);let g=0,C=0;m.forEach(t=>{const c=d[t],h=o[t],m=(l+n)*r+u/2-b/2,x=c>0,f=x?Math.abs(100*(a(g-c)-a(g)+Number.EPSILON)/100):Math.abs(100*(a(C-c)-a(C)+Number.EPSILON)/100);x&&(g+=c);const y=x?100*(a(g)+Number.EPSILON)/100:a(C)-a(0)+a(0);p.push({x:m,y:y+(i||0),height:f,color:h,value:c,groupName:s,name:t,stackIndex:r,groupIndex:e}),x||(C+=c)})}),p})})({data:a,yScale:Mt,xScale:Yt,barWidth:kt,barPadding:"number"==typeof s?s:0,colors:p,marginTop:K}),Ft=D?D(Dt):Dt;Bt.attr("transform","translate( "+(tt+Et)+", 0)"),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,drawGridX:n,drawGridY:o}=t;if(!o&&!n)return;const i=e.append("g").attr("class",Jt.barChartGridGlobal),s=a.ticks(l),c=r.range(),d=r.domain();if(n&&i.append("g").selectAll("line").data(s).join("line").attr("class",t=>0===t?Jt.barChartGridLineX+" "+Jt.barChartGridLineXZero:Jt.barChartGridLineX).attr("x1",()=>c[0]).attr("x2",()=>c[1]).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),o){const t=t=>void 0!==d[t]?0===t?c[0]:Math.round(r.step()*t+c[0]-r.step()/2*r.padding()):c[1];i.append("g").selectAll("line").data(Array.from({length:d.length+1},(t,e)=>e)).join("line").attr("class",t=>0===t?Jt.barChartGridLineY+" "+Jt.barChartGridLineYZero:Jt.barChartGridLineY).attr("x1",t).attr("x2",t).attr("y1",()=>Math.round(a(s[0]))).attr("y2",()=>Math.round(a(s[s.length-1])))}})({svg:st,yScale:Mt,xScale:Yt,yTicksCount:Nt,drawGridY:g,drawGridX:C}),Pt.attr("transform","translate(0, "+(Mt(At[0])+(h||0))+")");const Ot=st.append("g").attr("class",Jt.barChartBarGlobal).selectAll("g").data(Ft).enter().append("g").attr("transform",(t,e)=>"translate("+Math.round(Yt(e))+","+-(K||0)+")"),Vt=W?W({groups:Ot,yScale:Mt,marshalledData:Ft,barWidth:kt}):(t=>{let{groups:e,barWidth:a}=t;return e.selectAll("rect").data(t=>t).join("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",a).attr("height",t=>t.height).style("fill",t=>t.color)})({groups:Ot,barWidth:kt});let jt=null;Array.isArray(r)&&r.length>0&&(jt=(t=>{let{svg:e,lineData:a,min:r,yScale:l,xScale:n,curve:i,stackedLine:s}=t,c=null,d=null,p=null;const u=o.line().defined(t=>null!==t).x((t,e)=>n(e)+h/2).y(t=>l(t)).curve(i||o.curveLinear),h=n.bandwidth(),m=a.filter(t=>{let{lineType:e}=t;return"line"===e}),b=a.filter(t=>{let{lineType:e}=t;return"area"===e});if(m.length>0&&(c=e.append("g").attr("class",Ut.barChartLinesGlobal).selectAll("path").data(m).join("path").attr("class",Ut.barChartLine).attr("d",t=>u(t.values)).attr("stroke",t=>{let{stroke:e}=t;return e||""}).attr("fill",t=>{let{fill:e}=t;return e||"none"})),b.length>0){let t=-2;p=o.area().x((t,e)=>n(e)+h/2).y0((e,n)=>(0===n&&(t+=1),l(s&&t>-1?"number"!=typeof a[t].values[n]?0:a[t].values[n]:r))).y1(t=>l(t)).curve(i||o.curveLinear),d=e.append("g").attr("class",Ut.barChartAreasGlobal).selectAll("path").data(b).join("path").attr("class",Ut.barChartArea).attr("d",t=>p&&p(t.values)).attr("fill",t=>{let{fill:e}=t;return e||"none"})}return{areasSelection:d,linesSelection:c,area:p}})({svg:st,lineData:r,xScale:Yt,yScale:Mt,min:"number"==typeof I?I:ot,stackedLine:G,curve:z})),S&&S({bars:Vt,yScale:Mt,lines:jt,marshalledData:Ft,lineData:r}),(M||w)&&(t=>{let{svg:e,node:a,data:r,marshalledData:l,xScale:s,yScale:p,renderTooltip:u,labelPosition:h,marginTop:m,renderLabel:b,barWidth:g,barPadding:C,dynamicTooltipEnable:x,tooltipY:f,tooltipBind:y,lineData:v,formatTooltipValue:T,formatTooltipName:L,tooltipYDomain:S,setTooltipPosition:k,onLabelItem:M,isBarTooltip:A,bars:w,tooltipRoot:N,tooltipClassName:B}=t;o.select(a).select("."+Jt.barChartMouseContainer).remove();const E=s.domain(),[G,z]=s.range(),[Y,X]=p.range(),R=s.bandwidth(),I=o.format(","),P=E.map(t=>{return e=Number(t)+1,void 0!==E[e]?0===e?G:Math.round(s.step()*e+G-s.step()/2*s.padding()):z;var e}),D=S?S({data:l,lineData:v,yScale:p}):l.reduce((t,e,a)=>{const r=o.min(v,t=>{let{values:e}=t;return"number"==typeof e[a]?p((e[a]||0)-X):Number.POSITIVE_INFINITY})||Number.POSITIVE_INFINITY;return t.push(e.reduce((t,e)=>{let{y:a}=e;return Math.min(t,a,r)},Number.POSITIVE_INFINITY)),t},[]),F=e.append("g").attr("class","lineChartMouseGlobal").append("rect").attr("width",z-G).attr("height",Math.abs(Y-X)).attr("class",Jt.barChartMouseRect).attr("transform","translate("+G+", "+X+")");if(x){const t=N||document.querySelector("body");let p=o.select("."+Jt.barChartMouseTooltip);0===p.size()&&(p=o.select(t).append("div").attr("class",Jt.barChartMouseTooltip).style("opacity","0").style("position","absolute").html(()=>i.renderToString(n.createElement(ct,{className:Jt.barChartTooltipFlex}))));const h=p.select("."+Jt.barChartTooltipFlex);let m=!1,b=null;const C=t=>{m=Boolean(t),p.style("opacity",m?"1":"0"),m?(p.attr("class",Jt.barChartMouseTooltip+" "+(B||"")),p.style("transition",null)):(p.attr("class",Jt.barChartMouseTooltip),b=null,p.style("transition","none"),p.style("top",null),p.style("left",null))};F.on("mouseout.tooltip",()=>C()),F.on("touchmove.tooltip mousemove.tooltip",t=>{const[x,S]=o.pointer(t,document),[M]=o.pointer(t,F),[N,B]=o.pointer(t,a),E=M-(M-N),G=x-N,z=S-B,Y=P.findIndex(t=>E<=t);if(A){const e=document.elementsFromPoint(t.clientX,t.clientY),a=o.select(w.nodes()[Y]).selectAll("rect").nodes();if(!e.some(t=>a.includes(t)))return m&&C(!1),void F.style("cursor","default");F.style("cursor","pointer")}const O=("number"==typeof f?f:D[Y]-X)+z,V=(y?(s(Y)||0)+R/2:E)+G;if(y&&b===Y)return;let j=l[Y];if(Array.isArray(j)&&0===j.length)return;if(v){const t=v.map(t=>{let{values:e}=t;return c({},d(t,ee),{value:e[Y],groupName:r[Y]&&r[Y].groupName})});Array.isArray(t)&&Array.isArray(j)&&(j=j.concat(t))}const W=e.node().getBoundingClientRect().width;"function"==typeof k?k({left:V,top:O,tooltip:p,svgWidth:W}):k||p.style("left",V+"px").style("top",O+"px"),u?h.html(()=>i.renderToString(n.createElement(n.Fragment,null,u(j,k?{left:V,top:O,tooltip:p,svgWidth:W}:void 0,g)))):(m||C(!0),h.html(()=>i.renderToString(n.createElement(ut,{className:Jt.barChartTooltip},j&&j[0]&&n.createElement(ht,{className:Jt.barChartTooltipGroupName},j[0].groupName),j&&j.map(t=>{let{name:e,value:a,stroke:r,fill:l,color:o,lineType:i}=t;return n.createElement(mt,{key:e,className:Jt.barChartTooltipItem},n.createElement(bt,{className:Jt.barChartTooltipColFlex},i?n.createElement(Ct,{className:Jt.barChartColorLine,style:{backgroundColor:r||l}}):n.createElement(gt,{className:Jt.barChartColorBox,style:{backgroundColor:o}}),n.createElement(xt,{className:Jt.barChartTooltipName},L?L(e):e)),n.createElement(ft,{className:Jt.barChartTooltipValue},T?T(a):I(a)))}))))),b=Y,m||C(!0)})}const O=o.select(a).append("div").attr("class",Jt.barChartMouseContainer).append("div").attr("class",Jt.barChartLabelContainer).style("position","absolute").style("top",X+"px");if(h){const t=v?l.map((t,e)=>t.concat(v.map(a=>{let{values:r,name:l,stroke:n}=a;const{stacksCount:o}=t.reduce((t,e)=>{let{stackIndex:a}=e;const{indexFlag:r,stacksCount:l}=t;return a!==r?{indexFlag:a,stacksCount:l+1}:t},{indexFlag:-1,stacksCount:0});return{x:t[0].x-g/2+(g*o+(C||0)*(o-1))/2,y:p(r[e])+m,height:0,color:n,value:r[e],groupName:t[0].groupName,name:l,stackIndex:0,groupIndex:e}}))):l,e=O.selectAll("div").data(t).enter().append("div").style("position","absolute").style("transform",(t,e)=>"translate("+Math.round(s(e))+"px,"+-(m||0)+"px)"),a="center"===h?pt:dt,r=(t=>{switch(t){case"top":return vt;case"bottom":return Tt;default:return yt}})(h);e.selectAll("span").data(t=>M?M(t):t).join("div").style("left",t=>Math.round(t.x+g/2)+"px").style("top",t=>((t,e,a)=>{switch(t){case"center":return a.y+a.height/2-e;case"bottom":return a.y+a.height-e;default:return a.y}})(h,X,t)+"px").style("position","absolute").html(t=>i.renderToString(n.createElement(a,{className:Jt.barChartLabelFlex},b?b(c({},t,{barWidth:g})):n.createElement(r,{className:Jt.barChartLabel},I(t.value)))))}})({svg:st,node:t,xScale:Yt,yScale:Mt,marshalledData:Ft,data:a,lineData:r,renderTooltip:A,labelPosition:w,marginTop:K,renderLabel:N,barWidth:kt,barPadding:s,dynamicTooltipEnable:M,tooltipY:B,tooltipBind:E,formatTooltipValue:Y,formatTooltipName:X,tooltipYDomain:P,setTooltipPosition:q,onLabelItem:Z,isBarTooltip:U,bars:Ot,tooltipRoot:H,tooltipClassName:J}),k&&k({svg:st,marshalledData:Ft,yScale:Mt,xScale:Yt,lineData:r})}},le=t=>{const{className:e,style:a,children:r}=t,[o,i]=h();return l.useEffect(()=>{i&&re(i,t)},[i,t]),m(t.width,()=>re(i,t)),n.createElement("div",{className:e,style:a},n.createElement(Qt,null),n.createElement(Kt,{ref:o},r))};le.defaultProps={data:[],colors:{},margin:{top:10,right:10,bottom:10,left:0},barWidth:12,barPadding:0,height:320,yAxisPadding:0,xAxisPadding:0,tooltipBind:!0,sectionPadding:1};const ne=["value"];var oe,ie,se,ce,de,pe,ue,he;const me={horizontalBarChartButtonTd:"horizontalBarChartButtonTd",horizontalBarChartLabelTd:"horizontalBarChartLabelTd",horizontalBarChartLabelCell:"horizontalBarChartLabelCell",horizontalBarChartBarTd:"horizontalBarChartBarTd",horizontalBarChartBarFlex:"horizontalBarChartBarFlex",horizontalBarChartBar:"horizontalBarChartBar",horizontalBarChartBarFirst:"horizontalBarChartBarFirst",horizontalBarChartBarLast:"horizontalBarChartBarLast",horizontalBarChartBarOnly:"horizontalBarChartBarOnly",horizontalBarChartTooltipFlex:"horizontalBarChartTooltipFlex",horizontalBarChartStackWrapper:"horizontalBarChartStackWrapper",horizontalBarChartTooltipContainer:"horizontalBarChartTooltipContainer",horizontalBarChartStackSumContainer:"horizontalBarChartStackSumContainer",horizontalBarChartStackSum:"horizontalBarChartStackSum",horizontalBarChartXScaleTd:"horizontalBarChartXScaleTd",horizontalBarChartXScaleTicks:"horizontalBarChartXScaleTicks",horizontalBarChartXScaleTick:"horizontalBarChartXScaleTick",horizontalBarChartTooltipItem:"horizontalBarChartTooltipItem",horizontalBarChartTooltipName:"horizontalBarChartTooltipName",horizontalBarChartTooltipValue:"horizontalBarChartTooltipValue"},be=r.table(oe||(oe=p(["\n width: 100%;\n"]))),ge=r.div(ie||(ie=p(["\n text-align: right;\n"]))),Ce=r.div(se||(se=p(["\n width: 100%;\n display: flex;\n height: 1rem;\n"]))),xe=r.td(ce||(ce=p(["\n width: 100%;\n position: relative;\n vertical-align: middle;\n"]))),fe=r(ct)(de||(de=p(["\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n will-change: left, top;\n"]))),ye=r.div(pe||(pe=p(["\n position: relative;\n"]))),ve=r.div(ue||(ue=p(["\n white-space: nowrap;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(0, -50%);\n"]))),Te=r.div(he||(he=p(["\n position: absolute;\n top: 0;\n display: flex;\n justify-content: flex-start;\n height: 100%;\n"]))),Le=t=>{let{renderTooltip:e,bars:a,style:r,className:l}=t;const i=o.format(",");return n.createElement(fe,{className:me.horizontalBarChartTooltipFlex+" "+(l||""),style:r},n.createElement(ut,{className:me.horizontalBarChartTooltipContainer},e?e(a):a.map((t,e)=>{let{color:a,name:r,value:l,groupName:o}=t;return n.createElement(mt,{key:(r||"")+"-"+e+"-"+o,className:me.horizontalBarChartTooltipItem},a&&n.createElement(gt,{style:{backgroundColor:a}}),r&&n.createElement(xt,{className:me.horizontalBarChartTooltipName},r),n.createElement(ft,{className:me.horizontalBarChartTooltipValue},i(l)))})))},Se=document.createElement("div"),ke=["item","mouseMove","mouseLeave","tooltipBind"];var Me;const Ae=r.div(Me||(Me=p(["\n position: relative;\n display: inline-flex;\n height: 100%;\n"]))),we=t=>{let{withTooltip:e,bar:a,formatNativeTitle:r,tooltipBind:l,mouseMove:o,mouseLeave:i,pointerEventsNone:s,isFirstChild:c,isLastChild:d,isOnlyChild:p}=t;const{color:u,width:h}=a,m=Math.abs(h),b=e?t=>o(t,[a]):void 0,g=e?()=>i():void 0;return n.createElement(Ae,{className:me.horizontalBarChartBar+" "+(c?me.horizontalBarChartBarFirst:"")+" "+(d?me.horizontalBarChartBarLast:"")+" "+(p?me.horizontalBarChartBarOnly:""),style:{width:m+"%",backgroundColor:u,pointerEvents:s?"none":"auto"},title:r?r(a):"",onMouseOver:b,onMouseMove:l?b:void 0,onMouseOut:g})};var Ne,Be,Ee;const Ge=r.td(Ne||(Ne=p(["\n position: relative;\n"]))),ze=r.div(Be||(Be=p(["\n position: relative;\n height: 1rem;\n"]))),Ye=r.div(Ee||(Ee=p(["\n white-space: nowrap;\n width: 0;\n height: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n"]))),Xe=t=>{let{maxValue:e,scaleTicks:a,renderTicks:r,scaleDomain:i}=t;const s=(t=>{let{maxValue:e,scaleTicks:a,scaleDomain:r}=t;return l.useMemo(()=>{const t=o.scaleLinear().domain([0,e]).range([0,100]),l=t.ticks(a);return(r||l).map(e=>({value:e,x:t(e)}))},[e,a,r])})({maxValue:e,scaleTicks:a,scaleDomain:i}),c=o.format(",");return n.createElement("tr",null,n.createElement("td",null),n.createElement(Ge,{className:me.horizontalBarChartXScaleTd},n.createElement(ze,{className:me.horizontalBarChartXScaleTicks},s.map((t,e,a)=>{const{value:l,x:o}=t;return n.createElement(Ye,{key:l,className:me.horizontalBarChartXScaleTick,style:{left:o+"%",justifyContent:0===e?"flex-start":e===a.length-1?"flex-end":""}},r?r(t):c(l))}))))},Re=t=>{let{data:e,className:a,style:r,children:i,labels:p,fullExtent:u,maxValue:h,formatNativeTitle:m,renderTooltip:b,withTooltip:g,withStackSum:C,tooltipBind:x,scaleTicks:f,renderTicks:y,renderButton:v,tooltipStyle:T,tooltipClassName:L,scaleDomain:S,renderDataTable:k,thead:M,withoutXScale:A,stackedTooltip:w,fullChartTooltip:N,hideTooltip:B}=t;const{fullMax:E,data:G}=(t=>{let{data:e,fullExtent:a,maxValue:r,labels:n}=t;return l.useMemo(()=>{const t=o.max(e,t=>o.sum(t,t=>{let{value:e}=t;return e})),l=o.scaleLinear().domain([0,"number"==typeof r?r:t]).range([0,100]);return{fullMax:t,data:e.map((t,e)=>(a||l.domain([0,"number"==typeof r?r:o.sum(t,t=>{let{value:e}=t;return e})]),t.map(t=>{let{value:a}=t;return c({},d(t,ne),{value:a,width:l(a),groupName:n?n[e]:""})})))}},[e,a,r,n])})({data:e,fullExtent:u,maxValue:h,labels:p}),[z,Y]=(t=>{let{renderTooltip:e,tooltipBind:a,tooltipStyle:r,tooltipRoot:i,tooltipClassName:d,hideTooltip:p}=t;return l.useEffect(()=>{const t=i||document.querySelector("body");return t&&t.appendChild(Se),()=>{s.unmountComponentAtNode(Se)}},[i]),[l.useCallback((t,l)=>{let[i,p]=o.pointer(t,document);if(!a&&"getBoundingClientRect"in t.target){const{width:e,height:a}=t.target.getBoundingClientRect(),[r,l]=o.pointer(t,t.target);i=i-r+e/2,p=p-l+a/2}Se&&(Se.style.visibility="visible"),s.render(n.createElement(Le,{style:c({left:i,top:p},r),bars:l,renderTooltip:e,className:d}),Se)},[d,r,e,a]),l.useCallback(()=>{Se&&(Se.style.visibility="hidden",p&&p())},[p])]})({renderTooltip:b,tooltipBind:x,tooltipStyle:T,tooltipClassName:L,hideTooltip:B}),X=(t=>l.useMemo(()=>t?t=>{let{item:e,mouseMove:a,mouseLeave:r,tooltipBind:l}=t,o=d(t,ke);return n.createElement(Te,Object.assign({className:me.horizontalBarChartStackWrapper,onMouseOver:t=>a(t,e),onMouseMove:l?t=>a(t,e):void 0,onMouseOut:r},o))}:t=>{let{children:e}=t;return n.createElement(l.Fragment,null,e)},[t]))(w);return n.createElement(be,{className:a,style:r,onMouseOver:N?t=>z(t,G.flat()):void 0,onMouseMove:N?t=>z(t,G.flat()):void 0,onMouseOut:N?Y:void 0},M,n.createElement("tbody",null,G.map((t,e)=>{const a=(C||k)&&o.sum(t,t=>{let{value:e}=t;return e}),r=o.sum(t,t=>{let{width:e}=t;return e});return n.createElement("tr",{key:"row-"+e},"function"==typeof v&&n.createElement("td",{className:me.horizontalBarChartButtonTd},v(t,e)),n.createElement("td",{className:me.horizontalBarChartLabelTd},p&&p[e]&&n.createElement(ge,{className:me.horizontalBarChartLabelCell},p[e])),n.createElement(xe,{className:me.horizontalBarChartBarTd,style:{pointerEvents:N?"none":"auto"}},n.createElement(Ce,{className:me.horizontalBarChartBarFlex,style:{pointerEvents:N?"none":"auto"}},n.createElement(X,{style:w?{width:r+"%"}:void 0,item:t,tooltipBind:x,mouseMove:z,mouseLeave:Y}),t.map((t,e,a)=>0!==t.value&&n.createElement(we,{key:"bar-"+(t.name||"")+"-"+e,formatNativeTitle:m,bar:t,tooltipBind:x,pointerEventsNone:w||N,withTooltip:g&&!w,mouseMove:z,mouseLeave:Y,isOnlyChild:1===a.length,isFirstChild:0===e&&a.length>1,isLastChild:a.length-1===e&&a.length>1})),C&&n.createElement(ye,{className:me.horizontalBarChartStackSumContainer},n.createElement(ve,{className:me.horizontalBarChartStackSum},a)))),k&&k(t,a,e))}),!A&&n.createElement(Xe,{maxValue:"number"==typeof h?h:E,scaleTicks:f,renderTicks:y,scaleDomain:S}),i))};Re.defaultProps={fullExtent:!0,withTooltip:!1,withStackSum:!1,tooltipBind:!1,scaleTicks:4,withoutXScale:!1};const Ie={height:280,minSize:6,maxSize:30,margin:{top:10,right:15,bottom:10,left:0},yAxisPadding:10,xAxisPadding:10,yScaleLabelPadding:10};var Pe,De;const Fe={bubbleChartYAxis:"bubbleChartYAxis",bubbleChartYAxisZeroTick:"bubbleChartYAxisZeroTick",bubbleChartXAxis:"bubbleChartXAxis",bubbleChartGridGlobal:"bubbleChartGridGlobal",bubbleChartGridLineX:"bubbleChartGridLineX",bubbleChartGridLineY:"bubbleChartGridLineY",bubbleChartCircle:"bubbleChartCircle",bubbleChartYScaleLabel:"bubbleChartYScaleLabel",bubbleChartTooltip:"bubbleChartTooltip",bubbleChartTooltipContainer:"bubbleChartTooltipContainer",bubbleChartTooltipFlex:"bubbleChartTooltipFlex",bubbleChartTip:"bubbleChartTip"},Oe=r(u)(Pe||(Pe=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n\n ."," {\n font-size: 10px;\n }\n"])),Fe.bubbleChartYAxis,Fe.bubbleChartXAxis,Fe.bubbleChartGridGlobal,Fe.bubbleChartGridLineX,Fe.bubbleChartGridLineY,Fe.bubbleChartYScaleLabel),Ve=a.createGlobalStyle(De||(De=p(["\n ."," {\n position: absolute;\n transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);\n pointer-events: none;\n z-index: 1;\n }\n"])),Fe.bubbleChartTooltipContainer);var je;const We=r.div(je||(je=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),qe=(t,e)=>{const{data:a,margin:r,xAxisPadding:l,yAxisPadding:s,customYScale:c,customYAxis:d,customXScale:p,customXAxis:u,minSize:h,maxSize:m,minYValue:g,maxYValue:C,drawGridY:x,drawGridX:f,xScaleItemWidth:y,bubbleStyle:v,customize:T,yScaleLabel:L,yScaleLabelPadding:S,enableTooltip:k,tooltipRoot:M,tooltipClassName:A,renderTooltip:w}=e;if(null!==t&&a.length){const N=r?r.top:0,B=r?r.right:0,E=r?r.bottom:0,G=r?r.left:0,{width:z}=t.getBoundingClientRect(),Y=e.width||z,X=e.height||0,R=6,I="number"==typeof g?g:o.min(a,t=>{let{yValue:e}=t;return e}),P="number"==typeof C?C:o.max(a,t=>{let{yValue:e}=t;return e}),D=b(t,Y,X||0),F=o.scaleLinear().domain([o.min(a,t=>{let{sizeValue:e}=t;return e}),o.max(a,t=>{let{sizeValue:e}=t;return e})]).range([h||Ie.minSize,m||Ie.maxSize]),O=X-N-E-(l||0),V=o.scaleLinear().domain([I,P]).range([O,N]).nice();c&&c(V);const j=V.ticks(),W=o.axisLeft(V).ticks(R),q=W.tickArguments()[0],Z=D.append("g").attr("class",Fe.bubbleChartYAxis).call(W);let U=S||0;if(L){const t=D.append("text").text(L).attr("class",Fe.bubbleChartYScaleLabel),{width:e,height:a}=Gt(t);U+=a,t.attr("transform","rotate(-90) translate(-"+(O+E+e)/2+", "+a+")")}Z.selectAll(".tick").attr("class",t=>0===t?"tick "+Fe.bubbleChartYAxisZeroTick:"tick"),d&&d(Z);const{width:_}=Gt(Z),H=[G+_+(s||0)+U,Y-B],J=o.scaleLinear().domain([o.min(a,t=>{let{xValue:e}=t;return e}),o.max(a,t=>{let{xValue:e}=t;return e})]).range(H);p&&p(J);const K=o.axisBottom(J);if("number"==typeof y){const[t,e]=J.range();K.ticks(Math.round((e-t)/y)).tickSizeOuter(0)}const Q=D.append("g").call(K).attr("class",Fe.bubbleChartXAxis);u&&u(Q),Z.attr("transform","translate("+(G+_+U)+", 0)"),(t=>{let{svg:e,yScale:a,xScale:r,yTicksCount:l,drawGridX:n,drawGridY:o}=t;if(!o&&!n)return;const[i,s]=r.domain(),c=e.append("g").attr("class",Fe.bubbleChartGridGlobal),d=a.ticks(l);n&&c.append("g").selectAll("line").data(d).join("line").attr("class",Fe.bubbleChartGridLineX).attr("x1",()=>r(i)).attr("x2",()=>r(s)).attr("y1",t=>Math.round(a(t))).attr("y2",t=>Math.round(a(t))),o&&c.append("g").selectAll("line").data(r.ticks(l)).join("line").attr("class",Fe.bubbleChartGridLineY).attr("x1",t=>Math.round(r(t))).attr("x2",t=>Math.round(r(t))).attr("y1",()=>Math.round(a(d[0]))).attr("y2",()=>Math.round(a(d[d.length-1])))})({svg:D,yScale:V,xScale:J,yTicksCount:q,drawGridY:x,drawGridX:f}),Q.attr("transform","translate(0, "+(V(j[0])+(l||0))+")");const $=D.append("g").selectAll("dot").data(a).enter().append("circle").attr("class",Fe.bubbleChartCircle).attr("cx",t=>{let{xValue:e}=t;return J(e)}).attr("cy",t=>{let{yValue:e}=t;return V(e)}).attr("r",t=>{let{sizeValue:e}=t;return F(e)/2}).attr("fill",t=>{let{color:e}=t;return e||"rgba(0, 176, 113, 0.6)"}).attr("stroke",t=>{let{stroke:e}=t;return e||"transparent"}).attr("style",t=>{let{style:e}=t;return e||v||""});k&&(t=>{let{bubbles:e,tooltipRoot:a,tooltipClassName:r,renderTooltip:l}=t;const s=a||document.querySelector("body"),c=o.format(",");let d=o.select(s).select("."+Fe.bubbleChartTooltip);null===d.node()&&(d=o.select(s).append("div").attr("class",Fe.bubbleChartTooltip));let p=d.append("div").attr("class",Fe.bubbleChartTooltipContainer+" "+(r||"")).style("opacity","0");e.on("mouseover.tooltip",(t,e)=>{const{sizeValue:a}=e,r=t.currentTarget,{x:o,y:s,width:d}=r.getBoundingClientRect(),u=window.pageXOffset+o+d/2,h=window.pageYOffset+s;p.style("left",u+"px").style("top",h+"px").html(()=>i.renderToString(n.createElement(We,{className:Fe.bubbleChartTooltipFlex},n.createElement(ut,{className:Fe.bubbleChartTip},c(a))))),l&&l({tooltip:p,data:e,circle:r}),p.style("opacity","1")}),e.on("mouseout.tooltip",()=>{p.style("opacity","0")})})({bubbles:$,tooltipRoot:M,tooltipClassName:A,renderTooltip:w}),T&&T({svg:D,bubbles:$,yScale:V,xScale:J,sizeScale:F})}},Ze=t=>{const{className:e,style:a,children:r,tooltipRoot:i}=t,[s,c]=h();return l.useEffect(()=>{c&&qe(c,t)},[c,t]),l.useEffect(()=>()=>(t=>{const e=t||document.querySelector("body");o.select(e).select("."+Fe.bubbleChartTooltip).remove()})(i),[i]),m(t.width,()=>qe(c,t)),n.createElement("div",{className:e,style:a},n.createElement(Ve,null),n.createElement(Oe,{ref:s},r))};Ze.defaultProps=Ie,exports.BarChart=le,exports.BubbleChart=Ze,exports.CalendarChart=Et,exports.ChartWrapper=u,exports.HorizontalBarChart=Re,exports.LineChart=Zt,exports.PieChart=St,exports.RadarChart=V,exports.SwipeScroll=T,exports.appendSvg=b,exports.barChartClassNames=Jt,exports.bubbleChartClassNames=Fe,exports.calendarChartClassNames=Nt,exports.horizontalBarChartClassNames=me,exports.lineChartClassNames=It,exports.pieChartclassNames=q,exports.radarChartclassNames=D,exports.useNode=h,exports.useResize=m; | ||
//# sourceMappingURL=charts.cjs.production.min.js.map |
import React from 'react'; | ||
import { BubbleChartProps } from './types'; | ||
export declare const BubbleChart: React.FC<BubbleChartProps>; | ||
export declare const bubbleChartDefaultProps: { | ||
height: number; | ||
minSize: number; | ||
maxSize: number; | ||
margin: { | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
left: number; | ||
}; | ||
yAxisPadding: number; | ||
xAxisPadding: number; | ||
yScaleLabelPadding: number; | ||
}; |
{ | ||
"version": "2.0.22", | ||
"version": "2.0.23", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"react": ">=16" | ||
"react": ">=17" | ||
}, | ||
@@ -65,3 +65,3 @@ "husky": { | ||
}, | ||
"gitHead": "18293ed09146b6b5cce870977c8c9a72a934dc56" | ||
"gitHead": "65e81bc39dc616304a455ad6f4fa0f4d294a79b7" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1146186
112