@undp/data-viz 2.1.0 → 2.1.2

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.
Files changed (120) hide show
  1. package/dist/AreaChart.js +3 -3
  2. package/dist/BarGraph.cjs +1 -1
  3. package/dist/BarGraph.cjs.map +1 -1
  4. package/dist/BarGraph.js +1760 -1604
  5. package/dist/BarGraph.js.map +1 -1
  6. package/dist/BeeSwarmChart.js +2 -2
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +222 -207
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.cjs.map +1 -1
  13. package/dist/BulletChart.d.ts +11 -0
  14. package/dist/BulletChart.js +726 -640
  15. package/dist/BulletChart.js.map +1 -1
  16. package/dist/ButterflyChart.cjs +1 -1
  17. package/dist/ButterflyChart.cjs.map +1 -1
  18. package/dist/ButterflyChart.js +366 -348
  19. package/dist/ButterflyChart.js.map +1 -1
  20. package/dist/ChoroplethMap.cjs +1 -1
  21. package/dist/ChoroplethMap.cjs.map +1 -1
  22. package/dist/ChoroplethMap.js +311 -297
  23. package/dist/ChoroplethMap.js.map +1 -1
  24. package/dist/CirclePackingGraph.js +1 -1
  25. package/dist/DifferenceLineChart.js +3 -3
  26. package/dist/DotDensityMap.cjs +1 -1
  27. package/dist/DotDensityMap.cjs.map +1 -1
  28. package/dist/DotDensityMap.js +219 -203
  29. package/dist/DotDensityMap.js.map +1 -1
  30. package/dist/DualAxisLineChart.js +3 -3
  31. package/dist/DumbbellChart.cjs +1 -1
  32. package/dist/DumbbellChart.cjs.map +1 -1
  33. package/dist/DumbbellChart.js +606 -556
  34. package/dist/DumbbellChart.js.map +1 -1
  35. package/dist/GraphEl-YKUlz-37.cjs +2 -0
  36. package/dist/GraphEl-YKUlz-37.cjs.map +1 -0
  37. package/dist/{GraphEl-ebgfxefq.js → GraphEl-sVZvlyWe.js} +3 -2
  38. package/dist/GraphEl-sVZvlyWe.js.map +1 -0
  39. package/dist/GriddedGraphs.cjs +1 -1
  40. package/dist/GriddedGraphs.js +2 -2
  41. package/dist/HeatMap.js +4 -4
  42. package/dist/Histogram.js +3 -3
  43. package/dist/HybridMap.cjs +1 -1
  44. package/dist/HybridMap.cjs.map +1 -1
  45. package/dist/HybridMap.js +357 -342
  46. package/dist/HybridMap.js.map +1 -1
  47. package/dist/LineChartWithConfidenceInterval.js +3 -3
  48. package/dist/MultiLineAltChart.cjs +1 -1
  49. package/dist/MultiLineAltChart.cjs.map +1 -1
  50. package/dist/MultiLineAltChart.js +453 -425
  51. package/dist/MultiLineAltChart.js.map +1 -1
  52. package/dist/MultiLineChart.js +3 -3
  53. package/dist/ParetoChart.js +2 -2
  54. package/dist/RadarChart.js +1 -1
  55. package/dist/ScatterPlot.cjs +1 -1
  56. package/dist/ScatterPlot.cjs.map +1 -1
  57. package/dist/ScatterPlot.js +471 -452
  58. package/dist/ScatterPlot.js.map +1 -1
  59. package/dist/SimpleLineChart.js +3 -3
  60. package/dist/SingleGraphDashboard.cjs +1 -1
  61. package/dist/SingleGraphDashboard.js +2 -2
  62. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  63. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  64. package/dist/SlopeChart.js +1 -1
  65. package/dist/SparkLine.js +3 -3
  66. package/dist/StripChart.js +1 -1
  67. package/dist/ThreeDGlobe.js +2 -2
  68. package/dist/Types.d.ts +1 -0
  69. package/dist/{band-CyHaVft5.js → band-DHUZ2X7J.js} +3 -3
  70. package/dist/{band-CyHaVft5.js.map → band-DHUZ2X7J.js.map} +1 -1
  71. package/dist/ensureCompleteData-DS7gCvVd.js +122 -0
  72. package/dist/ensureCompleteData-DS7gCvVd.js.map +1 -0
  73. package/dist/ensureCompleteData-Oib-vGb0.cjs +2 -0
  74. package/dist/ensureCompleteData-Oib-vGb0.cjs.map +1 -0
  75. package/dist/getSchema.cjs +1 -1
  76. package/dist/getSchema.cjs.map +1 -1
  77. package/dist/getSchema.js +15 -15
  78. package/dist/getSchema.js.map +1 -1
  79. package/dist/{index-BBV4tAeA.js → index-DPGq3eIL.js} +2 -2
  80. package/dist/{index-BBV4tAeA.js.map → index-DPGq3eIL.js.map} +1 -1
  81. package/dist/index.cjs +1 -1
  82. package/dist/index.d.ts +3 -0
  83. package/dist/index.js +3 -3
  84. package/dist/{init-BJFW6EwE.js → init-BhZylTFx.js} +3 -3
  85. package/dist/{init-BJFW6EwE.js.map → init-BhZylTFx.js.map} +1 -1
  86. package/dist/{linear-BwnDd9KF.js → linear-BqltdMeF.js} +2 -2
  87. package/dist/{linear-BwnDd9KF.js.map → linear-BqltdMeF.js.map} +1 -1
  88. package/dist/{ordinal-P77xw8aL.js → ordinal-BJ6O_LC5.js} +2 -2
  89. package/dist/{ordinal-P77xw8aL.js.map → ordinal-BJ6O_LC5.js.map} +1 -1
  90. package/dist/{pow-DE4c7dbW.js → pow-CM2aze4M.js} +3 -3
  91. package/dist/{pow-DE4c7dbW.js.map → pow-CM2aze4M.js.map} +1 -1
  92. package/dist/{threshold-Bgr20hik.js → threshold-DFfqcDMa.js} +2 -2
  93. package/dist/{threshold-Bgr20hik.js.map → threshold-DFfqcDMa.js.map} +1 -1
  94. package/dist/{time-DCCfQk3V.js → time-BUL-dwnK.js} +3 -3
  95. package/dist/{time-DCCfQk3V.js.map → time-BUL-dwnK.js.map} +1 -1
  96. package/dist/transformData.cjs +1 -1
  97. package/dist/transformData.js +2 -2
  98. package/dist/transformDataForAggregation-CYoB5Xsk.cjs +2 -0
  99. package/dist/transformDataForAggregation-CYoB5Xsk.cjs.map +1 -0
  100. package/dist/{transformDataForAggregation-DEU__LUl.js → transformDataForAggregation-j34UL73s.js} +14 -10
  101. package/dist/transformDataForAggregation-j34UL73s.js.map +1 -0
  102. package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs → transformDataForGraphFromFile-CuXxR8uA.cjs} +2 -2
  103. package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs.map → transformDataForGraphFromFile-CuXxR8uA.cjs.map} +1 -1
  104. package/dist/{transformDataForGraphFromFile-CSG24iF6.js → transformDataForGraphFromFile-DyP-83Nh.js} +2 -2
  105. package/dist/{transformDataForGraphFromFile-CSG24iF6.js.map → transformDataForGraphFromFile-DyP-83Nh.js.map} +1 -1
  106. package/package.json +4 -4
  107. package/dist/GraphEl-B16EYkko.cjs +0 -2
  108. package/dist/GraphEl-B16EYkko.cjs.map +0 -1
  109. package/dist/GraphEl-ebgfxefq.js.map +0 -1
  110. package/dist/ensureCompleteData-DNKEGRiP.js +0 -102
  111. package/dist/ensureCompleteData-DNKEGRiP.js.map +0 -1
  112. package/dist/ensureCompleteData-I6nYmT8E.cjs +0 -2
  113. package/dist/ensureCompleteData-I6nYmT8E.cjs.map +0 -1
  114. package/dist/sort-BIvMlUH1.js +0 -34
  115. package/dist/sort-BIvMlUH1.js.map +0 -1
  116. package/dist/sort-O96oMZLb.cjs +0 -2
  117. package/dist/sort-O96oMZLb.cjs.map +0 -1
  118. package/dist/transformDataForAggregation-DEU__LUl.js.map +0 -1
  119. package/dist/transformDataForAggregation-XNg0OGYE.cjs +0 -2
  120. package/dist/transformDataForAggregation-XNg0OGYE.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].categoricalColors.colors\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","i","findIndex","el","id","properties","length","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","DetailsModal","modal","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","timeline","t24","Colors","light","graphNoData","grays","t25","t26","t27","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","dateFormat","Date","getTime","_temp","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t28","t29","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t30","shape","onUpdateShape","useEffectEvent","t31","fetchAndParseJSON","then","d_0","t32","t33","getUniqValue","getJenks","_temp2","interval","setInterval","speed","clearInterval","markObj","getSliderMarks","t34","graphContainer","t35","t36","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t37","Pause","Play","SliderUI","nextValue","nextValue_0","t38","GraphArea","d_7","date","format","_temp8","categoricalColors","sequentialColors","max","Spinner","t39","footnote","source","GraphFooter","t40","GraphContainer","NAME","d_4","d_3","d_2","d_6","d_5","d_1","a","b","ascending"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJC,MAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,kBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,qBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,oBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,6BAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,YAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,cAAAA;AAAAA,IACAC,6BAAAA;AAAAA,EAAAA,IACE/B,GACE,CAACgC,GAAeC,CAAgB,IAAIC,EAA6BC,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AAmP,GAAA0B,GAAA;AAAA,SAuJ6ChM,MAAM7E;AAAS;AAvJ5D,SAAAkP,GAAA4B,GAAA;AAAA,SAuJyBjM,EAAC/G;AAAK;AAvJ/B,SAAAmR,GAAA8B,GAAA;AAAA,SAsJ2ClM,MAAM7E;AAAS;AAtJ1D,SAAAgP,GAAAgC,GAAA;AAAA,SAsJuBnM,EAAC/G;AAAK;AAtJ7B,SAAAoQ,GAAA+C,GAAA;AAAA,SAiGiBpM,EAAC2B;AAA+B;AAjGjD,SAAA4F,GAAA8E,GAAAC,GAAA;AAAA,SA0DOC,GAAUF,GAAGC,CAAC;AAAC;"}
