@undp/data-viz 1.5.2 → 1.5.3

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 (228) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +3 -2
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarGraph.cjs +1 -1
  6. package/dist/BarGraph.cjs.map +1 -1
  7. package/dist/BarGraph.js +1196 -1224
  8. package/dist/BarGraph.js.map +1 -1
  9. package/dist/BeeSwarmChart.cjs +1 -1
  10. package/dist/BeeSwarmChart.cjs.map +1 -1
  11. package/dist/BeeSwarmChart.js +130 -142
  12. package/dist/BeeSwarmChart.js.map +1 -1
  13. package/dist/BiVariateChoroplethMap.cjs +1 -1
  14. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  15. package/dist/BiVariateChoroplethMap.js +41 -41
  16. package/dist/BiVariateChoroplethMap.js.map +1 -1
  17. package/dist/BulletChart.cjs +1 -1
  18. package/dist/BulletChart.cjs.map +1 -1
  19. package/dist/BulletChart.js +483 -487
  20. package/dist/BulletChart.js.map +1 -1
  21. package/dist/ButterflyChart.cjs +1 -1
  22. package/dist/ButterflyChart.cjs.map +1 -1
  23. package/dist/ButterflyChart.js +99 -99
  24. package/dist/ButterflyChart.js.map +1 -1
  25. package/dist/ChoroplethMap.cjs +1 -1
  26. package/dist/ChoroplethMap.cjs.map +1 -1
  27. package/dist/ChoroplethMap.js +125 -125
  28. package/dist/ChoroplethMap.js.map +1 -1
  29. package/dist/CirclePackingGraph.cjs +1 -1
  30. package/dist/CirclePackingGraph.js +2 -2
  31. package/dist/DataCards.cjs +2 -2
  32. package/dist/DataCards.cjs.map +1 -1
  33. package/dist/DataCards.js +6 -6
  34. package/dist/DataCards.js.map +1 -1
  35. package/dist/DataTable.cjs +1 -1
  36. package/dist/DataTable.cjs.map +1 -1
  37. package/dist/DataTable.js +66 -68
  38. package/dist/DataTable.js.map +1 -1
  39. package/dist/DifferenceLineChart.cjs +1 -1
  40. package/dist/DifferenceLineChart.cjs.map +1 -1
  41. package/dist/DifferenceLineChart.js +3 -2
  42. package/dist/DifferenceLineChart.js.map +1 -1
  43. package/dist/DonutChart.cjs +1 -1
  44. package/dist/DonutChart.cjs.map +1 -1
  45. package/dist/DonutChart.js +205 -205
  46. package/dist/DonutChart.js.map +1 -1
  47. package/dist/DotDensityMap.cjs +1 -1
  48. package/dist/DotDensityMap.cjs.map +1 -1
  49. package/dist/DotDensityMap.js +78 -81
  50. package/dist/DotDensityMap.js.map +1 -1
  51. package/dist/DualAxisLineChart.cjs +1 -1
  52. package/dist/DualAxisLineChart.cjs.map +1 -1
  53. package/dist/DualAxisLineChart.js +3 -2
  54. package/dist/DualAxisLineChart.js.map +1 -1
  55. package/dist/DumbbellChart.cjs +1 -1
  56. package/dist/DumbbellChart.cjs.map +1 -1
  57. package/dist/DumbbellChart.js +64 -65
  58. package/dist/DumbbellChart.js.map +1 -1
  59. package/dist/GeoHubMap.cjs +1 -1
  60. package/dist/GeoHubMap.js +1 -1
  61. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  62. package/dist/GeoHubMapWithLayerSelection.js +1 -1
  63. package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
  64. package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
  65. package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
  66. package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
  67. package/dist/GriddedGraphs.cjs +1 -1
  68. package/dist/GriddedGraphs.js +4 -4
  69. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  70. package/dist/GriddedGraphsFromConfig.js +1 -1
  71. package/dist/HeatMap.cjs +1 -1
  72. package/dist/HeatMap.cjs.map +1 -1
  73. package/dist/HeatMap.js +83 -83
  74. package/dist/HeatMap.js.map +1 -1
  75. package/dist/Histogram.cjs +1 -1
  76. package/dist/Histogram.js +1 -1
  77. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  78. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  79. package/dist/LineChartWithConfidenceInterval.js +7 -6
  80. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  81. package/dist/MultiGraphDashboard.cjs +1 -1
  82. package/dist/MultiGraphDashboard.js +2 -2
  83. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  84. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  85. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  86. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  87. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  88. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  89. package/dist/MultiLineAltChart.cjs +1 -1
  90. package/dist/MultiLineAltChart.cjs.map +1 -1
  91. package/dist/MultiLineAltChart.js +82 -91
  92. package/dist/MultiLineAltChart.js.map +1 -1
  93. package/dist/MultiLineChart.cjs +1 -1
  94. package/dist/MultiLineChart.cjs.map +1 -1
  95. package/dist/MultiLineChart.js +3 -2
  96. package/dist/MultiLineChart.js.map +1 -1
  97. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  98. package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
  99. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  100. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  101. package/dist/RadarChart.cjs +1 -1
  102. package/dist/RadarChart.cjs.map +1 -1
  103. package/dist/RadarChart.js +124 -130
  104. package/dist/RadarChart.js.map +1 -1
  105. package/dist/SankeyChart.cjs +1 -1
  106. package/dist/SankeyChart.cjs.map +1 -1
  107. package/dist/SankeyChart.js +200 -200
  108. package/dist/SankeyChart.js.map +1 -1
  109. package/dist/ScatterPlot.cjs +1 -1
  110. package/dist/ScatterPlot.cjs.map +1 -1
  111. package/dist/ScatterPlot.js +149 -155
  112. package/dist/ScatterPlot.js.map +1 -1
  113. package/dist/SimpleLineChart.cjs +1 -1
  114. package/dist/SimpleLineChart.cjs.map +1 -1
  115. package/dist/SimpleLineChart.js +44 -43
  116. package/dist/SimpleLineChart.js.map +1 -1
  117. package/dist/SingleGraphDashboard.cjs +1 -1
  118. package/dist/SingleGraphDashboard.js +4 -4
  119. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  120. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  121. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  122. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  123. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  124. package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
  125. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  126. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  127. package/dist/SlopeChart.cjs +1 -1
  128. package/dist/SlopeChart.cjs.map +1 -1
  129. package/dist/SlopeChart.js +107 -113
  130. package/dist/SlopeChart.js.map +1 -1
  131. package/dist/SparkLine.cjs +1 -1
  132. package/dist/SparkLine.cjs.map +1 -1
  133. package/dist/SparkLine.js +3 -2
  134. package/dist/SparkLine.js.map +1 -1
  135. package/dist/StripChart.cjs +1 -1
  136. package/dist/StripChart.cjs.map +1 -1
  137. package/dist/StripChart.js +159 -159
  138. package/dist/StripChart.js.map +1 -1
  139. package/dist/ThreeDGlobe.cjs +1 -1
  140. package/dist/ThreeDGlobe.cjs.map +1 -1
  141. package/dist/ThreeDGlobe.js +3 -3
  142. package/dist/ThreeDGlobe.js.map +1 -1
  143. package/dist/TreeMapGraph.cjs +1 -1
  144. package/dist/TreeMapGraph.cjs.map +1 -1
  145. package/dist/TreeMapGraph.js +194 -200
  146. package/dist/TreeMapGraph.js.map +1 -1
  147. package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
  148. package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
  149. package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
  150. package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
  151. package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
  152. package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
  153. package/dist/fetchAndParseData-sapWbnYk.js +583 -0
  154. package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
  155. package/dist/fetchAndParseData.cjs +1 -1
  156. package/dist/fetchAndParseData.js +1 -1
  157. package/dist/getJenks-BbngDoBQ.js +19 -0
  158. package/dist/getJenks-BbngDoBQ.js.map +1 -0
  159. package/dist/getJenks-GYmdwBqm.cjs +2 -0
  160. package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
  161. package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
  162. package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
  163. package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
  164. package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
  165. package/dist/getUniqValue-DiCh_MOD.js +13 -0
  166. package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
  167. package/dist/getUniqValue-RViz8tTw.cjs +2 -0
  168. package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
  169. package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
  170. package/dist/index-37q0ULNQ.js.map +1 -0
  171. package/dist/index-CVlCtJbC.cjs +2 -0
  172. package/dist/index-CVlCtJbC.cjs.map +1 -0
  173. package/dist/index.cjs +1 -1
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.js +6 -6
  176. package/dist/sort-DfK1b0F5.js +34 -0
  177. package/dist/sort-DfK1b0F5.js.map +1 -0
  178. package/dist/sort-O96oMZLb.cjs +2 -0
  179. package/dist/sort-O96oMZLb.cjs.map +1 -0
  180. package/dist/transformData.cjs +1 -1
  181. package/dist/transformData.js +3 -3
  182. package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
  183. package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
  184. package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
  185. package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
  186. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
  187. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
  188. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
  189. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
  190. package/dist/uniqBy-BHy4I8PK.js +8 -0
  191. package/dist/uniqBy-BHy4I8PK.js.map +1 -0
  192. package/dist/uniqBy-O05lp2S5.cjs +2 -0
  193. package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
  194. package/dist/utils.cjs +1 -1
  195. package/dist/utils.d.ts +1 -1
  196. package/dist/utils.js +2 -2
  197. package/package.json +1 -7
  198. package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
  199. package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
  200. package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
  201. package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
  202. package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
  203. package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
  204. package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
  205. package/dist/getJenks-DW96UYNE.js +0 -23
  206. package/dist/getJenks-DW96UYNE.js.map +0 -1
  207. package/dist/getJenks-vofIZmeb.cjs +0 -2
  208. package/dist/getJenks-vofIZmeb.cjs.map +0 -1
  209. package/dist/getSliderMarks-C0jptXeP.js +0 -1054
  210. package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
  211. package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
  212. package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
  213. package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
  214. package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
  215. package/dist/getUniqValue-CttuU_wn.js +0 -20
  216. package/dist/getUniqValue-CttuU_wn.js.map +0 -1
  217. package/dist/index-AqnpA7_O.js +0 -631
  218. package/dist/index-AqnpA7_O.js.map +0 -1
  219. package/dist/index-BJOeaYTk.cjs +0 -2
  220. package/dist/index-BJOeaYTk.cjs.map +0 -1
  221. package/dist/index-BMgDMxKJ.js.map +0 -1
  222. package/dist/index-DYH8g9WA.cjs +0 -2
  223. package/dist/index-DYH8g9WA.cjs.map +0 -1
  224. package/dist/index-Da2GUKrr.cjs +0 -2
  225. package/dist/index-Da2GUKrr.cjs.map +0 -1
  226. package/dist/index-fwdktvAS.js +0 -707
  227. package/dist/index-fwdktvAS.js.map +0 -1
  228. package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"TreeMapGraph.js","sources":["../node_modules/d3-hierarchy/src/hierarchy/count.js","../node_modules/d3-hierarchy/src/hierarchy/each.js","../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","../node_modules/d3-hierarchy/src/hierarchy/find.js","../node_modules/d3-hierarchy/src/hierarchy/sum.js","../node_modules/d3-hierarchy/src/hierarchy/sort.js","../node_modules/d3-hierarchy/src/hierarchy/path.js","../node_modules/d3-hierarchy/src/hierarchy/ancestors.js","../node_modules/d3-hierarchy/src/hierarchy/descendants.js","../node_modules/d3-hierarchy/src/hierarchy/leaves.js","../node_modules/d3-hierarchy/src/hierarchy/links.js","../node_modules/d3-hierarchy/src/hierarchy/iterator.js","../node_modules/d3-hierarchy/src/hierarchy/index.js","../node_modules/d3-hierarchy/src/accessors.js","../node_modules/d3-hierarchy/src/constant.js","../node_modules/d3-hierarchy/src/treemap/round.js","../node_modules/d3-hierarchy/src/treemap/dice.js","../node_modules/d3-hierarchy/src/stratify.js","../node_modules/d3-hierarchy/src/treemap/slice.js","../node_modules/d3-hierarchy/src/treemap/squarify.js","../node_modules/d3-hierarchy/src/treemap/index.js","../src/Components/Graphs/TreeMapGraph/Graph.tsx","../src/Components/Graphs/TreeMapGraph/index.tsx"],"sourcesContent":["function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { stratify, treemap } from 'd3-hierarchy';\r\nimport { useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { AnimateDataType, ClassNameObject, Languages, StyleObject, TreeMapDataType } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n data: TreeMapDataType[];\r\n colors: string[];\r\n colorDomain: string[];\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n showValues: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n highlightedDataPoints: (string | number)[];\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n language?: Languages;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n selectedColor,\r\n showValues,\r\n suffix,\r\n prefix,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n language,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const treeMapData = [\r\n {\r\n id: 'root',\r\n parent: undefined,\r\n value: undefined,\r\n data: undefined,\r\n },\r\n ...data.map((d: TreeMapDataType) => ({\r\n id: d.label,\r\n value: d.size,\r\n parent: 'root',\r\n data: d,\r\n })),\r\n ];\r\n const treeData = stratify()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .id((d: any) => d.id)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .parentId((d: any) => d.parent)(treeMapData);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n treeData.sum((d: any) => d.value);\r\n const treeMapVizData = treemap().size([graphWidth, graphHeight]).padding(2)(treeData);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <AnimatePresence>\r\n {treeMapVizData.children?.map(d => {\r\n return (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n key={(d.data as any).id}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: d.x0,\r\n y: d.y0,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color\r\n ? colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n highlightedDataPoints.indexOf((d.data as any).id) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n x: d.x0,\r\n y: d.y0,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?.((d.data as any).data);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mouseClickData === (d.data as any).id &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseClickData((d.data as any).id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?.((d.data as any).data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n exit={{\r\n width: 0,\r\n height: 0,\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n width: 0,\r\n height: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n },\r\n whileInView: {\r\n width: d.x1 - d.x0,\r\n height: d.y1 - d.y0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x1 - d.x0 > 50 && d.y1 - d.y0 > 25 && (showLabels || showValues) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject y={0} x={0} width={d.x1 - d.x0} height={d.y1 - d.y0}>\r\n <div\r\n className='flex flex-col gap-0.5 p-2 w-full'\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n ),\r\n }}\r\n >\r\n {showLabels ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full treemap-label',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n WebkitLineClamp:\r\n d.y1 - d.y0 > 50\r\n ? d.y1 - d.y0 > 100\r\n ? d.y1 - d.y0 > 150\r\n ? undefined\r\n : 3\r\n : 2\r\n : 1,\r\n display: '-webkit-box',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).id\r\n }\r\n </P>\r\n ) : null}\r\n {showValues ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full font-bold treemap-value',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).value,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n </P>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport {\r\n TreeMapDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: TreeMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for circle */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Maximum radius of the circle */\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function TreeMapGraph(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n leftMargin = 0,\r\n rightMargin = 0,\r\n topMargin = 0,\r\n bottomMargin = 0,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n showLabels = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n showValues = true,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a chart where data points are represented by squares, and their sizes reflect their values. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data.filter(d => !checkIfNullOrUndefined(d.size))}\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n selectedColor={selectedColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n language={language}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["count","node","sum","children","i","node_count","node_each","callback","that","index","node_eachBefore","nodes","node_eachAfter","next","n","node_find","node_sum","value","node_sort","compare","node_path","end","start","ancestor","leastCommonAncestor","k","a","b","aNodes","bNodes","c","node_ancestors","node_descendants","node_leaves","leaves","node_links","root","links","node_iterator","current","hierarchy","data","mapChildren","objectChildren","Node","child","childs","computeHeight","node_copy","copyData","d","height","optional","f","required","constantZero","constant","x","roundNode","treemapDice","parent","x0","y0","x1","y1","preroot","ambiguous","imputed","defaultId","defaultParentId","stratify","id","parentId","path","currentId","currentParentId","nodeId","nodeKey","nodeByKey","I","normalize","P","parentof","S","_","slash","treemapSlice","phi","squarifyRatio","ratio","rows","row","nodeValue","i0","i1","dx","dy","sumValue","minValue","maxValue","newRatio","minRatio","alpha","beta","squarify","custom","treemap","tile","round","paddingStack","paddingInner","paddingTop","paddingRight","paddingBottom","paddingLeft","positionNode","p","Graph","props","colors","leftMargin","width","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","selectedColor","showValues","suffix","prefix","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","language","styles","classNames","animate","dimmedOpacity","precision","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","treeMapData","treeData","treeMapVizData","jsxs","Fragment","jsx","motion","AnimatePresence","event","el","Colors","getTextColorBasedOnBgColor","cn","numberFormattingFunction","Tooltip","Modal","string2HTML","TreeMapGraph","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","checkIfNullOrUndefined","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAMC,GAAM;AACnB,MAAIC,IAAM,GACNC,IAAWF,EAAK,UAChBG,IAAID,KAAYA,EAAS;AAC7B,MAAI,CAACC,EAAG,CAAAF,IAAM;AAAA,MACT,QAAO,EAAEE,KAAK,IAAG,CAAAF,KAAOC,EAASC,CAAC,EAAE;AACzC,EAAAH,EAAK,QAAQC;AACf;AAEe,SAAAG,KAAW;AACxB,SAAO,KAAK,UAAUL,EAAK;AAC7B;ACXe,SAAAM,GAASC,GAAUC,GAAM;AACtC,MAAIC,IAAQ;AACZ,aAAWR,KAAQ;AACjB,IAAAM,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI;AAEzC,SAAO;AACT;ACNe,SAAAC,GAASH,GAAUC,GAAM;AAEtC,WADIP,IAAO,MAAMU,IAAQ,CAACV,CAAI,GAAGE,GAAUC,GAAGK,IAAQ,IAC/CR,IAAOU,EAAM;AAElB,QADAJ,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI,GACnCN,IAAWF,EAAK;AAClB,WAAKG,IAAID,EAAS,SAAS,GAAGC,KAAK,GAAG,EAAEA;AACtC,QAAAO,EAAM,KAAKR,EAASC,CAAC,CAAC;AAI5B,SAAO;AACT;ACXe,SAAAQ,GAASL,GAAUC,GAAM;AAEtC,WADIP,IAAO,MAAMU,IAAQ,CAACV,CAAI,GAAGY,IAAO,CAAA,GAAIV,GAAUC,GAAGU,GAAGL,IAAQ,IAC7DR,IAAOU,EAAM;AAElB,QADAE,EAAK,KAAKZ,CAAI,GACVE,IAAWF,EAAK;AAClB,WAAKG,IAAI,GAAGU,IAA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A,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCoC,KAAWE,IACVhB,gBAAAA,EAAAA;AAAAA,kBAAC4C;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUtE,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAuC;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAA3D;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}
