@undp/data-viz 2.5.0 → 2.5.1

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 (59) hide show
  1. package/dist/BiVariateChoroplethMap.cjs +1 -1
  2. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  3. package/dist/BiVariateChoroplethMap.js +275 -272
  4. package/dist/BiVariateChoroplethMap.js.map +1 -1
  5. package/dist/ChoroplethMap.cjs +1 -1
  6. package/dist/ChoroplethMap.cjs.map +1 -1
  7. package/dist/ChoroplethMap.js +321 -318
  8. package/dist/ChoroplethMap.js.map +1 -1
  9. package/dist/DotDensityMap.cjs +1 -1
  10. package/dist/DotDensityMap.cjs.map +1 -1
  11. package/dist/DotDensityMap.js +268 -265
  12. package/dist/DotDensityMap.js.map +1 -1
  13. package/dist/{GraphEl-B7x5ku_y.cjs → GraphEl-BgkDbq50.cjs} +2 -2
  14. package/dist/GraphEl-BgkDbq50.cjs.map +1 -0
  15. package/dist/{GraphEl-B8tGXqWk.js → GraphEl-Ch0uAeZw.js} +2 -1
  16. package/dist/GraphEl-Ch0uAeZw.js.map +1 -0
  17. package/dist/GriddedGraphs.cjs +1 -1
  18. package/dist/GriddedGraphs.d.ts +1 -0
  19. package/dist/GriddedGraphs.js +1 -1
  20. package/dist/GriddedGraphsFromConfig.d.ts +1 -0
  21. package/dist/HybridMap.cjs +1 -1
  22. package/dist/HybridMap.cjs.map +1 -1
  23. package/dist/HybridMap.js +304 -301
  24. package/dist/HybridMap.js.map +1 -1
  25. package/dist/ImageDownloadButton.cjs +1 -1
  26. package/dist/ImageDownloadButton.js +1 -1
  27. package/dist/MultiGraphDashboard.d.ts +1 -0
  28. package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
  29. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
  30. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
  31. package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
  32. package/dist/ScatterPlot.cjs +1 -1
  33. package/dist/ScatterPlot.cjs.map +1 -1
  34. package/dist/ScatterPlot.d.ts +2 -0
  35. package/dist/ScatterPlot.js +451 -449
  36. package/dist/ScatterPlot.js.map +1 -1
  37. package/dist/ScrollStory.d.ts +1 -0
  38. package/dist/SingleGraphDashboard.cjs +1 -1
  39. package/dist/SingleGraphDashboard.d.ts +1 -0
  40. package/dist/SingleGraphDashboard.js +1 -1
  41. package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
  42. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
  43. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
  44. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
  45. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
  46. package/dist/Types.d.ts +1 -0
  47. package/dist/{imageDownload-Diofs_vY.js → imageDownload-BYsNEtMS.js} +11 -11
  48. package/dist/{imageDownload-Diofs_vY.js.map → imageDownload-BYsNEtMS.js.map} +1 -1
  49. package/dist/{imageDownload-61q6jyJW.cjs → imageDownload-CkMwA7Cw.cjs} +4 -4
  50. package/dist/{imageDownload-61q6jyJW.cjs.map → imageDownload-CkMwA7Cw.cjs.map} +1 -1
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.js +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/utils.cjs +1 -1
  56. package/dist/utils.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/GraphEl-B7x5ku_y.cjs.map +0 -1
  59. package/dist/GraphEl-B8tGXqWk.js.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, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\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\nimport rewind from '@turf/rewind';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n NumberFormatOptions,\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 { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n mapData: FeatureCollection;\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 zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n numberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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 zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n numberDisplayOptions,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\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 const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const pathGenerator = geoPath().projection(projection);\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 {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.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 if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\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 className='undp-map-shapes'\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 ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedIds\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 <motion.path\r\n key={`${d.id}`}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.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 .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\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(\r\n d as number,\r\n 'NA',\r\n numberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n numberDisplayOptions?.locale || 'en',\r\n numberDisplayOptions?.padZeros || false,\r\n )}\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='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\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\nimport { FeatureCollection } from 'geojson';\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 MapOverlayDataType,\r\n NumberFormatOptions,\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 mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, 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 /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n numberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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-v2.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 = 'naturalEarth',\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 projectionRotate = [0, 0],\r\n zoomAndCenterByHighlightedIds = false,\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n numberDisplayOptions,\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 const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(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\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(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 useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.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}` ===\r\n 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(el => el.properties?.NAME !== 'Antarctica'),\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 overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\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 zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n numberDisplayOptions={numberDisplayOptions}\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","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","numberDisplayOptions","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","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","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","i","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","precision","locale","padZeros","ExpandIcon","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","graphDownload","t12","dataDownload","t13","showAntarctica","t14","language","t15","minHeight","t16","theme","t17","ariaLabel","t18","t19","t20","t21","t22","t23","timeline","t24","t25","t26","t27","mapOverlay","Colors","light","graphNoData","grays","t28","t29","t30","enabled","autoplay","showOnlyActiveDate","t31","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t32","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t33","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t34","shape","onUpdateShape","useEffectEvent","t35","shape_0","onUpdateOverlayMapShape","t36","fetchAndParseJSON","then","d_1","t37","t38","d_2","t39","t40","t41","getUniqValue","getJenks","_temp3","t42","t43","speed","interval","setInterval","clearInterval","t44","t45","getSliderMarks","markObj","t46","graphContainer","t47","t48","description","title","GraphHeader","_temp4","_temp5","_temp6","_temp7","_temp8","t49","Pause","Play","SliderUI","nextValue","nextValue_0","t50","GraphArea","d_9","format","_temp9","categoricalColors","sequentialColors","max","Spinner","t51","footnote","source","GraphFooter","t52","GraphContainer","NAME","d_6","d_5","d_4","d_8","d_7","d_3","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJC,MAAAA;AAAAA,IACAC,aAAAA;AAAAA,I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jG;AAAK;AA/K7B,SAAAmS,GAAAkD,GAAA;AAAA,SA0HiBpP,EAACiD;AAA+B;AA1HjD,SAAA0G,GAAA0F,GAAAC,GAAA;AAAA,SAmEkBD,IAAIC;AAAC;AAnEvB,SAAA7F,GAAAzJ,GAAA;AAAA,SA+DgBA,EAACqJ;AAAK;"}
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 { RefObject, useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\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\nimport rewind from '@turf/rewind';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n NumberFormatOptions,\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 { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { ImageDownloadButton } from '@/Components/Actions/ImageDownloadButton';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n mapData: FeatureCollection;\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 zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n numberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n graphDownload?: RefObject<HTMLDivElement | null>;\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 zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n numberDisplayOptions,\r\n graphDownload,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\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 const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const pathGenerator = geoPath().projection(projection);\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 {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.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 if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\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 className='undp-map-shapes'\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 ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedIds\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 <motion.path\r\n key={`${d.id}`}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.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 .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\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(\r\n d as number,\r\n 'NA',\r\n numberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n numberDisplayOptions?.locale || 'en',\r\n numberDisplayOptions?.padZeros || false,\r\n )}\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='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\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 undp-viz-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 {graphDownload && (\r\n <div className='absolute right-4 top-4 flex flex-col image-download-button'>\r\n <ImageDownloadButton nodeID={graphDownload} buttonSmall />\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\nimport { FeatureCollection } from 'geojson';\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 MapOverlayDataType,\r\n NumberFormatOptions,\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 mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, 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 /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n numberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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-v2.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 = 'naturalEarth',\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 projectionRotate = [0, 0],\r\n zoomAndCenterByHighlightedIds = false,\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n numberDisplayOptions,\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 const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(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\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(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 useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.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 || 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}` ===\r\n 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(el => el.properties?.NAME !== 'Antarctica'),\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 overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\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 zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n numberDisplayOptions={numberDisplayOptions}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\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","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","numberDisplayOptions","graphDownload","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","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","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","i","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","precision","locale","padZeros","ExpandIcon","ImageDownloadButton","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","dataDownload","t13","showAntarctica","t14","language","t15","minHeight","t16","theme","t17","ariaLabel","t18","t19","t20","t21","t22","t23","timeline","t24","t25","t26","t27","mapOverlay","Colors","light","graphNoData","grays","t28","t29","t30","enabled","autoplay","showOnlyActiveDate","t31","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t32","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t33","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t34","shape","onUpdateShape","useEffectEvent","t35","shape_0","onUpdateOverlayMapShape","t36","fetchAndParseJSON","then","d_1","t37","t38","d_2","t39","t40","t41","getUniqValue","getJenks","_temp3","t42","t43","speed","interval","setInterval","clearInterval","t44","t45","getSliderMarks","markObj","t46","graphContainer","t47","t48","description","title","GraphHeader","_temp4","_temp5","_temp6","_temp7","_temp8","t49","Pause","Play","SliderUI","nextValue","nextValue_0","t50","GraphArea","d_9","format","_temp9","categoricalColors","sequentialColors","max","Spinner","t51","footnote","source","GraphFooter","t52","GraphContainer","NAME","d_6","d_5","d_4","d_8","d_7","d_3","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,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;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arks-BzrpHrHS.cjs"),Mt=require("./Spinner-WHzzloYQ.cjs"),Ot=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Nt=require("./Typography-BqmyF1gP.cjs"),qt=require("./index-C5K--w8d.cjs"),Bt=require("./Tooltip-C9F3uYG0.cjs"),D=require("./Colors.cjs"),nt=require("./index-BhI7mBJx.cjs"),$t=require("./DetailsModal-Du8Fr1QD.cjs"),It=require("./pow-BnyPO-NX.cjs"),yt=require("./select-Bnfk0lJx.cjs"),at=require("./proxy-CqH8m8IQ.cjs"),Pt=require("./use-in-view-dnRv_qqF.cjs"),_t=require("./index-FXfr51ZM.cjs"),Wt=require("./GraphFooter.cjs"),zt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-QTF6tjij.cjs"),Vt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Lt=require("./uniqBy-O05lp2S5.cjs"),Dt=require("./GraphContainer-Cul9b74X.cjs");function At(n){const{data:e,colors:r,mapData:K,colorLegendTitle:q,colorDomain:y,radius:k,height:g,width:m,scale:x,centerPoint:B,tooltip:Z,showLabels:xe,mapBorderWidth:ge,mapBorderColor:ye,mapNoDataColor:ve,onSeriesMouseOver:Q,showColorScale:$e,zoomScaleExtend:Ie,zoomTranslateExtend:Pe,highlightedDataPoints:je,onSeriesMouseClick:ee,resetSelectionOnDoubleClick:be,detailsOnClick:v,styles:te,classNames:W,mapProjection:z,zoomInteraction:C,animate:j,dimmedOpacity:oe,customLayers:re,maxRadiusValue:Ee,collapseColorScaleByDefault:De,projectionRotate:$,rewindCoordinatesInMapData:V,overlayMapData:L,overlayMapBorderColor:_e,overlayMapBorderWidth:We}=n,A=i.useMemo(()=>V?S.index_default(K,{reverse:!0}):K,[K,V]),ze=i.useMemo(()=>!V||!L?L:S.index_default(L,{reverse:!0}),[L,V]),[ae,d]=i.useState(void 0),[f,Ce]=i.useState(De===void 0?!(m<680):!De),ne=i.useRef(null),[ie,se]=i.useState(void 0),[F,I]=i.useState(void 0),[T,G]=i.useState(void 0),[H,le]=i.useState(void 0),p=i.useRef(null),b=Pt.useInView(p,{once:j.once,amount:j.amount}),U=i.useRef(null),w=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?It.sqrt().domain([0,Ee]).range([.25,k]).nice():void 0;i.useEffect(()=>{const t=yt.select(U.current),h=yt.select(p.current),a=u=>{if(C==="noZoom")return!1;if(C==="button")return!u.type.includes("wheel");const _=u.type==="wheel",Me=u.type.startsWith("touch"),Oe=u.type==="mousedown"||u.type==="mousemove";return Me?!0:_?C==="scroll"?!0:u.ctrlKey:Oe&&!u.button&&!u.ctrlKey},ue=S.zoom().scaleExtent(Ie).translateExtent(Pe||[[-20,-20],[m+20,g+20]]).filter(a).on("zoom",({transform:u})=>{t.attr("transform",u)});h.call(ue),ne.current=ue},[g,m,C]);const P=S.index_default$1(A),M=qt.index_default(A),we=(P[2]-P[0])*1.15,Re=(P[3]-P[1])*1.15,Se=m*190/960*360/we,ke=g*190/678*180/Re,R=x*Math.min(Se,ke),X=z==="mercator"?S.geoMercator().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="equalEarth"?S.geoEqualEarth().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="naturalEarth"?S.geoNaturalEarth1().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="orthographic"?S.geoOrthographic().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):S.geoAlbersUsa().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R),Y=S.geoPath().projection(X),ce=t=>{if(!p.current||!ne.current)return;yt.select(p.current).call(ne.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(at.motion.svg,{width:`${m}px`,height:`${g}px`,viewBox:`0 0 ${m} ${g}`,ref:p,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:U,children:[re.filter(t=>t.position==="before").map(t=>t.layer),A.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ye,strokeWidth:ge,fill:ve,vectorEffect:"non-scaling-stroke"}},h):null}),ze?.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:_e||ye,strokeWidth:We||ge+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},h):null}),o.jsxRuntimeExports.jsx(_t.AnimatePresence,{children:e.map(t=>{const h=e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray;return o.jsxRuntimeExports.jsxs(at.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:ae?ae===h?1:oe:je?je.indexOf(t.label||"")!==-1?1:oe:1,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},onMouseEnter:a=>{I(t),le(a.clientY),G(a.clientX),Q?.(t)},onMouseMove:a=>{I(t),le(a.clientY),G(a.clientX)},onMouseLeave:()=>{I(void 0),G(void 0),le(void 0),Q?.(void 0)},onClick:()=>{(ee||v)&&(Ot.isEqual(ie,t)&&be?(se(void 0),ee?.(void 0)):(se(t),ee?.(t)))},transform:`translate(${X([t.long,t.lat])[0]},${X([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(at.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{r:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{r:0,transition:{duration:j.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),xe&&t.label?o.jsxRuntimeExports.jsx(at.motion.text,{variants:{initial:{opacity:0,x:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{opacity:1,x:w?w(t.radius||0):k,transition:{duration:j.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},y:0,className:o.mo("graph-value text-sm",W?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...te?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),re.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||$e===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",W?.colorLegend),children:f?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(nt.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[q&&q!==""?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:q}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:y.map((t,h)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(r[h%r.length])},onMouseLeave:()=>{d(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[h%r.length]}}),o.jsxRuntimeExports.jsx(Nt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},h))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{Ce(!0)},children:o.jsxRuntimeExports.jsx(nt.ExpandIcon,{})})}),C==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("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:()=>ce("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&&ie!==void 0?o.jsxRuntimeExports.jsx($t.DetailsModal,{body:v,data:ie,setData:se,className:W?.modal}):null,F&&Z&&T&&H?o.jsxRuntimeExports.jsx(Bt.Tooltip,{data:F,body:Z,xPos:T,yPos:H,backgroundStyle:te?.tooltip,className:W?.tooltip}):null]})}function Ft(n){const e=o.compilerRuntimeExports.c(128),{data:r,mapData:K,graphTitle:q,colors:y,sources:k,graphDescription:g,height:m,width:x,footNote:B,colorLegendTitle:Z,colorDomain:xe,radius:ge,scale:ye,centerPoint:ve,padding:Q,mapBorderWidth:$e,mapNoDataColor:Ie,backgroundColor:Pe,showLabels:je,mapBorderColor:ee,tooltip:be,relativeHeight:v,onSeriesMouseOver:te,isWorldMap:W,showColorScale:z,zoomScaleExtend:C,zoomTranslateExtend:j,graphID:oe,highlightedDataPoints:re,onSeriesMouseClick:Ee,graphDownload:De,dataDownload:$,showAntarctica:V,language:L,minHeight:_e,theme:We,ariaLabel:A,resetSelectionOnDoubleClick:ze,detailsOnClick:ae,styles:d,classNames:f,mapProjection:Ce,zoomInteraction:ne,animate:ie,dimmedOpacity:se,customLayers:F,maxRadiusValue:I,timeline:T,collapseColorScaleByDefault:G,projectionRotate:H,rewindCoordinatesInMapData:le,mapOverlay:p}=n,b=K===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":K,U=B===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.":B,w=ge===void 0?5:ge,P=ye===void 0?.95:ye,M=$e===void 0?.5:$e,we=Ie===void 0?D.Colors.light.graphNoData:Ie,Re=Pe===void 0?!1:Pe,Se=je===void 0?!1:je,ke=ee===void 0?D.Colors.light.grays["gray-500"]:ee,R=W===void 0?!0:W,X=z===void 0?!0:z;let Y;e[0]!==C?(Y=C===void 0?[.8,6]:C,e[0]=C,e[1]=Y):Y=e[1];const ce=Y,t=De===void 0?!1:De,h=$===void 0?!1:$,a=V===void 0?!1:V,ue=L===void 0?"en":L,u=_e===void 0?0:_e,_=We===void 0?"light":We,Me=ze===void 0?!0:ze,Oe=Ce===void 0?"naturalEarth":Ce,it=ne===void 0?"button":ne,Ve=ie===void 0?!1:ie,st=se===void 0?.3:se;let Le;e[2]!==F?(Le=F===void 0?[]:F,e[2]=F,e[3]=Le):Le=e[3];const lt=Le;let Ae;e[4]!==T?(Ae=T===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:T,e[4]=T,e[5]=Ae):Ae=e[5];const s=Ae;let Fe;e[6]!==H?(Fe=H===void 0?[0,0]:H,e[6]=H,e[7]=Fe):Fe=e[7];const ct=Fe,ut=le===void 0?!0:le,[J,Ct]=i.useState(0),[Ne,wt]=i.useState(0),[O,Rt]=i.useState(s.autoplay);let qe;if(e[8]!==r||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=E=>jt.parse(`${E.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],qe=[...new Set(r.filter(to).map(l))],qe.sort(eo),e[8]=r,e[9]=s.dateFormat,e[10]=qe}else qe=e[10];const c=qe,[N,dt]=i.useState(s.autoplay?0:c.length-1),[de,St]=i.useState(void 0),[pt,kt]=i.useState(void 0),mt=i.useRef(null),vt=i.useRef(null);let Te,Ge;e[13]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const l=new ResizeObserver(E=>{Ct(E[0].target.clientWidth||620),wt(E[0].target.clientHeight||480)});return mt.current&&l.observe(mt.current),()=>l.disconnect()},Ge=[],e[13]=Te,e[14]=Ge):(Te=e[13],Ge=e[14]),i.useEffect(Te,Ge);let He;e[15]===Symbol.for("react.memo_cache_sentinel")?(He=l=>{St(l)},e[15]=He):He=e[15];const Ue=i.useEffectEvent(He);let Xe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Xe=l=>{kt(l)},e[16]=Xe):Xe=e[16];const Be=i.useEffectEvent(Xe);let Ye;e[17]!==b||e[18]!==Ue?(Ye=()=>{typeof b=="string"?Et.fetchAndParseJSON(b).then(E=>{Ue(E)}):Ue(b)},e[17]=b,e[18]=Ue,e[19]=Ye):Ye=e[19];let Je;e[20]!==b?(Je=[b],e[20]=b,e[21]=Je):Je=e[21],i.useEffect(Ye,Je);let Ke;e[22]!==p?.mapData||e[23]!==Be?(Ke=()=>{p?.mapData||Be(void 0),typeof p?.mapData=="string"?Et.fetchAndParseJSON(p?.mapData).then(E=>{Be(E)}):Be(p?.mapData)},e[22]=p?.mapData,e[23]=Be,e[24]=Ke):Ke=e[24];const ft=p?.mapData;let Ze;e[25]!==ft?(Ze=[ft],e[25]=ft,e[26]=Ze):Ze=e[26],i.useEffect(Ke,Ze);let Qe,et;e[27]!==O||e[28]!==s.speed||e[29]!==c?(Qe=()=>{const l=setInterval(()=>{dt(E=>E<c.length-1?E+1:0)},(s.speed||2)*1e3);return O||clearInterval(l),()=>clearInterval(l)},et=[c,O,s.speed],e[27]=O,e[28]=s.speed,e[29]=c,e[30]=Qe,e[31]=et):(Qe=e[30],et=e[31]),i.useEffect(Qe,et);const ht=s.dateFormat||"yyyy";let tt;e[32]!==N||e[33]!==ht||e[34]!==s.showOnlyActiveDate||e[35]!==c?(tt=bt.getSliderMarks(c,N,s.showOnlyActiveDate,ht),e[32]=N,e[33]=ht,e[34]=s.showOnlyActiveDate,e[35]=c,e[36]=tt):tt=e[36];const ot=tt,xt=f?.graphContainer,gt=d?.graphContainer;let pe;e[37]!==f?.description||e[38]!==f?.title||e[39]!==r||e[40]!==h||e[41]!==g||e[42]!==t||e[43]!==q||e[44]!==d?.description||e[45]!==d?.title||e[46]!==x?(pe=q||g||t||h?o.jsxRuntimeExports.jsx(zt.GraphHeader,{styles:{title:d?.title,description:d?.description},classNames:{title:f?.title,description:f?.description},graphTitle:q,graphDescription:g,width:x,graphDownload:t?vt:void 0,dataDownload:h?r.map(Qt).filter(Zt).length>0?r.map(Kt).filter(Jt):r.filter(Yt):null}):null,e[37]=f?.description,e[38]=f?.title,e[39]=r,e[40]=h,e[41]=g,e[42]=t,e[43]=q,e[44]=d?.description,e[45]=d?.title,e[46]=x,e[47]=pe):pe=e[47];let me;e[48]!==N||e[49]!==ot||e[50]!==O||e[51]!==s.enabled||e[52]!==c?(me=s.enabled&&c.length>0&&ot?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Rt(!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(nt.Pause,{}):o.jsxRuntimeExports.jsx(nt.Play,{})}),o.jsxRuntimeExports.jsx(bt.Nr,{min:c[0],max:c[c.length-1],marks:ot,step:null,defaultValue:c[c.length-1],value:c[N],onChangeComplete:l=>{dt(c.indexOf(l))},onChange:l=>{dt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[48]=N,e[49]=ot,e[50]=O,e[51]=s.enabled,e[52]=c,e[53]=me):me=e[53];let fe;e[54]!==Ve||e[55]!==ve||e[56]!==f||e[57]!==G||e[58]!==xe||e[59]!==Z||e[60]!==y||e[61]!==lt||e[62]!==r||e[63]!==ae||e[64]!==st||e[65]!==m||e[66]!==re||e[67]!==N||e[68]!==R||e[69]!==ke||e[70]!==M||e[71]!==we||e[72]!==p?.mapBorderColor||e[73]!==p?.mapBorderWidth||e[74]!==Oe||e[75]!==de||e[76]!==I||e[77]!==u||e[78]!==Ee||e[79]!==te||e[80]!==pt||e[81]!==ct||e[82]!==w||e[83]!==v||e[84]!==Me||e[85]!==ut||e[86]!==P||e[87]!==a||e[88]!==X||e[89]!==Se||e[90]!==d||e[91]!==Ne||e[92]!==J||e[93]!==_||e[94]!==s.dateFormat||e[95]!==s.enabled||e[96]!==be||e[97]!==c||e[98]!==x||e[99]!==it||e[100]!==ce||e[101]!==j?(fe=o.jsxRuntimeExports.jsx(Dt.GraphArea,{ref:mt,children:J&&Ne&&de?o.jsxRuntimeExports.jsx(At,{data:r.filter(l=>s.enabled?`${l.date}`===jt.format(new Date(c[N]),s.dateFormat||"yyyy"):l),mapData:a?de:{...de,features:de.features.filter(Xt)},colorDomain:r.filter(Ut).length===0?[]:xe||Lt.uniqBy(r,"color",!0),width:J,height:Ne,scale:P,centerPoint:ve,colors:r.filter(Ht).length===0?y?[y]:[D.Colors.primaryColors["blue-600"]]:y||D.Colors[_].categoricalColors.colors,colorLegendTitle:Z,radius:w,overlayMapData:pt,overlayMapBorderColor:p?.mapBorderColor,overlayMapBorderWidth:p?.mapBorderWidth,mapBorderWidth:M,mapNoDataColor:we,mapBorderColor:ke,tooltip:be,onSeriesMouseOver:te,showLabels:Se,isWorldMap:R,showColorScale:X,zoomScaleExtend:ce,zoomTranslateExtend:j,onSeriesMouseClick:Ee,highlightedDataPoints:re,resetSelectionOnDoubleClick:Me,styles:d,classNames:f,zoomInteraction:it,detailsOnClick:ae,mapProjection:Oe||(R?"naturalEarth":"mercator"),animate:Ve===!0?{duration:.5,once:!0,amount:.5}:Ve||{duration:0,once:!0,amount:0},dimmedOpacity:st,customLayers:lt,maxRadiusValue:Vt.checkIfNullOrUndefined(I)?Math.max(...r.map(Gt).filter(Tt)):I,collapseColorScaleByDefault:G,projectionRotate:ct,rewindCoordinatesInMapData:ut}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(u,m||(v?u?(x||J)*v>u?(x||J)*v:u:(x||J)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[54]=Ve,e[55]=ve,e[56]=f,e[57]=G,e[58]=xe,e[59]=Z,e[60]=y,e[61]=lt,e[62]=r,e[63]=ae,e[64]=st,e[65]=m,e[66]=re,e[67]=N,e[68]=R,e[69]=ke,e[70]=M,e[71]=we,e[72]=p?.mapBorderColor,e[73]=p?.mapBorderWidth,e[74]=Oe,e[75]=de,e[76]=I,e[77]=u,e[78]=Ee,e[79]=te,e[80]=pt,e[81]=ct,e[82]=w,e[83]=v,e[84]=Me,e[85]=ut,e[86]=P,e[87]=a,e[88]=X,e[89]=Se,e[90]=d,e[91]=Ne,e[92]=J,e[93]=_,e[94]=s.dateFormat,e[95]=s.enabled,e[96]=be,e[97]=c,e[98]=x,e[99]=it,e[100]=ce,e[101]=j,e[102]=fe):fe=e[102];let he;e[103]!==f?.footnote||e[104]!==f?.source||e[105]!==U||e[106]!==k||e[107]!==d?.footnote||e[108]!==d?.source||e[109]!==x?(he=k||U?o.jsxRuntimeExports.jsx(Wt.GraphFooter,{styles:{footnote:d?.footnote,source:d?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:k,footNote:U,width:x}):null,e[103]=f?.footnote,e[104]=f?.source,e[105]=U,e[106]=k,e[107]=d?.footnote,e[108]=d?.source,e[109]=x,e[110]=he):he=e[110];let rt;return e[111]!==A||e[112]!==Re||e[113]!==oe||e[114]!==m||e[115]!==ue||e[116]!==u||e[117]!==Q||e[118]!==v||e[119]!==xt||e[120]!==gt||e[121]!==pe||e[122]!==me||e[123]!==fe||e[124]!==he||e[125]!==_||e[126]!==x?(rt=o.jsxRuntimeExports.jsxs(Dt.GraphContainer,{className:xt,style:gt,id:oe,ref:vt,"aria-label":A,backgroundColor:Re,theme:_,language:ue,minHeight:u,width:x,height:m,relativeHeight:v,padding:Q,children:[pe,me,fe,he]}),e[111]=A,e[112]=Re,e[113]=oe,e[114]=m,e[115]=ue,e[116]=u,e[117]=Q,e[118]=v,e[119]=xt,e[120]=gt,e[121]=pe,e[122]=me,e[123]=fe,e[124]=he,e[125]=_,e[126]=x,e[127]=rt):rt=e[127],rt}function Tt(n){return n!=null}function Gt(n){return n.radius}function Ht(n){return n.color}function Ut(n){return n.color}function Xt(n){return n.properties?.NAME!=="Antarctica"}function Yt(n){return n!==void 0}function Jt(n){return n!==void 0}function Kt(n){return n.data}function Zt(n){return n!==void 0}function Qt(n){return n.data}function eo(n,e){return n-e}function to(n){return n.date}exports.DotDensityMap=Ft;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),i=require("react"),jt=require("./parse-xYI9yrvL.cjs"),bt=require("./getSliderMarks-BzrpHrHS.cjs"),Mt=require("./Spinner-WHzzloYQ.cjs"),Ot=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Nt=require("./Typography-BqmyF1gP.cjs"),qt=require("./index-C5K--w8d.cjs"),Bt=require("./Tooltip-C9F3uYG0.cjs"),w=require("./Colors.cjs"),it=require("./index-BhI7mBJx.cjs"),It=require("./DetailsModal-Du8Fr1QD.cjs"),$t=require("./ImageDownloadButton.cjs"),Pt=require("./pow-BnyPO-NX.cjs"),yt=require("./select-Bnfk0lJx.cjs"),nt=require("./proxy-CqH8m8IQ.cjs"),_t=require("./use-in-view-dnRv_qqF.cjs"),zt=require("./index-FXfr51ZM.cjs"),Wt=require("./GraphFooter.cjs"),Vt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-QTF6tjij.cjs"),Lt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),At=require("./uniqBy-O05lp2S5.cjs"),Dt=require("./GraphContainer-Cul9b74X.cjs");function Ft(n){const{data:e,colors:r,mapData:X,colorLegendTitle:B,colorDomain:y,radius:k,height:g,width:p,scale:f,centerPoint:I,tooltip:Y,showLabels:fe,mapBorderWidth:he,mapBorderColor:ge,mapNoDataColor:ye,onSeriesMouseOver:J,showColorScale:$e,zoomScaleExtend:Pe,zoomTranslateExtend:_e,highlightedDataPoints:ve,onSeriesMouseClick:K,resetSelectionOnDoubleClick:je,detailsOnClick:j,styles:Z,classNames:A,mapProjection:F,zoomInteraction:C,animate:b,dimmedOpacity:Q,customLayers:ee,maxRadiusValue:be,collapseColorScaleByDefault:Ee,projectionRotate:$,rewindCoordinatesInMapData:T,overlayMapData:G,overlayMapBorderColor:ze,overlayMapBorderWidth:We,graphDownload:te}=n,oe=i.useMemo(()=>T?S.index_default(X,{reverse:!0}):X,[X,T]),De=i.useMemo(()=>!T||!G?G:S.index_default(G,{reverse:!0}),[G,T]),[u,d]=i.useState(void 0),[Ve,we]=i.useState(Ee===void 0?!(p<680):!Ee),re=i.useRef(null),[ae,P]=i.useState(void 0),[H,_]=i.useState(void 0),[ne,z]=i.useState(void 0),[Ce,m]=i.useState(void 0),v=i.useRef(null),W=_t.useInView(v,{once:b.once,amount:b.amount}),ie=i.useRef(null),R=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?Pt.sqrt().domain([0,be]).range([.25,k]).nice():void 0;i.useEffect(()=>{const t=yt.select(ie.current),h=yt.select(v.current),a=x=>{if(C==="noZoom")return!1;if(C==="button")return!x.type.includes("wheel");const Me=x.type==="wheel",Oe=x.type.startsWith("touch"),Ne=x.type==="mousedown"||x.type==="mousemove";return Oe?!0:Me?C==="scroll"?!0:x.ctrlKey:Ne&&!x.button&&!x.ctrlKey},E=S.zoom().scaleExtent(Pe).translateExtent(_e||[[-20,-20],[p+20,g+20]]).filter(a).on("zoom",({transform:x})=>{t.attr("transform",x)});h.call(E),re.current=E},[g,p,C]);const V=S.index_default$1(oe),M=qt.index_default(oe),Re=(V[2]-V[0])*1.15,Se=(V[3]-V[1])*1.15,ke=p*190/960*360/Re,se=g*190/678*180/Se,O=f*Math.min(ke,se),L=F==="mercator"?S.geoMercator().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="equalEarth"?S.geoEqualEarth().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="naturalEarth"?S.geoNaturalEarth1().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="orthographic"?S.geoOrthographic().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):S.geoAlbersUsa().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O),le=S.geoPath().projection(L),ce=t=>{if(!v.current||!re.current)return;yt.select(v.current).call(re.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(nt.motion.svg,{width:`${p}px`,height:`${g}px`,viewBox:`0 0 ${p} ${g}`,ref:v,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:ie,children:[ee.filter(t=>t.position==="before").map(t=>t.layer),oe.features.map((t,h)=>{const a=le(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ge,strokeWidth:he,fill:ye,vectorEffect:"non-scaling-stroke"}},h):null}),De?.features.map((t,h)=>{const a=le(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ze||ge,strokeWidth:We||he+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},h):null}),o.jsxRuntimeExports.jsx(zt.AnimatePresence,{children:e.map(t=>{const h=e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray;return o.jsxRuntimeExports.jsxs(nt.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:u?u===h?1:Q:ve?ve.indexOf(t.label||"")!==-1?1:Q:1,transition:{duration:b.duration}}},initial:"initial",animate:W?"whileInView":"initial",exit:{opacity:0,transition:{duration:b.duration}},onMouseEnter:a=>{_(t),m(a.clientY),z(a.clientX),J?.(t)},onMouseMove:a=>{_(t),m(a.clientY),z(a.clientX)},onMouseLeave:()=>{_(void 0),z(void 0),m(void 0),J?.(void 0)},onClick:()=>{(K||j)&&(Ot.isEqual(ae,t)&&je?(P(void 0),K?.(void 0)):(P(t),K?.(t)))},transform:`translate(${L([t.long,t.lat])[0]},${L([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(nt.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray},whileInView:{r:R?R(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,transition:{duration:b.duration}}},initial:"initial",animate:W?"whileInView":"initial",exit:{r:0,transition:{duration:b.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),fe&&t.label?o.jsxRuntimeExports.jsx(nt.motion.text,{variants:{initial:{opacity:0,x:R?R(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray},whileInView:{opacity:1,x:R?R(t.radius||0):k,transition:{duration:b.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray}},initial:"initial",animate:W?"whileInView":"initial",exit:{opacity:0,transition:{duration:b.duration}},y:0,className:o.mo("graph-value text-sm",A?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...Z?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),ee.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||$e===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",A?.colorLegend),children:Ve?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:()=>{we(!1)},children:o.jsxRuntimeExports.jsx(it.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[B&&B!==""?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:B}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:y.map((t,h)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(r[h%r.length])},onMouseLeave:()=>{d(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[h%r.length]}}),o.jsxRuntimeExports.jsx(Nt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},h))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx(it.ExpandIcon,{})})}),C==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("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:()=>ce("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:"–"})]}),te&&o.jsxRuntimeExports.jsx("div",{className:"absolute right-4 top-4 flex flex-col image-download-button",children:o.jsxRuntimeExports.jsx($t.ImageDownloadButton,{nodeID:te,buttonSmall:!0})})]}),j&&ae!==void 0?o.jsxRuntimeExports.jsx(It.DetailsModal,{body:j,data:ae,setData:P,className:A?.modal}):null,H&&Y&&ne&&Ce?o.jsxRuntimeExports.jsx(Bt.Tooltip,{data:H,body:Y,xPos:ne,yPos:Ce,backgroundStyle:Z?.tooltip,className:A?.tooltip}):null]})}function Tt(n){const e=o.compilerRuntimeExports.c(128),{data:r,mapData:X,graphTitle:B,colors:y,sources:k,graphDescription:g,height:p,width:f,footNote:I,colorLegendTitle:Y,colorDomain:fe,radius:he,scale:ge,centerPoint:ye,padding:J,mapBorderWidth:$e,mapNoDataColor:Pe,backgroundColor:_e,showLabels:ve,mapBorderColor:K,tooltip:je,relativeHeight:j,onSeriesMouseOver:Z,isWorldMap:A,showColorScale:F,zoomScaleExtend:C,zoomTranslateExtend:b,graphID:Q,highlightedDataPoints:ee,onSeriesMouseClick:be,graphDownload:Ee,dataDownload:$,showAntarctica:T,language:G,minHeight:ze,theme:We,ariaLabel:te,resetSelectionOnDoubleClick:oe,detailsOnClick:De,styles:u,classNames:d,mapProjection:Ve,zoomInteraction:we,animate:re,dimmedOpacity:ae,customLayers:P,maxRadiusValue:H,timeline:_,collapseColorScaleByDefault:ne,projectionRotate:z,rewindCoordinatesInMapData:Ce,mapOverlay:m}=n,v=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":X,W=I===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.":I,ie=he===void 0?5:he,R=ge===void 0?.95:ge,V=$e===void 0?.5:$e,M=Pe===void 0?w.Colors.light.graphNoData:Pe,Re=_e===void 0?!1:_e,Se=ve===void 0?!1:ve,ke=K===void 0?w.Colors.light.grays["gray-500"]:K,se=A===void 0?!0:A,O=F===void 0?!0:F;let L;e[0]!==C?(L=C===void 0?[.8,6]:C,e[0]=C,e[1]=L):L=e[1];const le=L,ce=Ee===void 0?!1:Ee,t=$===void 0?!1:$,h=T===void 0?!1:T,a=G===void 0?"en":G,E=ze===void 0?0:ze,x=We===void 0?"light":We,Me=oe===void 0?!0:oe,Oe=Ve===void 0?"naturalEarth":Ve,Ne=we===void 0?"button":we,Le=re===void 0?!1:re,st=ae===void 0?.3:ae;let Ae;e[2]!==P?(Ae=P===void 0?[]:P,e[2]=P,e[3]=Ae):Ae=e[3];const lt=Ae;let Fe;e[4]!==_?(Fe=_===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:_,e[4]=_,e[5]=Fe):Fe=e[5];const s=Fe;let Te;e[6]!==z?(Te=z===void 0?[0,0]:z,e[6]=z,e[7]=Te):Te=e[7];const ct=Te,ut=Ce===void 0?!0:Ce,[U,wt]=i.useState(0),[qe,Ct]=i.useState(0),[N,Rt]=i.useState(s.autoplay);let Be;if(e[8]!==r||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=D=>jt.parse(`${D.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],Be=[...new Set(r.filter(oo).map(l))],Be.sort(to),e[8]=r,e[9]=s.dateFormat,e[10]=Be}else Be=e[10];const c=Be,[q,dt]=i.useState(s.autoplay?0:c.length-1),[ue,St]=i.useState(void 0),[pt,kt]=i.useState(void 0),mt=i.useRef(null),vt=i.useRef(null);let Ge,He;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ge=()=>{const l=new ResizeObserver(D=>{wt(D[0].target.clientWidth||620),Ct(D[0].target.clientHeight||480)});return mt.current&&l.observe(mt.current),()=>l.disconnect()},He=[],e[13]=Ge,e[14]=He):(Ge=e[13],He=e[14]),i.useEffect(Ge,He);let Ue;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ue=l=>{St(l)},e[15]=Ue):Ue=e[15];const Xe=i.useEffectEvent(Ue);let Ye;e[16]===Symbol.for("react.memo_cache_sentinel")?(Ye=l=>{kt(l)},e[16]=Ye):Ye=e[16];const Ie=i.useEffectEvent(Ye);let Je;e[17]!==v||e[18]!==Xe?(Je=()=>{typeof v=="string"?Et.fetchAndParseJSON(v).then(D=>{Xe(D)}):Xe(v)},e[17]=v,e[18]=Xe,e[19]=Je):Je=e[19];let Ke;e[20]!==v?(Ke=[v],e[20]=v,e[21]=Ke):Ke=e[21],i.useEffect(Je,Ke);let Ze;e[22]!==m?.mapData||e[23]!==Ie?(Ze=()=>{m?.mapData||Ie(void 0),typeof m?.mapData=="string"?Et.fetchAndParseJSON(m?.mapData).then(D=>{Ie(D)}):Ie(m?.mapData)},e[22]=m?.mapData,e[23]=Ie,e[24]=Ze):Ze=e[24];const xt=m?.mapData;let Qe;e[25]!==xt?(Qe=[xt],e[25]=xt,e[26]=Qe):Qe=e[26],i.useEffect(Ze,Qe);let et,tt;e[27]!==N||e[28]!==s.speed||e[29]!==c?(et=()=>{const l=setInterval(()=>{dt(D=>D<c.length-1?D+1:0)},(s.speed||2)*1e3);return N||clearInterval(l),()=>clearInterval(l)},tt=[c,N,s.speed],e[27]=N,e[28]=s.speed,e[29]=c,e[30]=et,e[31]=tt):(et=e[30],tt=e[31]),i.useEffect(et,tt);const ft=s.dateFormat||"yyyy";let ot;e[32]!==q||e[33]!==ft||e[34]!==s.showOnlyActiveDate||e[35]!==c?(ot=bt.getSliderMarks(c,q,s.showOnlyActiveDate,ft),e[32]=q,e[33]=ft,e[34]=s.showOnlyActiveDate,e[35]=c,e[36]=ot):ot=e[36];const rt=ot,ht=d?.graphContainer,gt=u?.graphContainer;let de;e[37]!==d?.description||e[38]!==d?.title||e[39]!==r||e[40]!==t||e[41]!==g||e[42]!==B||e[43]!==u?.description||e[44]!==u?.title||e[45]!==f?(de=B||g||t?o.jsxRuntimeExports.jsx(Vt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:d?.title,description:d?.description},graphTitle:B,graphDescription:g,width:f,dataDownload:t?r.map(eo).filter(Qt).length>0?r.map(Zt).filter(Kt):r.filter(Jt):null}):null,e[37]=d?.description,e[38]=d?.title,e[39]=r,e[40]=t,e[41]=g,e[42]=B,e[43]=u?.description,e[44]=u?.title,e[45]=f,e[46]=de):de=e[46];let pe;e[47]!==q||e[48]!==rt||e[49]!==N||e[50]!==s.enabled||e[51]!==c?(pe=s.enabled&&c.length>0&&rt?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Rt(!N)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":N?"Click to pause animation":"Click to play animation",children:N?o.jsxRuntimeExports.jsx(it.Pause,{}):o.jsxRuntimeExports.jsx(it.Play,{})}),o.jsxRuntimeExports.jsx(bt.Nr,{min:c[0],max:c[c.length-1],marks:rt,step:null,defaultValue:c[c.length-1],value:c[q],onChangeComplete:l=>{dt(c.indexOf(l))},onChange:l=>{dt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=q,e[48]=rt,e[49]=N,e[50]=s.enabled,e[51]=c,e[52]=pe):pe=e[52];let me;e[53]!==Le||e[54]!==ye||e[55]!==d||e[56]!==ne||e[57]!==fe||e[58]!==Y||e[59]!==y||e[60]!==lt||e[61]!==r||e[62]!==De||e[63]!==st||e[64]!==ce||e[65]!==p||e[66]!==ee||e[67]!==q||e[68]!==se||e[69]!==ke||e[70]!==V||e[71]!==M||e[72]!==m?.mapBorderColor||e[73]!==m?.mapBorderWidth||e[74]!==Oe||e[75]!==ue||e[76]!==H||e[77]!==E||e[78]!==be||e[79]!==Z||e[80]!==pt||e[81]!==ct||e[82]!==ie||e[83]!==j||e[84]!==Me||e[85]!==ut||e[86]!==R||e[87]!==h||e[88]!==O||e[89]!==Se||e[90]!==u||e[91]!==qe||e[92]!==U||e[93]!==x||e[94]!==s.dateFormat||e[95]!==s.enabled||e[96]!==je||e[97]!==c||e[98]!==f||e[99]!==Ne||e[100]!==le||e[101]!==b?(me=o.jsxRuntimeExports.jsx(Dt.GraphArea,{ref:mt,children:U&&qe&&ue?o.jsxRuntimeExports.jsx(Ft,{data:r.filter(l=>s.enabled?`${l.date}`===jt.format(new Date(c[q]),s.dateFormat||"yyyy"):l),mapData:h?ue:{...ue,features:ue.features.filter(Yt)},colorDomain:r.filter(Xt).length===0?[]:fe||At.uniqBy(r,"color",!0),width:U,height:qe,scale:R,centerPoint:ye,colors:r.filter(Ut).length===0?y?[y]:[w.Colors.primaryColors["blue-600"]]:y||w.Colors[x].categoricalColors.colors,colorLegendTitle:Y,radius:ie,overlayMapData:pt,overlayMapBorderColor:m?.mapBorderColor,overlayMapBorderWidth:m?.mapBorderWidth,mapBorderWidth:V,mapNoDataColor:M,mapBorderColor:ke,tooltip:je,onSeriesMouseOver:Z,showLabels:Se,isWorldMap:se,showColorScale:O,zoomScaleExtend:le,zoomTranslateExtend:b,onSeriesMouseClick:be,highlightedDataPoints:ee,resetSelectionOnDoubleClick:Me,styles:u,classNames:d,zoomInteraction:Ne,detailsOnClick:De,mapProjection:Oe||(se?"naturalEarth":"mercator"),animate:Le===!0?{duration:.5,once:!0,amount:.5}:Le||{duration:0,once:!0,amount:0},dimmedOpacity:st,customLayers:lt,maxRadiusValue:Lt.checkIfNullOrUndefined(H)?Math.max(...r.map(Ht).filter(Gt)):H,collapseColorScaleByDefault:ne,projectionRotate:ct,rewindCoordinatesInMapData:ut,graphDownload:ce?vt:void 0}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(E,p||(j?E?(f||U)*j>E?(f||U)*j:E:(f||U)*j:qe))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[53]=Le,e[54]=ye,e[55]=d,e[56]=ne,e[57]=fe,e[58]=Y,e[59]=y,e[60]=lt,e[61]=r,e[62]=De,e[63]=st,e[64]=ce,e[65]=p,e[66]=ee,e[67]=q,e[68]=se,e[69]=ke,e[70]=V,e[71]=M,e[72]=m?.mapBorderColor,e[73]=m?.mapBorderWidth,e[74]=Oe,e[75]=ue,e[76]=H,e[77]=E,e[78]=be,e[79]=Z,e[80]=pt,e[81]=ct,e[82]=ie,e[83]=j,e[84]=Me,e[85]=ut,e[86]=R,e[87]=h,e[88]=O,e[89]=Se,e[90]=u,e[91]=qe,e[92]=U,e[93]=x,e[94]=s.dateFormat,e[95]=s.enabled,e[96]=je,e[97]=c,e[98]=f,e[99]=Ne,e[100]=le,e[101]=b,e[102]=me):me=e[102];let xe;e[103]!==d?.footnote||e[104]!==d?.source||e[105]!==W||e[106]!==k||e[107]!==u?.footnote||e[108]!==u?.source||e[109]!==f?(xe=k||W?o.jsxRuntimeExports.jsx(Wt.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:k,footNote:W,width:f}):null,e[103]=d?.footnote,e[104]=d?.source,e[105]=W,e[106]=k,e[107]=u?.footnote,e[108]=u?.source,e[109]=f,e[110]=xe):xe=e[110];let at;return e[111]!==te||e[112]!==Re||e[113]!==Q||e[114]!==p||e[115]!==a||e[116]!==E||e[117]!==J||e[118]!==j||e[119]!==ht||e[120]!==gt||e[121]!==de||e[122]!==pe||e[123]!==me||e[124]!==xe||e[125]!==x||e[126]!==f?(at=o.jsxRuntimeExports.jsxs(Dt.GraphContainer,{className:ht,style:gt,id:Q,ref:vt,"aria-label":te,backgroundColor:Re,theme:x,language:a,minHeight:E,width:f,height:p,relativeHeight:j,padding:J,children:[de,pe,me,xe]}),e[111]=te,e[112]=Re,e[113]=Q,e[114]=p,e[115]=a,e[116]=E,e[117]=J,e[118]=j,e[119]=ht,e[120]=gt,e[121]=de,e[122]=pe,e[123]=me,e[124]=xe,e[125]=x,e[126]=f,e[127]=at):at=e[127],at}function Gt(n){return n!=null}function Ht(n){return n.radius}function Ut(n){return n.color}function Xt(n){return n.color}function Yt(n){return n.properties?.NAME!=="Antarctica"}function Jt(n){return n!==void 0}function Kt(n){return n!==void 0}function Zt(n){return n.data}function Qt(n){return n!==void 0}function eo(n){return n.data}function to(n,e){return n-e}function oo(n){return n.date}exports.DotDensityMap=Tt;
2
2
  //# sourceMappingURL=DotDensityMap.cjs.map