1
+ {"version":3,"file":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent, useMemo } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].categoricalColors.colors\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","i","findIndex","el","id","properties","length","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","DetailsModal","modal","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","timeline","t24","Colors","light","graphNoData","grays","t25","t26","t27","t28","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t29","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t30","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t31","shape","onUpdateShape","useEffectEvent","t32","fetchAndParseJSON","then","d_1","t33","t34","getUniqValue","getJenks","_temp3","t35","t36","speed","interval","setInterval","clearInterval","t37","t38","getSliderMarks","markObj","t39","graphContainer","t40","t41","description","title","GraphHeader","_temp4","_temp5","_temp6","_temp7","_temp8","t42","Pause","Play","SliderUI","nextValue","nextValue_0","t43","GraphArea","d_8","format","_temp9","categoricalColors","sequentialColors","max","Spinner","t44","footnote","source","GraphFooter","t45","GraphContainer","NAME","d_5","d_4","d_3","d_7","d_6","d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5L,OAAAA,GACCD,QAAAA,GACQ6K,gBAAAA,GACPL,SAAAA,IAERyG,UAAAA;AAAAA,IAAAA;AAAAA,IAuBAS;AAAAA,IA6BDM;AAAAA,IAkFCS;AAAAA,EAAAA,GAYH,GAAiB5I,SAAAoC,GAAApC,SAAAP,GAAAO,SAAAqB,GAAArB,SAAA7J,GAAA6J,SAAA8B,GAAA9B,SAAAgC,GAAAhC,SAAAW,IAAAX,SAAAgB,GAAAhB,SAAAiH,IAAAjH,SAAAmH,IAAAnH,SAAAoH,IAAApH,SAAA6H,IAAA7H,SAAAmI,IAAAnI,SAAA4I,IAAA5I,SAAAkC,IAAAlC,SAAA5J,GAAA4J,SAAAgJ,MAAAA,KAAAhJ,EAAA,GAAA,GAjKjBgJ;AAiKiB;AA7Rd,SAAAT,GAAApL,GAAA;AAAA,SA8M4BA,EAAEE,WAAW6L,SAAU;AAAY;AA9M/D,SAAAtB,GAAAuB,GAAA;AAAA,SA6J4BvM,MAAM7E;AAAS;AA7J3C,SAAA4P,GAAAyB,GAAA;AAAA,SA4J6CxM,MAAM7E;AAAS;AA5J5D,SAAA2P,GAAA2B,GAAA;AAAA,SA4JyBzM,EAAC/G;AAAK;AA5J/B,SAAA4R,GAAA6B,GAAA;AAAA,SA2J2C1M,MAAM7E;AAAS;AA3J1D,SAAAyP,GAAA+B,GAAA;AAAA,SA2JuB3M,EAAC/G;AAAK;AA3J7B,SAAAyQ,GAAAkD,GAAA;AAAA,SAsGiB5M,EAAC2B;AAA+B;AAtGjD,SAAAiG,GAAAiF,GAAAC,GAAA;AAAA,SA8DkBD,IAAIC;AAAC;AA9DvB,SAAApF,GAAA1H,GAAA;AAAA,SA0DgBA,EAACsH;AAAK;"}
@@ -1,6 +1,6 @@
1
1
  import "./index-CHPV5EwG-Curnpaqc.js";
