@evergis/charts 3.1.8 → 3.1.11
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.
- package/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/charts.cjs.development.js +3723 -0
- package/dist/charts.cjs.development.js.map +1 -0
- package/dist/charts.cjs.production.min.js +2 -0
- package/dist/charts.cjs.production.min.js.map +1 -0
- package/dist/charts.esm.js +400 -400
- package/dist/index.js +400 -400
- package/package.json +2 -2
|
@@ -0,0 +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("lodash"),c=require("react-dom");function d(){return(d=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 u(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 p(e,t){return t||(t=e.slice(0)),e.raw=t,e}const h=r.div(t||(t=p(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n"])));function m(){const[e,t]=n.useState(null);return[n.useCallback(t,[t]),e]}const b=(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])},g=(e,t,a)=>(o.select(e).select("svg").remove(),o.select(e).append("svg").attr("width",t).attr("height",a));var f;const x=r.div(f||(f=p(["\n width: 100%;\n overflow: hidden;\n user-select: none;\n"]))),C=e=>e*(2-e),y=(e,t,a)=>Math.min(Math.max(e,t),a),v={animation:0,speed:0,timestamp:0,startX:0,currentX:0},L=["children","width","onSwipe"],T=e=>{let{children:t,width:a,onSwipe:r}=e,i=u(e,L);const[s,c]=m();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(v);n.useEffect(()=>{a&&u.current.animation&&(cancelAnimationFrame(u.current.animation),u.current=v)},[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=y(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=y(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=v),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])})(c,d({width:a,onSwipe:r},i)),l.createElement(x,Object.assign({},i),l.createElement("div",{ref:s},t))};var k;T.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)"},w=r.div.attrs(e=>({style:{transform:S(e)}}))(k||(k=p(["\n position: absolute;\n"])));var B,M,A,N,E,G;const z=r.div(B||(B=p(["\n display: flex;\n align-items: center;\n font-size: 12px;\n"]))),Y=r.div(M||(M=p(["\n text-align: center;\n max-width: 120px;\n"]))),R=a.css(A||(A=p(["\n position: absolute;\n top: 50%;\n right: 0;\n transform: translate(calc(100% + 6px), -50%);\n"]))),X=r.div(N||(N=p(["\n display: flex;\n align-items: center;\n padding: 2px 4px;\n border-radius: 4px;\n color: rgb(255, 255, 255);\n background-color: rgb(144, 197, 61);\n margin-left: 8px;\n"]))),I=r(X)(E||(E=p(["\n ","\n"])),R),P=r.div(G||(G=p(["\n margin-left: 4px;\n font-size: 10px;\n color: rgba(255, 255, 255, 0.54);\n"])));var F;const D={radar:"radar",radarAxis:"radarAxis",radarAxisTextGlobal:"radarAxisTextGlobal",radarAxisText:"radarAxisText",radarPolygon:"radarPolygon",radarLabel:"radarLabel",radarLabelName:"radarLabelName",radarLabelBadge:"radarLabelBadge",radarLabelBadgePrefix:"radarLabelBadgePrefix",radarCircle:"radarCircle"},V=r(h)(F||(F=p(["\n ."," {\n path,\n line,\n circle {\n fill: none;\n stroke-width: 1px;\n stroke: rgba(149, 149, 149, 0.18);\n }\n }\n ."," {\n font-size: 12px;\n fill-opacity: 0.56;\n }\n ."," {\n fill-opacity: 0.06;\n stroke-width: 2px;\n fill: rgb(144, 197, 61);\n stroke: rgb(144, 197, 61);\n }\n ."," {\n fill: rgb(144, 197, 61);\n }\n"])),D.radarAxis,D.radarAxisText,D.radarPolygon,D.radarCircle),O=(e,t)=>{const{data:a,curve:r,polar:n,formatValue:s,badgePrefix:c,labelOffset:u,circleRadius:p,svgElements:h,renderLabel:m,customize:b,formatAxisValue:f,radarStyles:x,labelIndex:C,selectLabel:y}=t;if(null!==e&&a.length){const v=10,L="number"==typeof t.bleedLength?t.bleedLength:v,{width:T}=e.getBoundingClientRect(),k=t.width||T,S=400,B=t.height||S,M=t.minValue||Math.min(0,o.min(a,e=>o.min(e.map(e=>{let{value:t}=e;return t})))),A=(t.maxValue||Math.max(0,o.max(a,e=>o.max(e.map(e=>{let{value:t}=e;return t})))))-M,N=t.paddingY||0,E=Math.min((k-2*(t.paddingX||0)-2*L)/2,(B-2*N-2*L)/2),G=4,R=o.scaleLinear().domain([0,A||1]).range([]).ticks(t.levels||G),F=R[R.length-1],V=F+(R[1]-R[0]);F<A&&R.push(V);const O=t.levels||R.length-1,j=R[R.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),H=o.lineRadial().curve(r||o.curveLinearClosed).radius(e=>{let{value:t}=e;return q(t)}).angle((e,t)=>t*W),U=g(e,k,B),_=U.append("g"),J=o.range(1,O+1).reverse(),K=e=>-e*E/O,Q=e=>j*e/O,$=_.append("g").attr("class",D.radarAxis).selectAll().data([a[0]]).enter(),ee=_.append("g").attr("class",D.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/O*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",D.radarPolygon).attr("style",(e,t)=>(null==x?void 0:x[t])||"").attr("d",e=>H(e.map(e=>d({},e,{value:e.value-M}))));const ne=o.format(",");_.append("g").attr("class",D.radarAxisTextGlobal).selectAll("text").data(J).enter().append("text").attr("class",D.radarAxisText).attr("x","4").attr("y",K).attr("dy",0).attr("dominant-baseline","central").text((e,t)=>{const a=Q(e)+M;return f?f(a,t):ne(a)}),p&&a.forEach(e=>{const t=_.append("g").attr("class",D.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=B-L-N,ie=k/2,se=oe/2+(oe-ae)/2,ce=L+(u||le);if(_.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,x=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(x(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(w,{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[C||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?I:X,o=a[C||0][t],{name:i,value:d}=o;return m?m({item:o,items:r,anchor:e,index:t}):l.createElement(z,{className:D.radarLabel},l.createElement(Y,{className:D.radarLabelName},i),l.createElement(n,{className:D.radarLabelBadge},s?s(d,t):ne(d),c&&l.createElement(P,{className:D.radarLabelBadgePrefix},c)))},selectLabel:(e,t,r)=>{if(y){const n=a.map(e=>e[r]);y(e,{index:r,item:a[C||0][r],items:n,anchor:t})}}}),h){const e=i.renderToString(h);U.append("g").html(e)}b&&b(U)}},j=e=>{const{className:t,style:a}=e,[r,o]=m();return n.useEffect(()=>{o&&O(o,e)},[o,e]),b(e.width,()=>O(o,e)),l.createElement("div",{className:t,style:a},l.createElement(V,{ref:r}))};function W(e){return e*(Math.PI/180)}var q;j.defaultProps={height:400,data:[],curve:o.curveLinearClosed};const Z={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"},H=r(h)(q||(q=p(["\n ."," {\n fill: #4a4a4a;\n }\n ."," {\n position: absolute;\n max-width: 128px;\n }\n ."," {\n stroke: #000;\n }\n ."," {\n fill: transparent;\n cursor: pointer;\n }\n"])),Z.pieSliceLabel,Z.pieRadialLabel,Z.pieRadialLink,Z.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 J,K,Q,$,ee,te,ae,re,ne,le,oe,ie,se,ce;const de=r.div(J||(J=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n pointer-events: none;\n white-space: nowrap;\n"]))),ue=r(de)(K||(K=p([""]))),pe=r(ue)(Q||(Q=p(["\n align-items: center;\n"]))),he=r.div($||($=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n margin-bottom: 8px;\n padding: 4px 6px;\n background-color: rgba(48, 69, 79, 1);\n border-radius: 4px;\n box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);\n :before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 100%);\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 4px 3px 0 3px;\n border-color: rgba(48, 69, 79, 1) transparent transparent transparent;\n }\n"]))),me=r.div(ee||(ee=p(["\n font-size: 14px;\n margin-bottom: 6px;\n"]))),be=r.div(te||(te=p(["\n display: flex;\n align-items: center;\n margin-bottom: 0.25rem;\n &:last-of-type {\n margin-bottom: 0;\n }\n"]))),ge=r.div(ae||(ae=p(["\n display: flex;\n align-items: center;\n margin-right: 4px;\n"]))),fe=r.div(re||(re=p(["\n margin-right: 4px;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n"]))),xe=r(fe)(ne||(ne=p(["\n height: 2px;\n border-radius: 0;\n"]))),Ce=r.div(le||(le=p(["\n margin-right: 4px;\n"]))),ye=r.div(oe||(oe=p(["\n text-align: right;\n flex-shrink: 0;\n flex-grow: 1;\n"]))),ve=r.div(ie||(ie=p(["\n position: relative;\n font-size: 11px;\n color: #fff;\n font-weight: bold;\n letter-spacing: 0.52px;\n"]))),Le=r(ve)(se||(se=p(["\n top: 6px;\n"]))),Te=r(ve)(ce||(ce=p(["\n bottom: 6px;\n"]))),ke=(e,t)=>{const{data:a,padAngle:r,onClick:n,outerRadius:s,startAngle:c,endAngle:d,cornerRadius:u,margin:p,enableSlicesLabels:h,formatSliceLabel:m,slicesLabelsSkipAngle:b,enableSlicesLabelsName:f,formatSliceLabelName:x,borderWidth:C,borderColor:y,enableRadialLabels:v,backgroundColor:L,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:k,formatRadialLabel:S,radialLabelYOffset:w,svgElements:B,formatSliceTitle:M,radialAngleXOffset:A,withTooltip:N,fullChartTooltip:E,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,tooltipStyle:R}=t;if(null!==e&&a.length){const X=p?p.top:0,I=p?p.right:0,P=p?p.bottom:0,F=p?p.left:0,{width:D}=e.getBoundingClientRect(),V=t.width||D,O=240,j=t.height||O,q=(Math.min(V,j)-2*(C||0)-(V>j?X+P:I+F))/2,H=g(e,V,j),J=H.append("g").attr("class",Z.pieGlobal).attr("transform","translate("+((V-(F+I))/2+F)+","+((j-(P+X))/2+X)+")"),K=45,Q=100,$=360,ee=o.pie().startAngle(-W(c||0)).endAngle(W(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(q).outerRadius(q*Math.min(Math.max(s||0,0),te));"string"==typeof L&&J.append("path").attr("fill",L).attr("d",()=>ae({startAngle:W(0),endAngle:W($)}));const re=o.format(","),ne=J.selectAll("allSlices").data(ee).enter().append("path").attr("d",ae);if(ne.attr("class",Z.pieSlice).attr("fill",e=>{let{index:t}=e;return a[t].color||""}).attr("stroke",y||"").attr("stroke-width",C||0).attr("style",n?"cursor: pointer":"").on("click",(e,t)=>n&&n(a[t.index])).append("svg:title").text(e=>M?M(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",Z.pieSliceLabel).attr("text-anchor","middle").attr("dominant-baseline","central").attr("transform",e=>"translate("+ae.centroid(e)+")");e.append("tspan").attr("class",Z.pieSliceLabelValue).text(e=>{const t=180*(e.endAngle-e.startAngle)/Math.PI;if(!b||t>b)return m?m(e):e.value}),f&&e.append("tspan").attr("class",Z.pieSliceLabelName).text(e=>x?x(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("."+Z.pieRadialLabel).remove(),a){const e=4,a=o.arc().innerRadius(l).outerRadius(l);r.selectAll("allPolylines").data(s).enter().append("polyline").attr("class",Z.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",Z.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:q,node:e,dataReady:ee,translateX:(V-(F-I))/2,translateY:(j+(X-P))/2,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:k,formatRadialLabel:S,radialLabelYOffset:w,radialAngleXOffset:A}),(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"),x=o.format(","),C=o.select(f).select("."+Z.pieTooltipContainer),y=C.empty()?o.select(f).append("div").attr("class",Z.pieTooltipContainer+" "+(s||"")).style("position","absolute").style("opacity","0").style("z-index","103"):C;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")},k=(e,t)=>{L(!0),T(e,t);const a=t?[t.data]:n;y.html(()=>i.renderToString(l.createElement(de,{className:Z.pieTooltipFlex},l.createElement(he,{className:Z.pieTooltip},d?d(a):l.createElement(l.Fragment,null,a.map((e,t)=>{let{color:a,name:r,value:n}=e;return l.createElement(be,{key:r+"-"+t,className:Z.pieTooltipItem},a&&l.createElement(fe,{className:Z.pieTooltipColorBox,style:{backgroundColor:a}}),r&&l.createElement(Ce,{className:Z.pieTooltipName},r),l.createElement(ye,{className:Z.pieTooltipValue},x(n)))}))))))};t?(a.on("mouseover.fulltooltip",e=>k(e)),a.on("mouseout.fulltooltip",()=>{y.html(""),L()}),m&&b&&a.append("circle").attr("class",Z.pieFullChartTooltipCircle).attr("r",g).attr("cx",0).attr("cy",0),c||a.on("touchmove.tooltipBind mousemove.tooltipBind",e=>T(e))):(p.on("mouseover.slice",k),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:R,width:V,height:j,radius:q}),B){const e=i.renderToString(B);H.append("g").html(e)}}},Se=e=>{const{className:t,style:a,children:r}=e,[o,i]=m();return n.useEffect(()=>{i&&ke(i,e)},[i,e]),b(e.width,()=>ke(i,e)),l.createElement("div",{className:t,style:a},l.createElement(H,{ref:o},r))};Se.defaultProps={data:[],startAngle:0,endAngle:360,slicesLabelsSkipAngle:0,radialLabelYOffset:16,radialAngleXOffset:8};const we={legendContainer:"d3-legend-container",legendTitle:"d3-legend-title",legendTick:"d3-legend-tick",legendTickLine:"d3-legend-tick-line",legendTickText:"d3-legend-tick-text"};function Be(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 Ne=d({calendarChart:"calendarChart",calendarYear:"calendarYear",calendarAxis:"calendarAxis",calendarBody:"calendarBody",calendarHeader:"calendarHeader",calendarYearTitle:"calendarYearTitle",calendarWeekDay:"calendarWeekDay",calendarMonth:"calendarMonth",calendarDays:"calendarDays",calendarDay:"calendarDay"},we),Ee=r(h)(Ae||(Ae=p(["\n ."," {\n display: flex;\n margin-bottom: 16px;\n }\n ."," {\n display: inline-flex;\n align-items: flex-end;\n height: ",";\n margin-bottom: 4px;\n font-weight: bold;\n }\n ."," {\n height: ",";\n margin-bottom: 4px;\n position: relative;\n display: flex;\n }\n ."," {\n font-size: 14px;\n bottom: 0;\n position: absolute;\n }\n ."," {\n display: flex;\n flex-direction: column;\n margin-right: 10px;\n }\n ."," {\n font-size: 12px;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n ."," {\n position: relative;\n }\n ."," {\n position: absolute;\n }\n"])),Ne.calendarYear,Ne.calendarYearTitle,"20px",Ne.calendarHeader,"20px",Ne.calendarMonth,Ne.calendarAxis,Ne.calendarWeekDay,Ne.calendarDays,Ne.calendarDay),Ge=e=>{const{className:t,style:a,children:r,data:i,startSunday:s,weekdays:c,cellOffset:u,cellSize:p,interpolator:h,monthSpacing:b,colorRange:g,legendProps:f}=e,[x,C]=m();return n.useEffect(()=>{C&&((e,t)=>{const{data:a,startSunday:r,weekdays:n,interpolator:l,monthSpacing:i,onEachDay:s,colorRange:c,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,x=n||["вс","пн","вт","ср","чт","пт","сб"],C=6,y=e=>r?x[e]:e===C?x[0]:x[e+1],v=o.utcFormat("%x"),L=r?o.utcSunday:o.utcMonday,T=(e,t)=>L.count(o.utcYear(e),t),k=e=>e.getUTCMonth()*(i||0),S=o.utcFormat("%b"),w=o.max(a.map(e=>{let{value:t}=e;return t})),B=o.min(a.map(e=>{let{value:t}=e;return t})),M=c?o.scaleLinear().domain([B,w]).range(c):o.scaleSequential(l||o.interpolateGreens).domain([B,+w]);let A=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;A=Math.max(A,l*(g+h)+(i||0)*n)}),o.select(e).select("."+Ne.calendarChart).remove();const N=o.select(e).append("div").attr("class",Ne.calendarChart),E=N.selectAll("div").data(p).join("div").attr("class",Ne.calendarYear),G=E.append("div").attr("class",Ne.calendarAxis);G.append("div").attr("class",Ne.calendarYearTitle).text(e=>{let[t]=e;return t}),G.selectAll("span").data(o.range(m)).join("div").attr("class",Ne.calendarWeekDay).style("height",g+"px").style("margin-bottom",h+"px").text(y);const z=E.append("div").attr("class",Ne.calendarBody);if(z.append("div").attr("class",Ne.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",Ne.calendarMonth).style("left",e=>T(e,L.ceil(e))*(g+h)+k(e)+"px").text(S),z.append("div").attr("class",Ne.calendarDays).style("height",(g+h)*m+"px").style("width",A+"px").selectAll("div").data(e=>{let[,t]=e;return t}).join("div").each((e,t,a)=>{if(s){const r=a[t],n=M(e.value);s(e,r,n)}}).attr("class",Ne.calendarDay).style("width",g+"px").style("height",g+"px").style("left",e=>T(e.date,e.date)*(g+h)+k(e.date)+"px").style("top",e=>f(e.date.getUTCDay())*(g+h)+"px").style("background-color",e=>M(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",we.legendContainer).attr("width",n-d-s).attr("height",l-i-c).attr("preserveAspectRatio","none").attr("xlink:href",Be(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",Be(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",we.legendTickLine),t.selectAll(".tick text").attr("class",we.legendTickText),t.attr("class",we.legendTick),t}).call(e=>e.select(".domain").remove()).call(e=>e.append("text").attr("x",d).attr("class",we.legendTitle).attr("y",i+c-l-(m||Me.titleMarginBottom)).attr("fill","currentColor").attr("text-anchor","start").attr("font-weight","bold").text(a)),b})(d({color:M},u)),t=N.node(),a=e.node();t.appendChild(a)}}})(C,e)},[C,i,s,c,u,p,h,b,g,f]),l.createElement(Ee,{ref:x,className:t,style:a},r)};function ze(e){let t;const a=e.node();return t=a instanceof SVGGraphicsElement?a.getBBox():a.getBoundingClientRect(),t}function Ye(){}function Re(e){return null==e||Number.isNaN(e)}var Xe,Ie;Ge.defaultProps={data:[]};const Pe={lineChartYScaleGlobal:"lineChartYScaleGlobal",lineChartYScaleRight:"lineChartYScaleRight",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"},Fe=r(h)(Xe||(Xe=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n stroke: steelblue;\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n fill-opacity: 0.24;\n }\n .",",\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n .",",\n ."," {\n transition: opacity linear 200ms;\n pointer-events: none;\n stroke-width: 1px;\n }\n ."," {\n stroke: #fff;\n stroke-width: 2px;\n }\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n"])),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),De=a.createGlobalStyle(Ie||(Ie=p(["\n ."," {\n transition: opacity linear 200ms;\n z-index: 100;\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 Ve,Oe;const je=r.div(Ve||(Ve=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),We=r.div(Oe||(Oe=p(["\n margin-bottom: 4px;\n"]))),qe=["values"],Ze=(e,t)=>{const{data:a,labels:r,margin:n,customYAxisSelection:s,customXAxisSelection:c,customYAxis:p,customXAxis:h,curve:m,yAxisPadding:b,xAxisPadding:f,drawGridY:x,drawGridX:C,withLabels:y,formatLabel:v,eachLabel:L,stacked:T,dynamicTooltipEnable:k,dynamicCircleRadius:S,formatDynamicTooltip:w,renderTooltip:B,stackedTooltip:M,stackedTooltipIndex:A,tooltipLineTop:N,customize:E,customYScale:G,customLine:z,tooltipClassName:Y,xScaleItemWidth:R,areaCurve:X,dotSnapping:I,rightAxis:P}=t;if(null!==e&&a.length){const F=T?(e=>{const t={};return e.map((e,a)=>(t[a]={},a>0?d({},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,D=n?n.top:0,V=n?n.right:0,O=n?n.bottom:0,j=n?n.left:0,{width:W}=e.getBoundingClientRect(),q=t.width||W,Z=t.height||0,H="number"==typeof t.min?t.min:o.min(F,e=>{let{values:t}=e;return o.min(t)}),U="number"==typeof t.max?t.max:o.max(F,e=>{let{values:t}=e;return o.max(t)}),_=g(e,q,Z||0),J=[Z-D-O-(f||0),D],K=o.scaleLinear().domain([H||0,U||0]).range(J).nice();G&&G(K);const Q=8,$=o.axisLeft(K).ticks(Q);p&&p($);const ee=$.tickArguments()[0],te=_.append("g").attr("class",Pe.lineChartYScaleGlobal).call($).call(s||Ye),{width:ae}=ze(te);te.attr("transform","translate("+(j+ae)+", 0)");let re=0;if(P){const e=o.min(P),t=o.max(P),a=o.scaleLinear().domain([e||0,t||0]).range(J).nice(),r=o.axisRight(a).ticks(Q),n=_.append("g").attr("class",Pe.lineChartYScaleGlobal+" "+Pe.lineChartYScaleRight).call(r).call(s||Ye);({width:re}=ze(n)),n.attr("transform","translate("+(q-re)+", 0)")}const ne=r&&r.length?r.length-1:F.reduce((e,t)=>{let{values:a}=t;return Math.max(e,a.length)},0)-1,le=o.scaleLinear().domain([0,ne]).range([j+ae+(b||0),q-re-V]),oe=o.axisBottom(le).tickFormat(e=>r&&r.length>0?r[e]:0).ticks(ne);if("number"==typeof R){const[e,t]=le.range();oe.ticks(Math.round((t-e)/R)).tickSizeOuter(0)}if(h&&h(oe),(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:_,yScale:K,xScale:le,yTicksCount:ee,lastIndex:ne,drawGridY:x,drawGridX:C}),Array.isArray(r)&&r.length>0){const e=_.append("g").call(c||Ye).attr("class",Pe.lineChartXScaleGlobal).call(oe),{height:t}=ze(e);e.attr("transform","translate(0, "+(Z-Math.ceil(t)-O)+")")}const ie=o.line().defined(e=>null!==e).x((e,t)=>le(t)).y(e=>K(e)).curve(m||o.curveLinear);if(z&&z(ie),F.some(e=>{let{fill:t}=e;return t})){let e=-2;const t=t=>{const{minAreaValues:a}=t,r=K.ticks()[0];return o.area().defined(e=>null!==e).x((e,t)=>le(t)).y0((t,n)=>{0===n&&(e+=1);let l=r;a&&"number"==typeof a[n]?l=a[n]||l:a&&(l=K(l-t));const o=F[e];return K(T&&e>-1?"number"!=typeof o.values[n]?0:o.values[n]:l)}).y1(e=>K(e)).curve(X||m||o.curveLinear)};_.append("g").attr("class",Pe.lineChartAreasGlobal).selectAll("path").data(F.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||""})}_.append("g").attr("class",Pe.lineChartLinesGlobal).selectAll("path").data(F).join("path").attr("class",Pe.lineChartLine).attr("d",e=>ie(e.values)).attr("stroke",e=>{let{stroke:t}=e;return t||"steelblue"}).attr("style",e=>{let{style:t}=e;return t||""});const se=F.filter(e=>{let{dot:t}=e;return t});if(se.length>0){const e=_.append("g").attr("class",Pe.lineChartDotsGlobalContainer);se.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)=>le(t)).attr("class",Pe.lineChartDot).attr("cy",e=>K(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(je,{className:Pe.lineChartLabelFlex},l.createElement(We,{className:Pe.lineChartLabel},s?s(e,t,a):u(e))))).each(c||Ye)})})({node:e,eachLabel:L,data:F,yScale:K,xScale:le,formatLabel:v}),k&&(e=>{let{svg:t,node:a,data:r,xScale:n,yScale:s,dynamicCircleRadius:c,formatDynamicTooltip:p,renderTooltip:h,stackedTooltipIndex:m,stackedTooltip:b,tooltipLineTop:g,tooltipRoot:f,tooltipClassName:x,dotSnapping:C,lastIndex:y}=e;const v=f||document.querySelector("body"),L=o.format(","),T=r.filter(e=>{let{tooltipOff:t}=e;return!t}),k="number"==typeof m?[T[m]]:b?[T[0]]:T,[S,w]=n.range(),[B,M]=s.range(),A=t.append("g").attr("class",Pe.lineChartMouseGlobal),N=A.append("rect").attr("width",w-S).attr("height",Math.abs(B-M)).attr("class",Pe.lineChartMouseRect).attr("transform","translate("+S+", "+M+")"),E=A.append("path").attr("class",Pe.lineChartMouseLine).style("opacity","0"),G=t.selectAll("."+Pe.lineChartLine).nodes(),z=A.selectAll("circle").data(T.filter(e=>{let{dynamicDotOff:t}=e;return!t})).join("circle").attr("class",Pe.lineChartMouseCircle).attr("r",c).attr("fill",e=>{let{stroke:t}=e;return t||"none"}).attr("stroke",e=>{let{stroke:t}=e;return t||"none"}).style("opacity","0");let Y=o.select("."+Pe.lineChartMouseLabelContainer);0===Y.size()&&(Y=o.select(v).append("div").attr("class",Pe.lineChartMouseLabelContainer));let R=null,X=!1;const I=e=>{X=Boolean(e);const t=X?"1":"0";E.style("opacity",t),z.style("opacity",t),R&&R.style("opacity",t)},P=e=>{const[c,f]=o.pointer(e,document),[x]=o.pointer(e,N),[v,k]=o.pointer(e,a),S=x-(x-v),w=v+(c-v),A=Math.abs(n.invert(S)),Y={},P=e=>e[Math.floor(A)];G.forEach((e,t)=>{let a={x:0,y:0};if(e.hasAttribute("d")&&!r[t].tooltipOff)if(C){const[e,a]=n.range(),l=(a-e)/y;Y[t]={x:e+Math.round(A)*l,y:"number"==typeof r[t].values[Math.round(A)]?s(r[t].values[Math.round(A)]):0}}else{let r=0,n=e.getTotalLength(),l=null;for(;l=Math.floor((r+n)/2),a=e.getPointAtLength(l),l!==n&&l!==r||a.x===S;)if(a.x>S)n=l;else{if(!(a.x<S))break;r=l}Y[t]=a}else Y[t]=a}),z.attr("transform",(e,t)=>{const a=P(e.values);return Y[t]&&a?"translate("+(C?Y[t].x:S)+","+Y[t].y+")":"translate(-9999, -9999)"}).attr("style",e=>{let{dynamicDotStyle:t}=e;return t||""});const F=T.map((e,t)=>{let{values:a}=e;return d({},u(e,qe),{value:P(a),invertValue:Y[t]?s.invert(Y[t].y):0})}),D=F.every(e=>{let{value:t}=e;return Re(t)});D&&X?I():X||D||I(!0);const V=Object.keys(Y).reduce((e,t,a)=>{var n,l;const o=null==(n=F[Number(e)])?void 0:n.value,i=null==(l=F[Number(t)])?void 0:l.value,s=null==r?void 0:r[a].dynamicDotOff;return 0===a||Re(i)||s?e:Re(o)||Y[e].y>Y[t].y?t:e},"0"),O=R&&R.style("left",(e,t)=>{var a,r;return C?(null!=(a=null==(r=Y[t])?void 0:r.x)?a:0)+"px":w+"px"}).style("top",(e,t)=>{var a,r;return(null!=(a=null==(r=Y["number"==typeof m?m:b?V:t])?void 0:r.y)?a:0)+(f-k)+"px"}).select("."+Pe.lineChartLabel);h&&R?R.html((a,r)=>i.renderToString(l.createElement(je,{className:Pe.lineChartLabelFlex},h(F,{indexX:Math.round(A),indexY:r,svg:t,event:e})))):O&&O.text((e,t)=>{const a=F[t].invertValue;return p?p(a,F[t].value):L(a)}),E.attr("d",()=>{var e;let t="M"+S+","+B;return t+=" "+S+","+(g?M:(null==(e=Y[V])?void 0:e.y)||0),t})};N.on("mouseover.tooltip",e=>{R=Y.selectAll("div").data(k).join("div").attr("class",Pe.lineChartMouseLabel+" "+(x||"")).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(je,{className:Pe.lineChartLabelFlex},l.createElement(We,{className:Pe.lineChartLabel})))),P(e)}),N.on("mouseout.tooltip",()=>{o.select("."+Pe.lineChartMouseLabelContainer).selectAll("*").remove(),I()}),N.on("touchmove.tooltip mousemove.tooltip",P)})({tooltipLineTop:N,stackedTooltip:M,renderTooltip:B,stackedTooltipIndex:A,formatDynamicTooltip:w,node:e,svg:_,data:F,xScale:le,yScale:K,dynamicCircleRadius:S,tooltipClassName:Y,dotSnapping:I,lastIndex:ne}),E&&E({svg:_,yScale:K,xScale:le})}},He=e=>{const{className:t,style:a,children:r}=e,[o,i]=m();return n.useEffect(()=>{i&&Ze(i,e)},[i,e]),b(e.width,()=>Ze(i,e)),l.createElement("div",{className:t,style:a},l.createElement(De,null),l.createElement(Fe,{ref:o},r))};He.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,Je;const Ke=d({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),Qe=r(h)(_e||(_e=p(["\n display: ",";\n user-select: ",";\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&&"auto"},Ke.barChartGridLineX,Ke.barChartGridLineY,Ke.barChartMouseRect,Ke.barChartMouseRect,Ke.barChartLinesGlobal,Ke.barChartLine,Ke.barChartArea,Ke.barChartSelection),$e=a.createGlobalStyle(Je||(Je=p(["\n ."," {\n z-index: 100;\n transition: all linear 144ms;\n\n ."," {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])),Ke.barChartMouseTooltip,Ke.barChartTooltipItem),et=["groupName"],tt=["groupName"],at=["values"],rt=["groupName"],nt=(e,t)=>{const{data:a,lineData:r=[],markers:n=[],barWidth:c,barPadding:p,colors:h,margin:m,xAxisPadding:b,yAxisPadding:f,drawGridY:x,drawGridX:C,customYScale:y,customXScale:v,customYAxisLeft:L,customXAxisBottom:T,customYAxis:k,customXAxis:S,customBars:w,customize:B,dynamicTooltipEnable:M,hideTooltipGroupName:A,renderTooltip:N,labelPosition:E,renderLabel:G,tooltipY:z,tooltipBind:Y,stackedLine:R,curve:X,formatTooltipValue:I,formatTooltipName:P,sectionPadding:F,minValuesLine:D,tooltipYDomain:V,marshalledMap:O,minValue:j,maxValue:W,minDomainValue:q,maxDomainValue:Z,drawBars:H,setTooltipPosition:U,onLabelItem:_,isBarTooltip:J,xScaleItemWidth:K,tooltipRoot:Q,tooltipClassName:$,onBarClick:ee,onBarHover:te}=t;if(null!==e&&a.length){const ae=m?m.top:0,re=m?m.right:0,ne=m?m.bottom:0,le=m?m.left:0,oe=12,{width:ie}=e.getBoundingClientRect(),se=t.width||ie,ce=t.height||0,ke=(e=>{let{data:t,minDomainValue:a,maxDomainValue:r}=e,n=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return t.forEach(e=>{let t=u(e,et),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:q,maxDomainValue:Z}),Se="number"==typeof j?j:Math.min(o.min(r,e=>{let{values:t}=e;return o.min(t)})||Number.POSITIVE_INFINITY,ke.min||0),we="number"==typeof W?W:Math.max(o.max(r,e=>{let{values:t}=e;return o.max(t)})||Number.NEGATIVE_INFINITY,ke.max),Be=g(e,se,ce||0),Me=6,Ae=a.map(e=>e.groupName);let Ne=c||oe;const Ee=o.scaleLinear().domain([Se,we]).range([ce-ae-ne-(b||0),ae]).nice();y&&y(Ee);const Ge=Ee.ticks(),Ye=o.axisLeft(Ee).ticks(Me);L&&L(Ye);const Re=Ye.tickArguments()[0],Xe=Be.append("g").attr("class",Ke.barChartYAxis).call(Ye);Xe.selectAll(".tick").attr("class",e=>0===e?"tick "+Ke.barChartYAxisZeroTick:"tick"),k&&k(Xe);const{width:Ie}=ze(Xe),Pe=[le+Ie+(f||0),se-re],Fe=o.scaleBand().domain(o.range(a.length)).range(Pe);Ne=(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=u(t,rt);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:F,range:Pe,barWidth:Ne,barPadding:p}),v&&v(Fe);const[De,Ve]=Fe.range(),Oe=o.axisBottom(Fe).tickFormat(e=>Ae[Number(e)]);"number"==typeof K&&Oe.tickValues(Fe.domain().filter((e,t,a)=>{const r=Math.round((Ve-De)/K);return!(t%Math.round(a.length/r))})).tickSizeOuter(0),T&&T(Oe,{node:e,labels:Ae});const je=Be.append("g").call(Oe).attr("class",Ke.barChartXAxis);S&&S(je);const We=(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=u(e,tt);const d=[],p=r.bandwidth(),h=Object.keys(c);return h.forEach((e,r)=>{const u=c[e],m=Object.keys(u),b=(n+l)*h.length-(m.length>1?l:0);let g=0,f=0;m.forEach(e=>{const c=u[e],h=o[e],m=(n+l)*r+p/2-b/2,x=c>0,C=x?Math.abs(100*(a(g-c)-a(g)+Number.EPSILON)/100):Math.abs(100*(a(f-c)-a(f)+Number.EPSILON)/100);x&&(g+=c);const y=x?100*(a(g)+Number.EPSILON)/100:a(f)-a(0)+a(0);d.push({x:m,y:y+(i||0),height:C,color:h,value:c,groupName:s,name:e,stackIndex:r,groupIndex:t}),x||(f+=c)})}),d})})({data:a,yScale:Ee,xScale:Fe,barWidth:Ne,barPadding:"number"==typeof p?p:0,colors:h,marginTop:ae}),qe=O?O(We):We;Xe.attr("transform","translate( "+(le+Ie)+", 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",Ke.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?Ke.barChartGridLineX+" "+Ke.barChartGridLineXZero:Ke.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?Ke.barChartGridLineY+" "+Ke.barChartGridLineYZero:Ke.barChartGridLineY).attr("x1",e).attr("x2",e).attr("y1",()=>Math.round(a(s[0]))).attr("y2",()=>Math.round(a(s[s.length-1])))}})({svg:Be,yScale:Ee,xScale:Fe,yTicksCount:Re,drawGridY:x,drawGridX:C}),je.attr("transform","translate(0, "+(Ee(Ge[0])+(b||0))+")");const Ze="height-limit-mask-"+s.uniqueId();Be.append("defs").append("mask").attr("id",Ze).append("rect").attr("width","100%").attr("height",ce-ne+2).attr("fill","white");const He=Be.append("g").attr("class",Ke.barChartBarGlobal).attr("mask","url(#"+Ze+")").selectAll("g").data(qe).enter().append("g").attr("transform",(e,t)=>"translate("+Math.round(Fe(t))+","+-(ae||0)+")"),_e=H?H({groups:He,yScale:Ee,marshalledData:qe,barWidth:Ne}):(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=>null===e.value?0:Math.max(e.height,2)).style("fill",e=>e.color)})({groups:He,barWidth:Ne});n.forEach(e=>{if(e){if(e.horizontal)return e.line&&Be.append("line").style("stroke",e.lineColor||e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",le+Ie).attr("y1",Ee(e.value)+1).attr("x2",se).attr("y2",Ee(e.value)+1),void Be.append("text").attr("y",Ee(e.value)+1).attr("x",le+Ie).attr("text-anchor","middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label);e.line&&Be.append("line").style("stroke",e.lineColor||e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",se/a.length*e.value+1).attr("y1",0).attr("x2",se/a.length*e.value+1).attr("y2",ce-ae-ne+8),Be.append("text").attr("y",ce-2).attr("x",se/a.length*e.value+1).attr("text-anchor","right"===e.align?"end":"left"===e.align?"start":"middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label)}});let Je=null;Array.isArray(r)&&r.length>0&&(Je=(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:Be,lineData:r,xScale:Fe,yScale:Ee,min:"number"==typeof D?D:Se,stackedLine:R,curve:X})),w&&w({bars:_e,yScale:Ee,lines:Je,marshalledData:qe,lineData:r}),(M||E)&&(e=>{let{svg:t,node:a,data:r,marshalledData:n,xScale:s,yScale:c,renderTooltip:p,labelPosition:h,marginTop:m,renderLabel:b,barWidth:g,barPadding:f,dynamicTooltipEnable:x,hideTooltipGroupName:C,tooltipY:y,tooltipBind:v,lineData:L,formatTooltipValue:T,formatTooltipName:k,tooltipYDomain:S,setTooltipPosition:w,onLabelItem:B,isBarTooltip:M,bars:A,tooltipRoot:N,tooltipClassName:E,onBarClick:G,onBarHover:z}=e;o.select(a).select("."+Ke.barChartMouseContainer).remove();const Y=s.domain(),[R,X]=s.range(),[I,P]=c.range(),F=s.bandwidth(),D=o.format(","),V=Y.map(e=>{return t=Number(e)+1,void 0!==Y[t]?0===t?R:Math.round(s.step()*t+R-s.step()/2*s.padding()):X;var t}),O=S?S({data:n,lineData:L,yScale:c}):n.reduce((e,t,a)=>{const r=o.min(L,e=>{let{values:t}=e;return"number"==typeof t[a]?c((t[a]||0)-P):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},[]),j=t.append("g").attr("class","lineChartMouseGlobal"),W=j.append("rect").attr("width",X-R).attr("height",Math.abs(I-P)).attr("class",Ke.barChartMouseRect).attr("transform","translate("+R+", "+P+")");if(x){const e=N||document.querySelector("body");let c=o.select("."+Ke.barChartMouseTooltip);0===c.size()&&(c=o.select(e).append("div").attr("class",Ke.barChartMouseTooltip).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(de,{className:Ke.barChartTooltipFlex}))));const h=c.select("."+Ke.barChartTooltipFlex);let m=!1,b=null;const f=e=>{m=Boolean(e),c.style("opacity",m?"1":"0"),m?(c.attr("class",Ke.barChartMouseTooltip+" "+(E||"")),c.style("transition",null)):(c.attr("class",Ke.barChartMouseTooltip),b=null,c.style("transition","none"),c.style("top",null),c.style("left",null))};W.on("mouseout.tooltip",()=>f()),W.on("touchmove.tooltip mousemove.tooltip",e=>{const[x,S]=o.pointer(e,document),[B]=o.pointer(e,W),[N,E]=o.pointer(e,a),G=B-(B-N),z=x-N,Y=S-E,R=V.findIndex(e=>G<=e);if(M){const t=document.elementsFromPoint(e.clientX,e.clientY),a=o.select(A.nodes()[R]).selectAll("rect").nodes();if(!t.some(e=>a.includes(e)))return m&&f(!1),void W.style("cursor","default");W.style("cursor","pointer")}const X=("number"==typeof y?y:O[R]-P)+Y,I=(v?(s(R)||0)+F/2:G)+z;if(v&&b===R)return;let j=n[R];if(Array.isArray(j)&&0===j.length)return;if(L){const e=L.map(e=>{let{values:t}=e;return d({},u(e,at),{value:t[R],groupName:r[R]&&r[R].groupName})});Array.isArray(e)&&Array.isArray(j)&&(j=j.concat(e))}const q=t.node().getBoundingClientRect().width;"function"==typeof w?w({left:I,top:X,tooltip:c,svgWidth:q}):w||c.style("left",I+"px").style("top",X+"px"),p?h.html(()=>i.renderToString(l.createElement(l.Fragment,null,p(j,w?{left:I,top:X,tooltip:c,svgWidth:q}:void 0,g)))):(m||f(!0),h.html(()=>i.renderToString(l.createElement(he,{className:Ke.barChartTooltip},j&&j[0]&&!C&&l.createElement(me,{className:Ke.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(be,{key:t,className:Ke.barChartTooltipItem},l.createElement(ge,{className:Ke.barChartTooltipColFlex},i?l.createElement(xe,{className:Ke.barChartColorLine,style:{backgroundColor:r||n}}):l.createElement(fe,{className:Ke.barChartColorBox,style:{backgroundColor:o}}),l.createElement(Ce,{className:Ke.barChartTooltipName},k?k(t):t)),l.createElement(ye,{className:Ke.barChartTooltipValue},T?T(a,t):D(a)))}))))),b=R,m||f(!0)})}const q=o.select(a).append("div").attr("class",Ke.barChartMouseContainer).append("div").attr("class",Ke.barChartLabelContainer).style("position","absolute").style("top",P+"px"),Z=(e,t)=>{const[r,l]=o.pointer(e,W),[i,s]=o.pointer(e,a),c=r-(r-i),d=l-s,u=V.findIndex(e=>c<=e),p=n[u][0];p.height>=I-d&&t(p)};if(j.on("click",e=>Z(e,e=>G&&G(e))).on("mousemove",e=>Z(e,e=>z&&z(e))).on("mouseleave",()=>z&&z(void 0)),h){const e=L?n.map((e,t)=>e.concat(L.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:c(r[t])+m,height:0,color:l,value:r[t],groupName:e[0].groupName,name:n,stackIndex:0,groupIndex:t}}))):n,t=q.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?pe:ue,r=(e=>{switch(e){case"top":return Le;case"bottom":return Te;default:return ve}})(h);t.selectAll("span").data(e=>B?B(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,P,e)+"px").style("position","absolute").html(e=>i.renderToString(l.createElement(a,{className:Ke.barChartLabelFlex},b?b(d({},e,{barWidth:g})):l.createElement(r,{className:Ke.barChartLabel},D(e.value)))))}})({svg:Be,node:e,xScale:Fe,yScale:Ee,marshalledData:qe,data:a,lineData:r,renderTooltip:N,labelPosition:E,marginTop:ae,renderLabel:G,barWidth:Ne,barPadding:p,dynamicTooltipEnable:M,hideTooltipGroupName:A,tooltipY:z,tooltipBind:Y,formatTooltipValue:I,formatTooltipName:P,tooltipYDomain:V,setTooltipPosition:U,onLabelItem:_,isBarTooltip:J,bars:He,tooltipRoot:Q,tooltipClassName:$,onBarClick:ee,onBarHover:te}),B&&B({svg:Be,marshalledData:qe,yScale:Ee,xScale:Fe,lineData:r})}},lt=e=>{const{className:t,style:a,children:r,selectable:o}=e,[i,s]=m();return n.useEffect(()=>{s&&nt(s,e)},[s,e]),b(e.width,()=>nt(s,e)),((e,t)=>{const a=n.useRef(!1),r=n.useRef(0),l=n.useRef(),o=n.useCallback(()=>{e&&l.current&&(a.current=!1,e.removeChild(l.current),l.current=void 0)},[e]),i=n.useCallback(n=>{const i=Boolean(n.touches);var s,c,d;n.stopPropagation(),e&&3!==n.which&&(o(),l.current=document.createElement("div"),l.current.setAttribute("class",Ke.barChartSelection),l.current.setAttribute("style","height: calc(100% - "+(null!=(s=null==(c=t.margin)?void 0:c.bottom)?s:0)+"px)"),e.appendChild(l.current),a.current=!0,r.current=i?(null==(d=n.touches[0])?void 0:d.pageX)-e.firstChild.getBoundingClientRect().left:n.offsetX,l.current.style.display="block",l.current.style.width="0px",l.current.style.left=r.current+"px")},[e]),s=n.useCallback(t=>{const n=Boolean(t.touches);if(t.stopPropagation(),e&&a.current&&l.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.current.style.marginLeft="0px",l.current.style.width=i<=a?s+"px":a-r.current+"px"):(l.current.style.right=a-r.current+"px",l.current.style.width=Math.abs(s)+"px",l.current.style.marginLeft=s+"px")),n&&e.offsetLeft>t.touches[0].pageX&&(l.current.style.right=a-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px")}},[e]),c=n.useCallback(t=>{if(a.current&&e&&l.current){if(e.offsetLeft>t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.right=t-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px"}if(e.offsetLeft+e.offsetWidth<t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.left=r.current+"px",l.current.style.width=t-r.current+"px",l.current.style.marginLeft="0px"}}},[e]),d=n.useCallback(()=>{if(e&&l.current){const a=e.firstChild.getBoundingClientRect().width,r=l.current.offsetLeft>=0?l.current.offsetLeft<=a?l.current.offsetLeft:a:0,n=l.current.getBoundingClientRect().right-l.current.getBoundingClientRect().left,o=l.current.offsetLeft+n<=a?l.current.offsetLeft+n>=0?l.current.offsetLeft+n:0:a,i=Math.round(r),s=Math.round(o);s-i>0&&t.onSelect&&t.onSelect([i,s])}o()},[e,o]);n.useEffect(()=>(e&&(e.childNodes.forEach(e=>{e.style.userSelect="none"}),e.addEventListener("mousedown",i),e.addEventListener("touchstart",i),e.addEventListener("mousemove",s),e.addEventListener("touchmove",s),e.addEventListener("mouseleave",c),e.addEventListener("mouseup",d),e.addEventListener("touchend",d),document.addEventListener("mouseup",d)),()=>{null==e||e.removeEventListener("mousedown",i),null==e||e.removeEventListener("touchstart",i),null==e||e.removeEventListener("mousemove",s),null==e||e.removeEventListener("touchmove",s),null==e||e.removeEventListener("mouseleave",c),null==e||e.removeEventListener("mouseup",d),null==e||e.removeEventListener("touchend",d),document.removeEventListener("mouseup",d)}),[e])})(o?s:null,e),l.createElement("div",{className:t,style:a},l.createElement($e,null),l.createElement(Qe,{ref:i,selectable:o},r))};lt.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 ot=["value"];var it,st,ct,dt,ut,pt,ht,mt;const bt={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"},gt=r.table(it||(it=p(["\n width: 100%;\n"]))),ft=r.div(st||(st=p(["\n text-align: right;\n"]))),xt=r.div(ct||(ct=p(["\n width: 100%;\n display: flex;\n height: 1rem;\n"]))),Ct=r.td(dt||(dt=p(["\n width: 100%;\n position: relative;\n vertical-align: middle;\n"]))),yt=r(de)(ut||(ut=p(["\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n will-change: left, top;\n"]))),vt=r.div(pt||(pt=p(["\n position: relative;\n"]))),Lt=r.div(ht||(ht=p(["\n white-space: nowrap;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(0, -50%);\n"]))),Tt=r.div(mt||(mt=p(["\n position: absolute;\n top: 0;\n display: flex;\n justify-content: flex-start;\n height: 100%;\n"]))),kt=e=>{let{renderTooltip:t,bars:a,style:r,className:n}=e;const i=o.format(",");return l.createElement(yt,{className:bt.horizontalBarChartTooltipFlex+" "+(n||""),style:r},l.createElement(he,{className:bt.horizontalBarChartTooltipContainer},t?t(a):a.map((e,t)=>{let{color:a,name:r,value:n,groupName:o}=e;return l.createElement(be,{key:(r||"")+"-"+t+"-"+o,className:bt.horizontalBarChartTooltipItem},a&&l.createElement(fe,{style:{backgroundColor:a}}),r&&l.createElement(Ce,{className:bt.horizontalBarChartTooltipName},r),l.createElement(ye,{className:bt.horizontalBarChartTooltipValue},i(n)))})))},St=document.createElement("div"),wt=["item","mouseMove","mouseLeave","tooltipBind"];var Bt;const Mt=r.div(Bt||(Bt=p(["\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:bt.horizontalBarChartBar+" "+(c?bt.horizontalBarChartBarFirst:"")+" "+(d?bt.horizontalBarChartBarLast:"")+" "+(u?bt.horizontalBarChartBarOnly:""),style:{width:m+"%",backgroundColor:p,pointerEvents:s?"none":"auto"},title:r?r(a):"",onMouseOver:b,onMouseMove:n?b:void 0,onMouseOut:g})};var Nt,Et,Gt;const zt=r.td(Nt||(Nt=p(["\n position: relative;\n"]))),Yt=r.div(Et||(Et=p(["\n position: relative;\n height: 1rem;\n"]))),Rt=r.div(Gt||(Gt=p(["\n white-space: nowrap;\n width: 0;\n height: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n"]))),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(zt,{className:bt.horizontalBarChartXScaleTd},l.createElement(Yt,{className:bt.horizontalBarChartXScaleTicks},s.map((e,t,a)=>{const{value:n,x:o}=e;return l.createElement(Rt,{key:n,className:bt.horizontalBarChartXScaleTick,style:{left:o+"%",justifyContent:0===t?"flex-start":t===a.length-1?"flex-end":""}},r?r(e):c(n))}))))},It=e=>{let{data:t,className:a,style:r,children:i,labels:s,fullExtent:p,maxValue:h,formatNativeTitle:m,renderTooltip:b,withTooltip:g,withStackSum:f,tooltipBind:x,scaleTicks:C,renderTicks:y,renderButton:v,tooltipStyle:L,tooltipClassName:T,scaleDomain:k,renderDataTable:S,thead:w,withoutXScale:B,stackedTooltip:M,fullChartTooltip:A,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 d({},u(e,ot),{value:a,width:n(a),groupName:l?l[t]:""})})))}},[t,a,r,l])})({data:t,fullExtent:p,maxValue:h,labels:s}),[z,Y]=(e=>{let{renderTooltip:t,tooltipBind:a,tooltipStyle:r,tooltipRoot:i,tooltipClassName:s,hideTooltip:u}=e;return n.useEffect(()=>{const e=i||document.querySelector("body");return e&&e.appendChild(St),()=>{c.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"),c.render(l.createElement(kt,{style:d({left:i,top:u},r),bars:n,renderTooltip:t,className:s}),St)},[s,r,t,a]),n.useCallback(()=>{St&&(St.style.visibility="hidden",u&&u())},[u])]})({renderTooltip:b,tooltipBind:x,tooltipStyle:L,tooltipClassName:T,hideTooltip:N}),R=(e=>n.useMemo(()=>e?e=>{let{item:t,mouseMove:a,mouseLeave:r,tooltipBind:n}=e,o=u(e,wt);return l.createElement(Tt,Object.assign({className:bt.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]))(M);return l.createElement(gt,{className:a,style:r,onMouseOver:A?e=>z(e,G.flat()):void 0,onMouseMove:A?e=>z(e,G.flat()):void 0,onMouseOut:A?Y:void 0},w,l.createElement("tbody",null,G.map((e,t)=>{const a=(f||S)&&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:bt.horizontalBarChartButtonTd},v(e,t)),l.createElement("td",{className:bt.horizontalBarChartLabelTd},s&&s[t]&&l.createElement(ft,{className:bt.horizontalBarChartLabelCell},s[t])),l.createElement(Ct,{className:bt.horizontalBarChartBarTd,style:{pointerEvents:A?"none":"auto"}},l.createElement(xt,{className:bt.horizontalBarChartBarFlex,style:{pointerEvents:A?"none":"auto"}},l.createElement(R,{style:M?{width:r+"%"}:void 0,item:e,tooltipBind:x,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:x,pointerEventsNone:M||A,withTooltip:g&&!M,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(vt,{className:bt.horizontalBarChartStackSumContainer},l.createElement(Lt,{className:bt.horizontalBarChartStackSum},a)))),S&&S(e,a,t))}),!B&&l.createElement(Xt,{maxValue:"number"==typeof h?h:E,scaleTicks:C,renderTicks:y,scaleDomain:k}),i))};It.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 Ft,Dt;const Vt={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(h)(Ft||(Ft=p(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n\n ."," {\n font-size: 10px;\n }\n"])),Vt.bubbleChartYAxis,Vt.bubbleChartXAxis,Vt.bubbleChartGridGlobal,Vt.bubbleChartGridLineX,Vt.bubbleChartGridLineY,Vt.bubbleChartYScaleLabel),jt=a.createGlobalStyle(Dt||(Dt=p(["\n ."," {\n position: absolute;\n transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);\n pointer-events: none;\n z-index: 1;\n }\n"])),Vt.bubbleChartTooltipContainer);var Wt;const qt=r.div(Wt||(Wt=p(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),Zt=(e,t)=>{const{data:a,margin:r,xAxisPadding:n,yAxisPadding:s,customYScale:c,customYAxis:d,customXScale:u,customXAxis:p,minSize:h,maxSize:m,minYValue:b,maxYValue:f,drawGridY:x,drawGridX:C,scaleLog:y,xScaleItemWidth:v,bubbleStyle:L,customize:T,yScaleLabel:k,yScaleLabelPadding:S,enableTooltip:w,tooltipRoot:B,tooltipClassName:M,renderTooltip:A}=t;if(null!==e&&a.length){const N=r?r.top:0,E=r?r.right:0,G=r?r.bottom:0,z=r?r.left:0,{width:Y}=e.getBoundingClientRect(),R=t.width||Y,X=t.height||0,I=6,P="number"==typeof b?b:o.min(a,e=>{let{yValue:t}=e;return t}),F="number"==typeof f?f:o.max(a,e=>{let{yValue:t}=e;return t}),D=g(e,R,X||0),V=y?o.scaleLog().domain([o.min(a,e=>{let{sizeValue:t}=e;return t})||.1,o.max(a,e=>{let{sizeValue:t}=e;return t})||.1]).range([h||Pt.minSize||.1,m||Pt.maxSize||.1]):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-N-G-(n||0),j=y?o.scaleLog().domain([P||.1,F||.1]).range([O||.1,N||.1]).nice():o.scaleLinear().domain([P,F]).range([O,N]).nice();c&&c(j);const W=j.ticks(),q=o.axisLeft(j).ticks(I),Z=q.tickArguments()[0],H=D.append("g").attr("class",Vt.bubbleChartYAxis).call(q);let U=S||0;if(k){const e=D.append("text").text(k).attr("class",Vt.bubbleChartYScaleLabel),{width:t,height:a}=ze(e);U+=a,e.attr("transform","rotate(-90) translate(-"+(O+G+t)/2+", "+a+")")}H.selectAll(".tick").attr("class",e=>0===e?"tick "+Vt.bubbleChartYAxisZeroTick:"tick"),d&&d(H);const{width:_}=ze(H),J=y?o.scaleLog().domain([o.min(a,e=>{let{xValue:t}=e;return t})||.1,o.max(a,e=>{let{xValue:t}=e;return t})||.1]).range([z+_+(s||0)+U||.1,R-E||.1]):o.scaleLinear().domain([o.min(a,e=>{let{xValue:t}=e;return t}),o.max(a,e=>{let{xValue:t}=e;return t})]).range([z+_+(s||0)+U,R-E]);u&&u(J);const K=o.axisBottom(J);if("number"==typeof v){const[e,t]=J.range();K.ticks(Math.round((t-e)/v)).tickSizeOuter(0)}const Q=D.append("g").call(K).attr("class",Vt.bubbleChartXAxis);p&&p(Q),H.attr("transform","translate("+(z+_+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",Vt.bubbleChartGridGlobal),d=a.ticks(n);l&&c.append("g").selectAll("line").data(d).join("line").attr("class",Vt.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",Vt.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:D,yScale:j,xScale:J,yTicksCount:Z,drawGridY:x,drawGridX:C}),Q.attr("transform","translate(0, "+(j(W[0])+(n||0))+")");const $=D.append("g").selectAll("dot").data(a).enter().append("circle").attr("class",Vt.bubbleChartCircle).attr("cx",e=>{let{xValue:t}=e;return J(t)}).attr("cy",e=>{let{yValue:t}=e;return j(t)}).attr("r",e=>{let{sizeValue:t}=e;return V(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||L||""});w&&(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("."+Vt.bubbleChartTooltip);null===d.node()&&(d=o.select(s).append("div").attr("class",Vt.bubbleChartTooltip));let u=d.append("div").attr("class",Vt.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(qt,{className:Vt.bubbleChartTooltipFlex},l.createElement(he,{className:Vt.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:B,tooltipClassName:M,renderTooltip:A}),T&&T({svg:D,bubbles:$,yScale:j,xScale:J,sizeScale:V})}},Ht=e=>{const{className:t,style:a,children:r,tooltipRoot:i}=e,[s,c]=m();return n.useEffect(()=>{c&&Zt(c,e)},[c,e]),n.useEffect(()=>()=>(e=>{const t=e||document.querySelector("body");o.select(t).select("."+Vt.bubbleChartTooltip).remove()})(i),[i]),b(e.width,()=>Zt(c,e)),l.createElement("div",{className:t,style:a},l.createElement(jt,null),l.createElement(Ot,{ref:s},r))};Ht.defaultProps=Pt,exports.BarChart=lt,exports.BubbleChart=Ht,exports.CalendarChart=Ge,exports.ChartWrapper=h,exports.HorizontalBarChart=It,exports.LineChart=He,exports.PieChart=Se,exports.RadarChart=j,exports.SwipeScroll=T,exports.appendSvg=g,exports.barChartClassNames=Ke,exports.bubbleChartClassNames=Vt,exports.calendarChartClassNames=Ne,exports.horizontalBarChartClassNames=bt,exports.lineChartClassNames=Pe,exports.pieChartclassNames=Z,exports.radarChartclassNames=D,exports.useNode=m,exports.useResize=b;
|
|
2
|
+
//# sourceMappingURL=charts.cjs.production.min.js.map
|