@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
5 lines (4 loc) • 820 B
JavaScript
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
v3.2.1 */
import{a as c}from"./RANAS7OG.js";import{b as m}from"./GOXLUS3W.js";import"./T42VIETG.js";var u=n=>n.map(o=>{let{label:a}=o,t=m(a);return{...o,continent:t}});async function v(){let n=[],o=c.map(t=>({label:t})),a=u(o);for(let t of a){let{label:e,continent:l}=t;if(t.visited)continue;t.visited=!0;let i={label:l,tzs:[{label:e}]};for(let r of a.filter(s=>!s.visited)){let{label:s,continent:b}=r;if(l===b){let p={label:s};i.tzs.push(p),r.visited=!0}}n.push(i)}return n.map(t=>(t.tzs=t.tzs.sort((e,l)=>e.label.localeCompare(l.label)),{label:t.label,tzs:t.tzs.map(e=>e.label)})).sort((t,e)=>t.label.localeCompare(e.label))}export{v as groupByRegion};