2
2
  import "react";
3
- import { C as g } from "./index-BBV4tAeA.js";
3
+ import { C as g } from "./index-DPGq3eIL.js";
4
4
  import "./GraphFooter.js";
5
5
  import "./GraphHeader.js";
6
6
  import "./ColorLegendWithMouseOver.js";
@@ -12,13 +12,13 @@ import { X as wi } from "./XTicksAndGridLines-CObVFSm4.js";
12
12
  import { a as bi } from "./ReferenceLine-2XCwHXQ4.js";
13
13
  import { Y as ji } from "./YTicksAndGridLines-Blepl7XF.js";
14
14
  import { H as Ai } from "./index-SKgJALZg.js";
15
- import { t as Oi } from "./time-DCCfQk3V.js";
16
- import { a as Ci } from "./linear-BwnDd9KF.js";
15
+ import { t as Oi } from "./time-BUL-dwnK.js";
16
+ import { a as Ci } from "./linear-BqltdMeF.js";
17
17
  import { l as ai, c as Vi } from "./line-CPfhohvF.js";
18
18
  import { c as Di, s as Li, a as Si, m as ki } from "./step-BrDul-H4.js";
19
19
  import { a as oi } from "./area-BE2wo7fv.js";
20
20
  import { s as $i } from "./select-DKy99ogv.js";
21
- import { c as Ti } from "./init-BJFW6EwE.js";
21
+ import { a as Ti } from "./init-BhZylTFx.js";
22
22
  import { p as Ii } from "./pointer-CWRWOsrb.js";
23
23
  import { u as Mi } from "./use-in-view-Cxa7y1TH.js";
