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