1
+ {"version":3,"file":"TreeMapGraph.js","sources":["../node_modules/d3-hierarchy/src/hierarchy/count.js","../node_modules/d3-hierarchy/src/hierarchy/each.js","../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","../node_modules/d3-hierarchy/src/hierarchy/find.js","../node_modules/d3-hierarchy/src/hierarchy/sum.js","../node_modules/d3-hierarchy/src/hierarchy/sort.js","../node_modules/d3-hierarchy/src/hierarchy/path.js","../node_modules/d3-hierarchy/src/hierarchy/ancestors.js","../node_modules/d3-hierarchy/src/hierarchy/descendants.js","../node_modules/d3-hierarchy/src/hierarchy/leaves.js","../node_modules/d3-hierarchy/src/hierarchy/links.js","../node_modules/d3-hierarchy/src/hierarchy/iterator.js","../node_modules/d3-hierarchy/src/hierarchy/index.js","../node_modules/d3-hierarchy/src/accessors.js","../node_modules/d3-hierarchy/src/constant.js","../node_modules/d3-hierarchy/src/treemap/round.js","../node_modules/d3-hierarchy/src/treemap/dice.js","../node_modules/d3-hierarchy/src/stratify.js","../node_modules/d3-hierarchy/src/treemap/slice.js","../node_modules/d3-hierarchy/src/treemap/squarify.js","../node_modules/d3-hierarchy/src/treemap/index.js","../src/Components/Graphs/TreeMapGraph/Graph.tsx","../src/Components/Graphs/TreeMapGraph/index.tsx"],"sourcesContent":["function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { stratify, treemap } from 'd3-hierarchy';\r\nimport { useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { AnimateDataType, ClassNameObject, Languages, StyleObject, TreeMapDataType } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n data: TreeMapDataType[];\r\n colors: string[];\r\n colorDomain: string[];\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n showValues: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n highlightedDataPoints: (string | number)[];\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n language?: Languages;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n selectedColor,\r\n showValues,\r\n suffix,\r\n prefix,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n language,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const treeMapData = [\r\n {\r\n id: 'root',\r\n parent: undefined,\r\n value: undefined,\r\n data: undefined,\r\n },\r\n ...data.map((d: TreeMapDataType) => ({\r\n id: d.label,\r\n value: d.size,\r\n parent: 'root',\r\n data: d,\r\n })),\r\n ];\r\n const treeData = stratify()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .id((d: any) => d.id)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .parentId((d: any) => d.parent)(treeMapData);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n treeData.sum((d: any) => d.value);\r\n const treeMapVizData = treemap().size([graphWidth, graphHeight]).padding(2)(treeData);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <AnimatePresence>\r\n {treeMapVizData.children?.map(d => {\r\n return (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n key={(d.data as any).id}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: d.x0,\r\n y: d.y0,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color\r\n ? colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n highlightedDataPoints.indexOf((d.data as any).id) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n x: d.x0,\r\n y: d.y0,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?.((d.data as any).data);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mouseClickData === (d.data as any).id &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseClickData((d.data as any).id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?.((d.data as any).data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n exit={{\r\n width: 0,\r\n height: 0,\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n width: 0,\r\n height: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n },\r\n whileInView: {\r\n width: d.x1 - d.x0,\r\n height: d.y1 - d.y0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x1 - d.x0 > 50 && d.y1 - d.y0 > 25 && (showLabels || showValues) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject y={0} x={0} width={d.x1 - d.x0} height={d.y1 - d.y0}>\r\n <div\r\n className='flex flex-col gap-0.5 p-2 w-full'\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n ),\r\n }}\r\n >\r\n {showLabels ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full treemap-label',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n WebkitLineClamp:\r\n d.y1 - d.y0 > 50\r\n ? d.y1 - d.y0 > 100\r\n ? d.y1 - d.y0 > 150\r\n ? undefined\r\n : 3\r\n : 2\r\n : 1,\r\n display: '-webkit-box',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).id\r\n }\r\n </P>\r\n ) : null}\r\n {showValues ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full font-bold treemap-value',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).value,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n </P>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport {\r\n TreeMapDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: TreeMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for circle */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Maximum radius of the circle */\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function TreeMapGraph(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n leftMargin = 0,\r\n rightMargin = 0,\r\n topMargin = 0,\r\n bottomMargin = 0,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n showLabels = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n showValues = true,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a chart where data points are represented by squares, and their sizes reflect their values. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data.filter(d => !checkIfNullOrUndefined(d.size))}\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain || (uniqBy(data, 'color', true) as string[])\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n selectedColor={selectedColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n language={language}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["count","node","sum","children","i","node_count","node_each","callback","that","index","node_eachBefore","nodes","node_eachAfter","next","n","node_find","node_sum","value","node_sort","compare","node_path","end","start","ancestor","leastCommonAncestor","k","a","b","aNodes","bNodes","c","node_ancestors","node_descendants","node_leaves","leaves","node_links","root","links","node_iterator","current","hierarchy","data","mapChildren","objectChildren","Node","child","childs","computeHeight","node_copy","copyData","d","height","optional","f","required","constantZero","constant","x","roundNode","treemapDice","parent","x0","y0","x1","y1","preroot","ambiguous","imputed","defaultId","defaultParentId","stratify","id","parentId","path","currentId","currentParentId","nodeId","nodeKey","nodeByKey","I","normalize","P","parentof","S","_","slash","treemapSlice","phi","squarifyRatio","ratio","rows","row","nodeValue","i0","i1","dx","dy","sumValue","minValue","maxValue","newRatio","minRatio","alpha","beta","squarify","custom","treemap","tile","round","paddingStack","paddingInner","paddingTop","paddingRight","paddingBottom","paddingLeft","positionNode","p","Graph","props","colors","leftMargin","width","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","selectedColor","showValues","suffix","prefix","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","language","styles","classNames","animate","dimmedOpacity","precision","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","treeMapData","treeData","treeMapVizData","jsxs","Fragment","jsx","motion","AnimatePresence","event","el","Colors","getTextColorBasedOnBgColor","cn","numberFormattingFunction","Tooltip","Modal","string2HTML","TreeMapGraph","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","checkIfNullOrUndefined","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAMC,GAAM;AACnB,MAAIC,IAAM,GACNC,IAAWF,EAAK,UAChBG,IAAID,KAAYA,EAAS;AAC7B,MAAI,CAACC,EAAG,CAAAF,IAAM;AAAA,MACT,QAAO,EAAEE,KAAK,IAAG,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,2 @@
1
+ "use strict";const c=require("./parse-hMnG_lRV.cjs"),m=require("./index-CQ3e6Ewi.cjs");function f(t,s){const l=Array.from(new Set(t.map(r=>r.label))),n=Array.from(new Set(t.map(r=>r.date))).filter(r=>r!==void 0);if(n.length===0)return t;const i=new Set(t.map(r=>`${r.label}-${r.date}`)),a=t.reduce((r,o)=>(r[o.label]||(r[o.label]=o.color),r),{}),e=[...t];return l.forEach(r=>{n.forEach(o=>{i.has(`${r}-${o}`)||e.push({label:r,color:a[r],size:void 0,date:o})})}),m.orderBy(e,[r=>c.parse(`${r.date}`,s||"yyyy",new Date)],["asc"])}function p(t,s){const l=Array.from(new Set(t.map(e=>e.label))),n=Array.from(new Set(t.map(e=>e.date))).filter(e=>e!==void 0);if(n.length===0)return t;const i=new Set(t.map(e=>`${e.label}-${e.date}`)),a=[...t];return l.forEach(e=>{n.forEach(r=>{i.has(`${e}-${r}`)||a.push({label:e,size:t[0].size.map(o=>null),date:r})})}),m.orderBy(a,[e=>c.parse(`${e.date}`,s||"yyyy",new Date)],["asc"])}function u(t,s){const l=Array.from(new Set(t.map(e=>e.label))),n=Array.from(new Set(t.map(e=>e.date))).filter(e=>e!==void 0);if(n.length===0)return t;const i=new Set(t.map(e=>`${e.label}-${e.date}`)),a=[...t];return l.forEach(e=>{n.forEach(r=>{i.has(`${e}-${r}`)||a.push({label:e,leftBar:void 0,rightBar:void 0,date:r})})}),m.orderBy(a,[e=>c.parse(`${e.date}`,s,new Date)],["asc"])}function h(t,s){const l=Array.from(new Set(t.map(r=>r.label))),n=Array.from(new Set(t.map(r=>r.date))).filter(r=>r!==void 0);if(n.length===0)return t;const i=new Set(t.map(r=>`${r.label}-${r.date}`)),a=t.reduce((r,o)=>(r[o.label]||(r[o.label]=o.color),r),{}),e=[...t];return l.forEach(r=>{n.forEach(o=>{i.has(`${r}-${o}`)||e.push({label:r,color:a[r],x:void 0,y:void 0,radius:void 0,date:o})})}),m.orderBy(e,[r=>c.parse(`${r.date}`,s,new Date)],["asc"])}function y(t,s){const l=Array.from(new Set(t.map(e=>e.label))),n=Array.from(new Set(t.map(e=>e.date))).filter(e=>e!==void 0);if(n.length===0)return t;const i=new Set(t.map(e=>`${e.label}-${e.date}`)),a=[...t];return l.forEach(e=>{n.forEach(r=>{i.has(`${e}-${r}`)||a.push({label:e,x:t[0].x.map(o=>null),date:r})})}),m.orderBy(a,[e=>c.parse(`${e.date}`,s||"yyyy",new Date)],["asc"])}exports.ensureCompleteDataForBarChart=f;exports.ensureCompleteDataForButterFlyChart=u;exports.ensureCompleteDataForDumbbellChart=y;exports.ensureCompleteDataForScatterPlot=h;exports.ensureCompleteDataForStackedBarChart=p;
2
+ //# sourceMappingURL=ensureCompleteData-DkQYPeDa.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureCompleteData-DkQYPeDa.cjs","sources":["../src/Utils/ensureCompleteData.ts"],"sourcesContent":["import { parse } from 'date-fns/parse';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n BarGraphDataType,\r\n ButterflyChartDataType,\r\n DumbbellChartDataType,\r\n GroupedBarGraphDataType,\r\n ScatterPlotDataType,\r\n} from '@/Types';\r\n\r\nexport function ensureCompleteDataForBarChart(data: BarGraphDataType[], dateFormat: string) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const colors = data.reduce((acc: any, curr: any) => {\r\n if (!acc[curr.label]) {\r\n acc[curr.label] = curr.color;\r\n }\r\n return acc;\r\n }, {});\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n color: colors[label], // Keep the same color for the label\r\n size: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForStackedBarChart(\r\n data: GroupedBarGraphDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n size: data[0].size.map(_d => null),\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForButterFlyChart(\r\n data: ButterflyChartDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n leftBar: undefined,\r\n rightBar: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForScatterPlot(data: ScatterPlotDataType[], dateFormat: string) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const colors = data.reduce((acc: any, curr: any) => {\r\n if (!acc[curr.label]) {\r\n acc[curr.label] = curr.color;\r\n }\r\n return acc;\r\n }, {});\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n color: colors[label], // Keep the same color for the label\r\n x: undefined,\r\n y: undefined,\r\n radius: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForDumbbellChart(\r\n data: DumbbellChartDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n x: data[0].x.map(_d => null),\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n"],"names":["ensureCompleteDataForBarChart","data","dateFormat","labels","d","dates","existingCombinations","colors","acc","curr","completeData","label","date","orderBy","parse","ensureCompleteDataForStackedBarChart","ensureCompleteDataForButterFlyChart","ensureCompleteDataForScatterPlot","ensureCompleteDataForDumbbellChart"],"mappings":"uFAWO,SAASA,EAA8BC,EAA0BC,EAAoB,CAE1F,MAAMC,EAAS,MAAM,KAAK,IAAI,IAAIF,EAAK,IAAIG,GAAKA,EAAE,KAAK,CAAC,CAAC,EACnDC,EAAQ,MAAM,KAAK,IAAI,IAAIJ,EAAK,IAAIG,GAAKA,EAAE,IAAI,CAAC,CAAC,EAAE,OAAOA,GAAKA,IAAM,MAAS,EACpF,GAAIC,EAAM,SAAW,EAAG,OAAOJ,EAG/B,MAAMK,EAAuB,IAAI,IAE/BL,EAAK,IAAKG,GAAW,GAAGA,EAAE,KAAK,IAAIA,EAAE,IAAI,EAAE,CAAA,EAIvCG,EAASN,EAAK,OAAO,CAACO,EAAUC,KAC/BD,EAAIC,EAAK,KAAK,IACjBD,EAAIC,EAAK,KAAK,EAAIA,EAAK,OAElBD,GACN,CAAA,CAAE,EAGCE,EAAe,CAAC,GAAGT,CAAI,EAE7B,OAAAE,EAAO,QAAQQ,GAAS,CACtBN,EAAM,QAAQO,GAAQ,CACfN,EAAqB,IAAI,GAAGK,CAAK,IAAIC,CAAI,EAAE,GAC9CF,EAAa,KAAK,CAChB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CAChB,MAAAC,EACA,MAAOJ,EAAOI,CAAK,EACnB,EAAG,OACH,EAAG,OACH,OAAQ,OACR,KAAAC,CAAA,CACD,CAEL,CAAC,CACH,CAAC,EAEMC,EAAAA,QACLH,EACA,CAACN,GAAKU,QAAM,GAAGV,EAAE,IAAI,GAAIF,EAAsB,IAAI,IAAM,CAAC,EAC1D,CAAC,KAAK,CAAA,CAEV,CAEO,SAASgB,EACdjB,EACAC,EACA,CAEA,MAAMC,EAAS,MAAM,KAAK,IAAI,IAAIF,EAAK,IAAIG,GAAKA,EAAE,KAAK,CAAC,CAAC,EACnDC,EAAQ,MAAM,KAAK,IAAI,IAAIJ,EAAK,IAAIG,GAAKA,EAAE,IAAI,CAAC,CAAC,EAAE,OAAOA,GAAKA,IAAM,MAAS,EACpF,GAAIC,EAAM,SAAW,EAAG,OAAOJ,EAG/B,MAAMK,EAAuB,IAAI,IAE/BL,EAAK,IAAKG,GAAW,GAAGA,EAAE,KAAK,IAAIA,EAAE,IAAI,EAAE,CAAA,EAIvCM,EAAe,CAAC,GAAGT,CAAI,EAE7B,OAAAE,EAAO,QAAQQ,GAAS,CACtBN,EAAM,QAAQO,GAAQ,CACfN,EAAqB,IAAI,GAAGK,CAAK,IAAIC,CAAI,EAAE,GAC9CF,EAAa,KAAK,CAChB,MAAAC,EACA,EAAGV,EAAK,CAAC,EAAE,EAAE,OAAU,IAAI,EAC3B,KAAAW,CAAA,CACD,CAEL,CAAC,CACH,CAAC,EAEMC,EAAAA,QACLH,EACA,CAACN,GAAKU,QAAM,GAAGV,EAAE,IAAI,GAAIF,GAAc,OAAQ,IAAI,IAAM,CAAC,EAC1D,CAAC,KAAK,CAAA,CAEV"}
@@ -1,5 +1,5 @@
1
- import { s as m } from "./index-fwdktvAS.js";
2
- import { p as f } from "./parse-DlCRUFh_.js";
1
+ import { p as m } from "./parse-DlCRUFh_.js";
2
+ import { o as c } from "./index-DvVprvy6.js";
3
3
  function h(o, a) {
4
4
  const i = Array.from(new Set(o.map((t) => t.label))), n = Array.from(new Set(o.map((t) => t.date))).filter((t) => t !== void 0);
5
5
  if (n.length === 0) return o;
@@ -17,7 +17,11 @@ function h(o, a) {
17
17
  date: r
18
18
  });
19
19
  });