24
24
  import { m as S } from "./proxy-BxkFHwUw.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),s=require("react"),at=require("./parse-hMnG_lRV.cjs"),nt=require("./getSliderMarks-BmADcPQt.cjs"),dt=require("./Spinner-DRMBUsX7.cjs"),mt=require("./index-DQA8q5sC.cjs"),U=require("./zoom-DPw8bba-.cjs"),pt=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-DxXnJ8Ti.cjs"),ht=require("./Tooltip-uUdw6wJL.cjs"),q=require("./Colors.cjs"),ot=require("./index-DRXx7m-C.cjs"),gt=require("./DetailsModal-BN0HDFlV.cjs"),ft=require("./pow-DgrUorRi.cjs"),tt=require("./select-Bnfk0lJx.cjs"),yt=require("./use-in-view-QcfiW0w3.cjs"),Fe=require("./proxy-BxvUI_9l.cjs"),vt=require("./index-DG2bgAva.cjs"),bt=require("./GraphFooter.cjs"),jt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-l5HGMAEs.cjs"),wt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),it=require("./uniqBy-O05lp2S5.cjs"),st=require("./GraphContainer-d8A46BK2.cjs"),Ct=require("./sort-O96oMZLb.cjs"),Dt=require("./init-DU0ybBc_.cjs");function Rt(a){const{data:e,colors:r,mapData:X,colorLegendTitle:O,colorDomain:j,radius:R,height:h,width:u,scale:p,centerPoint:M,tooltip:Y,showLabels:xe,mapBorderWidth:he,mapBorderColor:ge,mapNoDataColor:K,onSeriesMouseOver:Z,showColorScale:Oe,zoomScaleExtend:Me,zoomTranslateExtend:$e,highlightedDataPoints:fe,onSeriesMouseClick:J,resetSelectionOnDoubleClick:ye,detailsOnClick:v,styles:ve,classNames:Q,mapProjection:_,zoomInteraction:D,animate:E,dimmedOpacity:ee,customLayers:B,maxRadiusValue:be,collapseColorScaleByDefault:je}=a,[Ee,we]=s.useState(void 0),[Pe,Ce]=s.useState(je===void 0?!(u<680):!je),te=s.useRef(null),[V,oe]=s.useState(void 0),[re,l]=s.useState(void 0),[c,W]=s.useState(void 0),[De,ae]=s.useState(void 0),$=s.useRef(null),P=yt.useInView($,{once:E.once,amount:E.amount}),T=s.useRef(null),k=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?ft.sqrt().domain([0,be]).range([.25,R]).nice():void 0;s.useEffect(()=>{const t=tt.select(T.current),g=tt.select($.current),n=i=>{if(D==="noZoom")return!1;if(D==="button")return!i.type.includes("wheel");const w=i.type==="wheel",b=i.type.startsWith("touch"),y=i.type==="mousedown"||i.type==="mousemove";return b?!0:w?D==="scroll"?!0:i.ctrlKey:y&&!i.button&&!i.ctrlKey},C=U.zoom().scaleExtent(Me).translateExtent($e||[[-20,-20],[u+20,h+20]]).filter(n).on("zoom",({transform:i})=>{t.attr("transform",i)});g.call(C),te.current=C},[h,u,D]);const z=U.turf_bbox_default(X),f=xt.turf_center_of_mass_default(X),ne=z[2]-z[0],Re=z[3]-z[1],ke=u*190/960*360/ne,Se=h*190/678*180/Re,S=p*Math.min(ke,Se),I=_==="mercator"?U.geoMercator().rotate([0,0]).center(M||f.geometry.coordinates).translate([u/2,h/2]).scale(S):_==="equalEarth"?U.geoEqualEarth().rotate([0,0]).center(M||f.geometry.coordinates).translate([u/2,h/2]).scale(S):_==="naturalEarth"?U.geoNaturalEarth1().rotate([0,0]).center(M||f.geometry.coordinates).translate([u/2,h/2]).scale(S):_==="orthographic"?U.geoOrthographic().rotate([0,0]).center(M||f.geometry.coordinates).translate([u/2,h/2]).scale(S):U.geoAlbersUsa().rotate([0,0]).center(M||f.geometry.coordinates).translate([u/2,h/2]).scale(S),ie=t=>{if(!$.current||!te.current)return;tt.select($.current).call(te.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(Fe.motion.svg,{width:`${u}px`,height:`${h}px`,viewBox:`0 0 ${u} ${h}`,ref:$,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:T,children:[B.filter(t=>t.position==="before").map(t=>t.layer),X.features.map((t,g)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((n,C)=>{let i="";return n.forEach(w=>{let b=" M";w.forEach((y,se)=>{const L=I([y[0],y[1]]);se!==w.length-1?b=`${b}${L[0]} ${L[1]}L`:b=`${b}${L[0]} ${L[1]}`}),i+=b}),o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ge,strokeWidth:he,fill:K}},C)}):t.geometry.coordinates.map((n,C)=>{let i="M";return n.forEach((w,b)=>{const y=I([w[0],w[1]]);b!==n.length-1?i=`${i}${y[0]} ${y[1]}L`:i=`${i}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ge,strokeWidth:he,fill:K}},C)})},g)),o.jsxRuntimeExports.jsx(vt.AnimatePresence,{children:e.map(t=>{const g=e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:q.Colors.gray;return o.jsxRuntimeExports.jsxs(Fe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Ee?Ee===g?1:ee:fe.length!==0?fe.indexOf(t.label||"")!==-1?1:ee:1,transition:{duration:E.duration}}},initial:"initial",animate:P?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},onMouseEnter:n=>{l(t),ae(n.clientY),W(n.clientX),Z?.(t)},onMouseMove:n=>{l(t),ae(n.clientY),W(n.clientX)},onMouseLeave:()=>{l(void 0),W(void 0),ae(void 0),Z?.(void 0)},onClick:()=>{(J||v)&&(mt.isEqual(V,t)&&ye?(oe(void 0),J?.(void 0)):(oe(t),J?.(t)))},transform:`translate(${I([t.long,t.lat])[0]},${I([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(Fe.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:q.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:q.Colors.gray},whileInView:{r:k?k(t.radius||0):R,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:q.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:q.Colors.gray,transition:{duration:E.duration}}},initial:"initial",animate:P?"whileInView":"initial",exit:{r:0,transition:{duration:E.duration}},style:{fillOpacity:.8}}),xe&&t.label?o.jsxRuntimeExports.jsx(Fe.motion.text,{variants:{initial:{opacity:0,x:k?k(t.radius||0):R},whileInView:{opacity:1,x:k?k(t.radius||0):R,transition:{duration:E.duration}}},initial:"initial",animate:P?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),B.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||Oe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",Q?.colorLegend),children:Pe?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ce(!1)},children:o.jsxRuntimeExports.jsx(ot.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[O&&O!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:O}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((t,g)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{we(r[g%r.length])},onMouseLeave:()=>{we(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[g%r.length]}}),o.jsxRuntimeExports.jsx(pt.j,{size:"sm",marginBottom:"none",leading:"none",children:t})]},g))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Ce(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),D==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&V!==void 0?o.jsxRuntimeExports.jsx(gt.DetailsModal,{body:v,data:V,setData:oe,className:Q?.modal}):null,re&&Y&&c&&De?o.jsxRuntimeExports.jsx(ht.Tooltip,{data:re,body:Y,xPos:c,yPos:De,backgroundStyle:ve?.tooltip,className:Q?.tooltip}):null]})}function kt(a){const e=o.compilerRuntimeExports.c(102),{data:r,mapData:X,graphTitle:O,colors:j,sources:R,graphDescription:h,height:u,width:p,footNote:M,colorLegendTitle:Y,colorDomain:xe,radius:he,scale:ge,centerPoint:K,padding:Z,mapBorderWidth:Oe,mapNoDataColor:Me,backgroundColor:$e,showLabels:fe,mapBorderColor:J,tooltip:ye,relativeHeight:v,onSeriesMouseOver:ve,isWorldMap:Q,showColorScale:_,zoomScaleExtend:D,zoomTranslateExtend:E,graphID:ee,highlightedDataPoints:B,onSeriesMouseClick:be,graphDownload:je,dataDownload:Ee,showAntarctica:we,language:Pe,minHeight:Ce,theme:te,ariaLabel:V,resetSelectionOnDoubleClick:oe,detailsOnClick:re,styles:l,classNames:c,mapProjection:W,zoomInteraction:De,animate:ae,dimmedOpacity:$,customLayers:P,maxRadiusValue:T,timeline:k,collapseColorScaleByDefault:z}=a,f=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":X,ne=M===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":M,Re=he===void 0?5:he,ke=ge===void 0?.95:ge,Se=Oe===void 0?.5:Oe,S=Me===void 0?q.Colors.light.graphNoData:Me,I=$e===void 0?!1:$e,ie=fe===void 0?!1:fe,t=J===void 0?q.Colors.light.grays["gray-500"]:J,g=Q===void 0?!0:Q,n=_===void 0?!0:_;let C;e[0]!==D?(C=D===void 0?[.8,6]:D,e[0]=D,e[1]=C):C=e[1];const i=C;let w;e[2]!==B?(w=B===void 0?[]:B,e[2]=B,e[3]=w):w=e[3];const b=w,y=je===void 0?!1:je,se=Ee===void 0?!1:Ee,L=we===void 0?!1:we,He=Pe===void 0?"en":Pe,N=Ce===void 0?0:Ce,le=te===void 0?"light":te,Ue=oe===void 0?!0:oe,Xe=De===void 0?"button":De,ze=ae===void 0?!1:ae,Ye=$===void 0?.3:$;let Ie;e[4]!==P?(Ie=P===void 0?[]:P,e[4]=P,e[5]=Ie):Ie=e[5];const Ke=Ie,x=k===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:k,[A,lt]=s.useState(0),[Ne,ct]=s.useState(0),[G,Ze]=s.useState(x.autoplay),d=Ct.sort(it.uniqBy(r,"date",!0).map(m=>at.parse(`${m}`,x.dateFormat||"yyyy",new Date).getTime()),_t),[F,qe]=s.useState(x.autoplay?0:d.length-1),[ce,ut]=s.useState(void 0),Je=s.useRef(null),rt=s.useRef(null);let Le,_e;e[6]===Symbol.for("react.memo_cache_sentinel")?(Le=()=>{const m=new ResizeObserver(H=>{lt(H[0].target.clientWidth||620),ct(H[0].target.clientHeight||480)});return Je.current&&m.observe(Je.current),()=>m.disconnect()},_e=[],e[6]=Le,e[7]=_e):(Le=e[6],_e=e[7]),s.useEffect(Le,_e);let Be;e[8]===Symbol.for("react.memo_cache_sentinel")?(Be=m=>{ut(m)},e[8]=Be):Be=e[8];const Ve=s.useEffectEvent(Be);let We;e[9]!==f||e[10]!==Ve?(We=()=>{typeof f=="string"?Et.fetchAndParseJSON(f).then(H=>{Ve(H)}):Ve(f)},e[9]=f,e[10]=Ve,e[11]=We):We=e[11];let Te;e[12]!==f?(Te=[f],e[12]=f,e[13]=Te):Te=e[13],s.useEffect(We,Te),s.useEffect(()=>{const m=setInterval(()=>{qe(H=>H<d.length-1?H+1:0)},(x.speed||2)*1e3);return G||clearInterval(m),()=>clearInterval(m)},[d,G,x.speed]);const Ae=nt.getSliderMarks(d,F,x.showOnlyActiveDate,x.dateFormat||"yyyy"),Qe=c?.graphContainer,et=l?.graphContainer;let ue;e[14]!==c?.description||e[15]!==c?.title||e[16]!==r||e[17]!==se||e[18]!==h||e[19]!==y||e[20]!==O||e[21]!==l?.description||e[22]!==l?.title||e[23]!==p?(ue=O||h||y||se?o.jsxRuntimeExports.jsx(jt.GraphHeader,{styles:{title:l?.title,description:l?.description},classNames:{title:c?.title,description:c?.description},graphTitle:O,graphDescription:h,width:p,graphDownload:y?rt:void 0,dataDownload:se?r.map(Lt).filter(It).length>0?r.map(zt).filter(Pt):r.filter($t):null}):null,e[14]=c?.description,e[15]=c?.title,e[16]=r,e[17]=se,e[18]=h,e[19]=y,e[20]=O,e[21]=l?.description,e[22]=l?.title,e[23]=p,e[24]=ue):ue=e[24];let de;e[25]!==F||e[26]!==Ae||e[27]!==G||e[28]!==qe||e[29]!==Ze||e[30]!==x.enabled||e[31]!==d?(de=x.enabled&&d.length>0&&Ae?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ze(!G)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":G?"Click to pause animation":"Click to play animation",children:G?o.jsxRuntimeExports.jsx(ot.Pause,{}):o.jsxRuntimeExports.jsx(ot.Play,{})}),o.jsxRuntimeExports.jsx(nt.Nr,{min:d[0],max:d[d.length-1],marks:Ae,step:null,defaultValue:d[d.length-1],value:d[F],onChangeComplete:m=>{qe(d.indexOf(m))},onChange:m=>{qe(d.indexOf(m))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[25]=F,e[26]=Ae,e[27]=G,e[28]=qe,e[29]=Ze,e[30]=x.enabled,e[31]=d,e[32]=de):de=e[32];let me;e[33]!==ze||e[34]!==K||e[35]!==c||e[36]!==z||e[37]!==xe||e[38]!==Y||e[39]!==j||e[40]!==Ke||e[41]!==r||e[42]!==re||e[43]!==Ye||e[44]!==u||e[45]!==b||e[46]!==F||e[47]!==g||e[48]!==t||e[49]!==Se||e[50]!==S||e[51]!==W||e[52]!==ce||e[53]!==T||e[54]!==N||e[55]!==be||e[56]!==ve||e[57]!==Re||e[58]!==v||e[59]!==Ue||e[60]!==ke||e[61]!==L||e[62]!==n||e[63]!==ie||e[64]!==l||e[65]!==Ne||e[66]!==A||e[67]!==le||e[68]!==x.dateFormat||e[69]!==x.enabled||e[70]!==ye||e[71]!==d||e[72]!==p||e[73]!==Xe||e[74]!==i||e[75]!==E?(me=o.jsxRuntimeExports.jsx(st.GraphArea,{ref:Je,children:A&&Ne&&ce?o.jsxRuntimeExports.jsx(Rt,{data:r.filter(m=>x.enabled?m.date===at.format(new Date(d[F]),x.dateFormat||"yyyy"):m),mapData:L?ce:{...ce,features:ce.features.filter(Mt)},colorDomain:r.filter(Ot).length===0?[]:xe||it.uniqBy(r,"color",!0),width:A,height:Ne,scale:ke,centerPoint:K,colors:r.filter(qt).length===0?j?[j]:[q.Colors.primaryColors["blue-600"]]:j||q.Colors[le].categoricalColors.colors,colorLegendTitle:Y,radius:Re,mapBorderWidth:Se,mapNoDataColor:S,mapBorderColor:t,tooltip:ye,onSeriesMouseOver:ve,showLabels:ie,isWorldMap:g,showColorScale:n,zoomScaleExtend:i,zoomTranslateExtend:E,onSeriesMouseClick:be,highlightedDataPoints:b,resetSelectionOnDoubleClick:Ue,styles:l,classNames:c,zoomInteraction:Xe,detailsOnClick:re,mapProjection:W||(g?"naturalEarth":"mercator"),animate:ze===!0?{duration:.5,once:!0,amount:.5}:ze||{duration:0,once:!0,amount:0},dimmedOpacity:Ye,customLayers:Ke,maxRadiusValue:wt.checkIfNullOrUndefined(T)?Math.max(...r.map(Nt).filter(St)):T,collapseColorScaleByDefault:z}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(N,u||(v?N?(p||A)*v>N?(p||A)*v:N:(p||A)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(dt.w,{"aria-label":"Loading graph"})})}),e[33]=ze,e[34]=K,e[35]=c,e[36]=z,e[37]=xe,e[38]=Y,e[39]=j,e[40]=Ke,e[41]=r,e[42]=re,e[43]=Ye,e[44]=u,e[45]=b,e[46]=F,e[47]=g,e[48]=t,e[49]=Se,e[50]=S,e[51]=W,e[52]=ce,e[53]=T,e[54]=N,e[55]=be,e[56]=ve,e[57]=Re,e[58]=v,e[59]=Ue,e[60]=ke,e[61]=L,e[62]=n,e[63]=ie,e[64]=l,e[65]=Ne,e[66]=A,e[67]=le,e[68]=x.dateFormat,e[69]=x.enabled,e[70]=ye,e[71]=d,e[72]=p,e[73]=Xe,e[74]=i,e[75]=E,e[76]=me):me=e[76];let pe;e[77]!==c?.footnote||e[78]!==c?.source||e[79]!==ne||e[80]!==R||e[81]!==l?.footnote||e[82]!==l?.source||e[83]!==p?(pe=R||ne?o.jsxRuntimeExports.jsx(bt.GraphFooter,{styles:{footnote:l?.footnote,source:l?.source},classNames:{footnote:c?.footnote,source:c?.source},sources:R,footNote:ne,width:p}):null,e[77]=c?.footnote,e[78]=c?.source,e[79]=ne,e[80]=R,e[81]=l?.footnote,e[82]=l?.source,e[83]=p,e[84]=pe):pe=e[84];let Ge;return e[85]!==V||e[86]!==I||e[87]!==ee||e[88]!==u||e[89]!==He||e[90]!==N||e[91]!==Z||e[92]!==v||e[93]!==Qe||e[94]!==et||e[95]!==ue||e[96]!==de||e[97]!==me||e[98]!==pe||e[99]!==le||e[100]!==p?(Ge=o.jsxRuntimeExports.jsxs(st.GraphContainer,{className:Qe,style:et,id:ee,ref:rt,"aria-label":V,backgroundColor:I,theme:le,language:He,minHeight:N,width:p,height:u,relativeHeight:v,padding:Z,children:[ue,de,me,pe]}),e[85]=V,e[86]=I,e[87]=ee,e[88]=u,e[89]=He,e[90]=N,e[91]=Z,e[92]=v,e[93]=Qe,e[94]=et,e[95]=ue,e[96]=de,e[97]=me,e[98]=pe,e[99]=le,e[100]=p,e[101]=Ge):Ge=e[101],Ge}function St(a){return a!=null}function Nt(a){return a.radius}function qt(a){return a.color}function Ot(a){return a.color}function Mt(a){return a.properties.NAME!=="Antarctica"}function $t(a){return a!==void 0}function Pt(a){return a!==void 0}function zt(a){return a.data}function It(a){return a!==void 0}function Lt(a){return a.data}function _t(a,e){return Dt.ascending(a,e)}exports.DotDensityMap=kt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),c=require("react"),ct=require("./parse-hMnG_lRV.cjs"),ut=require("./getSliderMarks-BmADcPQt.cjs"),ft=require("./Spinner-DRMBUsX7.cjs"),gt=require("./index-DQA8q5sC.cjs"),U=require("./zoom-DPw8bba-.cjs"),yt=require("./Typography-DX7PlgQU.cjs"),vt=require("./index-DxXnJ8Ti.cjs"),bt=require("./Tooltip-uUdw6wJL.cjs"),$=require("./Colors.cjs"),st=require("./index-DRXx7m-C.cjs"),jt=require("./DetailsModal-BN0HDFlV.cjs"),Et=require("./pow-DgrUorRi.cjs"),it=require("./select-Bnfk0lJx.cjs"),wt=require("./use-in-view-QcfiW0w3.cjs"),Ye=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Ct=require("./GraphFooter.cjs"),Rt=require("./GraphHeader.cjs"),kt=require("./fetchAndParseData-l5HGMAEs.cjs"),St=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Nt=require("./uniqBy-O05lp2S5.cjs"),dt=require("./GraphContainer-d8A46BK2.cjs");function Ot(a){const{data:e,colors:r,mapData:X,colorLegendTitle:P,colorDomain:j,radius:k,height:x,width:p,scale:h,centerPoint:_,tooltip:Y,showLabels:he,mapBorderWidth:xe,mapBorderColor:fe,mapNoDataColor:K,onSeriesMouseOver:Z,showColorScale:qe,zoomScaleExtend:Me,zoomTranslateExtend:$e,highlightedDataPoints:ge,onSeriesMouseClick:J,resetSelectionOnDoubleClick:ye,detailsOnClick:v,styles:ve,classNames:Q,mapProjection:A,zoomInteraction:R,animate:E,dimmedOpacity:ee,customLayers:F,maxRadiusValue:be,collapseColorScaleByDefault:je}=a,[Ee,we]=c.useState(void 0),[Pe,De]=c.useState(je===void 0?!(p<680):!je),te=c.useRef(null),[W,oe]=c.useState(void 0),[re,u]=c.useState(void 0),[m,T]=c.useState(void 0),[Ce,ae]=c.useState(void 0),z=c.useRef(null),I=wt.useInView(z,{once:E.once,amount:E.amount}),G=c.useRef(null),D=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?Et.sqrt().domain([0,be]).range([.25,k]).nice():void 0;c.useEffect(()=>{const t=it.select(G.current),f=it.select(z.current),n=s=>{if(R==="noZoom")return!1;if(R==="button")return!s.type.includes("wheel");const w=s.type==="wheel",b=s.type.startsWith("touch"),y=s.type==="mousedown"||s.type==="mousemove";return b?!0:w?R==="scroll"?!0:s.ctrlKey:y&&!s.button&&!s.ctrlKey},C=U.zoom().scaleExtent(Me).translateExtent($e||[[-20,-20],[p+20,x+20]]).filter(n).on("zoom",({transform:s})=>{t.attr("transform",s)});f.call(C),te.current=C},[x,p,R]);const L=U.turf_bbox_default(X),g=vt.turf_center_of_mass_default(X),ne=L[2]-L[0],Re=L[3]-L[1],ke=p*190/960*360/ne,Se=x*190/678*180/Re,S=h*Math.min(ke,Se),B=A==="mercator"?U.geoMercator().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="equalEarth"?U.geoEqualEarth().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="naturalEarth"?U.geoNaturalEarth1().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="orthographic"?U.geoOrthographic().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):U.geoAlbersUsa().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S),ie=t=>{if(!z.current||!te.current)return;it.select(z.current).call(te.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(Ye.motion.svg,{width:`${p}px`,height:`${x}px`,viewBox:`0 0 ${p} ${x}`,ref:z,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:G,children:[F.filter(t=>t.position==="before").map(t=>t.layer),X.features.map((t,f)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((n,C)=>{let s="";return n.forEach(w=>{let b=" M";w.forEach((y,se)=>{const V=B([y[0],y[1]]);se!==w.length-1?b=`${b}${V[0]} ${V[1]}L`:b=`${b}${V[0]} ${V[1]}`}),s+=b}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)}):t.geometry.coordinates.map((n,C)=>{let s="M";return n.forEach((w,b)=>{const y=B([w[0],w[1]]);b!==n.length-1?s=`${s}${y[0]} ${y[1]}L`:s=`${s}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)})},f)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const f=e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray;return o.jsxRuntimeExports.jsxs(Ye.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Ee?Ee===f?1:ee:ge.length!==0?ge.indexOf(t.label||"")!==-1?1:ee:1,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},onMouseEnter:n=>{u(t),ae(n.clientY),T(n.clientX),Z?.(t)},onMouseMove:n=>{u(t),ae(n.clientY),T(n.clientX)},onMouseLeave:()=>{u(void 0),T(void 0),ae(void 0),Z?.(void 0)},onClick:()=>{(J||v)&&(gt.isEqual(W,t)&&ye?(oe(void 0),J?.(void 0)):(oe(t),J?.(t)))},transform:`translate(${B([t.long,t.lat])[0]},${B([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(Ye.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray},whileInView:{r:D?D(t.radius||0):k,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{r:0,transition:{duration:E.duration}},style:{fillOpacity:.8}}),he&&t.label?o.jsxRuntimeExports.jsx(Ye.motion.text,{variants:{initial:{opacity:0,x:D?D(t.radius||0):k},whileInView:{opacity:1,x:D?D(t.radius||0):k,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),F.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||qe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",Q?.colorLegend),children:Pe?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{De(!1)},children:o.jsxRuntimeExports.jsx(st.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[P&&P!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:P}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((t,f)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{we(r[f%r.length])},onMouseLeave:()=>{we(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[f%r.length]}}),o.jsxRuntimeExports.jsx(yt.j,{size:"sm",marginBottom:"none",leading:"none",children:t})]},f))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{De(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),R==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&W!==void 0?o.jsxRuntimeExports.jsx(jt.DetailsModal,{body:v,data:W,setData:oe,className:Q?.modal}):null,re&&Y&&m&&Ce?o.jsxRuntimeExports.jsx(bt.Tooltip,{data:re,body:Y,xPos:m,yPos:Ce,backgroundStyle:ve?.tooltip,className:Q?.tooltip}):null]})}function qt(a){const e=o.compilerRuntimeExports.c(117),{data:r,mapData:X,graphTitle:P,colors:j,sources:k,graphDescription:x,height:p,width:h,footNote:_,colorLegendTitle:Y,colorDomain:he,radius:xe,scale:fe,centerPoint:K,padding:Z,mapBorderWidth:qe,mapNoDataColor:Me,backgroundColor:$e,showLabels:ge,mapBorderColor:J,tooltip:ye,relativeHeight:v,onSeriesMouseOver:ve,isWorldMap:Q,showColorScale:A,zoomScaleExtend:R,zoomTranslateExtend:E,graphID:ee,highlightedDataPoints:F,onSeriesMouseClick:be,graphDownload:je,dataDownload:Ee,showAntarctica:we,language:Pe,minHeight:De,theme:te,ariaLabel:W,resetSelectionOnDoubleClick:oe,detailsOnClick:re,styles:u,classNames:m,mapProjection:T,zoomInteraction:Ce,animate:ae,dimmedOpacity:z,customLayers:I,maxRadiusValue:G,timeline:D,collapseColorScaleByDefault:L}=a,g=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":X,ne=_===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":_,Re=xe===void 0?5:xe,ke=fe===void 0?.95:fe,Se=qe===void 0?.5:qe,S=Me===void 0?$.Colors.light.graphNoData:Me,B=$e===void 0?!1:$e,ie=ge===void 0?!1:ge,t=J===void 0?$.Colors.light.grays["gray-500"]:J,f=Q===void 0?!0:Q,n=A===void 0?!0:A;let C;e[0]!==R?(C=R===void 0?[.8,6]:R,e[0]=R,e[1]=C):C=e[1];const s=C;let w;e[2]!==F?(w=F===void 0?[]:F,e[2]=F,e[3]=w):w=e[3];const b=w,y=je===void 0?!1:je,se=Ee===void 0?!1:Ee,V=we===void 0?!1:we,Ke=Pe===void 0?"en":Pe,N=De===void 0?0:De,le=te===void 0?"light":te,Ze=oe===void 0?!0:oe,Je=Ce===void 0?"button":Ce,_e=ae===void 0?!1:ae,Qe=z===void 0?.3:z;let ze;e[4]!==I?(ze=I===void 0?[]:I,e[4]=I,e[5]=ze):ze=e[5];const et=ze;let Ie;e[6]!==D?(Ie=D===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:D,e[6]=D,e[7]=Ie):Ie=e[7];const i=Ie,[H,mt]=c.useState(0),[Ne,pt]=c.useState(0),[O,ht]=c.useState(i.autoplay);let Oe;if(e[8]!==r||e[9]!==i.dateFormat){let d;e[11]!==i.dateFormat?(d=M=>ct.parse(`${M.date}`,i.dateFormat||"yyyy",new Date).getTime(),e[11]=i.dateFormat,e[12]=d):d=e[12],Oe=[...new Set(r.filter(Wt).map(d))],Oe.sort(Ft),e[8]=r,e[9]=i.dateFormat,e[10]=Oe}else Oe=e[10];const l=Oe,[q,tt]=c.useState(i.autoplay?0:l.length-1),[ce,xt]=c.useState(void 0),ot=c.useRef(null),lt=c.useRef(null);let Le,Be;e[13]===Symbol.for("react.memo_cache_sentinel")?(Le=()=>{const d=new ResizeObserver(M=>{mt(M[0].target.clientWidth||620),pt(M[0].target.clientHeight||480)});return ot.current&&d.observe(ot.current),()=>d.disconnect()},Be=[],e[13]=Le,e[14]=Be):(Le=e[13],Be=e[14]),c.useEffect(Le,Be);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=d=>{xt(d)},e[15]=Ve):Ve=e[15];const Ae=c.useEffectEvent(Ve);let Fe;e[16]!==g||e[17]!==Ae?(Fe=()=>{typeof g=="string"?kt.fetchAndParseJSON(g).then(M=>{Ae(M)}):Ae(g)},e[16]=g,e[17]=Ae,e[18]=Fe):Fe=e[18];let We;e[19]!==g?(We=[g],e[19]=g,e[20]=We):We=e[20],c.useEffect(Fe,We);let Te,Ge;e[21]!==O||e[22]!==i.speed||e[23]!==l?(Te=()=>{const d=setInterval(()=>{tt(M=>M<l.length-1?M+1:0)},(i.speed||2)*1e3);return O||clearInterval(d),()=>clearInterval(d)},Ge=[l,O,i.speed],e[21]=O,e[22]=i.speed,e[23]=l,e[24]=Te,e[25]=Ge):(Te=e[24],Ge=e[25]),c.useEffect(Te,Ge);const rt=i.dateFormat||"yyyy";let He;e[26]!==q||e[27]!==rt||e[28]!==i.showOnlyActiveDate||e[29]!==l?(He=ut.getSliderMarks(l,q,i.showOnlyActiveDate,rt),e[26]=q,e[27]=rt,e[28]=i.showOnlyActiveDate,e[29]=l,e[30]=He):He=e[30];const Ue=He,at=m?.graphContainer,nt=u?.graphContainer;let ue;e[31]!==m?.description||e[32]!==m?.title||e[33]!==r||e[34]!==se||e[35]!==x||e[36]!==y||e[37]!==P||e[38]!==u?.description||e[39]!==u?.title||e[40]!==h?(ue=P||x||y||se?o.jsxRuntimeExports.jsx(Rt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:P,graphDescription:x,width:h,graphDownload:y?lt:void 0,dataDownload:se?r.map(At).filter(Vt).length>0?r.map(Bt).filter(Lt):r.filter(It):null}):null,e[31]=m?.description,e[32]=m?.title,e[33]=r,e[34]=se,e[35]=x,e[36]=y,e[37]=P,e[38]=u?.description,e[39]=u?.title,e[40]=h,e[41]=ue):ue=e[41];let de;e[42]!==q||e[43]!==Ue||e[44]!==O||e[45]!==i.enabled||e[46]!==l?(de=i.enabled&&l.length>0&&Ue?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ht(!O)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":O?"Click to pause animation":"Click to play animation",children:O?o.jsxRuntimeExports.jsx(st.Pause,{}):o.jsxRuntimeExports.jsx(st.Play,{})}),o.jsxRuntimeExports.jsx(ut.Nr,{min:l[0],max:l[l.length-1],marks:Ue,step:null,defaultValue:l[l.length-1],value:l[q],onChangeComplete:d=>{tt(l.indexOf(d))},onChange:d=>{tt(l.indexOf(d))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=q,e[43]=Ue,e[44]=O,e[45]=i.enabled,e[46]=l,e[47]=de):de=e[47];let me;e[48]!==_e||e[49]!==K||e[50]!==m||e[51]!==L||e[52]!==he||e[53]!==Y||e[54]!==j||e[55]!==et||e[56]!==r||e[57]!==re||e[58]!==Qe||e[59]!==p||e[60]!==b||e[61]!==q||e[62]!==f||e[63]!==t||e[64]!==Se||e[65]!==S||e[66]!==T||e[67]!==ce||e[68]!==G||e[69]!==N||e[70]!==be||e[71]!==ve||e[72]!==Re||e[73]!==v||e[74]!==Ze||e[75]!==ke||e[76]!==V||e[77]!==n||e[78]!==ie||e[79]!==u||e[80]!==Ne||e[81]!==H||e[82]!==le||e[83]!==i.dateFormat||e[84]!==i.enabled||e[85]!==ye||e[86]!==l||e[87]!==h||e[88]!==Je||e[89]!==s||e[90]!==E?(me=o.jsxRuntimeExports.jsx(dt.GraphArea,{ref:ot,children:H&&Ne&&ce?o.jsxRuntimeExports.jsx(Ot,{data:r.filter(d=>i.enabled?d.date===ct.format(new Date(l[q]),i.dateFormat||"yyyy"):d),mapData:V?ce:{...ce,features:ce.features.filter(zt)},colorDomain:r.filter(_t).length===0?[]:he||Nt.uniqBy(r,"color",!0),width:H,height:Ne,scale:ke,centerPoint:K,colors:r.filter(Pt).length===0?j?[j]:[$.Colors.primaryColors["blue-600"]]:j||$.Colors[le].categoricalColors.colors,colorLegendTitle:Y,radius:Re,mapBorderWidth:Se,mapNoDataColor:S,mapBorderColor:t,tooltip:ye,onSeriesMouseOver:ve,showLabels:ie,isWorldMap:f,showColorScale:n,zoomScaleExtend:s,zoomTranslateExtend:E,onSeriesMouseClick:be,highlightedDataPoints:b,resetSelectionOnDoubleClick:Ze,styles:u,classNames:m,zoomInteraction:Je,detailsOnClick:re,mapProjection:T||(f?"naturalEarth":"mercator"),animate:_e===!0?{duration:.5,once:!0,amount:.5}:_e||{duration:0,once:!0,amount:0},dimmedOpacity:Qe,customLayers:et,maxRadiusValue:St.checkIfNullOrUndefined(G)?Math.max(...r.map($t).filter(Mt)):G,collapseColorScaleByDefault:L}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(N,p||(v?N?(h||H)*v>N?(h||H)*v:N:(h||H)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(ft.w,{"aria-label":"Loading graph"})})}),e[48]=_e,e[49]=K,e[50]=m,e[51]=L,e[52]=he,e[53]=Y,e[54]=j,e[55]=et,e[56]=r,e[57]=re,e[58]=Qe,e[59]=p,e[60]=b,e[61]=q,e[62]=f,e[63]=t,e[64]=Se,e[65]=S,e[66]=T,e[67]=ce,e[68]=G,e[69]=N,e[70]=be,e[71]=ve,e[72]=Re,e[73]=v,e[74]=Ze,e[75]=ke,e[76]=V,e[77]=n,e[78]=ie,e[79]=u,e[80]=Ne,e[81]=H,e[82]=le,e[83]=i.dateFormat,e[84]=i.enabled,e[85]=ye,e[86]=l,e[87]=h,e[88]=Je,e[89]=s,e[90]=E,e[91]=me):me=e[91];let pe;e[92]!==m?.footnote||e[93]!==m?.source||e[94]!==ne||e[95]!==k||e[96]!==u?.footnote||e[97]!==u?.source||e[98]!==h?(pe=k||ne?o.jsxRuntimeExports.jsx(Ct.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:k,footNote:ne,width:h}):null,e[92]=m?.footnote,e[93]=m?.source,e[94]=ne,e[95]=k,e[96]=u?.footnote,e[97]=u?.source,e[98]=h,e[99]=pe):pe=e[99];let Xe;return e[100]!==W||e[101]!==B||e[102]!==ee||e[103]!==p||e[104]!==Ke||e[105]!==N||e[106]!==Z||e[107]!==v||e[108]!==at||e[109]!==nt||e[110]!==ue||e[111]!==de||e[112]!==me||e[113]!==pe||e[114]!==le||e[115]!==h?(Xe=o.jsxRuntimeExports.jsxs(dt.GraphContainer,{className:at,style:nt,id:ee,ref:lt,"aria-label":W,backgroundColor:B,theme:le,language:Ke,minHeight:N,width:h,height:p,relativeHeight:v,padding:Z,children:[ue,de,me,pe]}),e[100]=W,e[101]=B,e[102]=ee,e[103]=p,e[104]=Ke,e[105]=N,e[106]=Z,e[107]=v,e[108]=at,e[109]=nt,e[110]=ue,e[111]=de,e[112]=me,e[113]=pe,e[114]=le,e[115]=h,e[116]=Xe):Xe=e[116],Xe}function Mt(a){return a!=null}function $t(a){return a.radius}function Pt(a){return a.color}function _t(a){return a.color}function zt(a){return a.properties.NAME!=="Antarctica"}function It(a){return a!==void 0}function Lt(a){return a!==void 0}function Bt(a){return a.data}function Vt(a){return a!==void 0}function At(a){return a.data}function Ft(a,e){return a-e}function Wt(a){return a.date}exports.DotDensityMap=qt;
2
2
  //# sourceMappingURL=DotDensityMap.cjs.map