col-browser 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,20 @@
1
- var Qe = Object.defineProperty;
2
- var et = (e, n, r) => n in e ? Qe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
- var Z = (e, n, r) => et(e, typeof n != "symbol" ? n + "" : n, r);
1
+ var tt = Object.defineProperty;
2
+ var nt = (e, n, r) => n in e ? tt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
+ var Z = (e, n, r) => nt(e, typeof n != "symbol" ? n + "" : n, r);
4
4
  import { j as s } from "./jsx-runtime-BzflLqGi.js";
5
- import * as Fe from "react";
6
- import tt, { useState as L, useRef as G, useMemo as ne, useEffect as N } from "react";
7
- import { Spin as nt, Popover as rt, Radio as le } from "antd";
8
- import { isArray as je, get as A, keyBy as st, startCase as ot } from "lodash-es";
9
- import { c as te, p as it } from "./router-CssZk5qZ.js";
10
- import { c as $ } from "./config-BPRXv9x8.js";
11
- import { E as at } from "./ErrorMsg-K8k5PPTp.js";
12
- import { I as ct } from "./AntdIcon-B1nMlqyh.js";
13
- import { M as lt } from "./MergedDataBadge-DsTsn5Xu.js";
14
- import z from "maplibre-gl";
5
+ import * as Ne from "react";
6
+ import rt, { useState as L, useRef as G, useMemo as ne, useEffect as N } from "react";
7
+ import { Spin as st, Popover as ot, Radio as le } from "antd";
8
+ import { isArray as we, get as $, keyBy as it, startCase as at } from "lodash-es";
9
+ import { c as te, p as ct } from "./router-CssZk5qZ.js";
10
+ import { c as A } from "./config-BPRXv9x8.js";
11
+ import { E as lt } from "./ErrorMsg-K8k5PPTp.js";
12
+ import { I as dt } from "./AntdIcon-B1nMlqyh.js";
13
+ import { M as ut } from "./MergedDataBadge-DsTsn5Xu.js";
14
+ import D from "maplibre-gl";
15
15
  import "maplibre-gl/dist/maplibre-gl.css";
