UNPKG

@arcgis/map-components

Version:
47 lines (46 loc) 1.38 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { t as r } from "./async-utils.js"; function y() { let e = new AbortController(); return async (o) => { e.abort(), e = new AbortController(); const t = { signal: e.signal }, l = o.toArray().map((n) => i(n, t)); await Promise.all(l), r(t); }; } async function i(e, o) { await e.load(o), await e.loadAll(), r(o), e.summaryStatistics && await e.summaryStatistics.load(o); } const u = "fullmodel", d = (e) => (o) => { const t = e.toLowerCase(); return o.sublayers.find((l) => l.modelName?.toLowerCase() === t) ?? null; }, w = d(u); function b(e, o) { const t = c(e, o); if (t == null) return null; const l = t.fieldName; if (l == null || !l) return null; const n = f(e, l), s = /* @__PURE__ */ new Map(); for (const a of t.mostFrequentValues ?? []) typeof a == "number" && s.set(a, n != null ? n.getName(a) : String(a)); return { fieldName: l, fieldValueMap: s }; } function f(e, o) { for (const t of e.allSublayers) { const l = t.type === "building-component" ? t.getFieldDomain?.(o) : null; if (l?.type === "coded-value") return l; } return null; } function c(e, o) { const t = e.summaryStatistics?.fields ?? [], l = o.toLowerCase(); return t.find((n) => n.modelName?.toLowerCase() === l) ?? null; } export { b as a, y as c, w as f };