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