16
- var dt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z" } }] }, name: "book", theme: "outlined" };
16
+ import { r as pt, w as ft } from "./storage-BgdCo9fV.js";
17
+ var ht = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z" } }] }, name: "book", theme: "outlined" };
17
18
  function fe() {
18
19
  return fe = Object.assign ? Object.assign.bind() : function(e) {
19
20
  for (var n = 1; n < arguments.length; n++) {
@@ -24,22 +25,22 @@ function fe() {
24
25
  return e;
25
26
  }, fe.apply(this, arguments);
26
27
  }
27
- const ut = (e, n) => /* @__PURE__ */ Fe.createElement(ct, fe({}, e, {
28
+ const gt = (e, n) => /* @__PURE__ */ Ne.createElement(dt, fe({}, e, {
28
29
  ref: n,
29
- icon: dt
30
- })), Ge = /* @__PURE__ */ Fe.forwardRef(ut);
31
- process.env.NODE_ENV !== "production" && (Ge.displayName = "BookOutlined");
32
- class pt extends tt.Component {
30
+ icon: ht
31
+ })), _e = /* @__PURE__ */ Ne.forwardRef(gt);
32
+ process.env.NODE_ENV !== "production" && (_e.displayName = "BookOutlined");
33
+ class mt extends rt.Component {
33
34
  constructor(r) {
34
35
  super(r);
35
36
  Z(this, "getData", () => {
36
37
  const { referenceId: r, datasetKey: i, references: o } = this.props;
37
38
  if (r) {
38
- const c = je(r) ? r : [r], f = [];
39
+ const c = we(r) ? r : [r], f = [];
39
40
  this.setState({ loading: !0 }), Promise.allSettled(
40
41
  c.map(
41
- (u) => A(o, u) ? Promise.resolve(f.push(o[u])) : te(
42
- `${$.dataApi}dataset/${i}/reference/${u}`
42
+ (u) => $(o, u) ? Promise.resolve(f.push(o[u])) : te(
43
+ `${A.dataApi}dataset/${i}/reference/${u}`
43
44
  ).then((a) => f.push(a.data)).catch((a) => this.setState({ error: a }))
44
45
  )
45
46
  ).then(() => this.setState({ reference: f, loading: !1 }));
@@ -47,15 +48,15 @@ class pt extends tt.Component {
47
48
  });
48
49
  Z(this, "getContent", () => {
49
50
  const { error: r, reference: i, loading: o } = this.state;
50
- return o ? /* @__PURE__ */ s.jsx(nt, {}) : r ? /* @__PURE__ */ s.jsx(at, { error: r }) : i.length === 1 ? i[0].citation : /* @__PURE__ */ s.jsx("ul", { children: i.map((c) => /* @__PURE__ */ s.jsx("li", { children: c.citation }, c.id)) });
51
+ return o ? /* @__PURE__ */ s.jsx(st, {}) : r ? /* @__PURE__ */ s.jsx(lt, { error: r }) : i.length === 1 ? i[0].citation : /* @__PURE__ */ s.jsx("ul", { children: i.map((c) => /* @__PURE__ */ s.jsx("li", { children: c.citation }, c.id)) });
51
52
  });
52
53
  Z(this, "scrollToReference", (r, i) => {
53
54
  const o = document.getElementById(`col-reference-${i}`);
54
55
  o && (r.preventDefault(), o.scrollIntoView({ behavior: "smooth", block: "start" }));
55
56
  });
56
57
  Z(this, "render", () => {
57
- const { referenceId: r, referenceIndexMap: i, trigger: o } = this.props, c = je(r) ? r : [r];
58
- let f = i && A(i, c[0]) ? c.map((u) => /* @__PURE__ */ s.jsx(
58
+ const { referenceId: r, referenceIndexMap: i, trigger: o } = this.props, c = we(r) ? r : [r];
59
+ let f = i && $(i, c[0]) ? c.map((u) => /* @__PURE__ */ s.jsx(
59
60
  "a",
60
61
  {
61
62
  className: "col-reference-link",
@@ -64,9 +65,9 @@ class pt extends tt.Component {
64
65
  children: `[${i[u]}]`
65
66
  },
66
67
  u
67
- )) : /* @__PURE__ */ s.jsx(Ge, { style: { cursor: "pointer" } });
68
+ )) : /* @__PURE__ */ s.jsx(_e, { style: { cursor: "pointer" } });
68
69
  return r ? /* @__PURE__ */ s.jsx("div", { id: `reference_${r}`, style: this.props.style, children: /* @__PURE__ */ s.jsx(
69
- rt,
70
+ ot,
70
71
  {
71
72
  getPopupContainer: () => document.getElementById(`reference_${r}`),
72
73
  placement: this.props.placement || "left",
@@ -92,13 +93,13 @@ const se = [
92
93
  "form",
93
94
  "subform",
94
95
  "infraspecific name"
95
- ], Me = (e, n) => {
96
+ ], $e = (e, n) => {
96
97
  const r = n.indexOf(e);
97
98
  return r === -1 ? [] : se.filter((i) => n.indexOf(i) > r);
98
- }, ft = 16, ht = (e) => {
99
+ }, yt = 16, bt = (e) => {
99
100
  var n, r;
100
101
  return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
101
- }, gt = async (e, n, r) => {
102
+ }, xt = async (e, n, r) => {
102
103
  const i = new Array(e.length);
103
104
  let o = 0;
104
105
  const c = Array.from({ length: Math.min(r, e.length) }, async () => {
@@ -109,53 +110,53 @@ const se = [
109
110
  }
110
111
  });
111
112
  return await Promise.all(c), i;
112
- }, mt = async (e, n, r) => {
113
+ }, vt = async (e, n, r) => {
113
114
  var u;
114
115
  if (r.length === 0) return [];
115
116
  const i = new URLSearchParams();
116
117
  i.append("TAXON_ID", n), r.forEach((a) => i.append("rank", a)), ["accepted", "provisionally accepted"].forEach(
117
118
  (a) => i.append("status", a)
118
119
  ), i.append("limit", "1000");
119
- const o = `${$.dataApi}dataset/${e}/nameusage/search?${i}`, c = await te(o);
120
+ const o = `${A.dataApi}dataset/${e}/nameusage/search?${i}`, c = await te(o);
120
121
  return (((u = c == null ? void 0 : c.data) == null ? void 0 : u.result) || []).filter((a) => {
121
122
  var p;
122
123
  return (p = a == null ? void 0 : a.usage) == null ? void 0 : p.id;
123
124
  }).map((a) => {
124
- var p, w, S, k, R, j;
125
+ var p, w, j, k, C, S;
125
126
  return {
126
127
  id: a.usage.id,
127
- scientificName: ((w = (p = a.usage) == null ? void 0 : p.name) == null ? void 0 : w.scientificName) || ((S = a.usage) == null ? void 0 : S.label) || a.usage.id,
128
- rank: (R = (k = a.usage) == null ? void 0 : k.name) == null ? void 0 : R.rank,
129
- parentId: (j = a.usage) == null ? void 0 : j.parentId
128
+ scientificName: ((w = (p = a.usage) == null ? void 0 : p.name) == null ? void 0 : w.scientificName) || ((j = a.usage) == null ? void 0 : j.label) || a.usage.id,
129
+ rank: (C = (k = a.usage) == null ? void 0 : k.name) == null ? void 0 : C.rank,
130
+ parentId: (S = a.usage) == null ? void 0 : S.parentId
130
131
  };
131
132
  });
132
- }, yt = async (e, n) => {
133
- const r = `${$.dataApi}dataset/${e}/taxon/${encodeURIComponent(n)}/distribution`;
133
+ }, jt = async (e, n) => {
134
+ const r = `${A.dataApi}dataset/${e}/taxon/${encodeURIComponent(n)}/distribution`;
134
135
  try {
135
136
  const i = await te(r);
136
137
  return Array.isArray(i == null ? void 0 : i.data) ? i.data : [];
137
138
  } catch {
138
139
  return [];
139
140
  }
140
- }, bt = async ({ datasetKey: e, focalTaxon: n, rankOrder: r }) => {
141
+ }, St = async ({ datasetKey: e, focalTaxon: n, rankOrder: r }) => {
141
142
  var a;
142
- const i = Me((a = n == null ? void 0 : n.name) == null ? void 0 : a.rank, r);
143
+ const i = $e((a = n == null ? void 0 : n.name) == null ? void 0 : a.rank, r);
143
144
  let o = !1, c = [];
144
145
  try {
145
- c = await mt(e, n.id, i);
146
+ c = await vt(e, n.id, i);
146
147
  } catch {
147
148
  return o = !0, { taxa: [], descendantsFailed: o };
148
149
  }
149
- const f = await gt(
150
+ const f = await xt(
150
151
  c,
151
- (p) => yt(e, p.id),
152
- ft
152
+ (p) => jt(e, p.id),
153
+ yt
153
154
  );
154
155
  return { taxa: c.map((p, w) => {
155
- const S = f[w] || [];
156
- return { ...p, distributions: S, mappable: S.filter(ht) };
156
+ const j = f[w] || [];
157
+ return { ...p, distributions: j, mappable: j.filter(bt) };
157
158
  }), descendantsFailed: o };
158
- }, Ie = [
159
+ }, Le = [
159
160
  "#E58606",
160
161
  "#5D69B1",
161
162
  "#52BCA3",
@@ -168,18 +169,18 @@ const se = [
168
169
  "#ED645A",
169
170
  "#CC3A8E",
170
171
  "#A5AA99"
171
- ], we = (e, n) => {
172
+ ], ke = (e, n) => {
172
173
  const r = n.indexOf(e);
173
174
  return r === -1 ? n.length : r;
174
- }, xt = (e, n) => {
175
+ }, It = (e, n) => {
175
176
  const r = [...e].sort((o, c) => {
176
- const f = we(o.rank, n), u = we(c.rank, n);
177
+ const f = ke(o.rank, n), u = ke(c.rank, n);
177
178
  return f !== u ? f - u : o.scientificName.localeCompare(c.scientificName);
178
179
  }), i = {};
179
180
  return r.forEach((o, c) => {
180
- i[o.id] = Ie[c % Ie.length];
181
+ i[o.id] = Le[c % Le.length];
181
182
  }), i;
182
- }, vt = {
183
+ }, wt = {
183
184
  position: "absolute",
184
185
  bottom: 8,
185
186
  left: 8,
@@ -191,21 +192,21 @@ const se = [
191
192
  fontSize: 12,
192
193
  lineHeight: 1.5,
193
194
  maxWidth: 260
194
- }, St = {
195
+ }, Lt = {
195
196
  maxHeight: 240,
196
197
  overflowY: "auto"
197
- }, Ne = {
198
+ }, Ae = {
198
199
  fontWeight: 600,
199
200
  marginTop: 4
200
- }, jt = {
201
- ...Ne,
201
+ }, kt = {
202
+ ...Ae,
202
203
  marginTop: 0
203
- }, _e = {
204
+ }, Pe = {
204
205
  display: "flex",
205
206
  alignItems: "center",
206
207
  gap: 6,
207
208
  paddingLeft: 4
208
- }, It = (e) => ({
209
+ }, Ct = (e) => ({
209
210
  display: "inline-block",
210
211
  width: 12,
211
212
  height: 12,
@@ -213,26 +214,26 @@ const se = [
213
214
  border: "1px solid rgba(0,0,0,0.15)",
214
215
  borderRadius: 2,
215
216
  flex: "0 0 auto"
216
- }), wt = {
217
+ }), Rt = {
217
218
  marginTop: 6,
218
219
  cursor: "pointer",
219
220
  color: "#1890ff",
220
221
  fontSize: 11
221
- }, Lt = {
222
+ }, Et = {
222
223
  marginTop: 4,
223
224
  borderTop: "1px solid #eee",
224
225
  paddingTop: 4,
225
226
  color: "#666"
226
- }, Ae = {
227
+ }, Oe = {
227
228
  fontWeight: 600,
228
229
  marginTop: 4
229
- }, kt = {
230
- ...Ae,
230
+ }, Bt = {
231
+ ...Oe,
231
232
  marginTop: 0
232
- }, Rt = {
233
+ }, Ft = {
233
234
  fontStyle: "italic",
234
235
  paddingLeft: 4
235
- }, Le = (e) => e.reduce((n, r) => n + r.taxa.length, 0), Ct = () => /* @__PURE__ */ s.jsxs("div", { style: _e, children: [
236
+ }, Ce = (e) => e.reduce((n, r) => n + r.taxa.length, 0), Gt = () => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
236
237
  /* @__PURE__ */ s.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ s.jsx(
237
238
  "polygon",
238
239
  {
@@ -243,24 +244,24 @@ const se = [
243
244
  }
244
245
  ) }),
245
246
  /* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
246
- ] }), Et = ({ visibleGroups: e, unmappableGroups: n, showGbif: r }) => {
247
- const [i, o] = L(!1), c = Le(e), f = Le(n);
248
- return c === 0 && f === 0 && !r ? null : /* @__PURE__ */ s.jsxs("div", { style: vt, children: [
249
- /* @__PURE__ */ s.jsxs("div", { style: St, children: [
247
+ ] }), Mt = ({ visibleGroups: e, unmappableGroups: n, showGbif: r }) => {
248
+ const [i, o] = L(!1), c = Ce(e), f = Ce(n);
249
+ return c === 0 && f === 0 && !r ? null : /* @__PURE__ */ s.jsxs("div", { style: wt, children: [
250
+ /* @__PURE__ */ s.jsxs("div", { style: Lt, children: [
250
251
  e.map((u, a) => /* @__PURE__ */ s.jsxs("div", { children: [
251
- /* @__PURE__ */ s.jsx("div", { style: a === 0 ? jt : Ne, children: u.label }),
252
- u.taxa.map((p) => /* @__PURE__ */ s.jsxs("div", { style: _e, children: [
253
- /* @__PURE__ */ s.jsx("span", { style: It(p.color) }),
252
+ /* @__PURE__ */ s.jsx("div", { style: a === 0 ? kt : Ae, children: u.label }),
253
+ u.taxa.map((p) => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
254
+ /* @__PURE__ */ s.jsx("span", { style: Ct(p.color) }),
254
255
  /* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: p.displayName || p.scientificName })
255
256
  ] }, p.id))
256
257
  ] }, u.rank)),
257
- r && /* @__PURE__ */ s.jsx(Ct, {})
258
+ r && /* @__PURE__ */ s.jsx(Gt, {})
258
259
  ] }),
259
260
  f > 0 && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
260
261
  /* @__PURE__ */ s.jsxs(
261
262
  "div",
262
263
  {
263
- style: wt,
264
+ style: Rt,
264
265
  onClick: () => o((u) => !u),
265
266
  children: [
266
267
  i ? "− Hide" : "+",
@@ -270,26 +271,26 @@ const se = [
270
271
  ]
271
272
  }
272
273
  ),
273
- i && /* @__PURE__ */ s.jsx("div", { style: Lt, children: n.map((u, a) => /* @__PURE__ */ s.jsxs("div", { children: [
274
+ i && /* @__PURE__ */ s.jsx("div", { style: Et, children: n.map((u, a) => /* @__PURE__ */ s.jsxs("div", { children: [
274
275
  /* @__PURE__ */ s.jsx(
275
276
  "div",
276
277
  {
277
- style: a === 0 ? kt : Ae,
278
+ style: a === 0 ? Bt : Oe,
278
279
  children: u.label
279
280
  }
280
281
  ),
281
- u.taxa.map((p) => /* @__PURE__ */ s.jsx("div", { style: Rt, children: p.displayName || p.scientificName }, p.id))
282
+ u.taxa.map((p) => /* @__PURE__ */ s.jsx("div", { style: Ft, children: p.displayName || p.scientificName }, p.id))
282
283
  ] }, u.rank)) })
283
284
  ] })
284
285
  ] });
285
- }, Bt = [
286
+ }, Nt = [
286
287
  "establishmentMeans",
287
288
  "degreeOfEstablishment",
288
289
  "pathway",
289
290
  "threatStatus",
290
291
  "year",
291
292
  "lifeStage"
292
- ], $e = [
293
+ ], De = [
293
294
  { key: "nativeendemic", label: "Native endemic", color: "#0F8554" },
294
295
  { key: "native", label: "Native", color: "#87C55F" },
295
296
  { key: "nativereintroduced", label: "Native reintroduced", color: "#C9DB74" },
@@ -301,64 +302,48 @@ const se = [
301
302
  },
302
303
  { key: "vagrant", label: "Vagrant", color: "#F6CF71" },
303
304
  { key: "uncertain", label: "Uncertain", color: "#8BE0A4" }
304
- ], Pe = Object.fromEntries(
305
- $e.map((e) => [e.key, e.color])
306
- ), oe = "#66C5CC", Ft = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), Oe = (e) => {
305
+ ], ze = Object.fromEntries(
306
+ De.map((e) => [e.key, e.color])
307
+ ), oe = "#66C5CC", _t = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), He = (e) => {
307
308
  const n = e == null ? void 0 : e.establishmentMeans;
308
309
  if (n == null || n === "") return null;
309
- const r = Ft(n);
310
- return Pe[r] ? r : "uncertain";
311
- }, Gt = (e) => {
312
- const n = Oe(e);
313
- return n == null ? oe : Pe[n];
314
- }, Mt = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", ze = "col-browser:gbif-visible", Nt = (e) => {
315
- try {
316
- const n = window.sessionStorage.getItem(ze);
317
- if (n === "true") return !0;
318
- if (n === "false") return !1;
319
- } catch {
320
- }
321
- return e;
322
- }, _t = (e) => {
323
- try {
324
- window.sessionStorage.setItem(
325
- ze,
326
- e ? "true" : "false"
327
- );
328
- } catch {
329
- }
330
- }, At = "/v2/map/occurrence/density/{z}/{x}/{y}@1x.png?srs=EPSG%3A3857&style=iNaturalist.poly&bin=hex&hexPerTile=64&hasCoordinate=true&hasGeospatialIssue=false&occurrenceStatus=PRESENT&checklistKey={checklistKey}&taxonKey={taxonKey}", X = "col-focal-distributions", W = "col-focal-fill", de = "col-focal-line", re = "col-gbif-occurrences", M = "col-gbif-occurrences", ue = (e) => `col-descendant-${e}`, J = (e) => `col-descendant-fill-${e}`, Q = (e) => `col-descendant-line-${e}`, pe = /* @__PURE__ */ new Map(), ke = (e, n) => {
310
+ const r = _t(n);
311
+ return ze[r] ? r : "uncertain";
312
+ }, $t = (e) => {
313
+ const n = He(e);
314
+ return n == null ? oe : ze[n];
315
+ }, At = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", Ve = "gbif-visible", Pt = (e) => pt(Ve, e), Re = (e) => ft(Ve, e), Ot = "/v2/map/occurrence/density/{z}/{x}/{y}@1x.png?srs=EPSG%3A3857&style=iNaturalist.poly&bin=hex&hexPerTile=64&hasCoordinate=true&hasGeospatialIssue=false&occurrenceStatus=PRESENT&checklistKey={checklistKey}&taxonKey={taxonKey}", X = "col-focal-distributions", U = "col-focal-fill", de = "col-focal-line", re = "col-gbif-occurrences", M = "col-gbif-occurrences", ue = (e) => `col-descendant-${e}`, J = (e) => `col-descendant-fill-${e}`, Q = (e) => `col-descendant-line-${e}`, pe = /* @__PURE__ */ new Map(), Ee = (e, n) => {
331
316
  const r = `${e}:${n}`;
332
317
  if (pe.has(r)) return pe.get(r);
333
- const i = `${$.dataApi}vocab/area/${r}`, o = te(i, {
318
+ const i = `${A.dataApi}vocab/area/${r}`, o = te(i, {
334
319
  headers: { Accept: "application/geo+json" }
335
320
  }).then(
336
321
  (c) => c.data,
337
322
  () => null
338
323
  );
339
324
  return pe.set(r, o), o;
340
- }, ee = (e) => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), De = (e) => {
325
+ }, ee = (e) => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), Ue = (e) => {
341
326
  var i, o;
342
- const n = ((i = e == null ? void 0 : e.area) == null ? void 0 : i.name) || ((o = e == null ? void 0 : e.area) == null ? void 0 : o.globalId) || "", r = Bt.map((c) => [c, e == null ? void 0 : e[c]]).filter(([, c]) => c != null && c !== "").map(
327
+ const n = ((i = e == null ? void 0 : e.area) == null ? void 0 : i.name) || ((o = e == null ? void 0 : e.area) == null ? void 0 : o.globalId) || "", r = Nt.map((c) => [c, e == null ? void 0 : e[c]]).filter(([, c]) => c != null && c !== "").map(
343
328
  ([c, f]) => `<div><strong>${ee(c)}:</strong> ${ee(f)}</div>`
344
329
  ).join("");
345
330
  return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${ee(
346
331
  n
347
332
  )}</div>${r}</div>`;
348
- }, $t = (e, n) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${ee(
333
+ }, Dt = (e, n) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${ee(
349
334
  e.scientificName
350
- )}</div><div style="color:#888;margin-bottom:4px">${ee(e.rank || "")}</div>` + De(n), Pt = {
335
+ )}</div><div style="color:#888;margin-bottom:4px">${ee(e.rank || "")}</div>` + Ue(n), zt = {
351
336
  subspecies: "subspecies",
352
337
  variety: "varieties",
353
338
  subvariety: "subvarieties",
354
339
  form: "forms",
355
340
  subform: "subforms",
356
341
  "infraspecific name": "infraspecific names"
357
- }, Re = (e) => Pt[e] || e, He = (e) => {
342
+ }, Be = (e) => zt[e] || e, We = (e) => {
358
343
  if (!e) return "";
359
344
  const n = e.trim().split(/\s+/);
360
345
  return n[n.length - 1];
361
- }, Ot = () => /* @__PURE__ */ s.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
346
+ }, Ht = () => /* @__PURE__ */ s.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
362
347
  /* @__PURE__ */ s.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ s.jsx(
363
348
  "polygon",
364
349
  {
@@ -369,7 +354,7 @@ const se = [
369
354
  }
370
355
  ) }),
371
356
  /* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
372
- ] }), zt = (e) => {
357
+ ] }), Vt = (e) => {
373
358
  var f;
374
359
  let n = 1 / 0, r = 1 / 0, i = -1 / 0, o = -1 / 0;
375
360
  const c = (u) => {
@@ -387,10 +372,10 @@ const se = [
387
372
  [n, r],
388
373
  [i, o]
389
374
  ];
390
- }, Ce = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Ee = () => {
375
+ }, Fe = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Ge = () => {
391
376
  var e;
392
- return typeof ((e = z) == null ? void 0 : e.supported) == "function" ? z.supported() : typeof WebGLRenderingContext < "u";
393
- }, Dt = ({
377
+ return typeof ((e = D) == null ? void 0 : e.supported) == "function" ? D.supported() : typeof WebGLRenderingContext < "u";
378
+ }, Ut = ({
394
379
  records: e,
395
380
  onUnmappable: n,
396
381
  datasetKey: r,
@@ -402,26 +387,28 @@ const se = [
402
387
  // component works without the count check.
403
388
  gbifAvailable: f = !0
404
389
  }) => {
405
- var Se;
406
- const u = G(null), a = G(null), p = G(null), w = G(/* @__PURE__ */ new Map()), S = G(/* @__PURE__ */ new Map()), k = G(/* @__PURE__ */ new Map()), R = G(!1), j = G(!1), C = G(/* @__PURE__ */ new Set()), [I, P] = L(!1), [E, _] = L(!1), [y, m] = L({
390
+ var Ie;
391
+ const u = G(null), a = G(null), p = G(null), w = G(/* @__PURE__ */ new Map()), j = G(/* @__PURE__ */ new Map()), k = G(/* @__PURE__ */ new Map()), C = G(!1), S = G(!1), R = G(/* @__PURE__ */ new Set()), [I, P] = L(!1), [E, _] = L(!1), [y, m] = L({
407
392
  status: "idle",
408
393
  // idle | loading | ready | empty | error
409
394
  taxa: []
410
- }), [D, O] = L(!0), H = !!c && (!e || e.length === 0), [B, Ve] = L(
411
- () => H ? !0 : Nt(!0)
412
- ), [K, he] = L(/* @__PURE__ */ new Set()), [Ue, ge] = L(!1), ie = G(!1), We = () => {
413
- Ve((t) => {
395
+ }), [z, O] = L(!0), W = !!c && (!e || e.length === 0), [B, he] = L(
396
+ () => Pt(!0)
397
+ ), [K, ge] = L(/* @__PURE__ */ new Set()), [Ke, me] = L(!1), ie = G(!1), Te = () => {
398
+ he((t) => {
414
399
  const d = !t;
415
- return H || _t(d), d;
400
+ return Re(d), d;
416
401
  });
417
- }, me = ne(() => {
402
+ }, ye = () => {
403
+ he(!0), Re(!0);
404
+ }, be = ne(() => {
418
405
  if (!(e != null && e.length)) return [];
419
406
  const t = /* @__PURE__ */ new Set();
420
407
  return e.forEach((d) => {
421
- const l = Oe(d);
408
+ const l = He(d);
422
409
  l != null && t.add(l);
423
- }), $e.filter((d) => t.has(d.key));
424
- }, [e]), T = ne(() => y.status !== "ready" ? {} : xt(
410
+ }), De.filter((d) => t.has(d.key));
411
+ }, [e]), T = ne(() => y.status !== "ready" ? {} : It(
425
412
  y.taxa.filter((t) => t.mappable.length > 0),
426
413
  o || []
427
414
  ), [y, o]), ae = ne(() => {
@@ -430,14 +417,14 @@ const se = [
430
417
  const t = (h) => ({
431
418
  ...h,
432
419
  color: T[h.id],
433
- displayName: He(h.scientificName)
420
+ displayName: We(h.scientificName)
434
421
  }), d = (h) => {
435
422
  const x = {};
436
423
  return h.forEach((b) => {
437
424
  (x[b.rank] = x[b.rank] || []).push(t(b));
438
425
  }), se.filter((b) => x[b]).map((b) => ({
439
426
  rank: b,
440
- label: Re(b),
427
+ label: Be(b),
441
428
  taxa: x[b]
442
429
  }));
443
430
  }, l = d(
@@ -448,12 +435,12 @@ const se = [
448
435
  y.taxa.filter((h) => h.mappable.length === 0)
449
436
  );
450
437
  return { visibleGroups: l, unmappableGroups: g };
451
- }, [y, T, K]), ye = ae.visibleGroups.length > 0;
438
+ }, [y, T, K]), xe = ae.visibleGroups.length > 0;
452
439
  N(() => {
453
- if (!u.current || a.current || !Ee()) return;
454
- const t = new z.Map({
440
+ if (!u.current || a.current || !Ge()) return;
441
+ const t = new D.Map({
455
442
  container: u.current,
456
- style: Mt,
443
+ style: At,
457
444
  center: [0, 20],
458
445
  zoom: 1,
459
446
  minZoom: 0,
@@ -461,10 +448,10 @@ const se = [
461
448
  renderWorldCopies: !0
462
449
  });
463
450
  t.addControl(
464
- new z.AttributionControl({ compact: !0 }),
451
+ new D.AttributionControl({ compact: !0 }),
465
452
  "bottom-right"
466
453
  ), t.addControl(
467
- new z.NavigationControl({ showCompass: !1 }),
454
+ new D.NavigationControl({ showCompass: !1 }),
468
455
  "top-left"
469
456
  ), a.current = t, t.on("load", () => {
470
457
  P(!0);
@@ -473,7 +460,7 @@ const se = [
473
460
  });
474
461
  const d = typeof ResizeObserver < "u" ? new ResizeObserver(() => t.resize()) : null;
475
462
  return d && d.observe(u.current), () => {
476
- d && d.disconnect(), p.current && (p.current.remove(), p.current = null), t.remove(), a.current = null, R.current = !1, j.current = !1, C.current = /* @__PURE__ */ new Set();
463
+ d && d.disconnect(), p.current && (p.current.remove(), p.current = null), t.remove(), a.current = null, C.current = !1, S.current = !1, R.current = /* @__PURE__ */ new Set();
477
464
  };
478
465
  }, []), N(() => {
479
466
  if (!I || !(e != null && e.length)) return;
@@ -482,7 +469,7 @@ const se = [
482
469
  let d = !1;
483
470
  return _(!1), Promise.allSettled(
484
471
  e.map(
485
- (l) => ke(l.area.gazetteer, l.area.id).then((g) => ({
472
+ (l) => Ee(l.area.gazetteer, l.area.id).then((g) => ({
486
473
  record: l,
487
474
  geojson: g
488
475
  }))
@@ -496,8 +483,8 @@ const se = [
496
483
  x += 1;
497
484
  return;
498
485
  }
499
- const { record: V, geojson: U } = v.value, ce = Gt(V), Y = `focal-${F}`;
500
- h.set(Y, V), Ce(U).forEach((q) => {
486
+ const { record: H, geojson: V } = v.value, ce = $t(H), Y = `focal-${F}`;
487
+ h.set(Y, H), Fe(V).forEach((q) => {
501
488
  g.push({
502
489
  ...q,
503
490
  properties: {
@@ -515,7 +502,7 @@ const se = [
515
502
  const v = t.getLayer(M) ? M : void 0;
516
503
  t.addSource(X, { type: "geojson", data: b }), t.addLayer(
517
504
  {
518
- id: W,
505
+ id: U,
519
506
  type: "fill",
520
507
  source: X,
521
508
  paint: {
@@ -535,10 +522,10 @@ const se = [
535
522
  }
536
523
  },
537
524
  v
538
- ), t.on("click", W, Ke), t.on("mouseenter", W, be), t.on("mouseleave", W, xe), R.current = !0;
525
+ ), t.on("click", U, Ye), t.on("mouseenter", U, ve), t.on("mouseleave", U, je), C.current = !0;
539
526
  }
540
527
  if (g.length > 0) {
541
- const v = zt(g);
528
+ const v = Vt(g);
542
529
  v && t.fitBounds(v, { padding: 20, animate: !1 });
543
530
  }
544
531
  typeof n == "function" && n(x), _(!0);
@@ -546,31 +533,31 @@ const se = [
546
533
  d = !0;
547
534
  };
548
535
  }, [I, e]);
549
- const Ke = (t) => {
536
+ const Ye = (t) => {
550
537
  var x, b;
551
538
  const d = a.current;
552
539
  if (!d) return;
553
540
  const l = (x = t.features) == null ? void 0 : x[0], g = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = g ? w.current.get(g) : null;
554
- h && (p.current && p.current.remove(), p.current = new z.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(De(h)).addTo(d));
555
- }, be = () => {
541
+ h && (p.current && p.current.remove(), p.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Ue(h)).addTo(d));
542
+ }, ve = () => {
556
543
  const t = a.current;
557
544
  t && (t.getCanvas().style.cursor = "pointer");
558
- }, xe = () => {
545
+ }, je = () => {
559
546
  const t = a.current;
560
547
  t && (t.getCanvas().style.cursor = "");
561
548
  };
562
549
  N(() => {
563
550
  const t = a.current;
564
- if (!t || !R.current) return;
565
- const d = D ? "visible" : "none";
566
- t.getLayer(W) && t.setLayoutProperty(W, "visibility", d), t.getLayer(de) && t.setLayoutProperty(de, "visibility", d);
567
- }, [D, E]), N(() => {
551
+ if (!t || !C.current) return;
552
+ const d = z ? "visible" : "none";
553
+ t.getLayer(U) && t.setLayoutProperty(U, "visibility", d), t.getLayer(de) && t.setLayoutProperty(de, "visibility", d);
554
+ }, [z, E]), N(() => {
568
555
  if (!I) return;
569
556
  const t = a.current;
570
557
  if (!t || ((() => {
571
- t.getLayer(M) && t.removeLayer(M), t.getSource(re) && t.removeSource(re), j.current = !1;
558
+ t.getLayer(M) && t.removeLayer(M), t.getSource(re) && t.removeSource(re), S.current = !1;
572
559
  })(), !c || !(i != null && i.id)) || f === !1) return;
573
- const l = ($.gbifApi + At).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(i.id)), g = $.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(i.id);
560
+ const l = (A.gbifApi + Ot).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(i.id)), g = A.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(i.id);
574
561
  t.addSource(re, {
575
562
  type: "raster",
576
563
  tiles: [l],
@@ -582,23 +569,23 @@ const se = [
582
569
  source: re,
583
570
  paint: { "raster-opacity": 0.9 },
584
571
  layout: { visibility: B ? "visible" : "none" }
585
- }), j.current = !0;
572
+ }), S.current = !0;
586
573
  }, [I, c, i == null ? void 0 : i.id, f]), N(() => {
587
574
  const t = a.current;
588
- if (!t || !j.current) return;
575
+ if (!t || !S.current) return;
589
576
  const d = B ? "visible" : "none";
590
577
  t.getLayer(M) && t.setLayoutProperty(M, "visibility", d);
591
578
  }, [B]), N(() => {
592
579
  if (!I) return;
593
580
  const t = a.current;
594
- if (!t || (C.current.forEach((l) => {
581
+ if (!t || (R.current.forEach((l) => {
595
582
  t.getLayer(J(l)) && t.removeLayer(J(l)), t.getLayer(Q(l)) && t.removeLayer(Q(l)), t.getSource(ue(l)) && t.removeSource(ue(l));
596
- }), C.current = /* @__PURE__ */ new Set(), S.current = /* @__PURE__ */ new Map(), k.current = /* @__PURE__ */ new Map(), y.status !== "ready")) return;
583
+ }), R.current = /* @__PURE__ */ new Set(), j.current = /* @__PURE__ */ new Map(), k.current = /* @__PURE__ */ new Map(), y.status !== "ready")) return;
597
584
  const d = T;
598
585
  y.taxa.forEach((l) => {
599
- l.mappable.length !== 0 && (S.current.set(l.id, l), Promise.allSettled(
586
+ l.mappable.length !== 0 && (j.current.set(l.id, l), Promise.allSettled(
600
587
  l.mappable.map(
601
- (g) => ke(g.area.gazetteer, g.area.id).then((h) => ({
588
+ (g) => Ee(g.area.gazetteer, g.area.id).then((h) => ({
602
589
  record: g,
603
590
  geojson: h
604
591
  }))
@@ -606,10 +593,10 @@ const se = [
606
593
  ).then((g) => {
607
594
  if (!a.current) return;
608
595
  const h = [];
609
- g.forEach((F, V) => {
596
+ g.forEach((F, H) => {
610
597
  if (F.status !== "fulfilled" || !F.value.geojson) return;
611
- const { record: U, geojson: ce } = F.value, Y = `desc-${l.id}-${V}`;
612
- k.current.set(Y, { taxon: l, record: U }), Ce(ce).forEach((q) => {
598
+ const { record: V, geojson: ce } = F.value, Y = `desc-${l.id}-${H}`;
599
+ k.current.set(Y, { taxon: l, record: V }), Fe(ce).forEach((q) => {
613
600
  h.push({
614
601
  ...q,
615
602
  properties: {
@@ -624,7 +611,7 @@ const se = [
624
611
  a.current.getSource(v).setData(b);
625
612
  else {
626
613
  a.current.addSource(v, { type: "geojson", data: b });
627
- const F = J(l.id), V = Q(l.id), U = a.current.getLayer(M) ? M : void 0;
614
+ const F = J(l.id), H = Q(l.id), V = a.current.getLayer(M) ? M : void 0;
628
615
  a.current.addLayer(
629
616
  {
630
617
  id: F,
@@ -633,40 +620,40 @@ const se = [
633
620
  paint: { "fill-color": x, "fill-opacity": 0.55 },
634
621
  layout: { visibility: "none" }
635
622
  },
636
- U
623
+ V
637
624
  ), a.current.addLayer(
638
625
  {
639
- id: V,
626
+ id: H,
640
627
  type: "line",
641
628
  source: v,
642
629
  paint: { "line-color": x, "line-width": 2 },
643
630
  layout: { visibility: "none" }
644
631
  },
645
- U
646
- ), a.current.on("click", F, Te), a.current.on("mouseenter", F, be), a.current.on("mouseleave", F, xe), C.current.add(l.id);
632
+ V
633
+ ), a.current.on("click", F, qe), a.current.on("mouseenter", F, ve), a.current.on("mouseleave", F, je), R.current.add(l.id);
647
634
  }
648
635
  }));
649
636
  });
650
637
  }, [I, y, T]);
651
- const Te = (t) => {
638
+ const qe = (t) => {
652
639
  var x, b;
653
640
  const d = a.current;
654
641
  if (!d) return;
655
642
  const l = (x = t.features) == null ? void 0 : x[0], g = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = g ? k.current.get(g) : null;
656
- h && (p.current && p.current.remove(), p.current = new z.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML($t(h.taxon, h.record)).addTo(d));
643
+ h && (p.current && p.current.remove(), p.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Dt(h.taxon, h.record)).addTo(d));
657
644
  };
658
645
  N(() => {
659
646
  const t = a.current;
660
- t && C.current.forEach((d) => {
647
+ t && R.current.forEach((d) => {
661
648
  const l = K.has(d) ? "visible" : "none";
662
649
  t.getLayer(J(d)) && t.setLayoutProperty(J(d), "visibility", l), t.getLayer(Q(d)) && t.setLayoutProperty(Q(d), "visibility", l);
663
650
  });
664
651
  }, [K, y]);
665
- const ve = () => {
652
+ const Se = () => {
666
653
  var l;
667
654
  if (ie.current || !r || !i || !o) return;
668
655
  const t = (l = i == null ? void 0 : i.name) == null ? void 0 : l.rank;
669
- !t || t !== "species" && !se.includes(t) || Me(t, o).length === 0 || (ie.current = !0, m({ status: "loading", taxa: [] }), bt({ datasetKey: r, focalTaxon: i, rankOrder: o }).then(
656
+ !t || t !== "species" && !se.includes(t) || $e(t, o).length === 0 || (ie.current = !0, m({ status: "loading", taxa: [] }), St({ datasetKey: r, focalTaxon: i, rankOrder: o }).then(
670
657
  ({ taxa: g, descendantsFailed: h }) => {
671
658
  if (h) {
672
659
  m({ status: "error", taxa: [] });
@@ -679,34 +666,34 @@ const se = [
679
666
  m({ status: "ready", taxa: g });
680
667
  }
681
668
  ));
682
- }, Ye = () => {
683
- ge(!0), ve();
684
- }, qe = ne(() => {
669
+ }, Ze = () => {
670
+ me(!0), Se();
671
+ }, Xe = ne(() => {
685
672
  if (y.status !== "ready") return [];
686
673
  const t = {};
687
674
  return y.taxa.filter((d) => d.mappable.length > 0).forEach((d) => {
688
675
  (t[d.rank] = t[d.rank] || []).push(d);
689
676
  }), se.filter((d) => t[d]).map((d) => ({
690
677
  rank: d,
691
- label: Re(d),
678
+ label: Be(d),
692
679
  taxa: t[d].slice().sort(
693
680
  (l, g) => l.scientificName.localeCompare(g.scientificName)
694
681
  )
695
682
  }));
696
- }, [y]), Ze = (t) => {
697
- he((d) => {
683
+ }, [y]), Je = (t) => {
684
+ ge((d) => {
698
685
  const l = new Set(d);
699
686
  return l.has(t) ? l.delete(t) : l.add(t), l;
700
687
  });
701
- }, Xe = (t) => {
702
- he((d) => {
688
+ }, Qe = (t) => {
689
+ ge((d) => {
703
690
  const l = new Set(d), g = t.every((h) => d.has(h.id));
704
691
  return t.forEach((h) => {
705
692
  g ? l.delete(h.id) : l.add(h.id);
706
693
  }), l;
707
694
  });
708
695
  };
709
- if (!Ee())
696
+ if (!Ge())
710
697
  return /* @__PURE__ */ s.jsx(
711
698
  "div",
712
699
  {
@@ -721,7 +708,41 @@ const se = [
721
708
  children: "Maps require WebGL, which your browser doesn't support."
722
709
  }
723
710
  );
724
- const Je = ((Se = i == null ? void 0 : i.name) == null ? void 0 : Se.scientificName) || "This taxon";
711
+ if (W && !B)
712
+ return /* @__PURE__ */ s.jsxs(
713
+ "div",
714
+ {
715
+ className: "col-distributions-map col-distributions-map--collapsed",
716
+ style: {
717
+ display: "flex",
718
+ alignItems: "center",
719
+ gap: 6,
720
+ padding: "8px 12px",
721
+ background: "#fafafa",
722
+ border: "1px solid #eee",
723
+ borderRadius: 4,
724
+ color: "#666",
725
+ fontSize: 12
726
+ },
727
+ children: [
728
+ /* @__PURE__ */ s.jsx("span", { children: "No curated distribution data." }),
729
+ /* @__PURE__ */ s.jsx(
730
+ "a",
731
+ {
732
+ role: "button",
733
+ tabIndex: 0,
734
+ style: { cursor: "pointer" },
735
+ onClick: ye,
736
+ onKeyDown: (t) => {
737
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), ye());
738
+ },
739
+ children: "Show GBIF occurrences"
740
+ }
741
+ )
742
+ ]
743
+ }
744
+ );
745
+ const et = ((Ie = i == null ? void 0 : i.name) == null ? void 0 : Ie.scientificName) || "This taxon";
725
746
  return /* @__PURE__ */ s.jsxs("div", { className: "col-distributions-map", style: { position: "relative" }, children: [
726
747
  /* @__PURE__ */ s.jsx(
727
748
  "div",
@@ -731,31 +752,31 @@ const se = [
731
752
  }
732
753
  ),
733
754
  /* @__PURE__ */ s.jsx(
734
- Ht,
755
+ Wt,
735
756
  {
736
- open: Ue,
737
- onOpen: Ye,
738
- onClose: () => ge(!1),
739
- focalName: Je,
757
+ open: Ke,
758
+ onOpen: Ze,
759
+ onClose: () => me(!1),
760
+ focalName: et,
740
761
  focalReady: E,
741
- focalVisible: D,
762
+ focalVisible: z,
742
763
  onToggleFocal: () => O((t) => !t),
743
764
  gbifEnabled: !!c,
744
765
  gbifVisible: B,
745
766
  gbifAvailable: f,
746
- onToggleGbif: We,
767
+ onToggleGbif: Te,
747
768
  descendantStatus: y.status,
748
- descendantsByRank: qe,
769
+ descendantsByRank: Xe,
749
770
  descendantColors: T,
750
771
  visibleTaxonIds: K,
751
- onToggleTaxon: Ze,
752
- onToggleRankGroup: Xe,
772
+ onToggleTaxon: Je,
773
+ onToggleRankGroup: Qe,
753
774
  onRetry: () => {
754
- ie.current = !1, m({ status: "idle", taxa: [] }), ve();
775
+ ie.current = !1, m({ status: "idle", taxa: [] }), Se();
755
776
  }
756
777
  }
757
778
  ),
758
- !ye && (me.length > 0 || c && f !== !1 && B) && /* @__PURE__ */ s.jsxs(
779
+ !xe && (be.length > 0 || c && f !== !1 && B) && /* @__PURE__ */ s.jsxs(
759
780
  "div",
760
781
  {
761
782
  style: {
@@ -771,7 +792,7 @@ const se = [
771
792
  lineHeight: 1.5
772
793
  },
773
794
  children: [
774
- me.map((t) => /* @__PURE__ */ s.jsxs(
795
+ be.map((t) => /* @__PURE__ */ s.jsxs(
775
796
  "div",
776
797
  {
777
798
  style: { display: "flex", alignItems: "center", gap: 6 },
@@ -794,12 +815,12 @@ const se = [
794
815
  },
795
816
  t.key
796
817
  )),
797
- c && f !== !1 && B && /* @__PURE__ */ s.jsx(Ot, {})
818
+ c && f !== !1 && B && /* @__PURE__ */ s.jsx(Ht, {})
798
819
  ]
799
820
  }
800
821
  ),
801
- ye && /* @__PURE__ */ s.jsx(
802
- Et,
822
+ xe && /* @__PURE__ */ s.jsx(
823
+ Mt,
803
824
  {
804
825
  visibleGroups: ae.visibleGroups,
805
826
  unmappableGroups: ae.unmappableGroups,
@@ -807,7 +828,7 @@ const se = [
807
828
  }
808
829
  )
809
830
  ] });
810
- }, Ht = ({
831
+ }, Wt = ({
811
832
  open: e,
812
833
  onOpen: n,
813
834
  onClose: r,
@@ -819,11 +840,11 @@ const se = [
819
840
  gbifVisible: a,
820
841
  gbifAvailable: p,
821
842
  onToggleGbif: w,
822
- descendantStatus: S,
843
+ descendantStatus: j,
823
844
  descendantsByRank: k,
824
- descendantColors: R,
825
- visibleTaxonIds: j,
826
- onToggleTaxon: C,
845
+ descendantColors: C,
846
+ visibleTaxonIds: S,
847
+ onToggleTaxon: R,
827
848
  onToggleRankGroup: I,
828
849
  onRetry: P
829
850
  }) => e ? /* @__PURE__ */ s.jsxs(
@@ -882,14 +903,14 @@ const se = [
882
903
  ]
883
904
  }
884
905
  ),
885
- S === "loading" && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
886
- S === "error" && /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
906
+ j === "loading" && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
907
+ j === "error" && /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
887
908
  "Couldn't load descendants.",
888
909
  " ",
889
910
  /* @__PURE__ */ s.jsx("a", { onClick: P, style: { cursor: "pointer" }, children: "Retry" })
890
911
  ] }),
891
- S === "ready" && k.map((E) => {
892
- const _ = E.taxa.every((m) => j.has(m.id)), y = E.taxa.some((m) => j.has(m.id));
912
+ j === "ready" && k.map((E) => {
913
+ const _ = E.taxa.every((m) => S.has(m.id)), y = E.taxa.some((m) => S.has(m.id));
893
914
  return /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6 }, children: [
894
915
  /* @__PURE__ */ s.jsxs(
895
916
  "label",
@@ -929,8 +950,8 @@ const se = [
929
950
  "input",
930
951
  {
931
952
  type: "checkbox",
932
- checked: j.has(m.id),
933
- onChange: () => C(m.id)
953
+ checked: S.has(m.id),
954
+ onChange: () => R(m.id)
934
955
  }
935
956
  ),
936
957
  /* @__PURE__ */ s.jsx(
@@ -940,13 +961,13 @@ const se = [
940
961
  display: "inline-block",
941
962
  width: 10,
942
963
  height: 10,
943
- background: R[m.id],
964
+ background: C[m.id],
944
965
  border: "1px solid rgba(0,0,0,0.15)",
945
966
  borderRadius: 2
946
967
  }
947
968
  }
948
969
  ),
949
- /* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: He(m.scientificName) })
970
+ /* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: We(m.scientificName) })
950
971
  ]
951
972
  },
952
973
  m.id
@@ -980,10 +1001,10 @@ const se = [
980
1001
  },
981
1002
  children: "+"
982
1003
  }
983
- ), Vt = (e) => {
1004
+ ), Kt = (e) => {
984
1005
  var n, r;
985
1006
  return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
986
- }, Be = ({ datasetKey: e, data: n }) => {
1007
+ }, Me = ({ datasetKey: e, data: n }) => {
987
1008
  const [r, i] = L({});
988
1009
  return N(() => {
989
1010
  let o = !1;
@@ -992,12 +1013,12 @@ const se = [
992
1013
  o = !0;
993
1014
  break;
994
1015
  }
995
- o && te(`${$.dataApi}vocab/country`).then((c) => {
996
- i(st(c.data, "alpha3"));
1016
+ o && te(`${A.dataApi}vocab/country`).then((c) => {
1017
+ i(it(c.data, "alpha3"));
997
1018
  });
998
1019
  }, []), /* @__PURE__ */ s.jsx("div", { children: n.map((o, c) => /* @__PURE__ */ s.jsxs("span", { children: [
999
1020
  (o == null ? void 0 : o.merged) && /* @__PURE__ */ s.jsx(
1000
- lt,
1021
+ ut,
1001
1022
  {
1002
1023
  createdBy: o == null ? void 0 : o.createdBy,
1003
1024
  datasetKey: o.datasetKey,
@@ -1006,10 +1027,10 @@ const se = [
1006
1027
  style: { marginRight: "4px" }
1007
1028
  }
1008
1029
  ),
1009
- (A(r, `[${A(o, "area.name")}].name`) ? ot(A(r, `[${A(o, "area.name")}].name`)) : null) || A(o, "area.name") || A(o, "area.globalId"),
1030
+ ($(r, `[${$(o, "area.name")}].name`) ? at($(r, `[${$(o, "area.name")}].name`)) : null) || $(o, "area.name") || $(o, "area.globalId"),
1010
1031
  " ",
1011
1032
  o.referenceId && /* @__PURE__ */ s.jsx(
1012
- pt,
1033
+ mt,
1013
1034
  {
1014
1035
  datasetKey: e,
1015
1036
  referenceId: o.referenceId,
@@ -1018,7 +1039,7 @@ const se = [
1018
1039
  ),
1019
1040
  c < n.length - 1 && ", "
1020
1041
  ] }, c)) });
1021
- }, nn = ({
1042
+ }, an = ({
1022
1043
  datasetKey: e,
1023
1044
  data: n,
1024
1045
  style: r,
@@ -1027,7 +1048,7 @@ const se = [
1027
1048
  rankOrder: c,
1028
1049
  gbifChecklistKey: f
1029
1050
  }) => {
1030
- const u = n.filter(Vt), a = n.length - u.length, p = !!f, w = n.length > 0, [S, k] = L("map"), [R, j] = L(0), [C, I] = L(null);
1051
+ const u = n.filter(Kt), a = n.length - u.length, p = !!f, w = n.length > 0, [j, k] = L("map"), [C, S] = L(0), [R, I] = L(null);
1031
1052
  N(() => {
1032
1053
  if (!f || !(o != null && o.id)) {
1033
1054
  I(null);
@@ -1035,7 +1056,7 @@ const se = [
1035
1056
  }
1036
1057
  I(null);
1037
1058
  let O = !1;
1038
- return it.get(`${$.gbifApi}/v1/occurrence/search`, {
1059
+ return ct.get(`${A.gbifApi}/v1/occurrence/search`, {
1039
1060
  params: {
1040
1061
  checklistKey: f,
1041
1062
  taxonKey: o.id,
@@ -1045,9 +1066,9 @@ const se = [
1045
1066
  limit: 0
1046
1067
  }
1047
1068
  }).then(
1048
- (H) => {
1069
+ (W) => {
1049
1070
  var B;
1050
- O || I(((B = H == null ? void 0 : H.data) == null ? void 0 : B.count) ?? 0);
1071
+ O || I(((B = W == null ? void 0 : W.data) == null ? void 0 : B.count) ?? 0);
1051
1072
  },
1052
1073
  () => {
1053
1074
  O || I(null);
@@ -1056,18 +1077,18 @@ const se = [
1056
1077
  O = !0;
1057
1078
  };
1058
1079
  }, [f, o == null ? void 0 : o.id]);
1059
- const P = p ? C === null || C > 0 : !1, E = u.length > 0 && R >= u.length, _ = i && (u.length > 0 || P) && !(u.length > 0 && E && !P);
1060
- if (!_ && p && u.length === 0 && C === 0)
1080
+ const P = p ? R === null || R > 0 : !1, E = u.length > 0 && C >= u.length, _ = i && (u.length > 0 || P) && !(u.length > 0 && E && !P);
1081
+ if (!_ && p && u.length === 0 && R === 0)
1061
1082
  return /* @__PURE__ */ s.jsx("div", { style: r, children: /* @__PURE__ */ s.jsx("span", { style: { color: "#888" }, children: "No occurrence data on GBIF for this taxon." }) });
1062
1083
  if (!_)
1063
- return w ? /* @__PURE__ */ s.jsx("div", { style: r, children: /* @__PURE__ */ s.jsx(Be, { datasetKey: e, data: n }) }) : null;
1064
- const y = a + R, m = w, D = m ? S : "map";
1084
+ return w ? /* @__PURE__ */ s.jsx("div", { style: r, children: /* @__PURE__ */ s.jsx(Me, { datasetKey: e, data: n }) }) : null;
1085
+ const y = a + C, m = w, z = m ? j : "map";
1065
1086
  return /* @__PURE__ */ s.jsxs("div", { style: r, children: [
1066
1087
  m ? /* @__PURE__ */ s.jsxs(
1067
1088
  le.Group,
1068
1089
  {
1069
1090
  size: "small",
1070
- value: D,
1091
+ value: z,
1071
1092
  onChange: (O) => k(O.target.value),
1072
1093
  style: { marginBottom: 8 },
1073
1094
  children: [
@@ -1080,12 +1101,12 @@ const se = [
1080
1101
  // map's top edge lines up with the "Distributions" label.
1081
1102
  /* @__PURE__ */ s.jsx("div", { style: { height: 24, marginBottom: 8 } })
1082
1103
  ),
1083
- D === "map" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
1104
+ z === "map" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
1084
1105
  /* @__PURE__ */ s.jsx(
1085
- Dt,
1106
+ Ut,
1086
1107
  {
1087
1108
  records: u,
1088
- onUnmappable: j,
1109
+ onUnmappable: S,
1089
1110
  datasetKey: e,
1090
1111
  focalTaxon: o,
1091
1112
  rankOrder: c,
@@ -1100,11 +1121,11 @@ const se = [
1100
1121
  y === 1 ? "" : "s",
1101
1122
  " not on map"
1102
1123
  ] }) })
1103
- ] }) : /* @__PURE__ */ s.jsx(Be, { datasetKey: e, data: n })
1124
+ ] }) : /* @__PURE__ */ s.jsx(Me, { datasetKey: e, data: n })
1104
1125
  ] });
1105
1126
  };
1106
1127
  export {
1107
- nn as D,
1108
- pt as R
1128
+ an as D,
1129
+ mt as R
1109
1130
  };
1110
- //# sourceMappingURL=Distributions-DDYEbGhW.js.map
1131
+ //# sourceMappingURL=Distributions-CXIEJ6e6.js.map