@undp/data-viz 1.4.16 → 1.5.0

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 (224) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +3 -3
  3. package/dist/BarGraph.cjs +1 -1
  4. package/dist/BarGraph.js +8 -8
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.js +5 -5
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +35 -34
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.js +5 -5
  13. package/dist/ButterflyChart.cjs +1 -1
  14. package/dist/ButterflyChart.js +5 -5
  15. package/dist/ChoroplethMap.cjs +1 -1
  16. package/dist/ChoroplethMap.cjs.map +1 -1
  17. package/dist/ChoroplethMap.js +52 -51
  18. package/dist/ChoroplethMap.js.map +1 -1
  19. package/dist/CirclePackingGraph.cjs +1 -1
  20. package/dist/CirclePackingGraph.js +3 -3
  21. package/dist/DataCards.cjs +1 -1
  22. package/dist/DataCards.js +5 -5
  23. package/dist/DataTable.cjs +1 -1
  24. package/dist/DataTable.js +3 -3
  25. package/dist/DifferenceLineChart.cjs +1 -1
  26. package/dist/DifferenceLineChart.js +2 -2
  27. package/dist/DonutChart.cjs +1 -1
  28. package/dist/DonutChart.js +4 -4
  29. package/dist/DotDensityMap.cjs +1 -1
  30. package/dist/DotDensityMap.cjs.map +1 -1
  31. package/dist/DotDensityMap.js +39 -38
  32. package/dist/DotDensityMap.js.map +1 -1
  33. package/dist/DualAxisLineChart.cjs +1 -1
  34. package/dist/DualAxisLineChart.js +2 -2
  35. package/dist/DumbbellChart.cjs +1 -1
  36. package/dist/DumbbellChart.js +6 -6
  37. package/dist/GeoHubCompareMaps.cjs +1 -1
  38. package/dist/GeoHubCompareMaps.js +1 -1
  39. package/dist/GeoHubMap.cjs +1 -1
  40. package/dist/GeoHubMap.js +3 -3
  41. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  42. package/dist/GeoHubMapWithLayerSelection.js +4 -4
  43. package/dist/{GraphEl-Bz2jatkM.cjs → GraphEl-4RUlclvW.cjs} +2 -2
  44. package/dist/{GraphEl-Bz2jatkM.cjs.map → GraphEl-4RUlclvW.cjs.map} +1 -1
  45. package/dist/{GraphEl-zNOHBYrK.js → GraphEl-ClIxlWa3.js} +2 -2
  46. package/dist/{GraphEl-zNOHBYrK.js.map → GraphEl-ClIxlWa3.js.map} +1 -1
  47. package/dist/GriddedGraphs.cjs +1 -1
  48. package/dist/GriddedGraphs.d.ts +58 -1
  49. package/dist/GriddedGraphs.js +7 -7
  50. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  51. package/dist/GriddedGraphsFromConfig.d.ts +58 -1
  52. package/dist/GriddedGraphsFromConfig.js +1 -1
  53. package/dist/HeatMap.cjs +1 -1
  54. package/dist/HeatMap.js +4 -4
  55. package/dist/Histogram.cjs +1 -1
  56. package/dist/Histogram.js +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +2 -2
  59. package/dist/MultiGraphDashboard.cjs +1 -1
  60. package/dist/MultiGraphDashboard.d.ts +58 -1
  61. package/dist/MultiGraphDashboard.js +5 -5
  62. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  63. package/dist/MultiGraphDashboardFromConfig.d.ts +58 -1
  64. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  65. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  66. package/dist/MultiGraphDashboardWideToLongFormat.js +2 -2
  67. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  68. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  69. package/dist/MultiLineAltChart.cjs +1 -1
  70. package/dist/MultiLineAltChart.js +3 -3
  71. package/dist/MultiLineChart.cjs +1 -1
  72. package/dist/MultiLineChart.js +2 -2
  73. package/dist/ParetoChart.cjs +1 -1
  74. package/dist/ParetoChart.js +3 -3
  75. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  76. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +58 -1
  77. package/dist/PerformanceIntensiveMultiGraphDashboard.js +5 -5
  78. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  79. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +58 -1
  80. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  81. package/dist/PerformanceIntensiveScrollStory.d.ts +58 -1
  82. package/dist/RadarChart.cjs +1 -1
  83. package/dist/RadarChart.js +4 -4
  84. package/dist/SankeyChart.cjs +1 -1
  85. package/dist/SankeyChart.js +6 -6
  86. package/dist/ScatterPlot.cjs +1 -1
  87. package/dist/ScatterPlot.js +6 -6
  88. package/dist/ScrollStory.d.ts +58 -1
  89. package/dist/SimpleLineChart.cjs +1 -1
  90. package/dist/SimpleLineChart.js +2 -2
  91. package/dist/SingleGraphDashboard.cjs +1 -1
  92. package/dist/SingleGraphDashboard.d.ts +58 -1
  93. package/dist/SingleGraphDashboard.js +8 -8
  94. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  95. package/dist/SingleGraphDashboardFromConfig.d.ts +58 -1
  96. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  97. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +58 -1
  98. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  99. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +58 -1
  100. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  101. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  102. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  103. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +58 -1
  104. package/dist/SingleGraphDashboardThreeDGraphs.js +20 -19
  105. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  106. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  107. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +58 -1
  108. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  109. package/dist/SlopeChart.cjs +1 -1
  110. package/dist/SlopeChart.js +4 -4
  111. package/dist/SparkLine.cjs +1 -1
  112. package/dist/SparkLine.js +2 -2
  113. package/dist/StatCardFromData.cjs +1 -1
  114. package/dist/StatCardFromData.js +1 -1
  115. package/dist/StripChart.cjs +1 -1
  116. package/dist/StripChart.js +5 -5
  117. package/dist/ThreeDGlobe.cjs +1 -1
  118. package/dist/ThreeDGlobe.cjs.map +1 -1
  119. package/dist/ThreeDGlobe.d.ts +61 -6
  120. package/dist/ThreeDGlobe.js +385 -314
  121. package/dist/ThreeDGlobe.js.map +1 -1
  122. package/dist/{Tooltip-DyM5snqx.js → Tooltip-CVCGWyzw.js} +2 -2
  123. package/dist/{Tooltip-DyM5snqx.js.map → Tooltip-CVCGWyzw.js.map} +1 -1
  124. package/dist/{Tooltip-n8z5bfav.cjs → Tooltip-De16GWhY.cjs} +2 -2
  125. package/dist/{Tooltip-n8z5bfav.cjs.map → Tooltip-De16GWhY.cjs.map} +1 -1
  126. package/dist/TreeMapGraph.cjs +1 -1
  127. package/dist/TreeMapGraph.js +3 -3
  128. package/dist/Types.d.ts +58 -1
  129. package/dist/UnitChart.cjs +1 -1
  130. package/dist/UnitChart.js +1 -1
  131. package/dist/_commonjsHelpers-BH3jXuIh.cjs +2 -0
  132. package/dist/_commonjsHelpers-BH3jXuIh.cjs.map +1 -0
  133. package/dist/_commonjsHelpers-ByX85dGu.js +34 -0
  134. package/dist/_commonjsHelpers-ByX85dGu.js.map +1 -0
  135. package/dist/{ensureCompleteData-BBDZbDCE.js → ensureCompleteData-BALdOrsS.js} +2 -2
  136. package/dist/{ensureCompleteData-BBDZbDCE.js.map → ensureCompleteData-BALdOrsS.js.map} +1 -1
  137. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs → ensureCompleteData-BU5Zlccy.cjs} +2 -2
  138. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs.map → ensureCompleteData-BU5Zlccy.cjs.map} +1 -1
  139. package/dist/{fetchAndParseData-4gsYTy6_.js → fetchAndParseData-DBOl1Icl.js} +2 -2
  140. package/dist/{fetchAndParseData-4gsYTy6_.js.map → fetchAndParseData-DBOl1Icl.js.map} +1 -1
  141. package/dist/{fetchAndParseData-CQyVGCul.cjs → fetchAndParseData-Dcy7AS_0.cjs} +2 -2
  142. package/dist/{fetchAndParseData-CQyVGCul.cjs.map → fetchAndParseData-Dcy7AS_0.cjs.map} +1 -1
  143. package/dist/fetchAndParseData.cjs +1 -1
  144. package/dist/fetchAndParseData.js +1 -1
  145. package/dist/{filterData-B8ocT57s.js → filterData-9nEcQ-Jp.js} +3 -3
  146. package/dist/{filterData-B8ocT57s.js.map → filterData-9nEcQ-Jp.js.map} +1 -1
  147. package/dist/{filterData-DN6py7y_.cjs → filterData-BoYadk0l.cjs} +2 -2
  148. package/dist/{filterData-DN6py7y_.cjs.map → filterData-BoYadk0l.cjs.map} +1 -1
  149. package/dist/{getJenks-VhM3GIoC.js → getJenks-DW96UYNE.js} +2 -2
  150. package/dist/{getJenks-VhM3GIoC.js.map → getJenks-DW96UYNE.js.map} +1 -1
  151. package/dist/{getJenks-TWQvbuOz.cjs → getJenks-vofIZmeb.cjs} +2 -2
  152. package/dist/{getJenks-TWQvbuOz.cjs.map → getJenks-vofIZmeb.cjs.map} +1 -1
  153. package/dist/{getUniqValue-CHqgSss5.cjs → getUniqValue-CfuE_l9c.cjs} +2 -2
  154. package/dist/{getUniqValue-CHqgSss5.cjs.map → getUniqValue-CfuE_l9c.cjs.map} +1 -1
  155. package/dist/{getUniqValue-BtUENB2H.js → getUniqValue-CttuU_wn.js} +4 -4
  156. package/dist/{getUniqValue-BtUENB2H.js.map → getUniqValue-CttuU_wn.js.map} +1 -1
  157. package/dist/{index-CaAIPGZo.js → index-AqnpA7_O.js} +2 -2
  158. package/dist/{index-CaAIPGZo.js.map → index-AqnpA7_O.js.map} +1 -1
  159. package/dist/{index-CZbIGs8q.cjs → index-BJOeaYTk.cjs} +2 -2
  160. package/dist/{index-CZbIGs8q.cjs.map → index-BJOeaYTk.cjs.map} +1 -1
  161. package/dist/{index-Bc5VF70V.js → index-BMgDMxKJ.js} +6 -6
  162. package/dist/{index-Bc5VF70V.js.map → index-BMgDMxKJ.js.map} +1 -1
  163. package/dist/{index-B0rbzOoC.cjs → index-BS2TADPj.cjs} +2 -2
  164. package/dist/{index-B0rbzOoC.cjs.map → index-BS2TADPj.cjs.map} +1 -1
  165. package/dist/{index-27yTRcko.js → index-Bwrro8-q.js} +2 -2
  166. package/dist/{index-27yTRcko.js.map → index-Bwrro8-q.js.map} +1 -1
  167. package/dist/{index-BczVvEBZ.cjs → index-CQ3e6Ewi.cjs} +2 -2
  168. package/dist/{index-BczVvEBZ.cjs.map → index-CQ3e6Ewi.cjs.map} +1 -1
  169. package/dist/{index-C21TvELx.cjs → index-CSNtgibC.cjs} +2 -2
  170. package/dist/{index-C21TvELx.cjs.map → index-CSNtgibC.cjs.map} +1 -1
  171. package/dist/{index-D7ltPi18.js → index-CeVNqhMO.js} +2 -2
  172. package/dist/{index-D7ltPi18.js.map → index-CeVNqhMO.js.map} +1 -1
  173. package/dist/index-D05lK1Te.cjs +2 -0
  174. package/dist/index-D05lK1Te.cjs.map +1 -0
  175. package/dist/{index-Ds0uHjK9.cjs → index-D72cOtq7.cjs} +2 -2
  176. package/dist/{index-Ds0uHjK9.cjs.map → index-D72cOtq7.cjs.map} +1 -1
  177. package/dist/{index-BXns0-ng.cjs → index-DQA8q5sC.cjs} +2 -2
  178. package/dist/{index-BXns0-ng.cjs.map → index-DQA8q5sC.cjs.map} +1 -1
  179. package/dist/{index-BzeLQvXk.cjs → index-DYH8g9WA.cjs} +2 -2
  180. package/dist/{index-BzeLQvXk.cjs.map → index-DYH8g9WA.cjs.map} +1 -1
  181. package/dist/{index-BbNoLJ_w.cjs → index-Da2GUKrr.cjs} +2 -2
  182. package/dist/{index-BbNoLJ_w.cjs.map → index-Da2GUKrr.cjs.map} +1 -1
  183. package/dist/{index-BLizQDlg.js → index-DvVprvy6.js} +2 -2
  184. package/dist/{index-BLizQDlg.js.map → index-DvVprvy6.js.map} +1 -1
  185. package/dist/{index-UV9hjG_S.js → index-EArKRVKg.js} +2 -2
  186. package/dist/{index-UV9hjG_S.js.map → index-EArKRVKg.js.map} +1 -1
  187. package/dist/{index-C1rRk_50.js → index-V_JXij1_.js} +2 -2
  188. package/dist/{index-C1rRk_50.js.map → index-V_JXij1_.js.map} +1 -1
  189. package/dist/{index-DxagiOHo.js → index-fwdktvAS.js} +2 -2
  190. package/dist/{index-DxagiOHo.js.map → index-fwdktvAS.js.map} +1 -1
  191. package/dist/index-qfWCwobm.js +682 -0
  192. package/dist/index-qfWCwobm.js.map +1 -0
  193. package/dist/index.cjs +1 -1
  194. package/dist/index.d.ts +63 -7
  195. package/dist/index.js +6 -6
  196. package/dist/{string2HTML-CWHGfz_d.js → string2HTML-oFCROsus.js} +2 -2
  197. package/dist/{string2HTML-CWHGfz_d.js.map → string2HTML-oFCROsus.js.map} +1 -1
  198. package/dist/{string2HTML-D2Avudmb.cjs → string2HTML-z7CwHXcx.cjs} +2 -2
  199. package/dist/{string2HTML-D2Avudmb.cjs.map → string2HTML-z7CwHXcx.cjs.map} +1 -1
  200. package/dist/transformData.cjs +1 -1
  201. package/dist/transformData.js +3 -3
  202. package/dist/{transformDataForAggregation-CdcwlnNe.js → transformDataForAggregation-1BYVFqvF.js} +4 -4
  203. package/dist/{transformDataForAggregation-CdcwlnNe.js.map → transformDataForAggregation-1BYVFqvF.js.map} +1 -1
  204. package/dist/{transformDataForAggregation-Du-Hei-W.cjs → transformDataForAggregation-BVxVu4yY.cjs} +2 -2
  205. package/dist/{transformDataForAggregation-Du-Hei-W.cjs.map → transformDataForAggregation-BVxVu4yY.cjs.map} +1 -1
  206. package/dist/{transformDataForGraphFromFile-BCjsizvb.js → transformDataForGraphFromFile-BC9Ha8hF.js} +3 -3
  207. package/dist/{transformDataForGraphFromFile-BCjsizvb.js.map → transformDataForGraphFromFile-BC9Ha8hF.js.map} +1 -1
  208. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs → transformDataForGraphFromFile-b41aNQYY.cjs} +2 -2
  209. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs.map → transformDataForGraphFromFile-b41aNQYY.cjs.map} +1 -1
  210. package/dist/utils.cjs +1 -1
  211. package/dist/utils.js +2 -2
  212. package/dist/zoom-Bsbhil-K.cjs +2 -0
  213. package/dist/zoom-Bsbhil-K.cjs.map +1 -0
  214. package/dist/zoom-DAu91HKr.js +1864 -0
  215. package/dist/zoom-DAu91HKr.js.map +1 -0
  216. package/package.json +2 -2
  217. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  218. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  219. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
  220. package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  221. package/dist/zoom-Lo7IAUfC.cjs +0 -2
  222. package/dist/zoom-Lo7IAUfC.cjs.map +0 -1
  223. package/dist/zoom-_lqdiGoI.js +0 -1983
  224. package/dist/zoom-_lqdiGoI.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),I=require("./index-Ds0uHjK9.cjs"),j=require("./index-B0rbzOoC.cjs"),b=require("./DropdownSelect-DBDM64B5.cjs"),z=require("./checkIfMultiple-BXbHUCWM.cjs"),L=require("./SingleGraphDashboard.cjs"),U=require("./SingleGraphDashboardThreeDGraphs.cjs"),Z=require("./SingleGraphDashboardGeoHubMaps.cjs"),p=require("./fetchAndParseData-CQyVGCul.cjs"),J=require("./getUniqValue-CHqgSss5.cjs"),B=require("./GraphHeader.cjs"),k=require("./filterData-DN6py7y_.cjs"),V=require("./transformDataForSelect-YmStusCI.cjs"),w=y=>y.map(a=>a.columnWidth||1).reduce((a,h)=>a+h,0),K=["barChart","choroplethMap","biVariateChoroplethMap","circlePacking","treeMap"];function Q(y){const{dashboardID:C,dashboardLayout:s,dataSettings:a,filters:h,debugMode:c,theme:g="light",readableHeader:T,dataFilters:R,noOfFiltersPerRow:v=4,filterPosition:F,uiMode:d="normal",graphStyles:S,graphClassNames:D}=y,[m,H]=o.useState(void 0),[f,q]=o.useState(void 0),[u,E]=o.useState([]),A=["threeDGlobe"],N=["geoHubCompareMap","geoHubMap","geoHubMapWithLayerSelection"],G=o.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),O=o.useMemo(()=>!f||u.length===0?f:f.filter(l=>u.every(e=>e.value&&j.flattenDeep([e.value]).length>0?I.intersection(j.flattenDeep([l[e.filter]]),j.flattenDeep([e.value]).map(i=>i.value)).length>0:!0)),[u,f]);o.useEffect(()=>{H(O)},[O]);const M=o.useCallback(async()=>{if(a)try{const l=await(a.dataURL?typeof a.dataURL=="string"?a.fileType==="json"?p.fetchAndParseJSON(a.dataURL,a.columnsToArray,a.dataTransformation,c):a.fileType==="api"?p.fetchAndTransformDataFromAPI(a.dataURL,a.apiHeaders,a.columnsToArray,a.dataTransformation,c):p.fetchAndParseCSV(a.dataURL,a.dataTransformation,a.columnsToArray,c,a.delimiter,!0):p.fetchAndParseMultipleDataSources(a.dataURL,a.idColumnTitle):p.transformColumnsToArray(a.data,a.columnsToArray));q(l);const e=(h||[]).map(i=>({filter:i.column,label:i.label||`Filter by ${i.column}`,singleSelect:i.singleSelect,clearable:i.clearable,defaultValue:V.transformDefaultValue(i.defaultValue),value:V.transformDefaultValue(i.defaultValue),availableValues:J.getUniqValue(l,i.column).filter(n=>!i.excludeValues?.includes(`${n}`)).map(n=>({value:n,label:n})),allowSelectAll:i.allowSelectAll,width:i.width}));E(e)}catch(t){console.error("Data fetching error:",t)}},[a,h,c]);o.useEffect(()=>{M()},[M]);const x=o.useCallback((t,l)=>{E(e=>e.map(i=>i.filter===t?{...i,value:l}:i))},[]);return r.jsxRuntimeExports.jsx("div",{className:`${g||"light"} flex grow`,dir:s.language==="he"||s.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${s.backgroundColor?s.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto gap-4 flex flex-col w-full grow h-inherit ${s.language||"en"}`,style:{...s.backgroundColor&&s.backgroundColor!==!0?{backgroundColor:s.backgroundColor}:{}},id:C,children:r.jsxRuntimeExports.jsx("div",{style:{padding:s.backgroundColor?s.padding||"1rem":s.padding||0,flexGrow:1,display:"flex"},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[s.title||s.description?r.jsxRuntimeExports.jsx(B.GraphHeader,{graphTitle:s.title,graphDescription:s.description,isDashboard:!0}):null,r.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[u.length!==0?r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"280px":"100%",flexGrow:1,flexShrink:0},children:r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%",position:"sticky",top:"1rem"},children:u?.map((t,l)=>r.jsxRuntimeExports.jsxs("div",{style:{width:t.width||`calc(${100/v}% - ${(v-1)/v}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(z.f,{className:"mb-2",children:t.label}),t.singleSelect?r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isClearable:t.clearable===void 0?!0:t.clearable,size:"sm",variant:d,isMulti:!1,isSearchable:!0,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},defaultValue:t.defaultValue,value:t.value}):r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isMulti:!0,size:"sm",isClearable:t.clearable===void 0?!0:t.clearable,variant:d,isSearchable:!0,controlShouldRenderValue:!0,closeMenuOnSelect:!1,hideSelectedOptions:!1,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},value:t.value,defaultValue:t.defaultValue}),t.allowSelectAll?r.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{x(t.filter,t.availableValues)},children:"Select all options"}):null]})]},l))})}):null,r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"calc(100% - 280px - 1rem)":"100%",minWidth:"280px",flexGrow:1,display:"flex",gap:"1rem",flexWrap:"wrap",flexShrink:"0"},children:s.rows.map((t,l)=>r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${t.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:t.columns.map((e,i)=>r.jsxRuntimeExports.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(e.columnWidth||1)/w(t.columns)}% - ${(w(t.columns)-(e.columnWidth||1))/w(t.columns)}rem)`,minHeight:"inherit"},children:A.includes(e.graphType)?r.jsxRuntimeExports.jsx(U.SingleGraphDashboardThreeDGraphs,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]}):N.includes(e.graphType)?r.jsxRuntimeExports.jsx(Z.SingleGraphDashboardGeoHubMaps,{graphType:e.graphType,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},debugMode:c}):r.jsxRuntimeExports.jsx(L.SingleGraphDashboard,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},updateFilters:e.attachedFilter&&K.indexOf(e.graphType)!==-1&&u.findIndex(n=>n.filter===e.attachedFilter)!==-1?n=>{const W=u.findIndex($=>$.filter===e.attachedFilter),P=n?u[W].singleSelect?{value:n,label:n}:[{value:n,label:n}]:void 0;x(e.attachedFilter,P)}:void 0,dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]})},i))},l))})]})]})})})})}exports.PerformanceIntensiveMultiGraphDashboard=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),I=require("./index-D72cOtq7.cjs"),j=require("./index-BS2TADPj.cjs"),b=require("./DropdownSelect-DBDM64B5.cjs"),z=require("./checkIfMultiple-BXbHUCWM.cjs"),L=require("./SingleGraphDashboard.cjs"),U=require("./SingleGraphDashboardThreeDGraphs.cjs"),Z=require("./SingleGraphDashboardGeoHubMaps.cjs"),p=require("./fetchAndParseData-Dcy7AS_0.cjs"),J=require("./getUniqValue-CfuE_l9c.cjs"),B=require("./GraphHeader.cjs"),k=require("./filterData-BoYadk0l.cjs"),V=require("./transformDataForSelect-YmStusCI.cjs"),w=y=>y.map(a=>a.columnWidth||1).reduce((a,h)=>a+h,0),K=["barChart","choroplethMap","biVariateChoroplethMap","circlePacking","treeMap"];function Q(y){const{dashboardID:C,dashboardLayout:s,dataSettings:a,filters:h,debugMode:c,theme:g="light",readableHeader:T,dataFilters:R,noOfFiltersPerRow:v=4,filterPosition:F,uiMode:d="normal",graphStyles:S,graphClassNames:D}=y,[m,H]=o.useState(void 0),[f,q]=o.useState(void 0),[u,E]=o.useState([]),A=["threeDGlobe"],N=["geoHubCompareMap","geoHubMap","geoHubMapWithLayerSelection"],G=o.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),O=o.useMemo(()=>!f||u.length===0?f:f.filter(l=>u.every(e=>e.value&&j.flattenDeep([e.value]).length>0?I.intersection(j.flattenDeep([l[e.filter]]),j.flattenDeep([e.value]).map(i=>i.value)).length>0:!0)),[u,f]);o.useEffect(()=>{H(O)},[O]);const M=o.useCallback(async()=>{if(a)try{const l=await(a.dataURL?typeof a.dataURL=="string"?a.fileType==="json"?p.fetchAndParseJSON(a.dataURL,a.columnsToArray,a.dataTransformation,c):a.fileType==="api"?p.fetchAndTransformDataFromAPI(a.dataURL,a.apiHeaders,a.columnsToArray,a.dataTransformation,c):p.fetchAndParseCSV(a.dataURL,a.dataTransformation,a.columnsToArray,c,a.delimiter,!0):p.fetchAndParseMultipleDataSources(a.dataURL,a.idColumnTitle):p.transformColumnsToArray(a.data,a.columnsToArray));q(l);const e=(h||[]).map(i=>({filter:i.column,label:i.label||`Filter by ${i.column}`,singleSelect:i.singleSelect,clearable:i.clearable,defaultValue:V.transformDefaultValue(i.defaultValue),value:V.transformDefaultValue(i.defaultValue),availableValues:J.getUniqValue(l,i.column).filter(n=>!i.excludeValues?.includes(`${n}`)).map(n=>({value:n,label:n})),allowSelectAll:i.allowSelectAll,width:i.width}));E(e)}catch(t){console.error("Data fetching error:",t)}},[a,h,c]);o.useEffect(()=>{M()},[M]);const x=o.useCallback((t,l)=>{E(e=>e.map(i=>i.filter===t?{...i,value:l}:i))},[]);return r.jsxRuntimeExports.jsx("div",{className:`${g||"light"} flex grow`,dir:s.language==="he"||s.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${s.backgroundColor?s.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto gap-4 flex flex-col w-full grow h-inherit ${s.language||"en"}`,style:{...s.backgroundColor&&s.backgroundColor!==!0?{backgroundColor:s.backgroundColor}:{}},id:C,children:r.jsxRuntimeExports.jsx("div",{style:{padding:s.backgroundColor?s.padding||"1rem":s.padding||0,flexGrow:1,display:"flex"},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[s.title||s.description?r.jsxRuntimeExports.jsx(B.GraphHeader,{graphTitle:s.title,graphDescription:s.description,isDashboard:!0}):null,r.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[u.length!==0?r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"280px":"100%",flexGrow:1,flexShrink:0},children:r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%",position:"sticky",top:"1rem"},children:u?.map((t,l)=>r.jsxRuntimeExports.jsxs("div",{style:{width:t.width||`calc(${100/v}% - ${(v-1)/v}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(z.f,{className:"mb-2",children:t.label}),t.singleSelect?r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isClearable:t.clearable===void 0?!0:t.clearable,size:"sm",variant:d,isMulti:!1,isSearchable:!0,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},defaultValue:t.defaultValue,value:t.value}):r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isMulti:!0,size:"sm",isClearable:t.clearable===void 0?!0:t.clearable,variant:d,isSearchable:!0,controlShouldRenderValue:!0,closeMenuOnSelect:!1,hideSelectedOptions:!1,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},value:t.value,defaultValue:t.defaultValue}),t.allowSelectAll?r.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{x(t.filter,t.availableValues)},children:"Select all options"}):null]})]},l))})}):null,r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"calc(100% - 280px - 1rem)":"100%",minWidth:"280px",flexGrow:1,display:"flex",gap:"1rem",flexWrap:"wrap",flexShrink:"0"},children:s.rows.map((t,l)=>r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${t.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:t.columns.map((e,i)=>r.jsxRuntimeExports.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(e.columnWidth||1)/w(t.columns)}% - ${(w(t.columns)-(e.columnWidth||1))/w(t.columns)}rem)`,minHeight:"inherit"},children:A.includes(e.graphType)?r.jsxRuntimeExports.jsx(U.SingleGraphDashboardThreeDGraphs,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]}):N.includes(e.graphType)?r.jsxRuntimeExports.jsx(Z.SingleGraphDashboardGeoHubMaps,{graphType:e.graphType,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},debugMode:c}):r.jsxRuntimeExports.jsx(L.SingleGraphDashboard,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},updateFilters:e.attachedFilter&&K.indexOf(e.graphType)!==-1&&u.findIndex(n=>n.filter===e.attachedFilter)!==-1?n=>{const W=u.findIndex($=>$.filter===e.attachedFilter),P=n?u[W].singleSelect?{value:n,label:n}:[{value:n,label:n}]:void 0;x(e.attachedFilter,P)}:void 0,dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]})},i))},l))})]})]})})})})}exports.PerformanceIntensiveMultiGraphDashboard=Q;
2
2
  //# sourceMappingURL=PerformanceIntensiveMultiGraphDashboard.cjs.map
@@ -27,6 +27,10 @@ declare interface AggregationSettingsDataType {
27
27
  aggregationMethod?: 'sum' | 'average' | 'min' | 'max';
28
28
  }
29
29
 
30
+ declare interface AmbientLightConfig extends BaseLightConfig {
31
+ type: 'ambient';
32
+ }
33
+
30
34
  declare interface AnimateDataType {
31
35
  duration: number;
32
36
  once: boolean;
@@ -69,6 +73,12 @@ declare interface AxesStyleObject {
69
73
  axis?: React.CSSProperties;
70
74
  }
71
75
 
76
+ declare interface BaseLightConfig {
77
+ type: string;
78
+ color: number;
79
+ intensity: number;
80
+ }
81
+
72
82
  declare interface ClassNameObject {
73
83
  title?: string;
74
84
  footnote?: string;
@@ -176,6 +186,14 @@ declare interface DataTableColumnDataType {
176
186
  columnWidth?: number;
177
187
  }
178
188
 
189
+ declare interface DirectionalLightConfig extends BaseLightConfig {
190
+ type: 'directional';
191
+ target?: Position;
192
+ castShadow?: boolean;
193
+ shadow?: ShadowConfig;
194
+ position?: Position | 'camera';
195
+ }
196
+
179
197
  declare interface FileSettingsDataType {
180
198
  dataURL: string;
181
199
  idColumnName: string;
@@ -453,9 +471,10 @@ declare interface GraphSettingsDataType {
453
471
  polygonAltitude?: number;
454
472
  atmosphereAltitude?: number;
455
473
  globeCurvatureResolution?: number;
456
- lightColor?: string;
474
+ lights?: LightConfig[];
457
475
  fogSetting?: FogDataType;
458
476
  showAxisLabels?: boolean;
477
+ highlightedAltitude?: number;
459
478
  }
460
479
 
461
480
  declare type GraphType = GraphTypeForGriddedGraph;
@@ -480,6 +499,8 @@ declare interface HighlightAreaSettingsForScatterPlotDataType {
480
499
 
481
500
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
482
501
 
502
+ declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
503
+
483
504
  declare interface MapLegendDataType {
484
505
  mapStyleName: string;
485
506
  legend: string | React.ReactNode;
@@ -500,6 +521,19 @@ declare interface PerformanceIntensiveDashboardLayoutDataType extends DashboardL
500
521
 
501
522
  export declare function PerformanceIntensiveMultiGraphDashboard(props: Props): JSX.Element;
502
523
 
524
+ declare interface PointLightConfig extends BaseLightConfig {
525
+ type: 'point';
526
+ distance?: number;
527
+ decay?: number;
528
+ position?: Position | 'camera';
529
+ }
530
+
531
+ declare interface Position {
532
+ x: number;
533
+ y: number;
534
+ z: number;
535
+ }
536
+
503
537
  declare interface Props {
504
538
  dashboardID?: string;
505
539
  dashboardLayout: PerformanceIntensiveDashboardLayoutDataType;
@@ -535,11 +569,34 @@ declare interface ReferenceDataType {
535
569
 
536
570
  declare type ScaleDataType = 'categorical' | 'linear' | 'threshold';
537
571
 
572
+ declare interface ShadowConfig {
573
+ mapSize: {
574
+ width: number;
575
+ height: number;
576
+ };
577
+ camera: {
578
+ near: number;
579
+ far: number;
580
+ };
581
+ }
582
+
538
583
  declare interface SourcesDataType {
539
584
  source: string;
540
585
  link?: string;
541
586
  }
542
587
 
588
+ declare interface SpotLightConfig extends BaseLightConfig {
589
+ type: 'spot';
590
+ target?: Position;
591
+ distance?: number;
592
+ angle?: number;
593
+ penumbra?: number;
594
+ decay?: number;
595
+ castShadow?: boolean;
596
+ shadow?: ShadowConfig;
597
+ position?: Position | 'camera';
598
+ }
599
+
543
600
  declare interface StyleObject {
544
601
  title?: React.CSSProperties;
545
602
  footnote?: React.CSSProperties;
@@ -1,16 +1,16 @@
1
1
  import { j as r } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as v, useMemo as M, useEffect as A, useCallback as H } from "react";
3
- import { i as Z } from "./index-C1rRk_50.js";
4
- import { f as S } from "./index-UV9hjG_S.js";
3
+ import { i as Z } from "./index-V_JXij1_.js";
4
+ import { f as S } from "./index-EArKRVKg.js";
5
5
  import { Z as G, H as N } from "./DropdownSelect-CtOKZHD0.js";
6
6
  import { f as q } from "./checkIfMultiple-ChTJk2Tk.js";
7
7
  import { SingleGraphDashboard as J } from "./SingleGraphDashboard.js";
8
8
  import { SingleGraphDashboardThreeDGraphs as B } from "./SingleGraphDashboardThreeDGraphs.js";
9
9
  import { SingleGraphDashboardGeoHubMaps as K } from "./SingleGraphDashboardGeoHubMaps.js";
10
- import { f as Q, a as X, b as Y, c as _, t as aa } from "./fetchAndParseData-4gsYTy6_.js";
11
- import { g as ea } from "./getUniqValue-BtUENB2H.js";
10
+ import { f as Q, a as X, b as Y, c as _, t as aa } from "./fetchAndParseData-DBOl1Icl.js";
11
+ import { g as ea } from "./getUniqValue-CttuU_wn.js";
12
12
  import { GraphHeader as ta } from "./GraphHeader.js";
13
- import { f as W } from "./filterData-B8ocT57s.js";
13
+ import { f as W } from "./filterData-9nEcQ-Jp.js";
14
14
  import { t as $ } from "./transformDataForSelect-D8AuvYdf.js";
15
15
  const D = (f) => f.map((t) => t.columnWidth || 1).reduce((t, u) => t + u, 0), ra = [
16
16
  "barChart",
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),o=require("./Spinner-DA6Z5E4n.cjs"),d=require("./PerformanceIntensiveMultiGraphDashboard.cjs"),f=require("./fetchAndParseData-CQyVGCul.cjs");function u(i){const{config:t}=i,[e,a]=s.useState(void 0);return s.useEffect(()=>{(async()=>{if(typeof t=="string"){const n=await f.fetchAndParseJSON(t);a(n)}else a(t)})()},[t]),e?r.jsxRuntimeExports.jsx(d.PerformanceIntensiveMultiGraphDashboard,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,filters:e.filters,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,noOfFiltersPerRow:e.noOfFiltersPerRow,filterPosition:e.filterPosition,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(o.y,{})})}exports.PerformanceIntensiveMultiGraphDashboardFromConfig=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),o=require("./Spinner-DA6Z5E4n.cjs"),d=require("./PerformanceIntensiveMultiGraphDashboard.cjs"),f=require("./fetchAndParseData-Dcy7AS_0.cjs");function u(i){const{config:t}=i,[e,a]=s.useState(void 0);return s.useEffect(()=>{(async()=>{if(typeof t=="string"){const n=await f.fetchAndParseJSON(t);a(n)}else a(t)})()},[t]),e?r.jsxRuntimeExports.jsx(d.PerformanceIntensiveMultiGraphDashboard,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,filters:e.filters,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,noOfFiltersPerRow:e.noOfFiltersPerRow,filterPosition:e.filterPosition,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(o.y,{})})}exports.PerformanceIntensiveMultiGraphDashboardFromConfig=u;
2
2
  //# sourceMappingURL=PerformanceIntensiveMultiGraphDashboardFromConfig.cjs.map
@@ -27,6 +27,10 @@ declare interface AggregationSettingsDataType {
27
27
  aggregationMethod?: 'sum' | 'average' | 'min' | 'max';
28
28
  }
29
29
 
30
+ declare interface AmbientLightConfig extends BaseLightConfig {
31
+ type: 'ambient';
32
+ }
33
+
30
34
  declare interface AnimateDataType {
31
35
  duration: number;
32
36
  once: boolean;
@@ -69,6 +73,12 @@ declare interface AxesStyleObject {
69
73
  axis?: React.CSSProperties;
70
74
  }
71
75
 
76
+ declare interface BaseLightConfig {
77
+ type: string;
78
+ color: number;
79
+ intensity: number;
80
+ }
81
+
72
82
  declare interface ClassNameObject {
73
83
  title?: string;
74
84
  footnote?: string;
@@ -195,6 +205,14 @@ declare interface DataTableColumnDataType {
195
205
  columnWidth?: number;
196
206
  }
197
207
 
208
+ declare interface DirectionalLightConfig extends BaseLightConfig {
209
+ type: 'directional';
210
+ target?: Position;
211
+ castShadow?: boolean;
212
+ shadow?: ShadowConfig;
213
+ position?: Position | 'camera';
214
+ }
215
+
198
216
  declare interface FileSettingsDataType {
199
217
  dataURL: string;
200
218
  idColumnName: string;
@@ -472,9 +490,10 @@ declare interface GraphSettingsDataType {
472
490
  polygonAltitude?: number;
473
491
  atmosphereAltitude?: number;
474
492
  globeCurvatureResolution?: number;
475
- lightColor?: string;
493
+ lights?: LightConfig[];
476
494
  fogSetting?: FogDataType;
477
495
  showAxisLabels?: boolean;
496
+ highlightedAltitude?: number;
478
497
  }
479
498
 
480
499
  declare type GraphType = GraphTypeForGriddedGraph;
@@ -499,6 +518,8 @@ declare interface HighlightAreaSettingsForScatterPlotDataType {
499
518
 
500
519
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
501
520
 
521
+ declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
522
+
502
523
  declare interface MapLegendDataType {
503
524
  mapStyleName: string;
504
525
  legend: string | React.ReactNode;
@@ -519,6 +540,19 @@ declare interface PerformanceIntensiveDashboardLayoutDataType extends DashboardL
519
540
 
520
541
  export declare function PerformanceIntensiveMultiGraphDashboardFromConfig(props: Props): JSX.Element;
521
542
 
543
+ declare interface PointLightConfig extends BaseLightConfig {
544
+ type: 'point';
545
+ distance?: number;
546
+ decay?: number;
547
+ position?: Position | 'camera';
548
+ }
549
+
550
+ declare interface Position {
551
+ x: number;
552
+ y: number;
553
+ z: number;
554
+ }
555
+
522
556
  declare interface Props {
523
557
  config: string | ConfigObject;
524
558
  }
@@ -539,11 +573,34 @@ declare interface ReferenceDataType {
539
573
 
540
574
  declare type ScaleDataType = 'categorical' | 'linear' | 'threshold';
541
575
 
576
+ declare interface ShadowConfig {
577
+ mapSize: {
578
+ width: number;
579
+ height: number;
580
+ };
581
+ camera: {
582
+ near: number;
583
+ far: number;
584
+ };
585
+ }
586
+
542
587
  declare interface SourcesDataType {
543
588
  source: string;
544
589
  link?: string;
545
590
  }
546
591
 
592
+ declare interface SpotLightConfig extends BaseLightConfig {
593
+ type: 'spot';
594
+ target?: Position;
595
+ distance?: number;
596
+ angle?: number;
597
+ penumbra?: number;
598
+ decay?: number;
599
+ castShadow?: boolean;
600
+ shadow?: ShadowConfig;
601
+ position?: Position | 'camera';
602
+ }
603
+
547
604
  declare interface StyleObject {
548
605
  title?: React.CSSProperties;
549
606
  footnote?: React.CSSProperties;
@@ -2,7 +2,7 @@ import { j as a } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as i, useEffect as n } from "react";
3
3
  import { y as f } from "./Spinner-C85UF28E.js";
4
4
  import { PerformanceIntensiveMultiGraphDashboard as d } from "./PerformanceIntensiveMultiGraphDashboard.js";
5
- import { f as l } from "./fetchAndParseData-4gsYTy6_.js";
5
+ import { f as l } from "./fetchAndParseData-DBOl1Icl.js";
6
6
  function b(s) {
7
7
  const { config: t } = s, [e, r] = i(void 0);
8
8
  return n(() => {
@@ -1,5 +1,9 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
2
 
3
+ declare interface AmbientLightConfig extends BaseLightConfig {
4
+ type: 'ambient';
5
+ }
6
+
3
7
  declare interface AnimateDataType {
4
8
  duration: number;
5
9
  once: boolean;
@@ -42,6 +46,12 @@ declare interface AxesStyleObject {
42
46
  axis?: React.CSSProperties;
43
47
  }
44
48
 
49
+ declare interface BaseLightConfig {
50
+ type: string;
51
+ color: number;
52
+ intensity: number;
53
+ }
54
+
45
55
  declare interface ClassNameObject {
46
56
  title?: string;
47
57
  footnote?: string;
@@ -109,6 +119,14 @@ declare interface DataTableColumnDataType {
109
119
  columnWidth?: number;
110
120
  }
111
121
 
122
+ declare interface DirectionalLightConfig extends BaseLightConfig {
123
+ type: 'directional';
124
+ target?: Position;
125
+ castShadow?: boolean;
126
+ shadow?: ShadowConfig;
127
+ position?: Position | 'camera';
128
+ }
129
+
112
130
  declare interface FileSettingsDataType {
113
131
  dataURL: string;
114
132
  idColumnName: string;
@@ -375,9 +393,10 @@ declare interface GraphSettingsDataType {
375
393
  polygonAltitude?: number;
376
394
  atmosphereAltitude?: number;
377
395
  globeCurvatureResolution?: number;
378
- lightColor?: string;
396
+ lights?: LightConfig[];
379
397
  fogSetting?: FogDataType;
380
398
  showAxisLabels?: boolean;
399
+ highlightedAltitude?: number;
381
400
  }
382
401
 
383
402
  declare type GraphType = GraphTypeForGriddedGraph;
@@ -407,6 +426,8 @@ declare interface InfoBoxDataType {
407
426
 
408
427
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
409
428
 
429
+ declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
430
+
410
431
  declare interface MapLegendDataType {
411
432
  mapStyleName: string;
412
433
  legend: string | React.ReactNode;
@@ -425,6 +446,19 @@ declare interface PerformanceIntensiveChaptersDataType {
425
446
  /** ScrollStory is a scrollytelling container component that reveals content step-by-step as the user scrolls through the page. */
426
447
  export declare function PerformanceIntensiveScrollStory(props: Props): JSX.Element;
427
448
 
449
+ declare interface PointLightConfig extends BaseLightConfig {
450
+ type: 'point';
451
+ distance?: number;
452
+ decay?: number;
453
+ position?: Position | 'camera';
454
+ }
455
+
456
+ declare interface Position {
457
+ x: number;
458
+ y: number;
459
+ z: number;
460
+ }
461
+
428
462
  declare interface Props {
429
463
  /** Defines if the information is shown as overlay or on the side */
430
464
  mode?: 'overlay' | 'side';
@@ -462,11 +496,34 @@ declare interface SectionsDataType {
462
496
  infoBox: InfoBoxDataType;
463
497
  }
464
498
 
499
+ declare interface ShadowConfig {
500
+ mapSize: {
501
+ width: number;
502
+ height: number;
503
+ };
504
+ camera: {
505
+ near: number;
506
+ far: number;
507
+ };
508
+ }
509
+
465
510
  declare interface SourcesDataType {
466
511
  source: string;
467
512
  link?: string;
468
513
  }
469
514
 
515
+ declare interface SpotLightConfig extends BaseLightConfig {
516
+ type: 'spot';
517
+ target?: Position;
518
+ distance?: number;
519
+ angle?: number;
520
+ penumbra?: number;
521
+ decay?: number;
522
+ castShadow?: boolean;
523
+ shadow?: ShadowConfig;
524
+ position?: Position | 'camera';
525
+ }
526
+
470
527
  declare interface StyleObject {
471
528
  title?: React.CSSProperties;
472
529
  footnote?: React.CSSProperties;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),xt=require("./index-CZbIGs8q.cjs"),wt=require("./index-BXns0-ng.cjs"),bt=require("./Modal-tXZlLE5s.cjs"),Et=require("./Tooltip-n8z5bfav.cjs"),q=require("./Colors.cjs"),dt=require("./numberFormattingFunction-02t-wJta.cjs"),kt=require("./string2HTML-D2Avudmb.cjs"),N=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pt=require("./linear-BVckp9RD.cjs"),mt=require("./line-DHV4JwCR.cjs"),Rt=require("./use-in-view-sQJZ_xDO.cjs"),W=require("./proxy-BHRoeZgd.cjs"),Ct=require("./index-BW8iNx7E.cjs"),It=require("./GraphFooter.cjs"),St=require("./GraphHeader.cjs"),Nt=require("./EmptyState-d8_8SxeW.cjs"),Ot=require("./ColorLegendWithMouseOver.cjs");var Pt=gt(mt.curveLinear);function ft(t){this._curve=t}ft.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function gt(t){function e(r){return new ft(t(r))}return e._curve=t,e}function Tt(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(r){return arguments.length?e(gt(r)):e()._curve},t}function $t(){return Tt(mt.line().curve(Pt))}function it(){}function ht(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function _t(t,e){this._context=t,this._k=(1-e)/6}_t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ht(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function r(c){return new _t(c,e)}return r.tension=function(c){return t(+c)},r})(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const qt=function t(e){function r(c){return new yt(c,e)}return r.tension=function(c){return t(+c)},r}(0);function vt(t){this._context=t}vt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Vt(t){return new vt(t)}function Dt(t){const{data:e,radius:r,lineColors:c,tooltip:k,onSeriesMouseOver:V,onSeriesMouseClick:M,colorDomain:u,detailsOnClick:j,styles:y,classNames:d,selectedColor:O,axisLabels:G,strokeWidth:et,showValues:nt,showDots:st,rightMargin:ot,topMargin:U,bottomMargin:rt,leftMargin:D,curveType:X,noOfTicks:Y,minValue:P,maxValue:T,resetSelectionOnDoubleClick:at,fillShape:h,highlightedLines:g,animate:x,dimmedOpacity:_,precision:R,customLayers:z}=t,B=f.useRef(null),$=Rt.useInView(B,{once:x.once,amount:x.amount}),w=X==="linear"?Vt:qt,b={top:U,left:D},v=Math.min((2*r-D-ot)/2,(2*r-U-rt)/2),[E,L]=f.useState(void 0),[C,A]=f.useState(void 0),[J,H]=f.useState(void 0),[K,F]=f.useState(void 0),l=pt.linear().domain([0,e[0].values.length]).range([0,2*Math.PI]),Q=N.checkIfNullOrUndefined(T)?Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))<0?0:Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):T,lt=N.checkIfNullOrUndefined(P)?Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))>=0?0:Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):P,p=pt.linear().domain([lt,Q]).range([0,v]).nice(),ct=p.ticks(Y),I=$t().radius(i=>p(i)).angle((i,s)=>l(s)).curve(w);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(W.motion.svg,{width:`${r*2}px`,height:`${r*2}px`,viewBox:`0 0 ${r*2} ${r*2}`,direction:"ltr",ref:B,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${b.left},${b.top})`,children:[z.filter(i=>i.position==="before").map(i=>i.layer),n.jsxRuntimeExports.jsxs("g",{transform:`translate(${v},${v})`,children:[G.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("line",{x1:0,y1:0,x2:Math.cos(l(s)-Math.PI/2)*v,y2:Math.sin(l(s)-Math.PI/2)*v,className:n.mo("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.axis),style:y?.xAxis?.axis},s),n.jsxRuntimeExports.jsx("text",{x:Math.cos(l(s)-Math.PI/2)*(v+6),y:Math.sin(l(s)-Math.PI/2)*(v+6),style:{textAnchor:Math.cos(l(s)-Math.PI/2)<0?"end":Math.cos(l(s)-Math.PI/2)<1e-5?"middle":"start",...y?.xAxis?.labels||""},dy:Math.sin(l(s)-Math.PI/2)<0?0:Math.sin(l(s)-Math.PI/2)<1e-5?5:10,className:n.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",d?.xAxis?.labels),children:i})]},s)),ct.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("path",{d:I(Array(G.length).fill(i))||"",className:n.mo("stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.gridLines),style:{...y?.xAxis?.gridLines,fill:"none"}}),n.jsxRuntimeExports.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*p(i)>-1e-4?Math.sin(-Math.PI/2)*p(i)-7:Math.sin(-Math.PI/2)*p(i)-5,width:50,height:12,children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-center",children:n.jsxRuntimeExports.jsx("p",{className:n.mo("fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700",d?.xAxis?.labels),style:y?.xAxis?.labels,children:dt.numberFormattingFunction(i,"NA",R)})})})]},s)),n.jsxRuntimeExports.jsx(Ct.AnimatePresence,{children:e.map((i,s)=>n.jsxRuntimeExports.jsxs(W.motion.g,{variants:{initial:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:.3:1},whileInView:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:_:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},onMouseEnter:a=>{L(i),F(a.clientY),H(a.clientX),V?.(i)},onMouseMove:a=>{L(i),F(a.clientY),H(a.clientX)},onMouseLeave:()=>{L(void 0),H(void 0),F(void 0),V?.(void 0)},onClick:()=>{(M||j)&&(wt.isEqual(C,i)&&at?(A(void 0),M?.(void 0)):(A(i),M?.(i)))},children:[n.jsxRuntimeExports.jsx(W.motion.path,{d:I(i.values)||"",variants:{initial:{d:I(i.values.map(a=>0))||""},whileInView:{d:I(i.values)||"",transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},style:{stroke:e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray,fill:h?e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray:"none",fillOpacity:.1,strokeWidth:et}}),n.jsxRuntimeExports.jsx("g",{children:i.values.map((a,m)=>n.jsxRuntimeExports.jsx("g",{children:N.checkIfNullOrUndefined(a)?null:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[st?n.jsxRuntimeExports.jsx(W.motion.circle,{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),r:4,style:{fill:e.filter(Z=>Z.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}}}):null,nt?n.jsxRuntimeExports.jsx(W.motion.text,{x:Math.cos(l(m)-Math.PI/2)*(p(a)+6),y:Math.sin(l(m)-Math.PI/2)*(p(a)+6),style:{fill:c[s],textAnchor:Math.cos(l(m)-Math.PI/2)<0?"end":Math.cos(l(m)-Math.PI/2)<1e-5?"middle":"start",...y?.graphObjectValues||{}},dy:Math.sin(l(m)-Math.PI/2)<0?10:(Math.sin(l(m)-Math.PI/2)<1e-5,0),className:n.mo("graph-value text-xs font-bold",d?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},children:dt.numberFormattingFunction(a,"NA",R)}):null]})},m))})]},i.label||s))})]}),z.filter(i=>i.position==="after").map(i=>i.layer)]})}),E&&k&&J&&K?n.jsxRuntimeExports.jsx(Et.Tooltip,{data:E,body:k,xPos:J,yPos:K,backgroundStyle:y?.tooltip,className:d?.tooltip}):null,j&&C!==void 0?n.jsxRuntimeExports.jsx(bt.X,{open:C!==void 0,onClose:()=>{A(void 0)},children:n.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof j=="string"?{__html:kt.string2HTML(j,C)}:void 0,children:typeof j=="function"?j(C):null})}):null]})}function Lt(t){const{graphTitle:e,colors:r,sources:c,graphDescription:k,footNote:V,radius:M,data:u,showColorScale:j=!0,padding:y,backgroundColor:d=!1,tooltip:O,onSeriesMouseOver:G,graphID:et,onSeriesMouseClick:nt,topMargin:st=75,bottomMargin:ot=75,leftMargin:U=75,rightMargin:rt=75,graphDownload:D=!1,dataDownload:X=!1,colorDomain:Y,language:P="en",theme:T="light",highlightedLines:at=[],width:h,height:g,minHeight:x=0,strokeWidth:_=2,relativeHeight:R,ariaLabel:z,colorLegendTitle:B,detailsOnClick:$,styles:w,classNames:b,showNAColor:v=!0,axisLabels:E,showDots:L=!0,showValues:C=!1,curveType:A="curve",noOfTicks:J=5,minValue:H,maxValue:K,fillShape:F=!1,resetSelectionOnDoubleClick:l=!0,animate:Q=!1,dimmedOpacity:lt=.3,precision:p=2,customLayers:ct=[]}=t,[I,i]=f.useState(0),[s,a]=f.useState(0),[m,Z]=f.useState(0),[Mt,jt]=f.useState(void 0),S=f.useRef(null),ut=f.useRef(null);return f.useEffect(()=>{const o=new ResizeObserver(tt=>{a(h||tt[0].target.clientWidth||420),Z(g||tt[0].target.clientHeight||420),i((Math.min(h||tt[0].target.clientWidth||620,g||tt[0].target.clientHeight||480)||420)/2)});return S.current&&(Z(S.current.clientHeight||420),a(S.current.clientWidth||420),i((Math.min(S.current.clientWidth,S.current.clientHeight)||420)/2),(!h||!M)&&o.observe(S.current)),()=>o.disconnect()},[h,g,M]),n.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:n.jsxRuntimeExports.jsx("div",{className:n.mo(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,h?"w-fit":"w-full",b?.graphContainer),style:{...w?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:et,ref:ut,"aria-label":z||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${k?` ${k}`:""}`,children:n.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:d?y||"1rem":y||0},children:n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||k||D||X?n.jsxRuntimeExports.jsx(St.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:b?.title,description:b?.description},graphTitle:e,graphDescription:k,width:h,graphDownload:D?ut.current:void 0,dataDownload:X?u.map(o=>o.data).filter(o=>o!==void 0).length>0?u.map(o=>o.data).filter(o=>o!==void 0):u.filter(o=>o!==void 0):null}):null,n.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:h?`${h}px`:"100%"},children:u.length===0?n.jsxRuntimeExports.jsx(Nt.EmptyState,{}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[j&&u.filter(o=>o.color).length!==0?n.jsxRuntimeExports.jsx(Ot.ColorLegendWithMouseOver,{width:h,colorLegendTitle:B,colors:r||q.Colors[T].categoricalColors.colors,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),setSelectedColor:jt,showNAColor:v}):null,n.jsxRuntimeExports.jsx("div",{className:`flex ${h?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:h?`${h}px`:"100%",height:g?`${Math.max(x,g||(R?x?(h||s)*R>x?(h||s)*R:x:(h||s)*R:m))}px`:"auto"},ref:S,"aria-label":"Graph area",children:n.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center leading-0",children:M||I?n.jsxRuntimeExports.jsx(Dt,{data:u,lineColors:u.filter(o=>o.color).length===0?r?[r]:[q.Colors.primaryColors["blue-600"]]:r||q.Colors[T].categoricalColors.colors,radius:M||I,tooltip:O,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),onSeriesMouseOver:G,onSeriesMouseClick:nt,styles:w,detailsOnClick:$,selectedColor:Mt,axisLabels:E,strokeWidth:_,showValues:C,showDots:L,topMargin:st,bottomMargin:ot,leftMargin:U,rightMargin:rt,curveType:A,noOfTicks:J,minValue:H,maxValue:K,fillShape:F,highlightedLines:at,resetSelectionOnDoubleClick:l,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:lt,precision:p,customLayers:ct}):null})})]})}),c||V?n.jsxRuntimeExports.jsx(It.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:c,footNote:V,width:h}):n.jsxRuntimeExports.jsx("div",{})]})})})})}exports.RadarChart=Lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),xt=require("./index-BJOeaYTk.cjs"),wt=require("./index-DQA8q5sC.cjs"),bt=require("./Modal-tXZlLE5s.cjs"),Et=require("./Tooltip-De16GWhY.cjs"),q=require("./Colors.cjs"),dt=require("./numberFormattingFunction-02t-wJta.cjs"),kt=require("./string2HTML-z7CwHXcx.cjs"),N=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pt=require("./linear-BVckp9RD.cjs"),mt=require("./line-DHV4JwCR.cjs"),Rt=require("./use-in-view-sQJZ_xDO.cjs"),W=require("./proxy-BHRoeZgd.cjs"),Ct=require("./index-BW8iNx7E.cjs"),It=require("./GraphFooter.cjs"),St=require("./GraphHeader.cjs"),Nt=require("./EmptyState-d8_8SxeW.cjs"),Ot=require("./ColorLegendWithMouseOver.cjs");var Pt=gt(mt.curveLinear);function ft(t){this._curve=t}ft.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function gt(t){function e(r){return new ft(t(r))}return e._curve=t,e}function Tt(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(r){return arguments.length?e(gt(r)):e()._curve},t}function $t(){return Tt(mt.line().curve(Pt))}function it(){}function ht(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function _t(t,e){this._context=t,this._k=(1-e)/6}_t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ht(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function r(c){return new _t(c,e)}return r.tension=function(c){return t(+c)},r})(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const qt=function t(e){function r(c){return new yt(c,e)}return r.tension=function(c){return t(+c)},r}(0);function vt(t){this._context=t}vt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Vt(t){return new vt(t)}function Dt(t){const{data:e,radius:r,lineColors:c,tooltip:k,onSeriesMouseOver:V,onSeriesMouseClick:M,colorDomain:u,detailsOnClick:j,styles:y,classNames:d,selectedColor:O,axisLabels:G,strokeWidth:et,showValues:nt,showDots:st,rightMargin:ot,topMargin:U,bottomMargin:rt,leftMargin:D,curveType:X,noOfTicks:Y,minValue:P,maxValue:T,resetSelectionOnDoubleClick:at,fillShape:h,highlightedLines:g,animate:x,dimmedOpacity:_,precision:R,customLayers:z}=t,B=f.useRef(null),$=Rt.useInView(B,{once:x.once,amount:x.amount}),w=X==="linear"?Vt:qt,b={top:U,left:D},v=Math.min((2*r-D-ot)/2,(2*r-U-rt)/2),[E,L]=f.useState(void 0),[C,A]=f.useState(void 0),[J,H]=f.useState(void 0),[K,F]=f.useState(void 0),l=pt.linear().domain([0,e[0].values.length]).range([0,2*Math.PI]),Q=N.checkIfNullOrUndefined(T)?Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))<0?0:Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):T,lt=N.checkIfNullOrUndefined(P)?Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))>=0?0:Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):P,p=pt.linear().domain([lt,Q]).range([0,v]).nice(),ct=p.ticks(Y),I=$t().radius(i=>p(i)).angle((i,s)=>l(s)).curve(w);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(W.motion.svg,{width:`${r*2}px`,height:`${r*2}px`,viewBox:`0 0 ${r*2} ${r*2}`,direction:"ltr",ref:B,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${b.left},${b.top})`,children:[z.filter(i=>i.position==="before").map(i=>i.layer),n.jsxRuntimeExports.jsxs("g",{transform:`translate(${v},${v})`,children:[G.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("line",{x1:0,y1:0,x2:Math.cos(l(s)-Math.PI/2)*v,y2:Math.sin(l(s)-Math.PI/2)*v,className:n.mo("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.axis),style:y?.xAxis?.axis},s),n.jsxRuntimeExports.jsx("text",{x:Math.cos(l(s)-Math.PI/2)*(v+6),y:Math.sin(l(s)-Math.PI/2)*(v+6),style:{textAnchor:Math.cos(l(s)-Math.PI/2)<0?"end":Math.cos(l(s)-Math.PI/2)<1e-5?"middle":"start",...y?.xAxis?.labels||""},dy:Math.sin(l(s)-Math.PI/2)<0?0:Math.sin(l(s)-Math.PI/2)<1e-5?5:10,className:n.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",d?.xAxis?.labels),children:i})]},s)),ct.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("path",{d:I(Array(G.length).fill(i))||"",className:n.mo("stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.gridLines),style:{...y?.xAxis?.gridLines,fill:"none"}}),n.jsxRuntimeExports.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*p(i)>-1e-4?Math.sin(-Math.PI/2)*p(i)-7:Math.sin(-Math.PI/2)*p(i)-5,width:50,height:12,children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-center",children:n.jsxRuntimeExports.jsx("p",{className:n.mo("fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700",d?.xAxis?.labels),style:y?.xAxis?.labels,children:dt.numberFormattingFunction(i,"NA",R)})})})]},s)),n.jsxRuntimeExports.jsx(Ct.AnimatePresence,{children:e.map((i,s)=>n.jsxRuntimeExports.jsxs(W.motion.g,{variants:{initial:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:.3:1},whileInView:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:_:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},onMouseEnter:a=>{L(i),F(a.clientY),H(a.clientX),V?.(i)},onMouseMove:a=>{L(i),F(a.clientY),H(a.clientX)},onMouseLeave:()=>{L(void 0),H(void 0),F(void 0),V?.(void 0)},onClick:()=>{(M||j)&&(wt.isEqual(C,i)&&at?(A(void 0),M?.(void 0)):(A(i),M?.(i)))},children:[n.jsxRuntimeExports.jsx(W.motion.path,{d:I(i.values)||"",variants:{initial:{d:I(i.values.map(a=>0))||""},whileInView:{d:I(i.values)||"",transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},style:{stroke:e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray,fill:h?e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray:"none",fillOpacity:.1,strokeWidth:et}}),n.jsxRuntimeExports.jsx("g",{children:i.values.map((a,m)=>n.jsxRuntimeExports.jsx("g",{children:N.checkIfNullOrUndefined(a)?null:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[st?n.jsxRuntimeExports.jsx(W.motion.circle,{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),r:4,style:{fill:e.filter(Z=>Z.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}}}):null,nt?n.jsxRuntimeExports.jsx(W.motion.text,{x:Math.cos(l(m)-Math.PI/2)*(p(a)+6),y:Math.sin(l(m)-Math.PI/2)*(p(a)+6),style:{fill:c[s],textAnchor:Math.cos(l(m)-Math.PI/2)<0?"end":Math.cos(l(m)-Math.PI/2)<1e-5?"middle":"start",...y?.graphObjectValues||{}},dy:Math.sin(l(m)-Math.PI/2)<0?10:(Math.sin(l(m)-Math.PI/2)<1e-5,0),className:n.mo("graph-value text-xs font-bold",d?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},children:dt.numberFormattingFunction(a,"NA",R)}):null]})},m))})]},i.label||s))})]}),z.filter(i=>i.position==="after").map(i=>i.layer)]})}),E&&k&&J&&K?n.jsxRuntimeExports.jsx(Et.Tooltip,{data:E,body:k,xPos:J,yPos:K,backgroundStyle:y?.tooltip,className:d?.tooltip}):null,j&&C!==void 0?n.jsxRuntimeExports.jsx(bt.X,{open:C!==void 0,onClose:()=>{A(void 0)},children:n.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof j=="string"?{__html:kt.string2HTML(j,C)}:void 0,children:typeof j=="function"?j(C):null})}):null]})}function Lt(t){const{graphTitle:e,colors:r,sources:c,graphDescription:k,footNote:V,radius:M,data:u,showColorScale:j=!0,padding:y,backgroundColor:d=!1,tooltip:O,onSeriesMouseOver:G,graphID:et,onSeriesMouseClick:nt,topMargin:st=75,bottomMargin:ot=75,leftMargin:U=75,rightMargin:rt=75,graphDownload:D=!1,dataDownload:X=!1,colorDomain:Y,language:P="en",theme:T="light",highlightedLines:at=[],width:h,height:g,minHeight:x=0,strokeWidth:_=2,relativeHeight:R,ariaLabel:z,colorLegendTitle:B,detailsOnClick:$,styles:w,classNames:b,showNAColor:v=!0,axisLabels:E,showDots:L=!0,showValues:C=!1,curveType:A="curve",noOfTicks:J=5,minValue:H,maxValue:K,fillShape:F=!1,resetSelectionOnDoubleClick:l=!0,animate:Q=!1,dimmedOpacity:lt=.3,precision:p=2,customLayers:ct=[]}=t,[I,i]=f.useState(0),[s,a]=f.useState(0),[m,Z]=f.useState(0),[Mt,jt]=f.useState(void 0),S=f.useRef(null),ut=f.useRef(null);return f.useEffect(()=>{const o=new ResizeObserver(tt=>{a(h||tt[0].target.clientWidth||420),Z(g||tt[0].target.clientHeight||420),i((Math.min(h||tt[0].target.clientWidth||620,g||tt[0].target.clientHeight||480)||420)/2)});return S.current&&(Z(S.current.clientHeight||420),a(S.current.clientWidth||420),i((Math.min(S.current.clientWidth,S.current.clientHeight)||420)/2),(!h||!M)&&o.observe(S.current)),()=>o.disconnect()},[h,g,M]),n.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:n.jsxRuntimeExports.jsx("div",{className:n.mo(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,h?"w-fit":"w-full",b?.graphContainer),style:{...w?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:et,ref:ut,"aria-label":z||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${k?` ${k}`:""}`,children:n.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:d?y||"1rem":y||0},children:n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||k||D||X?n.jsxRuntimeExports.jsx(St.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:b?.title,description:b?.description},graphTitle:e,graphDescription:k,width:h,graphDownload:D?ut.current:void 0,dataDownload:X?u.map(o=>o.data).filter(o=>o!==void 0).length>0?u.map(o=>o.data).filter(o=>o!==void 0):u.filter(o=>o!==void 0):null}):null,n.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:h?`${h}px`:"100%"},children:u.length===0?n.jsxRuntimeExports.jsx(Nt.EmptyState,{}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[j&&u.filter(o=>o.color).length!==0?n.jsxRuntimeExports.jsx(Ot.ColorLegendWithMouseOver,{width:h,colorLegendTitle:B,colors:r||q.Colors[T].categoricalColors.colors,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),setSelectedColor:jt,showNAColor:v}):null,n.jsxRuntimeExports.jsx("div",{className:`flex ${h?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:h?`${h}px`:"100%",height:g?`${Math.max(x,g||(R?x?(h||s)*R>x?(h||s)*R:x:(h||s)*R:m))}px`:"auto"},ref:S,"aria-label":"Graph area",children:n.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center leading-0",children:M||I?n.jsxRuntimeExports.jsx(Dt,{data:u,lineColors:u.filter(o=>o.color).length===0?r?[r]:[q.Colors.primaryColors["blue-600"]]:r||q.Colors[T].categoricalColors.colors,radius:M||I,tooltip:O,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),onSeriesMouseOver:G,onSeriesMouseClick:nt,styles:w,detailsOnClick:$,selectedColor:Mt,axisLabels:E,strokeWidth:_,showValues:C,showDots:L,topMargin:st,bottomMargin:ot,leftMargin:U,rightMargin:rt,curveType:A,noOfTicks:J,minValue:H,maxValue:K,fillShape:F,highlightedLines:at,resetSelectionOnDoubleClick:l,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:lt,precision:p,customLayers:ct}):null})})]})}),c||V?n.jsxRuntimeExports.jsx(It.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:c,footNote:V,width:h}):n.jsxRuntimeExports.jsx("div",{})]})})})})}exports.RadarChart=Lt;
2
2
  //# sourceMappingURL=RadarChart.cjs.map
@@ -1,12 +1,12 @@
1
1
  import { j as a, m as E } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as ut, useState as j, useEffect as kt } from "react";
3
- import { u as pt } from "./index-CaAIPGZo.js";
4
- import { i as jt } from "./index-27yTRcko.js";
3
+ import { u as pt } from "./index-AqnpA7_O.js";
4
+ import { i as jt } from "./index-Bwrro8-q.js";
5
5
  import { X as It } from "./Modal-DVVwpKhP.js";
6
- import { T as Ct } from "./Tooltip-DyM5snqx.js";
6
+ import { T as Ct } from "./Tooltip-CVCGWyzw.js";
7
7
  import { Colors as L } from "./Colors.js";
8
8
  import { n as ft } from "./numberFormattingFunction-14YCbkN2.js";
9
- import { s as Nt } from "./string2HTML-CWHGfz_d.js";
9
+ import { s as Nt } from "./string2HTML-oFCROsus.js";
10
10
  import { c as O } from "./checkIfNullOrUndefined-DmfiKkNw.js";
11
11
  import { a as xt } from "./linear-DUdu7l2G.js";
12
12
  import { c as Pt, l as St } from "./line-CPfhohvF.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-CZbIGs8q.cjs"),ut=require("./index-BzeLQvXk.cjs"),Et=require("./index-C21TvELx.cjs"),Dt=require("./index-BXns0-ng.cjs"),Pt=require("./Modal-tXZlLE5s.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-n8z5bfav.cjs"),It=require("./string2HTML-D2Avudmb.cjs"),Ht=require("./use-in-view-sQJZ_xDO.cjs"),xt=require("./proxy-BHRoeZgd.cjs"),At=require("./index-BW8iNx7E.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);et(u,c,r),tt(u,c,r)}}function tt(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function et(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];Q(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),Q(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function Q(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,K=1e-6,Kt=kt-K;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>K)if(!(Math.abs(j*x-v*w)>K)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>K&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>K||Math.abs(this._y1-w)>K)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>K&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:tt,targetTitle:et,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:Q,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),J=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[tt?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:tt}):null,et?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:et}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&Q?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:J(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:tt,onSeriesMouseClick:et,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:Q=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[J,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${Q?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,Q?"w-full":"w-fit",F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:tt,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||J)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||J,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||J)*_>P?($||J)*_:P:($||J)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:et,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-BJOeaYTk.cjs"),ut=require("./index-DYH8g9WA.cjs"),Et=require("./index-CSNtgibC.cjs"),Dt=require("./index-DQA8q5sC.cjs"),Pt=require("./Modal-tXZlLE5s.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-De16GWhY.cjs"),It=require("./string2HTML-z7CwHXcx.cjs"),Ht=require("./use-in-view-sQJZ_xDO.cjs"),xt=require("./proxy-BHRoeZgd.cjs"),At=require("./index-BW8iNx7E.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);et(u,c,r),tt(u,c,r)}}function tt(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function et(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];Q(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),Q(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function Q(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,K=1e-6,Kt=kt-K;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>K)if(!(Math.abs(j*x-v*w)>K)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>K&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>K||Math.abs(this._y1-w)>K)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>K&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:tt,targetTitle:et,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:Q,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),J=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[tt?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:tt}):null,et?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:et}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&Q?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:J(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:tt,onSeriesMouseClick:et,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:Q=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[J,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${Q?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,Q?"w-full":"w-fit",F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:tt,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||J)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||J,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||J)*_>P?($||J)*_:P:($||J)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:et,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
2
2
  //# sourceMappingURL=SankeyChart.cjs.map