20
- }), m(e, (t) => f(`${t.date}`, a || "yyyy", /* @__PURE__ */ new Date()));
20
+ }), c(
21
+ e,
22
+ [(t) => m(`${t.date}`, a || "yyyy", /* @__PURE__ */ new Date())],
23
+ ["asc"]
24
+ );
21
25
  }
22
26
  function u(o, a) {
23
27
  const i = Array.from(new Set(o.map((e) => e.label))), n = Array.from(new Set(o.map((e) => e.date))).filter((e) => e !== void 0);
@@ -34,7 +38,11 @@ function u(o, a) {
34
38
  date: t
35
39
  });
36
40
  });
37
- }), m(s, (e) => f(`${e.date}`, a || "yyyy", /* @__PURE__ */ new Date()));
41
+ }), c(
42
+ s,
43
+ [(e) => m(`${e.date}`, a || "yyyy", /* @__PURE__ */ new Date())],
44
+ ["asc"]
45
+ );
38
46
  }
39
47
  function y(o, a) {
40
48
  const i = Array.from(new Set(o.map((e) => e.label))), n = Array.from(new Set(o.map((e) => e.date))).filter((e) => e !== void 0);
@@ -52,7 +60,11 @@ function y(o, a) {
52
60
  date: t
53
61
  });
