@undp/data-viz 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),Oe=require("./index-BzeLQvXk.cjs"),we=require("./parse-hMnG_lRV.cjs"),je=require("./getSliderMarks-CtsEXiLV.cjs"),Te=require("./index-CZbIGs8q.cjs"),Le=require("./index-BXns0-ng.cjs"),Ve=require("./Modal-tXZlLE5s.cjs"),Se=require("./numberFormattingFunction-02t-wJta.cjs"),$e=require("./Tooltip-n8z5bfav.cjs"),A=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ae=require("./string2HTML-D2Avudmb.cjs"),Ke=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Fe=require("./AxisTitle-CK9YeovX.cjs"),Qe=require("./YAxesLabels-D8IydyZj.cjs"),qe=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Pe=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./linear-BVckp9RD.cjs"),He=require("./band-CAApY4Pd.cjs"),We=require("./use-in-view-sQJZ_xDO.cjs"),le=require("./proxy-BHRoeZgd.cjs"),Ue=require("./index-BW8iNx7E.cjs"),Ge=require("./GraphHeader.cjs"),Xe=require("./GraphFooter.cjs"),Ye=require("./ColorLegendWithMouseOver.cjs"),_e=require("./Colors.cjs"),ze=require("./EmptyState-d8_8SxeW.cjs"),Me=require("./index-BW_-wD2k.cjs"),ke=require("./ensureCompleteData-DqWQ2Zbi.cjs"),Je=require("./init-DU0ybBc_.cjs"),Ze=require("./Axis-DE7dSn1_.cjs"),et=require("./XAxesLabels-OjBNl_lS.cjs");function tt(ye){const{data:o,dotColors:p,suffix:_,prefix:z,barPadding:v,showValues:ue,showTicks:Z,leftMargin:ee,truncateBy:xe,width:te,height:ie,rightMargin:J,topMargin:N,bottomMargin:s,radius:F,showLabels:ce,tooltip:O,onSeriesMouseOver:q,maxValue:E,minValue:ae,onSeriesMouseClick:B,selectedColor:I,arrowConnector:R,connectorStrokeWidth:pe,maxBarThickness:re,minBarThickness:ne,resetSelectionOnDoubleClick:ge,detailsOnClick:w,axisTitle:U,noOfTicks:fe,valueColor:se,styles:c,classNames:m,labelOrder:D,refValues:oe,rtl:y,animate:l,precision:M,customLayers:G,highlightedDataPoints:X,dimmedOpacity:L}=ye,j=x.useRef(null),h=We.useInView(j,{once:l.once,amount:l.amount}),d={top:U?N+25:N,bottom:s,left:ee,right:J},H=te-d.left-d.right,W=ie-d.top-d.bottom,[K,P]=x.useState(void 0),[C,b]=x.useState(void 0),[S,Q]=x.useState(void 0),[V,$]=x.useState(void 0),Y=o.map((t,n)=>({...t,id:D?`${t.label}`:`${n}`})),k=D||Y.map(t=>`${t.id}`),g=Be.linear().domain([ae,E]).range([0,H]).nice(),T=He.band().domain(k).range([0,ne?Math.max(W,ne*Y.length):re?Math.min(W,re*Y.length):W]).paddingInner(v),a=g.ticks(fe);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsxs(le.motion.svg,{width:`${te}px`,height:`${ie}px`,viewBox:`0 0 ${te} ${ie}`,direction:"ltr",ref:j,children:[R?i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:i.jsxRuntimeExports.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-primary-gray-600 dark:fill-primary-gray-300"})})}):null,i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[Z?i.jsxRuntimeExports.jsx(Ke.XTicksAndGridLines,{values:a.filter((t,n)=>n!==0),x:a.filter((t,n)=>n!==0).map(t=>g(t)),y1:0-N,y2:W+d.bottom,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:m?.xAxis?.gridLines,labels:m?.xAxis?.labels},suffix:_,prefix:z,labelType:"secondary",showGridLines:!0,precision:M}):null,i.jsxRuntimeExports.jsx(Fe.AxisTitle,{x:H/2,y:0-d.top+15,style:c?.xAxis?.title,className:m?.xAxis?.title,text:U}),i.jsxRuntimeExports.jsx(qe.YTicksAndGridLines,{y:Y.map(t=>T(`${t.id}`)+T.bandwidth()/2),x1:0,x2:H,styles:{gridLines:c?.yAxis?.gridLines},classNames:{gridLines:m?.yAxis?.gridLines},labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:M}),G.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Ue.AnimatePresence,{children:[Y.map(t=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{x:0,y:T(`${t.id}`)+T.bandwidth()/2,opacity:X.length!==0?X.indexOf(t.label)!==-1?.85:L:.85},whileInView:{x:0,y:T(`${t.id}`)+T.bandwidth()/2,opacity:X.length!==0?X.indexOf(t.label)!==-1?.85:L:.85,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",exit:{opacity:0,transition:{duration:l.duration}},children:[ce?i.jsxRuntimeExports.jsx(Qe.YAxesLabels,{value:`${t.label}`.length<xe?`${t.label}`:`${`${t.label}`.substring(0,xe)}...`,y:0-T.bandwidth()/2,x:0-d.left,width:d.left,height:T.bandwidth(),alignment:"right",style:c?.yAxis?.labels,className:m?.yAxis?.labels,animate:l,isInView:h}):null,i.jsxRuntimeExports.jsx(le.motion.line,{y1:0,y2:0,style:{strokeWidth:pe,...c?.dataConnectors||{},opacity:I?.3:1},className:i.mo("stroke-primary-gray-600 dark:stroke-primary-gray-300",m?.dataConnectors),markerEnd:R&&t.x.indexOf(Math.min(...t.x.filter(n=>n!==null)))===0?"url(#arrow)":"",markerStart:R&&t.x.indexOf(Math.min(...t.x.filter(n=>n!==null)))===t.x.length-1?"url(#arrow)":"",exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x1:0,x2:0},whileInView:{x1:g(Math.min(...t.x.filter(n=>n!==null)))+F,x2:g(Math.max(...t.x.filter(n=>n!==null)))-F,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}),t.x.map((n,f)=>i.jsxRuntimeExports.jsx(le.motion.g,{onMouseEnter:de=>{P({...t,xIndex:f}),$(de.clientY),Q(de.clientX),q?.({...t,xIndex:f})},onClick:()=>{(B||w)&&(Le.isEqual(C,{...t,xIndex:f})&&ge?(b(void 0),B?.(void 0)):(b({...t,xIndex:f}),B&&B({...t,xIndex:f})))},onMouseMove:de=>{P({...t,xIndex:f}),$(de.clientY),Q(de.clientX)},onMouseLeave:()=>{P(void 0),Q(void 0),$(void 0),q?.(void 0)},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{opacity:I?p[f]===I?1:.3:1},whileInView:{opacity:I?p[f]===I?1:.3:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:A.checkIfNullOrUndefined(n)?null:i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,r:F,style:{fill:p[f],fillOpacity:.85,stroke:p[f],strokeWidth:1,opacity:A.checkIfNullOrUndefined(n)?0:1},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{cx:g(0),opacity:0},whileInView:{cx:g(n||0),opacity:A.checkIfNullOrUndefined(n)?0:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}),ue?i.jsxRuntimeExports.jsx(le.motion.text,{y:0,style:{fill:se||p[f],textAnchor:"middle",...c?.graphObjectValues||{}},dx:0,dy:0-F-3,className:i.mo("graph-value text-sm font-bold",A.checkIfNullOrUndefined(n)?"0opacity-0":"opacity-100",m?.graphObjectValues),exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:g(0),opacity:0},whileInView:{x:g(n||0),opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:Se.numberFormattingFunction(n,"NA",M,z,_)}):null]})},f))]},t.label)),oe?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:oe.map((t,n)=>i.jsxRuntimeExports.jsx(Pe.RefLineX,{text:t.text,color:t.color,x:g(t.value),y1:0-d.top,y2:W+d.bottom,textSide:g(t.value)>H*.75||y?"left":"right",classNames:t.classNames,styles:t.styles,animate:l,isInView:h},n))}):null]}),G.filter(t=>t.position==="after").map(t=>t.layer)]})]}),K&&O&&S&&V?i.jsxRuntimeExports.jsx($e.Tooltip,{data:K,body:O,xPos:S,yPos:V,backgroundStyle:c?.tooltip,className:m?.tooltip}):null,w&&C!==void 0?i.jsxRuntimeExports.jsx(Ve.X,{open:C!==void 0,onClose:()=>{b(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:Ae.string2HTML(w,C)}:void 0,children:typeof w=="function"?w(C):null})}):null]})}function it(ye){const{data:o,graphTitle:p,colors:_=_e.Colors.light.categoricalColors.colors,sources:z,graphDescription:v,barPadding:ue=.25,showTicks:Z=!0,leftMargin:ee=100,rightMargin:xe=40,topMargin:te=20,bottomMargin:ie=10,truncateBy:J=999,height:N,width:s,footNote:F,colorDomain:ce,colorLegendTitle:O,padding:q,backgroundColor:E=!1,radius:ae=3,showLabels:B=!0,tooltip:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne="",prefix:ge="",maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se=!1,dataDownload:c=!1,showValues:m=!0,sortParameter:D,arrowConnector:oe=!1,connectorStrokeWidth:y=2,language:l="en",minHeight:M=0,theme:G="light",labelOrder:X,maxBarThickness:L,maxNumberOfBars:j,minBarThickness:h,ariaLabel:d,resetSelectionOnDoubleClick:H=!0,detailsOnClick:W,axisTitle:K,noOfTicks:P=5,valueColor:C,styles:b,classNames:S,refValues:Q,filterNA:V=!0,animate:$=!1,precision:Y=2,customLayers:k=[],showColorScale:g=!0,highlightedDataPoints:T=[],dimmedOpacity:a=.3,timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ye,[n,f]=x.useState(0),[de,Ee]=x.useState(0),[me,Ne]=x.useState(t.autoplay),u=je.sort(Te.uniqBy(o.filter(e=>e.date!==void 0&&e.date!==null),e=>e.date).map(e=>we.parse(`${e.date}`,t.dateFormat||"yyyy",new Date).getTime()),(e,r)=>Je.ascending(e,r)),[be,ve]=x.useState(t.autoplay?0:u.length-1),[Ie,De]=x.useState(void 0),he=x.useRef(null),Re=x.useRef(null);x.useEffect(()=>{const e=new ResizeObserver(r=>{f(s||r[0].target.clientWidth||620),Ee(N||r[0].target.clientHeight||480)});return he.current&&(Ee(he.current.clientHeight||480),f(he.current.clientWidth||620),s||e.observe(he.current)),()=>e.disconnect()},[s,N]),x.useEffect(()=>{const e=setInterval(()=>{ve(r=>r<u.length-1?r+1:0)},(t.speed||2)*1e3);return me||clearInterval(e),()=>clearInterval(e)},[u,me,t.speed]);const Ce=je.getSliderMarks(u,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,S?.graphContainer),style:{...b?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:re,ref:Re,"aria-label":d||`${p?`The graph shows ${p}. `:""}This is a dumbbell chart that shows comparisons between two or more data points across categories. ${v?` ${v}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?q||"1rem":q||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||v||se||c?i.jsxRuntimeExports.jsx(Ge.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:S?.title,description:S?.description},graphTitle:p,graphDescription:v,width:s,graphDownload:se?Re.current:void 0,dataDownload:c?o.map(e=>e.data).filter(e=>e!==void 0).length>0?o.map(e=>e.data).filter(e=>e!==void 0):o.filter(e=>e!==void 0):null}):null,t.enabled&&u.length>0&&Ce?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ne(!me)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":me?"Click to pause animation":"Click to play animation",children:me?i.jsxRuntimeExports.jsx(Me.Pause,{}):i.jsxRuntimeExports.jsx(Me.Play,{})}),i.jsxRuntimeExports.jsx(je.xr,{min:u[0],max:u[u.length-1],marks:Ce,step:null,defaultValue:u[u.length-1],value:u[be],onChangeComplete:e=>{ve(u.indexOf(e))},onChange:e=>{ve(u.indexOf(e))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(ze.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[g?i.jsxRuntimeExports.jsx(Ye.ColorLegendWithMouseOver,{width:s,colorDomain:ce,colors:_,colorLegendTitle:O,setSelectedColor:De,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow w-full justify-center leading-0",ref:he,"aria-label":"Graph area",children:(s||n)&&(N||de)?i.jsxRuntimeExports.jsx(tt,{data:D!==void 0?D==="diff"?Oe.sortBy(ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(u[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[e.x.length-1])||A.checkIfNullOrUndefined(e.x[0])?-1/0:e.x[e.x.length-1]-e.x[0]).reverse().filter((e,r)=>j?r<j:!0):Oe.sortBy(ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(u[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[D])?-1/0:e.x[D]).reverse().filter((e,r)=>j?r<j:!0):ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>V?!e.x.every(r=>r==null):e).filter((e,r)=>j?r<j:!0),dotColors:_,width:s||n,height:Math.max(M,N||(R?M?(s||n)*R>M?(s||n)*R:M:(s||n)*R:de)),suffix:ne,prefix:ge,radius:ae,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,truncateBy:J,showLabels:B,showValues:m,tooltip:I,onSeriesMouseOver:pe,maxValue:A.checkIfNullOrUndefined(w)?Math.max(...o.map(e=>Math.max(...e.x.filter(r=>r!==null))))<0?0:Math.max(...o.map(e=>Math.max(...e.x.filter(r=>r!==null)))):w,minValue:A.checkIfNullOrUndefined(U)?Math.min(...o.map(e=>Math.min(...e.x.filter(r=>r!==null))))>0?0:Math.min(...o.map(e=>Math.min(...e.x.filter(r=>r!==null)))):U,onSeriesMouseClick:fe,selectedColor:Ie,arrowConnector:oe,connectorStrokeWidth:y,maxBarThickness:L,minBarThickness:h,resetSelectionOnDoubleClick:H,detailsOnClick:W,axisTitle:K,noOfTicks:P,valueColor:C,styles:b,classNames:S,labelOrder:X,refValues:Q,rtl:l==="he"||l==="ar",animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},precision:Y,customLayers:k,highlightedDataPoints:T,dimmedOpacity:a}):null})]})}),z||F?i.jsxRuntimeExports.jsx(Xe.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:z,footNote:F,width:s}):null]})})})})}function at(ye){const{data:o,dotColors:p,barPadding:_,showTicks:z,leftMargin:v,truncateBy:ue,width:Z,height:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,radius:J,showLabels:N,tooltip:s,onSeriesMouseOver:F,maxValue:ce,minValue:O,onSeriesMouseClick:q,showValues:E,suffix:ae,prefix:B,selectedColor:I,arrowConnector:R,connectorStrokeWidth:pe,maxBarThickness:re,minBarThickness:ne,resetSelectionOnDoubleClick:ge,detailsOnClick:w,axisTitle:U,noOfTicks:fe,valueColor:se,styles:c,classNames:m,labelOrder:D,refValues:oe,animate:y,precision:l,customLayers:M,highlightedDataPoints:G,dimmedOpacity:X}=ye,L=x.useRef(null),j=We.useInView(L,{once:y.once,amount:y.amount}),h={top:te,bottom:ie,left:U?v+30:v,right:xe},d=Z-h.left-h.right,H=ee-h.top-h.bottom,[W,K]=x.useState(void 0),[P,C]=x.useState(void 0),[b,S]=x.useState(void 0),[Q,V]=x.useState(void 0),$=o.map((a,t)=>({...a,id:D?`${a.label}`:`${t}`})),Y=D||$.map(a=>`${a.id}`),k=Be.linear().domain([O,ce]).range([H,0]).nice(),g=He.band().domain(Y).range([0,ne?Math.max(d,ne*$.length):re?Math.min(d,re*$.length):d]).paddingInner(_),T=k.ticks(fe);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsxs(le.motion.svg,{width:`${Z}px`,height:`${ee}px`,viewBox:`0 0 ${Z} ${ee}`,direction:"ltr",ref:L,children:[R?i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:i.jsxRuntimeExports.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-primary-gray-600 dark:fill-primary-gray-300"})})}):null,i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsx(Ze.Axis,{y1:k(O<0?0:O),y2:k(O<0?0:O),x1:0-v,x2:d+h.right,label:Se.numberFormattingFunction(O<0?0:O,"NA",l,B,ae),labelPos:{x:0-v,dx:0,dy:ce<0?"1em":-5,y:k(O<0?0:O)},classNames:{axis:m?.xAxis?.axis,label:m?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),z?i.jsxRuntimeExports.jsx(qe.YTicksAndGridLines,{values:T.filter(a=>a!==0),y:T.filter(a=>a!==0).map(a=>k(a)),x1:0-v,x2:d+h.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:m?.yAxis?.gridLines,labels:m?.yAxis?.labels},suffix:ae,prefix:B,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:l}):null,i.jsxRuntimeExports.jsx(Fe.AxisTitle,{x:0-v-15,y:H/2,style:c?.yAxis?.title,className:m?.yAxis?.title,text:U,rotate90:!0}),M.filter(a=>a.position==="before").map(a=>a.layer),i.jsxRuntimeExports.jsxs(Ue.AnimatePresence,{children:[$.map(a=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{x:g(`${a.id}`)+g.bandwidth()/2,y:0,opacity:G.length!==0?G.indexOf(a.label)!==-1?.85:X:.85},whileInView:{x:g(`${a.id}`)+g.bandwidth()/2,y:0,opacity:G.length!==0?G.indexOf(a.label)!==-1?.85:X:.85,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:y.duration}},children:[N?i.jsxRuntimeExports.jsx(et.XAxesLabels,{value:`${a.label}`.length<ue?`${a.label}`:`${`${a.label}`.substring(0,ue)}...`,y:H+5,x:0-g.bandwidth()/2,width:g.bandwidth(),height:h.bottom,style:c?.xAxis?.labels,className:m?.xAxis?.labels,alignment:"top",animate:y,isInView:j}):null,i.jsxRuntimeExports.jsx(le.motion.line,{x1:0,x2:0,style:{strokeWidth:pe,...c?.dataConnectors||{},opacity:I?.3:1},className:i.mo("stroke-primary-gray-600 dark:stroke-primary-gray-300",m?.dataConnectors),markerEnd:R&&a.x.indexOf(Math.min(...a.x.filter(t=>t!==null)))===0?"url(#arrow)":"",markerStart:R&&a.x.indexOf(Math.min(...a.x.filter(t=>t!==null)))===a.x.length-1?"url(#arrow)":"",exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{y1:0,y2:0},whileInView:{y1:k(Math.min(...a.x.filter(t=>t!==null)))+J,y2:k(Math.max(...a.x.filter(t=>t!==null)))-J,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial"}),a.x.map((t,n)=>i.jsxRuntimeExports.jsx(le.motion.g,{onMouseEnter:f=>{K({...a,xIndex:n}),V(f.clientY),S(f.clientX),F?.({...a,xIndex:n})},onClick:()=>{(q||w)&&(Le.isEqual(P,{...a,xIndex:n})&&ge?(C(void 0),q?.(void 0)):(C({...a,xIndex:n}),q&&q({...a,xIndex:n})))},onMouseMove:f=>{K({...a,xIndex:n}),V(f.clientY),S(f.clientX)},onMouseLeave:()=>{K(void 0),S(void 0),V(void 0),F?.(void 0)},exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{opacity:I?p[n]===I?1:.3:1},whileInView:{opacity:I?p[n]===I?1:.3:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",children:A.checkIfNullOrUndefined(t)?null:i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.circle,{cx:0,r:J,style:{fill:p[n],fillOpacity:.85,stroke:p[n],strokeWidth:1},exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{cy:k(0),opacity:0},whileInView:{cy:k(t||0),opacity:A.checkIfNullOrUndefined(t)?0:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial"}),E?i.jsxRuntimeExports.jsx(le.motion.text,{x:0,style:{fill:se||p[n],textAnchor:"start",...c?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",A.checkIfNullOrUndefined(t)?"opacity-0":"opacity-100",m?.graphObjectValues),dx:J+3,dy:"0.33em",exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{y:k(0),opacity:0},whileInView:{y:k(t||0),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",children:Se.numberFormattingFunction(t,"NA",l,B,ae)}):null]})},n))]},a.label)),oe?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:oe.map((a,t)=>i.jsxRuntimeExports.jsx(Pe.RefLineY,{text:a.text,color:a.color,y:k(a.value),x1:0-v,x2:d+h.right,classNames:a.classNames,styles:a.styles,animate:y,isInView:j},t))}):null]}),M.filter(a=>a.position==="after").map(a=>a.layer)]})]}),W&&s&&b&&Q?i.jsxRuntimeExports.jsx($e.Tooltip,{data:W,body:s,xPos:b,yPos:Q,backgroundStyle:c?.tooltip,className:m?.tooltip}):null,w&&P!==void 0?i.jsxRuntimeExports.jsx(Ve.X,{open:P!==void 0,onClose:()=>{C(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:Ae.string2HTML(w,P)}:void 0,children:typeof w=="function"?w(P):null})}):null]})}function rt(ye){const{data:o,graphTitle:p,colors:_=_e.Colors.light.categoricalColors.colors,sources:z,graphDescription:v,barPadding:ue=.25,showTicks:Z=!0,leftMargin:ee=20,rightMargin:xe=20,topMargin:te=20,bottomMargin:ie=25,truncateBy:J=999,height:N,width:s,footNote:F,colorDomain:ce,colorLegendTitle:O,padding:q,backgroundColor:E=!1,radius:ae=3,tooltip:B,showLabels:I=!0,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne="",prefix:ge="",maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se=!1,dataDownload:c=!1,showValues:m=!0,sortParameter:D,arrowConnector:oe=!1,connectorStrokeWidth:y=2,language:l="en",minHeight:M=0,theme:G="light",maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:h,resetSelectionOnDoubleClick:d=!0,detailsOnClick:H,axisTitle:W,noOfTicks:K=5,valueColor:P,styles:C,classNames:b,labelOrder:S,refValues:Q,filterNA:V=!0,animate:$=!1,precision:Y=2,customLayers:k=[],showColorScale:g=!0,highlightedDataPoints:T=[],dimmedOpacity:a=.3,timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ye,[n,f]=x.useState(0),[de,Ee]=x.useState(0),[me,Ne]=x.useState(t.autoplay),u=je.sort(Te.uniqBy(o.filter(e=>e.date!==void 0&&e.date!==null),e=>e.date).map(e=>we.parse(`${e.date}`,t.dateFormat||"yyyy",new Date).getTime()),(e,r)=>Je.ascending(e,r)),[be,ve]=x.useState(t.autoplay?0:u.length-1),[Ie,De]=x.useState(void 0),he=x.useRef(null),Re=x.useRef(null);x.useEffect(()=>{const e=new ResizeObserver(r=>{f(s||r[0].target.clientWidth||620),Ee(N||r[0].target.clientHeight||480)});return he.current&&(Ee(he.current.clientHeight||480),f(he.current.clientWidth||620),s||e.observe(he.current)),()=>e.disconnect()},[s,N]),x.useEffect(()=>{const e=setInterval(()=>{ve(r=>r<u.length-1?r+1:0)},(t.speed||2)*1e3);return me||clearInterval(e),()=>clearInterval(e)},[u,me,t.speed]);const Ce=je.getSliderMarks(u,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,b?.graphContainer),style:{...C?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:re,ref:Re,"aria-label":h||`${p?`The graph shows ${p}. `:""}This is a dumbbell chart that shows comparisons between two or more data points across categories. ${v?` ${v}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?q||"1rem":q||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||v||se||c?i.jsxRuntimeExports.jsx(Ge.GraphHeader,{styles:{title:C?.title,description:C?.description},classNames:{title:b?.title,description:b?.description},graphTitle:p,graphDescription:v,width:s,graphDownload:se?Re.current:void 0,dataDownload:c?o.map(e=>e.data).filter(e=>e!==void 0).length>0?o.map(e=>e.data).filter(e=>e!==void 0):o.filter(e=>e!==void 0):null}):null,t.enabled&&u.length>0&&Ce?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ne(!me)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":me?"Click to pause animation":"Click to play animation",children:me?i.jsxRuntimeExports.jsx(Me.Pause,{}):i.jsxRuntimeExports.jsx(Me.Play,{})}),i.jsxRuntimeExports.jsx(je.xr,{min:u[0],max:u[u.length-1],marks:Ce,step:null,defaultValue:u[u.length-1],value:u[be],onChangeComplete:e=>{ve(u.indexOf(e))},onChange:e=>{ve(u.indexOf(e))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(ze.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[g?i.jsxRuntimeExports.jsx(Ye.ColorLegendWithMouseOver,{width:s,colorDomain:ce,colors:_,colorLegendTitle:O,setSelectedColor:De,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow w-full justify-center leading-0",ref:he,"aria-label":"Graph area",children:(s||n)&&(N||de)?i.jsxRuntimeExports.jsx(at,{data:D!==void 0?D==="diff"?Oe.sortBy(ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(u[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[e.x.length-1])||A.checkIfNullOrUndefined(e.x[0])?-1/0:e.x[e.x.length-1]-e.x[0]).filter((e,r)=>L?r<L:!0):Oe.sortBy(ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(u[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[D])?-1/0:e.x[D]).filter((e,r)=>L?r<L:!0):ke.ensureCompleteDataForDumbbellChart(o,t.dateFormat||"yyyy").filter(e=>V?!e.x.every(r=>r==null):e).filter((e,r)=>L?r<L:!0),dotColors:_,width:s||n,height:Math.max(M,N||(R?M?(s||n)*R>M?(s||n)*R:M:(s||n)*R:de)),radius:ae,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,truncateBy:J,showLabels:I,showValues:m,tooltip:B,suffix:ne,prefix:ge,onSeriesMouseOver:pe,maxValue:A.checkIfNullOrUndefined(w)?Math.max(...o.map(e=>Math.max(...e.x.filter(r=>r!==null))))<0?0:Math.max(...o.map(e=>Math.max(...e.x.filter(r=>r!==null)))):w,minValue:A.checkIfNullOrUndefined(U)?Math.min(...o.map(e=>Math.min(...e.x.filter(r=>r!==null))))>0?0:Math.min(...o.map(e=>Math.min(...e.x.filter(r=>r!==null)))):U,onSeriesMouseClick:fe,selectedColor:Ie,arrowConnector:oe,connectorStrokeWidth:y,maxBarThickness:X,minBarThickness:j,resetSelectionOnDoubleClick:d,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,styles:C,classNames:b,labelOrder:S,refValues:Q,animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},precision:Y,customLayers:k,highlightedDataPoints:T,dimmedOpacity:a}):null})]})}),z||F?i.jsxRuntimeExports.jsx(Xe.GraphFooter,{styles:{footnote:C?.footnote,source:C?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:z,footNote:F,width:s}):null]})})})})}function nt(ye){const{data:o,graphTitle:p,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:ce,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:c,showValues:m,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:l,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:h,resetSelectionOnDoubleClick:d,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,orientation:C="vertical",styles:b,classNames:S,labelOrder:Q,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:g,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n}=ye;return C==="vertical"?i.jsxRuntimeExports.jsx(rt,{data:o,graphTitle:p,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:ce,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:c,showValues:m,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:l,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:h,resetSelectionOnDoubleClick:d,styles:b,detailsOnClick:H,axisTitle:W,noOfTicks:K,labelOrder:Q,valueColor:P,classNames:S,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:g,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n}):i.jsxRuntimeExports.jsx(it,{data:o,graphTitle:p,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:xe,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:ce,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:c,showValues:m,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:l,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:h,resetSelectionOnDoubleClick:d,styles:b,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,classNames:S,labelOrder:Q,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:g,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n})}exports.DumbbellChart=nt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),we=require("./parse-hMnG_lRV.cjs"),je=require("./getSliderMarks-CtsEXiLV.cjs"),Le=require("./index-CZbIGs8q.cjs"),Me=require("./index-BczVvEBZ.cjs"),Ve=require("./index-BXns0-ng.cjs"),$e=require("./Modal-tXZlLE5s.cjs"),Te=require("./numberFormattingFunction-02t-wJta.cjs"),Ae=require("./Tooltip-n8z5bfav.cjs"),A=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Fe=require("./string2HTML-D2Avudmb.cjs"),Qe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),qe=require("./AxisTitle-CK9YeovX.cjs"),Ze=require("./YAxesLabels-D8IydyZj.cjs"),Pe=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Be=require("./ReferenceLine-CFVBBN__.cjs"),He=require("./linear-BVckp9RD.cjs"),We=require("./band-CAApY4Pd.cjs"),Ue=require("./use-in-view-sQJZ_xDO.cjs"),le=require("./proxy-BHRoeZgd.cjs"),Ge=require("./index-BW8iNx7E.cjs"),Xe=require("./GraphHeader.cjs"),Ye=require("./GraphFooter.cjs"),_e=require("./ColorLegendWithMouseOver.cjs"),ze=require("./Colors.cjs"),Je=require("./EmptyState-d8_8SxeW.cjs"),Ne=require("./index-BW_-wD2k.cjs"),ke=require("./ensureCompleteData-DqWQ2Zbi.cjs"),Ke=require("./init-DU0ybBc_.cjs"),et=require("./Axis-DE7dSn1_.cjs"),tt=require("./XAxesLabels-OjBNl_lS.cjs");function it(ye){const{data:l,dotColors:g,suffix:_,prefix:z,barPadding:v,showValues:ue,showTicks:Z,leftMargin:ee,truncateBy:ce,width:te,height:ie,rightMargin:J,topMargin:N,bottomMargin:s,radius:F,showLabels:xe,tooltip:O,onSeriesMouseOver:q,maxValue:E,minValue:ae,onSeriesMouseClick:B,selectedColor:I,arrowConnector:R,connectorStrokeWidth:pe,maxBarThickness:re,minBarThickness:ne,resetSelectionOnDoubleClick:ge,detailsOnClick:w,axisTitle:U,noOfTicks:fe,valueColor:se,styles:d,classNames:h,labelOrder:D,refValues:oe,rtl:y,animate:u,precision:M,customLayers:G,highlightedDataPoints:X,dimmedOpacity:L}=ye,j=x.useRef(null),p=Ue.useInView(j,{once:u.once,amount:u.amount}),m={top:U?N+25:N,bottom:s,left:ee,right:J},H=te-m.left-m.right,W=ie-m.top-m.bottom,[K,P]=x.useState(void 0),[C,b]=x.useState(void 0),[S,Q]=x.useState(void 0),[V,$]=x.useState(void 0),Y=l.map((t,n)=>({...t,id:D?`${t.label}`:`${n}`})),k=D||Y.map(t=>`${t.id}`),f=He.linear().domain([ae,E]).range([0,H]).nice(),T=We.band().domain(k).range([0,ne?Math.max(W,ne*Y.length):re?Math.min(W,re*Y.length):W]).paddingInner(v),a=f.ticks(fe);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsxs(le.motion.svg,{width:`${te}px`,height:`${ie}px`,viewBox:`0 0 ${te} ${ie}`,direction:"ltr",ref:j,children:[R?i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:i.jsxRuntimeExports.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-primary-gray-600 dark:fill-primary-gray-300"})})}):null,i.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[Z?i.jsxRuntimeExports.jsx(Qe.XTicksAndGridLines,{values:a.filter((t,n)=>n!==0),x:a.filter((t,n)=>n!==0).map(t=>f(t)),y1:0-N,y2:W+m.bottom,styles:{gridLines:d?.xAxis?.gridLines,labels:d?.xAxis?.labels},classNames:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},suffix:_,prefix:z,labelType:"secondary",showGridLines:!0,precision:M}):null,i.jsxRuntimeExports.jsx(qe.AxisTitle,{x:H/2,y:0-m.top+15,style:d?.xAxis?.title,className:h?.xAxis?.title,text:U}),i.jsxRuntimeExports.jsx(Pe.YTicksAndGridLines,{y:Y.map(t=>T(`${t.id}`)+T.bandwidth()/2),x1:0,x2:H,styles:{gridLines:d?.yAxis?.gridLines},classNames:{gridLines:h?.yAxis?.gridLines},labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:M}),G.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[Y.map(t=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{x:0,y:T(`${t.id}`)+T.bandwidth()/2,opacity:X.length!==0?X.indexOf(t.label)!==-1?.85:L:.85},whileInView:{x:0,y:T(`${t.id}`)+T.bandwidth()/2,opacity:X.length!==0?X.indexOf(t.label)!==-1?.85:L:.85,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:u.duration}},children:[xe?i.jsxRuntimeExports.jsx(Ze.YAxesLabels,{value:`${t.label}`.length<ce?`${t.label}`:`${`${t.label}`.substring(0,ce)}...`,y:0-T.bandwidth()/2,x:0-m.left,width:m.left,height:T.bandwidth(),alignment:"right",style:d?.yAxis?.labels,className:h?.yAxis?.labels,animate:u,isInView:p}):null,i.jsxRuntimeExports.jsx(le.motion.line,{y1:0,y2:0,style:{strokeWidth:pe,...d?.dataConnectors||{},opacity:I?.3:1},className:i.mo("stroke-primary-gray-600 dark:stroke-primary-gray-300",h?.dataConnectors),markerEnd:R&&t.x.indexOf(Math.min(...t.x.filter(n=>n!==null)))===0?"url(#arrow)":"",markerStart:R&&t.x.indexOf(Math.min(...t.x.filter(n=>n!==null)))===t.x.length-1?"url(#arrow)":"",exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{x1:0,x2:0},whileInView:{x1:f(Math.min(...t.x.filter(n=>n!==null)))+F,x2:f(Math.max(...t.x.filter(n=>n!==null)))-F,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial"}),t.x.map((n,o)=>i.jsxRuntimeExports.jsx(le.motion.g,{onMouseEnter:de=>{P({...t,xIndex:o}),$(de.clientY),Q(de.clientX),q?.({...t,xIndex:o})},onClick:()=>{(B||w)&&(Ve.isEqual(C,{...t,xIndex:o})&&ge?(b(void 0),B?.(void 0)):(b({...t,xIndex:o}),B&&B({...t,xIndex:o})))},onMouseMove:de=>{P({...t,xIndex:o}),$(de.clientY),Q(de.clientX)},onMouseLeave:()=>{P(void 0),Q(void 0),$(void 0),q?.(void 0)},exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{opacity:I?g[o]===I?1:.3:1},whileInView:{opacity:I?g[o]===I?1:.3:1,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",children:A.checkIfNullOrUndefined(n)?null:i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,r:F,style:{fill:g[o],fillOpacity:.85,stroke:g[o],strokeWidth:1,opacity:A.checkIfNullOrUndefined(n)?0:1},exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{cx:f(0),opacity:0},whileInView:{cx:f(n||0),opacity:A.checkIfNullOrUndefined(n)?0:1,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial"}),ue?i.jsxRuntimeExports.jsx(le.motion.text,{y:0,style:{fill:se||g[o],textAnchor:"middle",...d?.graphObjectValues||{}},dx:0,dy:0-F-3,className:i.mo("graph-value text-sm font-bold",A.checkIfNullOrUndefined(n)?"0opacity-0":"opacity-100",h?.graphObjectValues),exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{x:f(0),opacity:0},whileInView:{x:f(n||0),opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",children:Te.numberFormattingFunction(n,"NA",M,z,_)}):null]})},o))]},t.label)),oe?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:oe.map((t,n)=>i.jsxRuntimeExports.jsx(Be.RefLineX,{text:t.text,color:t.color,x:f(t.value),y1:0-m.top,y2:W+m.bottom,textSide:f(t.value)>H*.75||y?"left":"right",classNames:t.classNames,styles:t.styles,animate:u,isInView:p},n))}):null]}),G.filter(t=>t.position==="after").map(t=>t.layer)]})]}),K&&O&&S&&V?i.jsxRuntimeExports.jsx(Ae.Tooltip,{data:K,body:O,xPos:S,yPos:V,backgroundStyle:d?.tooltip,className:h?.tooltip}):null,w&&C!==void 0?i.jsxRuntimeExports.jsx($e.X,{open:C!==void 0,onClose:()=>{b(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:Fe.string2HTML(w,C)}:void 0,children:typeof w=="function"?w(C):null})}):null]})}function at(ye){const{data:l,graphTitle:g,colors:_=ze.Colors.light.categoricalColors.colors,sources:z,graphDescription:v,barPadding:ue=.25,showTicks:Z=!0,leftMargin:ee=100,rightMargin:ce=40,topMargin:te=20,bottomMargin:ie=10,truncateBy:J=999,height:N,width:s,footNote:F,colorDomain:xe,colorLegendTitle:O,padding:q,backgroundColor:E=!1,radius:ae=3,showLabels:B=!0,tooltip:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne="",prefix:ge="",maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se=!1,dataDownload:d=!1,showValues:h=!0,sortParameter:D,arrowConnector:oe=!1,connectorStrokeWidth:y=2,language:u="en",minHeight:M=0,theme:G="light",labelOrder:X,maxBarThickness:L,maxNumberOfBars:j,minBarThickness:p,ariaLabel:m,resetSelectionOnDoubleClick:H=!0,detailsOnClick:W,axisTitle:K,noOfTicks:P=5,valueColor:C,styles:b,classNames:S,refValues:Q,filterNA:V=!0,animate:$=!1,precision:Y=2,customLayers:k=[],showColorScale:f=!0,highlightedDataPoints:T=[],dimmedOpacity:a=.3,timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},sortData:n}=ye,[o,de]=x.useState(0),[Ee,Re]=x.useState(0),[me,Ie]=x.useState(t.autoplay),c=je.sort(Le.uniqBy(l.filter(e=>e.date!==void 0&&e.date!==null),e=>e.date).map(e=>we.parse(`${e.date}`,t.dateFormat||"yyyy",new Date).getTime()),(e,r)=>Ke.ascending(e,r)),[be,ve]=x.useState(t.autoplay?0:c.length-1),[De,Se]=x.useState(void 0),he=x.useRef(null),Ce=x.useRef(null);x.useEffect(()=>{const e=new ResizeObserver(r=>{de(s||r[0].target.clientWidth||620),Re(N||r[0].target.clientHeight||480)});return he.current&&(Re(he.current.clientHeight||480),de(he.current.clientWidth||620),s||e.observe(he.current)),()=>e.disconnect()},[s,N]),x.useEffect(()=>{const e=setInterval(()=>{ve(r=>r<c.length-1?r+1:0)},(t.speed||2)*1e3);return me||clearInterval(e),()=>clearInterval(e)},[c,me,t.speed]);const Oe=je.getSliderMarks(c,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:u==="he"||u==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${u||"en"}`,S?.graphContainer),style:{...b?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:re,ref:Ce,"aria-label":m||`${g?`The graph shows ${g}. `:""}This is a dumbbell chart that shows comparisons between two or more data points across categories. ${v?` ${v}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?q||"1rem":q||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[g||v||se||d?i.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:S?.title,description:S?.description},graphTitle:g,graphDescription:v,width:s,graphDownload:se?Ce.current:void 0,dataDownload:d?l.map(e=>e.data).filter(e=>e!==void 0).length>0?l.map(e=>e.data).filter(e=>e!==void 0):l.filter(e=>e!==void 0):null}):null,t.enabled&&c.length>0&&Oe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ie(!me)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":me?"Click to pause animation":"Click to play animation",children:me?i.jsxRuntimeExports.jsx(Ne.Pause,{}):i.jsxRuntimeExports.jsx(Ne.Play,{})}),i.jsxRuntimeExports.jsx(je.xr,{min:c[0],max:c[c.length-1],marks:Oe,step:null,defaultValue:c[c.length-1],value:c[be],onChangeComplete:e=>{ve(c.indexOf(e))},onChange:e=>{ve(c.indexOf(e))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:l.length===0?i.jsxRuntimeExports.jsx(Je.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[f?i.jsxRuntimeExports.jsx(_e.ColorLegendWithMouseOver,{width:s,colorDomain:xe,colors:_,colorLegendTitle:O,setSelectedColor:Se,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow w-full justify-center leading-0",ref:he,"aria-label":"Graph area",children:(s||o)&&(N||Ee)?i.jsxRuntimeExports.jsx(it,{data:D!==void 0?D==="diff"?Me.orderBy(ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(c[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[e.x.length-1])||A.checkIfNullOrUndefined(e.x[0])?-1/0:e.x[e.x.length-1]-e.x[0],[n||"asc"]).filter((e,r)=>j?r<j:!0):Me.orderBy(ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(c[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[D])?-1/0:e.x[D],[n||"asc"]).filter((e,r)=>j?r<j:!0):ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>V?!e.x.every(r=>r==null):e).filter((e,r)=>j?r<j:!0),dotColors:_,width:s||o,height:Math.max(M,N||(R?M?(s||o)*R>M?(s||o)*R:M:(s||o)*R:Ee)),suffix:ne,prefix:ge,radius:ae,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,truncateBy:J,showLabels:B,showValues:h,tooltip:I,onSeriesMouseOver:pe,maxValue:A.checkIfNullOrUndefined(w)?Math.max(...l.map(e=>Math.max(...e.x.filter(r=>r!==null))))<0?0:Math.max(...l.map(e=>Math.max(...e.x.filter(r=>r!==null)))):w,minValue:A.checkIfNullOrUndefined(U)?Math.min(...l.map(e=>Math.min(...e.x.filter(r=>r!==null))))>0?0:Math.min(...l.map(e=>Math.min(...e.x.filter(r=>r!==null)))):U,onSeriesMouseClick:fe,selectedColor:De,arrowConnector:oe,connectorStrokeWidth:y,maxBarThickness:L,minBarThickness:p,resetSelectionOnDoubleClick:H,detailsOnClick:W,axisTitle:K,noOfTicks:P,valueColor:C,styles:b,classNames:S,labelOrder:X,refValues:Q,rtl:u==="he"||u==="ar",animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},precision:Y,customLayers:k,highlightedDataPoints:T,dimmedOpacity:a}):null})]})}),z||F?i.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:z,footNote:F,width:s}):null]})})})})}function rt(ye){const{data:l,dotColors:g,barPadding:_,showTicks:z,leftMargin:v,truncateBy:ue,width:Z,height:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,radius:J,showLabels:N,tooltip:s,onSeriesMouseOver:F,maxValue:xe,minValue:O,onSeriesMouseClick:q,showValues:E,suffix:ae,prefix:B,selectedColor:I,arrowConnector:R,connectorStrokeWidth:pe,maxBarThickness:re,minBarThickness:ne,resetSelectionOnDoubleClick:ge,detailsOnClick:w,axisTitle:U,noOfTicks:fe,valueColor:se,styles:d,classNames:h,labelOrder:D,refValues:oe,animate:y,precision:u,customLayers:M,highlightedDataPoints:G,dimmedOpacity:X}=ye,L=x.useRef(null),j=Ue.useInView(L,{once:y.once,amount:y.amount}),p={top:te,bottom:ie,left:U?v+30:v,right:ce},m=Z-p.left-p.right,H=ee-p.top-p.bottom,[W,K]=x.useState(void 0),[P,C]=x.useState(void 0),[b,S]=x.useState(void 0),[Q,V]=x.useState(void 0),$=l.map((a,t)=>({...a,id:D?`${a.label}`:`${t}`})),Y=D||$.map(a=>`${a.id}`),k=He.linear().domain([O,xe]).range([H,0]).nice(),f=We.band().domain(Y).range([0,ne?Math.max(m,ne*$.length):re?Math.min(m,re*$.length):m]).paddingInner(_),T=k.ticks(fe);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsxs(le.motion.svg,{width:`${Z}px`,height:`${ee}px`,viewBox:`0 0 ${Z} ${ee}`,direction:"ltr",ref:L,children:[R?i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:i.jsxRuntimeExports.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-primary-gray-600 dark:fill-primary-gray-300"})})}):null,i.jsxRuntimeExports.jsxs("g",{transform:`translate(${p.left},${p.top})`,children:[i.jsxRuntimeExports.jsx(et.Axis,{y1:k(O<0?0:O),y2:k(O<0?0:O),x1:0-v,x2:m+p.right,label:Te.numberFormattingFunction(O<0?0:O,"NA",u,B,ae),labelPos:{x:0-v,dx:0,dy:xe<0?"1em":-5,y:k(O<0?0:O)},classNames:{axis:h?.xAxis?.axis,label:h?.yAxis?.labels},styles:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels}}),z?i.jsxRuntimeExports.jsx(Pe.YTicksAndGridLines,{values:T.filter(a=>a!==0),y:T.filter(a=>a!==0).map(a=>k(a)),x1:0-v,x2:m+p.right,styles:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},classNames:{gridLines:h?.yAxis?.gridLines,labels:h?.yAxis?.labels},suffix:ae,prefix:B,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:u}):null,i.jsxRuntimeExports.jsx(qe.AxisTitle,{x:0-v-15,y:H/2,style:d?.yAxis?.title,className:h?.yAxis?.title,text:U,rotate90:!0}),M.filter(a=>a.position==="before").map(a=>a.layer),i.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[$.map(a=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{x:f(`${a.id}`)+f.bandwidth()/2,y:0,opacity:G.length!==0?G.indexOf(a.label)!==-1?.85:X:.85},whileInView:{x:f(`${a.id}`)+f.bandwidth()/2,y:0,opacity:G.length!==0?G.indexOf(a.label)!==-1?.85:X:.85,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:y.duration}},children:[N?i.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${a.label}`.length<ue?`${a.label}`:`${`${a.label}`.substring(0,ue)}...`,y:H+5,x:0-f.bandwidth()/2,width:f.bandwidth(),height:p.bottom,style:d?.xAxis?.labels,className:h?.xAxis?.labels,alignment:"top",animate:y,isInView:j}):null,i.jsxRuntimeExports.jsx(le.motion.line,{x1:0,x2:0,style:{strokeWidth:pe,...d?.dataConnectors||{},opacity:I?.3:1},className:i.mo("stroke-primary-gray-600 dark:stroke-primary-gray-300",h?.dataConnectors),markerEnd:R&&a.x.indexOf(Math.min(...a.x.filter(t=>t!==null)))===0?"url(#arrow)":"",markerStart:R&&a.x.indexOf(Math.min(...a.x.filter(t=>t!==null)))===a.x.length-1?"url(#arrow)":"",exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{y1:0,y2:0},whileInView:{y1:k(Math.min(...a.x.filter(t=>t!==null)))+J,y2:k(Math.max(...a.x.filter(t=>t!==null)))-J,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial"}),a.x.map((t,n)=>i.jsxRuntimeExports.jsx(le.motion.g,{onMouseEnter:o=>{K({...a,xIndex:n}),V(o.clientY),S(o.clientX),F?.({...a,xIndex:n})},onClick:()=>{(q||w)&&(Ve.isEqual(P,{...a,xIndex:n})&&ge?(C(void 0),q?.(void 0)):(C({...a,xIndex:n}),q&&q({...a,xIndex:n})))},onMouseMove:o=>{K({...a,xIndex:n}),V(o.clientY),S(o.clientX)},onMouseLeave:()=>{K(void 0),S(void 0),V(void 0),F?.(void 0)},exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{opacity:I?g[n]===I?1:.3:1},whileInView:{opacity:I?g[n]===I?1:.3:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",children:A.checkIfNullOrUndefined(t)?null:i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.circle,{cx:0,r:J,style:{fill:g[n],fillOpacity:.85,stroke:g[n],strokeWidth:1},exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{cy:k(0),opacity:0},whileInView:{cy:k(t||0),opacity:A.checkIfNullOrUndefined(t)?0:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial"}),E?i.jsxRuntimeExports.jsx(le.motion.text,{x:0,style:{fill:se||g[n],textAnchor:"start",...d?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",A.checkIfNullOrUndefined(t)?"opacity-0":"opacity-100",h?.graphObjectValues),dx:J+3,dy:"0.33em",exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{y:k(0),opacity:0},whileInView:{y:k(t||0),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",children:Te.numberFormattingFunction(t,"NA",u,B,ae)}):null]})},n))]},a.label)),oe?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:oe.map((a,t)=>i.jsxRuntimeExports.jsx(Be.RefLineY,{text:a.text,color:a.color,y:k(a.value),x1:0-v,x2:m+p.right,classNames:a.classNames,styles:a.styles,animate:y,isInView:j},t))}):null]}),M.filter(a=>a.position==="after").map(a=>a.layer)]})]}),W&&s&&b&&Q?i.jsxRuntimeExports.jsx(Ae.Tooltip,{data:W,body:s,xPos:b,yPos:Q,backgroundStyle:d?.tooltip,className:h?.tooltip}):null,w&&P!==void 0?i.jsxRuntimeExports.jsx($e.X,{open:P!==void 0,onClose:()=>{C(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:Fe.string2HTML(w,P)}:void 0,children:typeof w=="function"?w(P):null})}):null]})}function nt(ye){const{data:l,graphTitle:g,colors:_=ze.Colors.light.categoricalColors.colors,sources:z,graphDescription:v,barPadding:ue=.25,showTicks:Z=!0,leftMargin:ee=20,rightMargin:ce=20,topMargin:te=20,bottomMargin:ie=25,truncateBy:J=999,height:N,width:s,footNote:F,colorDomain:xe,colorLegendTitle:O,padding:q,backgroundColor:E=!1,radius:ae=3,tooltip:B,showLabels:I=!0,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne="",prefix:ge="",maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se=!1,dataDownload:d=!1,showValues:h=!0,sortParameter:D,arrowConnector:oe=!1,connectorStrokeWidth:y=2,language:u="en",minHeight:M=0,theme:G="light",maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:p,resetSelectionOnDoubleClick:m=!0,detailsOnClick:H,axisTitle:W,noOfTicks:K=5,valueColor:P,styles:C,classNames:b,labelOrder:S,refValues:Q,filterNA:V=!0,animate:$=!1,precision:Y=2,customLayers:k=[],showColorScale:f=!0,highlightedDataPoints:T=[],dimmedOpacity:a=.3,timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},sortData:n}=ye,[o,de]=x.useState(0),[Ee,Re]=x.useState(0),[me,Ie]=x.useState(t.autoplay),c=je.sort(Le.uniqBy(l.filter(e=>e.date!==void 0&&e.date!==null),e=>e.date).map(e=>we.parse(`${e.date}`,t.dateFormat||"yyyy",new Date).getTime()),(e,r)=>Ke.ascending(e,r)),[be,ve]=x.useState(t.autoplay?0:c.length-1),[De,Se]=x.useState(void 0),he=x.useRef(null),Ce=x.useRef(null);x.useEffect(()=>{const e=new ResizeObserver(r=>{de(s||r[0].target.clientWidth||620),Re(N||r[0].target.clientHeight||480)});return he.current&&(Re(he.current.clientHeight||480),de(he.current.clientWidth||620),s||e.observe(he.current)),()=>e.disconnect()},[s,N]),x.useEffect(()=>{const e=setInterval(()=>{ve(r=>r<c.length-1?r+1:0)},(t.speed||2)*1e3);return me||clearInterval(e),()=>clearInterval(e)},[c,me,t.speed]);const Oe=je.getSliderMarks(c,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:u==="he"||u==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${u||"en"}`,b?.graphContainer),style:{...C?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:re,ref:Ce,"aria-label":p||`${g?`The graph shows ${g}. `:""}This is a dumbbell chart that shows comparisons between two or more data points across categories. ${v?` ${v}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?q||"1rem":q||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[g||v||se||d?i.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:C?.title,description:C?.description},classNames:{title:b?.title,description:b?.description},graphTitle:g,graphDescription:v,width:s,graphDownload:se?Ce.current:void 0,dataDownload:d?l.map(e=>e.data).filter(e=>e!==void 0).length>0?l.map(e=>e.data).filter(e=>e!==void 0):l.filter(e=>e!==void 0):null}):null,t.enabled&&c.length>0&&Oe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ie(!me)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":me?"Click to pause animation":"Click to play animation",children:me?i.jsxRuntimeExports.jsx(Ne.Pause,{}):i.jsxRuntimeExports.jsx(Ne.Play,{})}),i.jsxRuntimeExports.jsx(je.xr,{min:c[0],max:c[c.length-1],marks:Oe,step:null,defaultValue:c[c.length-1],value:c[be],onChangeComplete:e=>{ve(c.indexOf(e))},onChange:e=>{ve(c.indexOf(e))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:l.length===0?i.jsxRuntimeExports.jsx(Je.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[f?i.jsxRuntimeExports.jsx(_e.ColorLegendWithMouseOver,{width:s,colorDomain:xe,colors:_,colorLegendTitle:O,setSelectedColor:Se,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow w-full justify-center leading-0",ref:he,"aria-label":"Graph area",children:(s||o)&&(N||Ee)?i.jsxRuntimeExports.jsx(rt,{data:D!==void 0?D==="diff"?Me.orderBy(ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(c[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[e.x.length-1])||A.checkIfNullOrUndefined(e.x[0])?-1/0:e.x[e.x.length-1]-e.x[0],[n||"asc"]).filter((e,r)=>L?r<L:!0):Me.orderBy(ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>t.enabled?e.date===we.format(new Date(c[be]),t.dateFormat||"yyyy"):e).filter(e=>V?!e.x.every(r=>r==null):e),e=>A.checkIfNullOrUndefined(e.x[D])?-1/0:e.x[D],[n||"asc"]).filter((e,r)=>L?r<L:!0):ke.ensureCompleteDataForDumbbellChart(l,t.dateFormat||"yyyy").filter(e=>V?!e.x.every(r=>r==null):e).filter((e,r)=>L?r<L:!0),dotColors:_,width:s||o,height:Math.max(M,N||(R?M?(s||o)*R>M?(s||o)*R:M:(s||o)*R:Ee)),radius:ae,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,truncateBy:J,showLabels:I,showValues:h,tooltip:B,suffix:ne,prefix:ge,onSeriesMouseOver:pe,maxValue:A.checkIfNullOrUndefined(w)?Math.max(...l.map(e=>Math.max(...e.x.filter(r=>r!==null))))<0?0:Math.max(...l.map(e=>Math.max(...e.x.filter(r=>r!==null)))):w,minValue:A.checkIfNullOrUndefined(U)?Math.min(...l.map(e=>Math.min(...e.x.filter(r=>r!==null))))>0?0:Math.min(...l.map(e=>Math.min(...e.x.filter(r=>r!==null)))):U,onSeriesMouseClick:fe,selectedColor:De,arrowConnector:oe,connectorStrokeWidth:y,maxBarThickness:X,minBarThickness:j,resetSelectionOnDoubleClick:m,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,styles:C,classNames:b,labelOrder:S,refValues:Q,animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},precision:Y,customLayers:k,highlightedDataPoints:T,dimmedOpacity:a}):null})]})}),z||F?i.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:C?.footnote,source:C?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:z,footNote:F,width:s}):null]})})})})}function st(ye){const{data:l,graphTitle:g,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:xe,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:d,showValues:h,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:u,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:p,resetSelectionOnDoubleClick:m,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,orientation:C="vertical",styles:b,classNames:S,labelOrder:Q,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:f,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n,sortData:o}=ye;return C==="vertical"?i.jsxRuntimeExports.jsx(nt,{data:l,graphTitle:g,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:xe,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:d,showValues:h,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:u,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:p,resetSelectionOnDoubleClick:m,styles:b,detailsOnClick:H,axisTitle:W,noOfTicks:K,labelOrder:Q,valueColor:P,classNames:S,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:f,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n,sortData:o}):i.jsxRuntimeExports.jsx(at,{data:l,graphTitle:g,colors:_,sources:z,graphDescription:v,barPadding:ue,showTicks:Z,leftMargin:ee,rightMargin:ce,topMargin:te,bottomMargin:ie,truncateBy:J,height:N,width:s,footNote:F,colorDomain:xe,colorLegendTitle:O,padding:q,backgroundColor:E,radius:ae,tooltip:B,showLabels:I,relativeHeight:R,onSeriesMouseOver:pe,graphID:re,suffix:ne,prefix:ge,maxValue:w,minValue:U,onSeriesMouseClick:fe,graphDownload:se,dataDownload:d,showValues:h,sortParameter:D,arrowConnector:oe,connectorStrokeWidth:y,language:u,minHeight:M,theme:G,maxBarThickness:X,maxNumberOfBars:L,minBarThickness:j,ariaLabel:p,resetSelectionOnDoubleClick:m,styles:b,detailsOnClick:H,axisTitle:W,noOfTicks:K,valueColor:P,classNames:S,labelOrder:Q,refValues:V,filterNA:$,animate:Y,precision:k,showColorScale:f,customLayers:T,highlightedDataPoints:a,dimmedOpacity:t,timeline:n,sortData:o})}exports.DumbbellChart=st;
2
2
  //# sourceMappingURL=DumbbellChart.cjs.map