"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),h=d=>{const{data:e,measures:o,customMeasureLabels:t,children:i,source:v}=d,l={locationsData:[],nationalData:{},measureLabelMap:{}};e.metadata&&e.metadata.measures&&e.metadata.measures.forEach(a=>{t&&t[a.value]&&t[a.value].hasCustomLabel&&t[a.value].customLabel?l.measureLabelMap[a.value]=t[a.value].customLabel:l.measureLabelMap[a.value]=a.label});const s=o.split(",");return e&&e.children&&(e.children.forEach(a=>{s.forEach(r=>{const u={...a,label:a.value,value:a[r],measure:r};a.children&&(u.children=[],a.children.forEach(n=>{u.children.push({...n,label:n.value,value:n[r]})})),l.locationsData.push(u)})}),l.measures=s.length>1?s:null,l.nationalData.value=e[o]),c.Children.map(i,a=>c.cloneElement(a,{transformedData:{...l,types:e.metadata?e.metadata.types:[]}}))};exports.default=h;