54
62
  });
55
- }), m(s, (e) => f(`${e.date}`, a, /* @__PURE__ */ new Date()));
63
+ }), c(
64
+ s,
65
+ [(e) => m(`${e.date}`, a, /* @__PURE__ */ new Date())],
66
+ ["asc"]
67
+ );
56
68
  }
57
69
  function $(o, a) {
58
70
  const i = Array.from(new Set(o.map((t) => t.label))), n = Array.from(new Set(o.map((t) => t.date))).filter((t) => t !== void 0);
@@ -73,7 +85,11 @@ function $(o, a) {
73
85
  date: r
74
86
  });
75
87
  });
76
- }), m(e, (t) => f(`${t.date}`, a, /* @__PURE__ */ new Date()));
88
+ }), c(
89
+ e,
90
+ [(t) => m(`${t.date}`, a, /* @__PURE__ */ new Date())],
91
+ ["asc"]
92
+ );
77
93
  }
78
94
  function b(o, a) {
79
95
  const i = Array.from(new Set(o.map((e) => e.label))), n = Array.from(new Set(o.map((e) => e.date))).filter((e) => e !== void 0);
@@ -90,7 +106,11 @@ function b(o, a) {
90
106
  date: t
91
107
  });
92
108
  });
93
- }), m(s, (e) => f(`${e.date}`, a || "yyyy", /* @__PURE__ */ new Date()));
109
+ }), c(
110
+ s,
111
+ [(e) => m(`${e.date}`, a || "yyyy", /* @__PURE__ */ new Date())],
112
+ ["asc"]
113
+ );
94
114
  }
95
115
  export {
96
116
  y as a,
@@ -99,4 +119,4 @@ export {
99
119
  u as d,
100
120
  $ as e
101
121
  };
102
- //# sourceMappingURL=ensureCompleteData-BALdOrsS.js.map
122
+ //# sourceMappingURL=ensureCompleteData-DlmibgaI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureCompleteData-DlmibgaI.js","sources":["../src/Utils/ensureCompleteData.ts"],"sourcesContent":["import { parse } from 'date-fns/parse';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n BarGraphDataType,\r\n ButterflyChartDataType,\r\n DumbbellChartDataType,\r\n GroupedBarGraphDataType,\r\n ScatterPlotDataType,\r\n} from '@/Types';\r\n\r\nexport function ensureCompleteDataForBarChart(data: BarGraphDataType[], dateFormat: string) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const colors = data.reduce((acc: any, curr: any) => {\r\n if (!acc[curr.label]) {\r\n acc[curr.label] = curr.color;\r\n }\r\n return acc;\r\n }, {});\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n color: colors[label], // Keep the same color for the label\r\n size: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForStackedBarChart(\r\n data: GroupedBarGraphDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n size: data[0].size.map(_d => null),\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForButterFlyChart(\r\n data: ButterflyChartDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n leftBar: undefined,\r\n rightBar: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForScatterPlot(data: ScatterPlotDataType[], dateFormat: string) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const colors = data.reduce((acc: any, curr: any) => {\r\n if (!acc[curr.label]) {\r\n acc[curr.label] = curr.color;\r\n }\r\n return acc;\r\n }, {});\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n color: colors[label], // Keep the same color for the label\r\n x: undefined,\r\n y: undefined,\r\n radius: undefined,\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n\r\nexport function ensureCompleteDataForDumbbellChart(\r\n data: DumbbellChartDataType[],\r\n dateFormat: string,\r\n) {\r\n // Extract unique labels and dates\r\n const labels = Array.from(new Set(data.map(d => d.label)));\r\n const dates = Array.from(new Set(data.map(d => d.date))).filter(d => d !== undefined);\r\n if (dates.length === 0) return data;\r\n\r\n // Create a set of existing label-date combinations\r\n const existingCombinations = new Set(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data.map((d: any) => `${d.label}-${d.date}`),\r\n );\r\n\r\n // Add missing label-date combinations with size as undefined\r\n const completeData = [...data];\r\n\r\n labels.forEach(label => {\r\n dates.forEach(date => {\r\n if (!existingCombinations.has(`${label}-${date}`)) {\r\n completeData.push({\r\n label,\r\n x: data[0].x.map(_d => null),\r\n date,\r\n });\r\n }\r\n });\r\n });\r\n\r\n return orderBy(\r\n completeData,\r\n [d => parse(`${d.date}`, dateFormat || 'yyyy', new Date())],\r\n ['asc'],\r\n );\r\n}\r\n"],"names":["ensureCompleteDataForBarChart","data","dateFormat","labels","d","dates","existingCombinations","colors","acc","curr","completeData","label","date","orderBy","parse","ensureCompleteDataForStackedBarChart","ensureCompleteDataForButterFlyChart","ensureCompleteDataForScatterPlot","ensureCompleteDataForDumbbellChart"],"mappings":";;AAWO,SAASA,EAA8BC,GAA0BC,GAAoB;AAE1F,QAAMC,IAAS,MAAM,KAAK,IAAI,IAAIF,EAAK,IAAI,CAAAG,MAAKA,EAAE,KAAK,CAAC,CAAC,GACnDC,IAAQ,MAAM,KAAK,IAAI,IAAIJ,EAAK,IAAI,CAAAG,MAAKA,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAAA,MAAKA,MAAM,MAAS;AACpF,MAAIC,EAAM,WAAW,EAAG,QAAOJ;AAG/B,QAAMK,IAAuB,IAAI;AAAA;AAAA,IAE/BL,EAAK,IAAI,CAACG,MAAW,GAAGA,EAAE,KAAK,IAAIA,EAAE,IAAI,EAAE;AAAA,EAAA,GAIvCG,IAASN,EAAK,OAAO,CAACO,GAAUC,OAC/BD,EAAIC,EAAK,KAAK,MACjBD,EAAIC,EAAK,KAAK,IAAIA,EAAK,QAElBD,IACN,CAAA,CAAE,GAGCE,IAAe,CAAC,GAAGT,CAAI;AAE7B,SAAAE,EAAO,QAAQ,CAAAQ,MAAS;AACtB,IAAAN,EAAM,QAAQ,CAAAO,MAAQ;AACpB,MAAKN,EAAqB,IAAI,GAAGK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AE;AAAA,EAAA,GAIvCM,IAAe,CAAC,GAAGT,CAAI;AAE7B,SAAAE,EAAO,QAAQ,CAAAQ,MAAS;AACtB,IAAAN,EAAM,QAAQ,CAAAO,MAAQ;AACpB,MAAKN,EAAqB,IAAI,GAAGK,CAAK,IAAIC,CAAI,EAAE,KAC9CF,EAAa,KAAK;AAAA,QAChB,OAAAC;AAAA,QACA,GAAGV,EAAK,CAAC,EAAE,EAAE,IAAI,OAAM,IAAI;AAAA,QAC3B,MAAAW;AAAA,MAAA,CACD;AAAA,IAEL,CAAC;AAAA,EACH,CAAC,GAEMC;AAAA,IACLH;AAAA,IACA,CAAC,CAAAN,MAAKU,EAAM,GAAGV,EAAE,IAAI,IAAIF,KAAc,QAAQ,oBAAI,KAAA,CAAM,CAAC;AAAA,IAC1D,CAAC,KAAK;AAAA,EAAA;AAEV;"}
@@ -0,0 +1,16 @@
1
+ "use strict";const Ce=require("./_commonjsHelpers-BH3jXuIh.cjs"),pe=require("handlebars");var he={exports:{}};/* @license
2
+ Papa Parse
3
+ v5.5.3
4
+ https://github.com/mholt/PapaParse
5
+ License: MIT
6
+ */var Oe=he.exports,we;function Ae(){return we||(we=1,function(v,k){((y,o)=>{v.exports=o()})(Oe,function y(){var o=typeof self<"u"?self:typeof window<"u"?window:o!==void 0?o:{},u,E=!o.document&&!!o.postMessage,P=o.IS_PAPA_WORKER||!1,S={},A=0,a={};function K(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(t){var r=de(t);r.chunkSize=parseInt(r.chunkSize),t.step||t.chunk||(r.chunkSize=null),this._handle=new ge(r),(this._handle.streamer=this)._config=r}).call(this,e),this.parseChunk=function(t,r){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let c=this._config.newline;c||(n=this._config.quoteChar||'"',c=this._handle.guessLineEndings(t,n)),t=[...t.split(c).slice(i)].join(c)}this.isFirstChunk&&R(this._config.beforeFirstChunk)&&(n=this._config.beforeFirstChunk(t))!==void 0&&(t=n),this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+t,n=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(t=n.meta.cursor,i=(this._finished||(this._partialLine=i.substring(t-this._baseIndex),this._baseIndex=t),n&&n.data&&(this._rowCount+=n.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),P)o.postMessage({results:n,workerId:a.WORKER_ID,finished:i});else if(R(this._config.chunk)&&!r){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!i||!R(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),i||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(t){R(this._config.error)?this._config.error(t):P&&this._config.error&&o.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function oe(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),K.call(this,e),this._nextChunk=E?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(r){this._input=r,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),E||(t.onload=Z(this._chunkLoaded,this),t.onerror=Z(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!E),this._config.downloadRequestHeaders){var r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}var n;this._config.chunkSize&&(n=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+n));try{t.send(this._config.downloadRequestBody)}catch(c){this._chunkError(c.message)}E&&t.status===0&&this._chunkError()}},this._chunkLoaded=function(){t.readyState===4&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(r=>(r=r.getResponseHeader("Content-Range"))!==null?parseInt(r.substring(r.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(r){r=t.statusText||r,this._sendError(new Error(r))}}function ue(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),K.call(this,e);var t,r,i=typeof FileReader<"u";this.stream=function(n){this._input=n,r=n.slice||n.webkitSlice||n.mozSlice,i?((t=new FileReader).onload=Z(this._chunkLoaded,this),t.onerror=Z(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var n=this._input,c=(this._config.chunkSize&&(c=Math.min(this._start+this._config.chunkSize,this._input.size),n=r.call(n,this._start,c)),t.readAsText(n,this._config.encoding));i||this._chunkLoaded({target:{result:c}})},this._chunkLoaded=function(n){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(t.error)}}function re(e){var t;K.call(this,e=e||{}),this.stream=function(r){return t=r,this._nextChunk()},this._nextChunk=function(){var r,i;if(!this._finished)return r=this._config.chunkSize,t=r?(i=t.substring(0,r),t.substring(r)):(i=t,""),this._finished=!t,this.parseChunk(i)}}function fe(e){K.call(this,e=e||{});var t=[],r=!0,i=!1;this.pause=function(){K.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){K.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=Z(function(n){try{t.push(typeof n=="string"?n:n.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(c){this._streamError(c)}},this),this._streamError=Z(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=Z(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=Z(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function ge(e){var t,r,i,n,c=Math.pow(2,53),L=-c,B=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,p=this,x=0,f=0,M=!1,l=!1,g=[],s={data:[],errors:[],meta:{}};function F(m){return e.skipEmptyLines==="greedy"?m.join("").trim()==="":m.length===1&&m[0].length===0}function T(){if(s&&i&&(H("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),i=!1),e.skipEmptyLines&&(s.data=s.data.filter(function(h){return!F(h)})),q()){let h=function(I,j){R(e.transformHeader)&&(I=e.transformHeader(I,j)),g.push(I)};if(s)if(Array.isArray(s.data[0])){for(var m=0;q()&&m<s.data.length;m++)s.data[m].forEach(h);s.data.splice(0,1)}else s.data.forEach(h)}function w(h,I){for(var j=e.header?{}:[],b=0;b<h.length;b++){var C=b,_=h[b],_=((J,d)=>(O=>(e.dynamicTypingFunction&&e.dynamicTyping[O]===void 0&&(e.dynamicTyping[O]=e.dynamicTypingFunction(O)),(e.dynamicTyping[O]||e.dynamicTyping)===!0))(J)?d==="true"||d==="TRUE"||d!=="false"&&d!=="FALSE"&&((O=>{if(B.test(O)&&(O=parseFloat(O),L<O&&O<c))return 1})(d)?parseFloat(d):W.test(d)?new Date(d):d===""?null:d):d)(C=e.header?b>=g.length?"__parsed_extra":g[b]:C,_=e.transform?e.transform(_,C):_);C==="__parsed_extra"?(j[C]=j[C]||[],j[C].push(_)):j[C]=_}return e.header&&(b>g.length?H("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+b,f+I):b<g.length&&H("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+b,f+I)),j}var D;s&&(e.header||e.dynamicTyping||e.transform)&&(D=1,!s.data.length||Array.isArray(s.data[0])?(s.data=s.data.map(w),D=s.data.length):s.data=w(s.data,0),e.header&&s.meta&&(s.meta.fields=g),f+=D)}function q(){return e.header&&g.length===0}function H(m,w,D,h){m={type:m,code:w,message:D},h!==void 0&&(m.row=h),s.errors.push(m)}R(e.step)&&(n=e.step,e.step=function(m){s=m,q()?T():(T(),s.data.length!==0&&(x+=m.data.length,e.preview&&x>e.preview?r.abort():(s.data=s.data[0],n(s,p))))}),this.parse=function(m,w,D){var h=e.quoteChar||'"',h=(e.newline||(e.newline=this.guessLineEndings(m,h)),i=!1,e.delimiter?R(e.delimiter)&&(e.delimiter=e.delimiter(m),s.meta.delimiter=e.delimiter):((h=((I,j,b,C,_)=>{var J,d,O,Y;_=_||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var X=0;X<_.length;X++){for(var Q,ie=_[X],U=0,$=0,z=0,N=(O=void 0,new le({comments:C,delimiter:ie,newline:j,preview:10}).parse(I)),G=0;G<N.data.length;G++)b&&F(N.data[G])?z++:(Q=N.data[G].length,$+=Q,O===void 0?O=Q:0<Q&&(U+=Math.abs(Q-O),O=Q));0<N.data.length&&($/=N.data.length-z),(d===void 0||U<=d)&&(Y===void 0||Y<$)&&1.99<$&&(d=U,J=ie,Y=$)}return{successful:!!(e.delimiter=J),bestDelimiter:J}})(m,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=h.bestDelimiter:(i=!0,e.delimiter=a.DefaultDelimiter),s.meta.delimiter=e.delimiter),de(e));return e.preview&&e.header&&h.preview++,t=m,r=new le(h),s=r.parse(t,w,D),T(),M?{meta:{paused:!0}}:s||{meta:{paused:!1}}},this.paused=function(){return M},this.pause=function(){M=!0,r.abort(),t=R(e.chunk)?"":t.substring(r.getCharIndex())},this.resume=function(){p.streamer._halted?(M=!1,p.streamer.parseChunk(t,!0)):setTimeout(p.resume,3)},this.aborted=function(){return l},this.abort=function(){l=!0,r.abort(),s.meta.aborted=!0,R(e.complete)&&e.complete(s),t=""},this.guessLineEndings=function(I,h){I=I.substring(0,1048576);var h=new RegExp(ne(h)+"([^]*?)"+ne(h),"gm"),D=(I=I.replace(h,"")).split("\r"),h=I.split(`
7
+ `),I=1<h.length&&h[0].length<D[0].length;if(D.length===1||I)return`
8
+ `;for(var j=0,b=0;b<D.length;b++)D[b][0]===`
9
+ `&&j++;return j>=D.length/2?`\r
10
+ `:"\r"}}function ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function le(e){var t=(e=e||{}).delimiter,r=e.newline,i=e.comments,n=e.step,c=e.preview,L=e.fastMode,B=null,W=!1,p=e.quoteChar==null?'"':e.quoteChar,x=p;if(e.escapeChar!==void 0&&(x=e.escapeChar),(typeof t!="string"||-1<a.BAD_DELIMITERS.indexOf(t))&&(t=","),i===t)throw new Error("Comment character same as delimiter");i===!0?i="#":(typeof i!="string"||-1<a.BAD_DELIMITERS.indexOf(i))&&(i=!1),r!==`
11
+ `&&r!=="\r"&&r!==`\r
12
+ `&&(r=`
13
+ `);var f=0,M=!1;this.parse=function(l,g,s){if(typeof l!="string")throw new Error("Input must be a string");var F=l.length,T=t.length,q=r.length,H=i.length,m=R(n),w=[],D=[],h=[],I=f=0;if(!l)return U();if(L||L!==!1&&l.indexOf(p)===-1){for(var j=l.split(r),b=0;b<j.length;b++){if(h=j[b],f+=h.length,b!==j.length-1)f+=r.length;else if(s)return U();if(!i||h.substring(0,H)!==i){if(m){if(w=[],Y(h.split(t)),$(),M)return U()}else Y(h.split(t));if(c&&c<=b)return w=w.slice(0,c),U(!0)}}return U()}for(var C=l.indexOf(t,f),_=l.indexOf(r,f),J=new RegExp(ne(x)+ne(p),"g"),d=l.indexOf(p,f);;)if(l[f]===p)for(d=f,f++;;){if((d=l.indexOf(p,d+1))===-1)return s||D.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:f}),Q();if(d===F-1)return Q(l.substring(f,d).replace(J,p));if(p===x&&l[d+1]===x)d++;else if(p===x||d===0||l[d-1]!==x){C!==-1&&C<d+1&&(C=l.indexOf(t,d+1));var O=X((_=_!==-1&&_<d+1?l.indexOf(r,d+1):_)===-1?C:Math.min(C,_));if(l.substr(d+1+O,T)===t){h.push(l.substring(f,d).replace(J,p)),l[f=d+1+O+T]!==p&&(d=l.indexOf(p,f)),C=l.indexOf(t,f),_=l.indexOf(r,f);break}if(O=X(_),l.substring(d+1+O,d+1+O+q)===r){if(h.push(l.substring(f,d).replace(J,p)),ie(d+1+O+q),C=l.indexOf(t,f),d=l.indexOf(p,f),m&&($(),M))return U();if(c&&w.length>=c)return U(!0);break}D.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:f}),d++}}else if(i&&h.length===0&&l.substring(f,f+H)===i){if(_===-1)return U();f=_+q,_=l.indexOf(r,f),C=l.indexOf(t,f)}else if(C!==-1&&(C<_||_===-1))h.push(l.substring(f,C)),f=C+T,C=l.indexOf(t,f);else{if(_===-1)break;if(h.push(l.substring(f,_)),ie(_+q),m&&($(),M))return U();if(c&&w.length>=c)return U(!0)}return Q();function Y(z){w.push(z),I=f}function X(z){var N=0;return N=z!==-1&&(z=l.substring(d+1,z))&&z.trim()===""?z.length:N}function Q(z){return s||(z===void 0&&(z=l.substring(f)),h.push(z),f=F,Y(h),m&&$()),U()}function ie(z){f=z,Y(h),h=[],_=l.indexOf(r,f)}function U(z){if(e.header&&!g&&w.length&&!W){var N=w[0],G=Object.create(null),ce=new Set(N);let ye=!1;for(let ee=0;ee<N.length;ee++){let V=N[ee];if(G[V=R(e.transformHeader)?e.transformHeader(V,ee):V]){let se,ke=G[V];for(;se=V+"_"+ke,ke++,ce.has(se););ce.add(se),N[ee]=se,G[V]++,ye=!0,(B=B===null?{}:B)[se]=V}else G[V]=1,N[ee]=V;ce.add(V)}ye&&console.warn("Duplicate headers found and renamed."),W=!0}return{data:w,errors:D,meta:{delimiter:t,linebreak:r,aborted:M,truncated:!!z,cursor:I+(g||0),renamedHeaders:B}}}function $(){n(U()),w=[],D=[]}},this.abort=function(){M=!0},this.getCharIndex=function(){return f}}function Re(e){var t=e.data,r=S[t.workerId],i=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){i=!0,me(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(R(r.userStep)){for(var c=0;c<t.results.data.length&&(r.userStep({data:t.results.data[c],errors:t.results.errors,meta:t.results.meta},n),!i);c++);delete t.results}else R(r.userChunk)&&(r.userChunk(t.results,n,t.file),delete t.results)}t.finished&&!i&&me(t.workerId,t.results)}function me(e,t){var r=S[e];R(r.userComplete)&&r.userComplete(t),r.terminate(),delete S[e]}function _e(){throw new Error("Not implemented.")}function de(e){if(typeof e!="object"||e===null)return e;var t,r=Array.isArray(e)?[]:{};for(t in e)r[t]=de(e[t]);return r}function Z(e,t){return function(){e.apply(t,arguments)}}function R(e){return typeof e=="function"}return a.parse=function(e,t){var r=(t=t||{}).dynamicTyping||!1;if(R(r)&&(t.dynamicTypingFunction=r,r={}),t.dynamicTyping=r,t.transform=!!R(t.transform)&&t.transform,!t.worker||!a.WORKERS_SUPPORTED)return r=null,a.NODE_STREAM_INPUT,typeof e=="string"?(e=(i=>i.charCodeAt(0)!==65279?i:i.slice(1))(e),r=new(t.download?oe:re)(t)):e.readable===!0&&R(e.read)&&R(e.on)?r=new fe(t):(o.File&&e instanceof File||e instanceof Object)&&(r=new ue(t)),r.stream(e);(r=(()=>{var i;return!!a.WORKERS_SUPPORTED&&(i=(()=>{var n=o.URL||o.webkitURL||null,c=y.toString();return a.BLOB_URL||(a.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",c,")();"],{type:"text/javascript"})))})(),(i=new o.Worker(i)).onmessage=Re,i.id=A++,S[i.id]=i)})()).userStep=t.step,r.userChunk=t.chunk,r.userComplete=t.complete,r.userError=t.error,t.step=R(t.step),t.chunk=R(t.chunk),t.complete=R(t.complete),t.error=R(t.error),delete t.worker,r.postMessage({input:e,config:t,workerId:r.id})},a.unparse=function(e,t){var r=!1,i=!0,n=",",c=`\r
14
+ `,L='"',B=L+L,W=!1,p=null,x=!1,f=((()=>{if(typeof t=="object"){if(typeof t.delimiter!="string"||a.BAD_DELIMITERS.filter(function(g){return t.delimiter.indexOf(g)!==-1}).length||(n=t.delimiter),typeof t.quotes!="boolean"&&typeof t.quotes!="function"&&!Array.isArray(t.quotes)||(r=t.quotes),typeof t.skipEmptyLines!="boolean"&&typeof t.skipEmptyLines!="string"||(W=t.skipEmptyLines),typeof t.newline=="string"&&(c=t.newline),typeof t.quoteChar=="string"&&(L=t.quoteChar),typeof t.header=="boolean"&&(i=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");p=t.columns}t.escapeChar!==void 0&&(B=t.escapeChar+L),t.escapeFormulae instanceof RegExp?x=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(x=/^[=+\-@\t\r].*$/)}})(),new RegExp(ne(L),"g"));if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return M(null,e,W);if(typeof e[0]=="object")return M(p||Object.keys(e[0]),e,W)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||p),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||typeof e.data[0]=="object"||(e.data=[e.data])),M(e.fields||[],e.data||[],W);throw new Error("Unable to serialize unrecognized input");function M(g,s,F){var T="",q=(typeof g=="string"&&(g=JSON.parse(g)),typeof s=="string"&&(s=JSON.parse(s)),Array.isArray(g)&&0<g.length),H=!Array.isArray(s[0]);if(q&&i){for(var m=0;m<g.length;m++)0<m&&(T+=n),T+=l(g[m],m);0<s.length&&(T+=c)}for(var w=0;w<s.length;w++){var D=(q?g:s[w]).length,h=!1,I=q?Object.keys(s[w]).length===0:s[w].length===0;if(F&&!q&&(h=F==="greedy"?s[w].join("").trim()==="":s[w].length===1&&s[w][0].length===0),F==="greedy"&&q){for(var j=[],b=0;b<D;b++){var C=H?g[b]:b;j.push(s[w][C])}h=j.join("").trim()===""}if(!h){for(var _=0;_<D;_++){0<_&&!I&&(T+=n);var J=q&&H?g[_]:_;T+=l(s[w][J],_)}w<s.length-1&&(!F||0<D&&!I)&&(T+=c)}}return T}function l(g,s){var F,T;return g==null?"":g.constructor===Date?JSON.stringify(g).slice(1,25):(T=!1,x&&typeof g=="string"&&x.test(g)&&(g="'"+g,T=!0),F=g.toString().replace(f,B),(T=T||r===!0||typeof r=="function"&&r(g,s)||Array.isArray(r)&&r[s]||((q,H)=>{for(var m=0;m<H.length;m++)if(-1<q.indexOf(H[m]))return!0;return!1})(F,a.BAD_DELIMITERS)||-1<F.indexOf(n)||F.charAt(0)===" "||F.charAt(F.length-1)===" ")?L+F+L:F)}},a.RECORD_SEP="",a.UNIT_SEP="",a.BYTE_ORDER_MARK="\uFEFF",a.BAD_DELIMITERS=["\r",`
15
+ `,'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!E&&!!o.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=le,a.ParserHandle=ge,a.NetworkStreamer=oe,a.FileStreamer=ue,a.StringStreamer=re,a.ReadableStreamStreamer=fe,o.jQuery&&((u=o.jQuery).fn.parse=function(e){var t=e.config||{},r=[];return this.each(function(c){if(!(u(this).prop("tagName").toUpperCase()==="INPUT"&&u(this).attr("type").toLowerCase()==="file"&&o.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)r.push({file:this.files[L],inputElem:this,instanceConfig:u.extend({},t)})}),i(),this;function i(){if(r.length===0)R(e.complete)&&e.complete();else{var c,L,B,W,p=r[0];if(R(e.before)){var x=e.before(p.file,p.inputElem);if(typeof x=="object"){if(x.action==="abort")return c="AbortError",L=p.file,B=p.inputElem,W=x.reason,void(R(e.error)&&e.error({name:c},L,B,W));if(x.action==="skip")return void n();typeof x.config=="object"&&(p.instanceConfig=u.extend(p.instanceConfig,x.config))}else if(x==="skip")return void n()}var f=p.instanceConfig.complete;p.instanceConfig.complete=function(M){R(f)&&f(M,p.file,p.inputElem),n()},a.parse(p.file,p.instanceConfig)}}function n(){r.splice(0,1),i()}}),P&&(o.onmessage=function(e){e=e.data,a.WORKER_ID===void 0&&e&&(a.WORKER_ID=e.workerId),typeof e.input=="string"?o.postMessage({workerId:a.WORKER_ID,results:a.parse(e.input,e.config),finished:!0}):(o.File&&e.input instanceof File||e.input instanceof Object)&&(e=a.parse(e.input,e.config))&&o.postMessage({workerId:a.WORKER_ID,results:e,finished:!0})}),(oe.prototype=Object.create(K.prototype)).constructor=oe,(ue.prototype=Object.create(K.prototype)).constructor=ue,(re.prototype=Object.create(re.prototype)).constructor=re,(fe.prototype=Object.create(K.prototype)).constructor=fe,a})}(he)),he.exports}var xe=Ae();const Ee=Ce.getDefaultExportFromCjs(xe);function ae(v,k){return!k||k.length===0?v:v.map(o=>{const u={...o};return k.forEach(E=>{u[E.column]=u[E.column]?u[E.column].split(E.delimiter||",").map(P=>P.trim()):[]}),u})}function De(v,k){return v.map(y=>{const o={...y};return o["~id"]=o[k],o})}function Ie(v,k){return v.reduce((y,o)=>{const u=String(o[k]);return y[u]||(y[u]=[]),y[u].push(o),y},{})}function Te(v){const k=[];return v.forEach(y=>{y.forEach(o=>{k.push(o)})}),k}function Le(v,k){const y=Ie(v,"~id"),o=Object.keys(y).map(S=>y[S].reduce((a,K)=>(Object.assign(a,K),a),{})),u=new Set;o.forEach(S=>{Object.keys(S).forEach(A=>{u.add(A)})});const E={};return u.forEach(S=>{E[S]=void 0}),o.map(S=>({...E,...S})).map(S=>({...S,[k]:S["~id"]}))}function Fe(v,k){const y=v.map(u=>De(u.data,u.idColumn)),o=Te(y);return Le(o,k||"~id")}function te(v,k){if(!k)return v;pe.registerHelper("json",o=>new pe.SafeString(JSON.stringify(o,null,2)));const y=pe.compile(k);return JSON.parse(y(v))}async function ve(v,k,y,o,u,E){return new Promise((P,S)=>{Ee.parse(v,{download:!0,skipEmptyLines:!0,dynamicTyping:!0,header:E!==!1,delimiter:u||",",complete(A){if(o&&console.log("Data from file:",A.data),y){const a=ae(A.data,y);o&&console.log("Data after transformation of column to array:",a),P(te(a,k))}else P(te(A.data,k))},error(A){S(A)}})})}async function je(v,k,y,o,u,E){return new Promise((P,S)=>{Ee.parse(v,{skipEmptyLines:!0,header:E!==!1,delimiter:u||",",complete(A){if(o&&console.log("Data from file:",A.data),y){const a=ae(A.data,y);o&&console.log("Data after transformation of column to array:",a),P(te(a,k))}else P(te(A.data,k))},error(A){S(A)}})})}async function be(v,k,y,o){const u=v;try{const E=await fetch(u);if(!E.ok)throw new Error(`Response status: ${E.status}`);const P=await E.json(),S=te(P,y);if(o&&console.log("Data from file:",P),k){const A=ae(S,k);return o&&console.log("Data after transformation of column to array:",A),A}return S}catch(E){return E}}async function Se(v,k,y,o,u){const E=await fetch(v,{method:"GET",headers:k});if(!E.ok)throw new Error("Network response was not ok");const P=await E.json(),S=te(P,o);if(u&&(console.log("Data from api:",P),console.log("Data from api after transformation:",S)),y){const A=ae(S,y);return u&&console.log("Data after transformation of column to array:",A),A}return S}async function Pe(v,k){const y=await Promise.all(v.map(u=>u.fileType==="json"?be(u.dataURL,u.columnsToArray,u.dataTransformation,!1):u.fileType==="api"?Se(u.dataURL,u.apiHeaders,u.columnsToArray,u.dataTransformation,!1):ve(u.dataURL,u.dataTransformation,u.columnsToArray,!1,u.delimiter,!0)));return Fe(y.map((u,E)=>({data:u,idColumn:v[E].idColumnName})),k)}exports.fetchAndParseCSV=ve;exports.fetchAndParseCSVFromTextBlob=je;exports.fetchAndParseJSON=be;exports.fetchAndParseMultipleDataSources=Pe;exports.fetchAndTransformDataFromAPI=Se;exports.transformColumnsToArray=ae;
16
+ //# sourceMappingURL=fetchAndParseData-Ba-_CgxS.cjs.map