col-browser 2.3.4 → 2.3.5
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.
- package/es/chunks/{Distributions-D_4NAlfr.js → Distributions-B3TlCDkA.js} +117 -107
- package/es/chunks/Distributions-B3TlCDkA.js.map +1 -0
- package/es/taxon.js +1 -1
- package/es/taxonDistribution.js +1 -1
- package/package.json +1 -1
- package/umd/col-browser.js +11 -1
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +2 -2
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/Distributions-D_4NAlfr.js.map +0 -1
|
@@ -4,8 +4,8 @@ var X = (e, r, s) => rt(e, typeof r != "symbol" ? r + "" : r, s);
|
|
|
4
4
|
import { j as n } from "./jsx-runtime-BzflLqGi.js";
|
|
5
5
|
import * as _e from "react";
|
|
6
6
|
import st, { useState as L, useRef as C, useMemo as se, useEffect as $ } from "react";
|
|
7
|
-
import { Spin as ot, Popover as
|
|
8
|
-
import { isArray as Le, get as O, keyBy as
|
|
7
|
+
import { Spin as ot, Popover as at, Radio as ue } from "antd";
|
|
8
|
+
import { isArray as Le, get as O, keyBy as it, startCase as ct } from "lodash-es";
|
|
9
9
|
import { c as ne, p as lt } from "./router-CssZk5qZ.js";
|
|
10
10
|
import { c as z } from "./config-BPRXv9x8.js";
|
|
11
11
|
import { E as dt } from "./ErrorMsg-K8k5PPTp.js";
|
|
@@ -20,8 +20,8 @@ function ge() {
|
|
|
20
20
|
return ge = Object.assign ? Object.assign.bind() : function(e) {
|
|
21
21
|
for (var r = 1; r < arguments.length; r++) {
|
|
22
22
|
var s = arguments[r];
|
|
23
|
-
for (var
|
|
24
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
23
|
+
for (var a in s)
|
|
24
|
+
Object.prototype.hasOwnProperty.call(s, a) && (e[a] = s[a]);
|
|
25
25
|
}
|
|
26
26
|
return e;
|
|
27
27
|
}, ge.apply(this, arguments);
|
|
@@ -35,30 +35,30 @@ class bt extends st.Component {
|
|
|
35
35
|
constructor(s) {
|
|
36
36
|
super(s);
|
|
37
37
|
X(this, "getData", () => {
|
|
38
|
-
const { referenceId: s, datasetKey:
|
|
38
|
+
const { referenceId: s, datasetKey: a, references: o } = this.props;
|
|
39
39
|
if (s) {
|
|
40
40
|
const c = Le(s) ? s : [s], p = [];
|
|
41
41
|
this.setState({ loading: !0 }), Promise.allSettled(
|
|
42
42
|
c.map(
|
|
43
43
|
(f) => O(o, f) ? Promise.resolve(p.push(o[f])) : ne(
|
|
44
|
-
`${z.dataApi}dataset/${
|
|
44
|
+
`${z.dataApi}dataset/${a}/reference/${f}`
|
|
45
45
|
).then((u) => p.push(u.data)).catch((u) => this.setState({ error: u }))
|
|
46
46
|
)
|
|
47
47
|
).then(() => this.setState({ reference: p, loading: !1 }));
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
X(this, "getContent", () => {
|
|
51
|
-
const { error: s, reference:
|
|
52
|
-
return o ? /* @__PURE__ */ n.jsx(ot, {}) : s ? /* @__PURE__ */ n.jsx(dt, { error: s }) :
|
|
51
|
+
const { error: s, reference: a, loading: o } = this.state;
|
|
52
|
+
return o ? /* @__PURE__ */ n.jsx(ot, {}) : s ? /* @__PURE__ */ n.jsx(dt, { error: s }) : a.length === 1 ? a[0].citation : /* @__PURE__ */ n.jsx("ul", { children: a.map((c) => /* @__PURE__ */ n.jsx("li", { children: c.citation }, c.id)) });
|
|
53
53
|
});
|
|
54
|
-
X(this, "scrollToReference", (s,
|
|
55
|
-
const o = document.getElementById(`col-reference-${
|
|
54
|
+
X(this, "scrollToReference", (s, a) => {
|
|
55
|
+
const o = document.getElementById(`col-reference-${a}`);
|
|
56
56
|
o && (s.preventDefault(), o.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
57
57
|
});
|
|
58
58
|
X(this, "render", () => {
|
|
59
|
-
const { referenceId: s, referenceIndexMap:
|
|
60
|
-
let f =
|
|
61
|
-
const u = p.slice(0, c),
|
|
59
|
+
const { referenceId: s, referenceIndexMap: a, trigger: o } = this.props, c = this.props.maxInline || 4, p = Le(s) ? s : [s];
|
|
60
|
+
let f = a && O(a, p[0]) ? (() => {
|
|
61
|
+
const u = p.slice(0, c), i = p.length - u.length;
|
|
62
62
|
return [
|
|
63
63
|
...u.map((y) => /* @__PURE__ */ n.jsx(
|
|
64
64
|
"a",
|
|
@@ -66,21 +66,31 @@ class bt extends st.Component {
|
|
|
66
66
|
className: "col-reference-link",
|
|
67
67
|
href: `#col-reference-${y}`,
|
|
68
68
|
onClick: (x) => this.scrollToReference(x, y),
|
|
69
|
-
children: `[${
|
|
69
|
+
children: `[${a[y]}]`
|
|
70
70
|
},
|
|
71
71
|
y
|
|
72
72
|
)),
|
|
73
|
-
|
|
73
|
+
i > 0 ? /* @__PURE__ */ n.jsx("span", { className: "col-reference-link", children: ` +${i}` }, "overflow") : null
|
|
74
74
|
];
|
|
75
75
|
})() : /* @__PURE__ */ n.jsx($e, { style: { cursor: "pointer" } });
|
|
76
76
|
return s ? /* @__PURE__ */ n.jsx("div", { id: `reference_${s}`, style: this.props.style, children: /* @__PURE__ */ n.jsx(
|
|
77
|
-
|
|
77
|
+
at,
|
|
78
78
|
{
|
|
79
79
|
getPopupContainer: () => document.getElementById(`reference_${s}`),
|
|
80
80
|
placement: this.props.placement || "left",
|
|
81
81
|
title: "Reference",
|
|
82
82
|
onOpenChange: (u) => u && this.getData(),
|
|
83
|
-
content: /* @__PURE__ */ n.jsx(
|
|
83
|
+
content: /* @__PURE__ */ n.jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
style: {
|
|
87
|
+
maxWidth: "500px",
|
|
88
|
+
maxHeight: "60vh",
|
|
89
|
+
overflowY: "auto"
|
|
90
|
+
},
|
|
91
|
+
children: this.getContent()
|
|
92
|
+
}
|
|
93
|
+
),
|
|
84
94
|
trigger: o || "hover",
|
|
85
95
|
children: f
|
|
86
96
|
}
|
|
@@ -93,7 +103,7 @@ class bt extends st.Component {
|
|
|
93
103
|
};
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
|
-
const
|
|
106
|
+
const ae = [
|
|
97
107
|
"subspecies",
|
|
98
108
|
"variety",
|
|
99
109
|
"subvariety",
|
|
@@ -102,37 +112,37 @@ const ie = [
|
|
|
102
112
|
"infraspecific name"
|
|
103
113
|
], Ae = (e, r) => {
|
|
104
114
|
const s = r.indexOf(e);
|
|
105
|
-
return s === -1 ? [] :
|
|
115
|
+
return s === -1 ? [] : ae.filter((a) => r.indexOf(a) > s);
|
|
106
116
|
}, xt = 16, vt = (e) => {
|
|
107
117
|
var r, s;
|
|
108
118
|
return ((r = e == null ? void 0 : e.area) == null ? void 0 : r.gazetteer) !== "text" && !!((s = e == null ? void 0 : e.area) != null && s.globalId);
|
|
109
119
|
}, jt = async (e, r, s) => {
|
|
110
|
-
const
|
|
120
|
+
const a = new Array(e.length);
|
|
111
121
|
let o = 0;
|
|
112
122
|
const c = Array.from({ length: Math.min(s, e.length) }, async () => {
|
|
113
123
|
for (; ; ) {
|
|
114
124
|
const p = o++;
|
|
115
125
|
if (p >= e.length) return;
|
|
116
|
-
|
|
126
|
+
a[p] = await r(e[p], p);
|
|
117
127
|
}
|
|
118
128
|
});
|
|
119
|
-
return await Promise.all(c),
|
|
129
|
+
return await Promise.all(c), a;
|
|
120
130
|
}, St = async (e, r, s) => {
|
|
121
131
|
var f;
|
|
122
132
|
if (s.length === 0) return [];
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
(u) =>
|
|
126
|
-
),
|
|
127
|
-
const o = `${z.dataApi}dataset/${e}/nameusage/search?${
|
|
133
|
+
const a = new URLSearchParams();
|
|
134
|
+
a.append("TAXON_ID", r), s.forEach((u) => a.append("rank", u)), ["accepted", "provisionally accepted"].forEach(
|
|
135
|
+
(u) => a.append("status", u)
|
|
136
|
+
), a.append("limit", "1000");
|
|
137
|
+
const o = `${z.dataApi}dataset/${e}/nameusage/search?${a}`, c = await ne(o);
|
|
128
138
|
return (((f = c == null ? void 0 : c.data) == null ? void 0 : f.result) || []).filter((u) => {
|
|
129
|
-
var
|
|
130
|
-
return (
|
|
139
|
+
var i;
|
|
140
|
+
return (i = u == null ? void 0 : u.usage) == null ? void 0 : i.id;
|
|
131
141
|
}).map((u) => {
|
|
132
|
-
var
|
|
142
|
+
var i, y, x, R, E, I;
|
|
133
143
|
return {
|
|
134
144
|
id: u.usage.id,
|
|
135
|
-
scientificName: ((y = (
|
|
145
|
+
scientificName: ((y = (i = u.usage) == null ? void 0 : i.name) == null ? void 0 : y.scientificName) || ((x = u.usage) == null ? void 0 : x.label) || u.usage.id,
|
|
136
146
|
rank: (E = (R = u.usage) == null ? void 0 : R.name) == null ? void 0 : E.rank,
|
|
137
147
|
parentId: (I = u.usage) == null ? void 0 : I.parentId
|
|
138
148
|
};
|
|
@@ -140,28 +150,28 @@ const ie = [
|
|
|
140
150
|
}, It = async (e, r) => {
|
|
141
151
|
const s = `${z.dataApi}dataset/${e}/taxon/${encodeURIComponent(r)}/distribution`;
|
|
142
152
|
try {
|
|
143
|
-
const
|
|
144
|
-
return Array.isArray(
|
|
153
|
+
const a = await ne(s);
|
|
154
|
+
return Array.isArray(a == null ? void 0 : a.data) ? a.data : [];
|
|
145
155
|
} catch {
|
|
146
156
|
return [];
|
|
147
157
|
}
|
|
148
158
|
}, wt = async ({ datasetKey: e, focalTaxon: r, rankOrder: s }) => {
|
|
149
159
|
var u;
|
|
150
|
-
const
|
|
160
|
+
const a = Ae((u = r == null ? void 0 : r.name) == null ? void 0 : u.rank, s);
|
|
151
161
|
let o = !1, c = [];
|
|
152
162
|
try {
|
|
153
|
-
c = await St(e, r.id,
|
|
163
|
+
c = await St(e, r.id, a);
|
|
154
164
|
} catch {
|
|
155
165
|
return o = !0, { taxa: [], descendantsFailed: o };
|
|
156
166
|
}
|
|
157
167
|
const p = await jt(
|
|
158
168
|
c,
|
|
159
|
-
(
|
|
169
|
+
(i) => It(e, i.id),
|
|
160
170
|
xt
|
|
161
171
|
);
|
|
162
|
-
return { taxa: c.map((
|
|
172
|
+
return { taxa: c.map((i, y) => {
|
|
163
173
|
const x = p[y] || [];
|
|
164
|
-
return { ...
|
|
174
|
+
return { ...i, distributions: x, mappable: x.filter(vt) };
|
|
165
175
|
}), descendantsFailed: o };
|
|
166
176
|
}, ke = [
|
|
167
177
|
"#E58606",
|
|
@@ -183,10 +193,10 @@ const ie = [
|
|
|
183
193
|
const s = [...e].sort((o, c) => {
|
|
184
194
|
const p = Ce(o.rank, r), f = Ce(c.rank, r);
|
|
185
195
|
return p !== f ? p - f : o.scientificName.localeCompare(c.scientificName);
|
|
186
|
-
}),
|
|
196
|
+
}), a = {};
|
|
187
197
|
return s.forEach((o, c) => {
|
|
188
|
-
|
|
189
|
-
}),
|
|
198
|
+
a[o.id] = ke[c % ke.length];
|
|
199
|
+
}), a;
|
|
190
200
|
}, kt = {
|
|
191
201
|
position: "absolute",
|
|
192
202
|
bottom: 8,
|
|
@@ -252,15 +262,15 @@ const ie = [
|
|
|
252
262
|
) }),
|
|
253
263
|
/* @__PURE__ */ n.jsx("span", { children: "GBIF occurrences" })
|
|
254
264
|
] }), _t = ({ visibleGroups: e, unmappableGroups: r, showGbif: s }) => {
|
|
255
|
-
const [
|
|
265
|
+
const [a, o] = L(!1), c = Re(e), p = Re(r);
|
|
256
266
|
return c === 0 && p === 0 && !s ? null : /* @__PURE__ */ n.jsxs("div", { style: kt, children: [
|
|
257
267
|
/* @__PURE__ */ n.jsxs("div", { style: Ct, children: [
|
|
258
268
|
e.map((f, u) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
259
269
|
/* @__PURE__ */ n.jsx("div", { style: u === 0 ? Rt : Pe, children: f.label }),
|
|
260
|
-
f.taxa.map((
|
|
261
|
-
/* @__PURE__ */ n.jsx("span", { style: Et(
|
|
262
|
-
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children:
|
|
263
|
-
] },
|
|
270
|
+
f.taxa.map((i) => /* @__PURE__ */ n.jsxs("div", { style: Oe, children: [
|
|
271
|
+
/* @__PURE__ */ n.jsx("span", { style: Et(i.color) }),
|
|
272
|
+
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: i.displayName || i.scientificName })
|
|
273
|
+
] }, i.id))
|
|
264
274
|
] }, f.rank)),
|
|
265
275
|
s && /* @__PURE__ */ n.jsx(Mt, {})
|
|
266
276
|
] }),
|
|
@@ -271,14 +281,14 @@ const ie = [
|
|
|
271
281
|
style: Ft,
|
|
272
282
|
onClick: () => o((f) => !f),
|
|
273
283
|
children: [
|
|
274
|
-
|
|
284
|
+
a ? "− Hide" : "+",
|
|
275
285
|
" ",
|
|
276
286
|
p,
|
|
277
287
|
" without map data"
|
|
278
288
|
]
|
|
279
289
|
}
|
|
280
290
|
),
|
|
281
|
-
|
|
291
|
+
a && /* @__PURE__ */ n.jsx("div", { style: Bt, children: r.map((f, u) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
282
292
|
/* @__PURE__ */ n.jsx(
|
|
283
293
|
"div",
|
|
284
294
|
{
|
|
@@ -286,7 +296,7 @@ const ie = [
|
|
|
286
296
|
children: f.label
|
|
287
297
|
}
|
|
288
298
|
),
|
|
289
|
-
f.taxa.map((
|
|
299
|
+
f.taxa.map((i) => /* @__PURE__ */ n.jsx("div", { style: Nt, children: i.displayName || i.scientificName }, i.id))
|
|
290
300
|
] }, f.rank)) })
|
|
291
301
|
] })
|
|
292
302
|
] });
|
|
@@ -311,18 +321,18 @@ const ie = [
|
|
|
311
321
|
{ key: "uncertain", label: "Uncertain", color: "#8BE0A4" }
|
|
312
322
|
], He = Object.fromEntries(
|
|
313
323
|
ze.map((e) => [e.key, e.color])
|
|
314
|
-
),
|
|
324
|
+
), ie = "#66C5CC", At = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), Ve = (e) => {
|
|
315
325
|
const r = e == null ? void 0 : e.establishmentMeans;
|
|
316
326
|
if (r == null || r === "") return null;
|
|
317
327
|
const s = At(r);
|
|
318
328
|
return He[s] ? s : "uncertain";
|
|
319
329
|
}, Pt = (e) => {
|
|
320
330
|
const r = Ve(e);
|
|
321
|
-
return r == null ?
|
|
331
|
+
return r == null ? ie : He[r];
|
|
322
332
|
}, Ot = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", Ue = "gbif-visible", Dt = (e) => ht(Ue, e), Ee = (e) => gt(Ue, e), zt = "/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}", J = "col-focal-distributions", K = "col-focal-fill", pe = "col-focal-line", oe = "col-gbif-occurrences", _ = "col-gbif-occurrences", fe = (e) => `col-descendant-${e}`, Q = (e) => `col-descendant-fill-${e}`, ee = (e) => `col-descendant-line-${e}`, he = /* @__PURE__ */ new Map(), Fe = (e, r) => {
|
|
323
333
|
const s = `${e}:${r}`;
|
|
324
334
|
if (he.has(s)) return he.get(s);
|
|
325
|
-
const
|
|
335
|
+
const a = `${z.dataApi}vocab/area/${s}`, o = ne(a, {
|
|
326
336
|
headers: { Accept: "application/geo+json" }
|
|
327
337
|
}).then(
|
|
328
338
|
(c) => c.data,
|
|
@@ -330,8 +340,8 @@ const ie = [
|
|
|
330
340
|
);
|
|
331
341
|
return he.set(s, o), o;
|
|
332
342
|
}, te = (e) => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), We = (e) => {
|
|
333
|
-
var
|
|
334
|
-
const r = ((
|
|
343
|
+
var a, o;
|
|
344
|
+
const r = ((a = e == null ? void 0 : e.area) == null ? void 0 : a.name) || ((o = e == null ? void 0 : e.area) == null ? void 0 : o.globalId) || "", s = $t.map((c) => [c, e == null ? void 0 : e[c]]).filter(([, c]) => c != null && c !== "").map(
|
|
335
345
|
([c, p]) => `<div><strong>${te(c)}:</strong> ${te(p)}</div>`
|
|
336
346
|
).join("");
|
|
337
347
|
return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${te(
|
|
@@ -363,11 +373,11 @@ const ie = [
|
|
|
363
373
|
/* @__PURE__ */ n.jsx("span", { children: "GBIF occurrences" })
|
|
364
374
|
] }), Wt = (e) => {
|
|
365
375
|
var p;
|
|
366
|
-
let r = 1 / 0, s = 1 / 0,
|
|
376
|
+
let r = 1 / 0, s = 1 / 0, a = -1 / 0, o = -1 / 0;
|
|
367
377
|
const c = (f) => {
|
|
368
378
|
if (typeof f[0] == "number") {
|
|
369
|
-
const [u,
|
|
370
|
-
u < r && (r = u), u >
|
|
379
|
+
const [u, i] = f;
|
|
380
|
+
u < r && (r = u), u > a && (a = u), i < s && (s = i), i > o && (o = i);
|
|
371
381
|
} else
|
|
372
382
|
for (let u = 0; u < f.length; u++) c(f[u]);
|
|
373
383
|
};
|
|
@@ -377,7 +387,7 @@ const ie = [
|
|
|
377
387
|
}
|
|
378
388
|
return r === 1 / 0 ? null : [
|
|
379
389
|
[r, s],
|
|
380
|
-
[
|
|
390
|
+
[a, o]
|
|
381
391
|
];
|
|
382
392
|
}, Ge = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Ne = () => {
|
|
383
393
|
var e;
|
|
@@ -386,7 +396,7 @@ const ie = [
|
|
|
386
396
|
records: e,
|
|
387
397
|
onUnmappable: r,
|
|
388
398
|
datasetKey: s,
|
|
389
|
-
focalTaxon:
|
|
399
|
+
focalTaxon: a,
|
|
390
400
|
rankOrder: o,
|
|
391
401
|
gbifChecklistKey: c,
|
|
392
402
|
// true | null → show GBIF layer; false → GBIF API returned 0 occurrences,
|
|
@@ -395,7 +405,7 @@ const ie = [
|
|
|
395
405
|
gbifAvailable: p = !0
|
|
396
406
|
}) => {
|
|
397
407
|
var we;
|
|
398
|
-
const f = C(null), u = C(null),
|
|
408
|
+
const f = C(null), u = C(null), i = C(null), y = C(null), x = C(/* @__PURE__ */ new Map()), R = C(/* @__PURE__ */ new Map()), E = C(/* @__PURE__ */ new Map()), I = C(!1), B = C(!1), G = C(/* @__PURE__ */ new Set()), [k, w] = L(!1), [N, V] = L(!1), [g, M] = L({
|
|
399
409
|
status: "idle",
|
|
400
410
|
// idle | loading | ready | empty | error
|
|
401
411
|
taxa: []
|
|
@@ -429,7 +439,7 @@ const ie = [
|
|
|
429
439
|
const v = {};
|
|
430
440
|
return h.forEach((b) => {
|
|
431
441
|
(v[b.rank] = v[b.rank] || []).push(t(b));
|
|
432
|
-
}),
|
|
442
|
+
}), ae.filter((b) => v[b]).map((b) => ({
|
|
433
443
|
rank: b,
|
|
434
444
|
label: Be(b),
|
|
435
445
|
taxa: v[b]
|
|
@@ -444,7 +454,7 @@ const ie = [
|
|
|
444
454
|
return { visibleGroups: l, unmappableGroups: m };
|
|
445
455
|
}, [g, Y, P]), ve = le.visibleGroups.length > 0;
|
|
446
456
|
$(() => {
|
|
447
|
-
if (!f.current ||
|
|
457
|
+
if (!f.current || i.current || !Ne()) return;
|
|
448
458
|
const t = new D.Map({
|
|
449
459
|
container: f.current,
|
|
450
460
|
style: Ot,
|
|
@@ -463,18 +473,18 @@ const ie = [
|
|
|
463
473
|
), t.addControl(
|
|
464
474
|
new D.FullscreenControl({ container: u.current }),
|
|
465
475
|
"top-right"
|
|
466
|
-
),
|
|
476
|
+
), i.current = t, t.on("load", () => {
|
|
467
477
|
w(!0);
|
|
468
478
|
const l = t.getContainer().querySelector(".maplibregl-ctrl-attrib");
|
|
469
479
|
l && l.classList.remove("maplibregl-compact-show");
|
|
470
480
|
});
|
|
471
481
|
const d = typeof ResizeObserver < "u" ? new ResizeObserver(() => t.resize()) : null;
|
|
472
482
|
return d && d.observe(f.current), () => {
|
|
473
|
-
d && d.disconnect(), y.current && (y.current.remove(), y.current = null), t.remove(),
|
|
483
|
+
d && d.disconnect(), y.current && (y.current.remove(), y.current = null), t.remove(), i.current = null, I.current = !1, B.current = !1, G.current = /* @__PURE__ */ new Set();
|
|
474
484
|
};
|
|
475
485
|
}, []), $(() => {
|
|
476
486
|
if (!k || !(e != null && e.length)) return;
|
|
477
|
-
const t =
|
|
487
|
+
const t = i.current;
|
|
478
488
|
if (!t) return;
|
|
479
489
|
let d = !1;
|
|
480
490
|
return V(!1), Promise.allSettled(
|
|
@@ -516,7 +526,7 @@ const ie = [
|
|
|
516
526
|
type: "fill",
|
|
517
527
|
source: J,
|
|
518
528
|
paint: {
|
|
519
|
-
"fill-color": ["coalesce", ["get", "_color"],
|
|
529
|
+
"fill-color": ["coalesce", ["get", "_color"], ie],
|
|
520
530
|
"fill-opacity": 0.65
|
|
521
531
|
}
|
|
522
532
|
},
|
|
@@ -527,7 +537,7 @@ const ie = [
|
|
|
527
537
|
type: "line",
|
|
528
538
|
source: J,
|
|
529
539
|
paint: {
|
|
530
|
-
"line-color": ["coalesce", ["get", "_color"],
|
|
540
|
+
"line-color": ["coalesce", ["get", "_color"], ie],
|
|
531
541
|
"line-width": 1
|
|
532
542
|
}
|
|
533
543
|
},
|
|
@@ -545,29 +555,29 @@ const ie = [
|
|
|
545
555
|
}, [k, e]);
|
|
546
556
|
const qe = (t) => {
|
|
547
557
|
var v, b;
|
|
548
|
-
const d =
|
|
558
|
+
const d = i.current;
|
|
549
559
|
if (!d) return;
|
|
550
560
|
const l = (v = t.features) == null ? void 0 : v[0], m = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = m ? x.current.get(m) : null;
|
|
551
561
|
h && (y.current && y.current.remove(), y.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(We(h)).addTo(d));
|
|
552
562
|
}, je = () => {
|
|
553
|
-
const t =
|
|
563
|
+
const t = i.current;
|
|
554
564
|
t && (t.getCanvas().style.cursor = "pointer");
|
|
555
565
|
}, Se = () => {
|
|
556
|
-
const t =
|
|
566
|
+
const t = i.current;
|
|
557
567
|
t && (t.getCanvas().style.cursor = "");
|
|
558
568
|
};
|
|
559
569
|
$(() => {
|
|
560
|
-
const t =
|
|
570
|
+
const t = i.current;
|
|
561
571
|
if (!t || !I.current) return;
|
|
562
572
|
const d = H ? "visible" : "none";
|
|
563
573
|
t.getLayer(K) && t.setLayoutProperty(K, "visibility", d), t.getLayer(pe) && t.setLayoutProperty(pe, "visibility", d);
|
|
564
574
|
}, [H, N]), $(() => {
|
|
565
575
|
if (!k) return;
|
|
566
|
-
const t =
|
|
576
|
+
const t = i.current;
|
|
567
577
|
if (!t || ((() => {
|
|
568
578
|
t.getLayer(_) && t.removeLayer(_), t.getSource(oe) && t.removeSource(oe), B.current = !1;
|
|
569
|
-
})(), !c || !(
|
|
570
|
-
const l = (z.gbifApi + zt).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(
|
|
579
|
+
})(), !c || !(a != null && a.id)) || p === !1) return;
|
|
580
|
+
const l = (z.gbifApi + zt).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(a.id)), m = z.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(a.id);
|
|
571
581
|
t.addSource(oe, {
|
|
572
582
|
type: "raster",
|
|
573
583
|
tiles: [l],
|
|
@@ -580,14 +590,14 @@ const ie = [
|
|
|
580
590
|
paint: { "raster-opacity": 0.9 },
|
|
581
591
|
layout: { visibility: j ? "visible" : "none" }
|
|
582
592
|
}), B.current = !0;
|
|
583
|
-
}, [k, c,
|
|
584
|
-
const t =
|
|
593
|
+
}, [k, c, a == null ? void 0 : a.id, p]), $(() => {
|
|
594
|
+
const t = i.current;
|
|
585
595
|
if (!t || !B.current) return;
|
|
586
596
|
const d = j ? "visible" : "none";
|
|
587
597
|
t.getLayer(_) && t.setLayoutProperty(_, "visibility", d);
|
|
588
598
|
}, [j]), $(() => {
|
|
589
599
|
if (!k) return;
|
|
590
|
-
const t =
|
|
600
|
+
const t = i.current;
|
|
591
601
|
if (!t || (G.current.forEach((l) => {
|
|
592
602
|
t.getLayer(Q(l)) && t.removeLayer(Q(l)), t.getLayer(ee(l)) && t.removeLayer(ee(l)), t.getSource(fe(l)) && t.removeSource(fe(l));
|
|
593
603
|
}), G.current = /* @__PURE__ */ new Set(), R.current = /* @__PURE__ */ new Map(), E.current = /* @__PURE__ */ new Map(), g.status !== "ready")) return;
|
|
@@ -601,7 +611,7 @@ const ie = [
|
|
|
601
611
|
}))
|
|
602
612
|
)
|
|
603
613
|
).then((m) => {
|
|
604
|
-
if (!
|
|
614
|
+
if (!i.current) return;
|
|
605
615
|
const h = [];
|
|
606
616
|
m.forEach((F, U) => {
|
|
607
617
|
if (F.status !== "fulfilled" || !F.value.geojson) return;
|
|
@@ -616,13 +626,13 @@ const ie = [
|
|
|
616
626
|
});
|
|
617
627
|
});
|
|
618
628
|
});
|
|
619
|
-
const v = d[l.id] ||
|
|
620
|
-
if (
|
|
621
|
-
|
|
629
|
+
const v = d[l.id] || ie, b = { type: "FeatureCollection", features: h }, S = fe(l.id);
|
|
630
|
+
if (i.current.getSource(S))
|
|
631
|
+
i.current.getSource(S).setData(b);
|
|
622
632
|
else {
|
|
623
|
-
|
|
624
|
-
const F = Q(l.id), U = ee(l.id), W =
|
|
625
|
-
|
|
633
|
+
i.current.addSource(S, { type: "geojson", data: b });
|
|
634
|
+
const F = Q(l.id), U = ee(l.id), W = i.current.getLayer(_) ? _ : void 0;
|
|
635
|
+
i.current.addLayer(
|
|
626
636
|
{
|
|
627
637
|
id: F,
|
|
628
638
|
type: "fill",
|
|
@@ -631,7 +641,7 @@ const ie = [
|
|
|
631
641
|
layout: { visibility: "none" }
|
|
632
642
|
},
|
|
633
643
|
W
|
|
634
|
-
),
|
|
644
|
+
), i.current.addLayer(
|
|
635
645
|
{
|
|
636
646
|
id: U,
|
|
637
647
|
type: "line",
|
|
@@ -640,20 +650,20 @@ const ie = [
|
|
|
640
650
|
layout: { visibility: "none" }
|
|
641
651
|
},
|
|
642
652
|
W
|
|
643
|
-
),
|
|
653
|
+
), i.current.on("click", F, Ze), i.current.on("mouseenter", F, je), i.current.on("mouseleave", F, Se), G.current.add(l.id);
|
|
644
654
|
}
|
|
645
655
|
}));
|
|
646
656
|
});
|
|
647
657
|
}, [k, g, Y]);
|
|
648
658
|
const Ze = (t) => {
|
|
649
659
|
var v, b;
|
|
650
|
-
const d =
|
|
660
|
+
const d = i.current;
|
|
651
661
|
if (!d) return;
|
|
652
662
|
const l = (v = t.features) == null ? void 0 : v[0], m = (b = l == null ? void 0 : l.properties) == null ? void 0 : b._recordKey, h = m ? E.current.get(m) : null;
|
|
653
663
|
h && (y.current && y.current.remove(), y.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Ht(h.taxon, h.record)).addTo(d));
|
|
654
664
|
};
|
|
655
665
|
$(() => {
|
|
656
|
-
const t =
|
|
666
|
+
const t = i.current;
|
|
657
667
|
t && G.current.forEach((d) => {
|
|
658
668
|
const l = P.has(d) ? "visible" : "none";
|
|
659
669
|
t.getLayer(Q(d)) && t.setLayoutProperty(Q(d), "visibility", l), t.getLayer(ee(d)) && t.setLayoutProperty(ee(d), "visibility", l);
|
|
@@ -661,9 +671,9 @@ const ie = [
|
|
|
661
671
|
}, [P, g]);
|
|
662
672
|
const Ie = () => {
|
|
663
673
|
var l;
|
|
664
|
-
if (ce.current || !s || !
|
|
665
|
-
const t = (l =
|
|
666
|
-
!t || t !== "species" && !
|
|
674
|
+
if (ce.current || !s || !a || !o) return;
|
|
675
|
+
const t = (l = a == null ? void 0 : a.name) == null ? void 0 : l.rank;
|
|
676
|
+
!t || t !== "species" && !ae.includes(t) || Ae(t, o).length === 0 || (ce.current = !0, M({ status: "loading", taxa: [] }), wt({ datasetKey: s, focalTaxon: a, rankOrder: o }).then(
|
|
667
677
|
({ taxa: m, descendantsFailed: h }) => {
|
|
668
678
|
if (h) {
|
|
669
679
|
M({ status: "error", taxa: [] });
|
|
@@ -683,7 +693,7 @@ const ie = [
|
|
|
683
693
|
const t = {};
|
|
684
694
|
return g.taxa.filter((d) => d.mappable.length > 0).forEach((d) => {
|
|
685
695
|
(t[d.rank] = t[d.rank] || []).push(d);
|
|
686
|
-
}),
|
|
696
|
+
}), ae.filter((d) => t[d]).map((d) => ({
|
|
687
697
|
rank: d,
|
|
688
698
|
label: Be(d),
|
|
689
699
|
taxa: t[d].slice().sort(
|
|
@@ -752,7 +762,7 @@ const ie = [
|
|
|
752
762
|
]
|
|
753
763
|
}
|
|
754
764
|
);
|
|
755
|
-
const tt = ((we =
|
|
765
|
+
const tt = ((we = a == null ? void 0 : a.name) == null ? void 0 : we.scientificName) || "This taxon";
|
|
756
766
|
return /* @__PURE__ */ n.jsxs(
|
|
757
767
|
"div",
|
|
758
768
|
{
|
|
@@ -851,13 +861,13 @@ const ie = [
|
|
|
851
861
|
open: e,
|
|
852
862
|
onOpen: r,
|
|
853
863
|
onClose: s,
|
|
854
|
-
focalName:
|
|
864
|
+
focalName: a,
|
|
855
865
|
focalReady: o,
|
|
856
866
|
focalVisible: c,
|
|
857
867
|
onToggleFocal: p,
|
|
858
868
|
gbifEnabled: f,
|
|
859
869
|
gbifVisible: u,
|
|
860
|
-
gbifAvailable:
|
|
870
|
+
gbifAvailable: i,
|
|
861
871
|
onToggleGbif: y,
|
|
862
872
|
descendantStatus: x,
|
|
863
873
|
descendantsByRank: R,
|
|
@@ -897,7 +907,7 @@ const ie = [
|
|
|
897
907
|
onChange: p
|
|
898
908
|
}
|
|
899
909
|
),
|
|
900
|
-
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children:
|
|
910
|
+
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: a })
|
|
901
911
|
] }),
|
|
902
912
|
f && /* @__PURE__ */ n.jsxs(
|
|
903
913
|
"div",
|
|
@@ -906,16 +916,16 @@ const ie = [
|
|
|
906
916
|
display: "flex",
|
|
907
917
|
alignItems: "center",
|
|
908
918
|
gap: 6,
|
|
909
|
-
opacity:
|
|
919
|
+
opacity: i === !1 ? 0.5 : 1
|
|
910
920
|
},
|
|
911
|
-
title:
|
|
921
|
+
title: i === !1 ? "GBIF has no occurrence records for this taxon." : void 0,
|
|
912
922
|
children: [
|
|
913
923
|
/* @__PURE__ */ n.jsx(
|
|
914
924
|
"input",
|
|
915
925
|
{
|
|
916
926
|
type: "checkbox",
|
|
917
|
-
checked:
|
|
918
|
-
disabled:
|
|
927
|
+
checked: i === !1 ? !1 : u,
|
|
928
|
+
disabled: i === !1,
|
|
919
929
|
onChange: y
|
|
920
930
|
}
|
|
921
931
|
),
|
|
@@ -1026,7 +1036,7 @@ const ie = [
|
|
|
1026
1036
|
var r, s;
|
|
1027
1037
|
return ((r = e == null ? void 0 : e.area) == null ? void 0 : r.gazetteer) !== "text" && !!((s = e == null ? void 0 : e.area) != null && s.globalId);
|
|
1028
1038
|
}, Me = ({ datasetKey: e, data: r }) => {
|
|
1029
|
-
const [s,
|
|
1039
|
+
const [s, a] = L({});
|
|
1030
1040
|
return $(() => {
|
|
1031
1041
|
let o = !1;
|
|
1032
1042
|
for (let c = 0; c < r.length; c++)
|
|
@@ -1035,7 +1045,7 @@ const ie = [
|
|
|
1035
1045
|
break;
|
|
1036
1046
|
}
|
|
1037
1047
|
o && ne(`${z.dataApi}vocab/country`).then((c) => {
|
|
1038
|
-
|
|
1048
|
+
a(it(c.data, "alpha3"));
|
|
1039
1049
|
});
|
|
1040
1050
|
}, []), /* @__PURE__ */ n.jsx("div", { children: r.map((o, c) => /* @__PURE__ */ n.jsxs("span", { children: [
|
|
1041
1051
|
(o == null ? void 0 : o.merged) && /* @__PURE__ */ n.jsx(
|
|
@@ -1064,14 +1074,14 @@ const ie = [
|
|
|
1064
1074
|
datasetKey: e,
|
|
1065
1075
|
data: r,
|
|
1066
1076
|
style: s,
|
|
1067
|
-
showDistributionMap:
|
|
1077
|
+
showDistributionMap: a,
|
|
1068
1078
|
focalTaxon: o,
|
|
1069
1079
|
rankOrder: c,
|
|
1070
1080
|
gbifChecklistKey: p,
|
|
1071
1081
|
label: f,
|
|
1072
1082
|
md: u
|
|
1073
1083
|
}) => {
|
|
1074
|
-
const
|
|
1084
|
+
const i = r.filter(Yt), y = r.length - i.length, x = !!p, R = r.length > 0, [E, I] = L("map"), [B, G] = L(0), [k, w] = L(null);
|
|
1075
1085
|
$(() => {
|
|
1076
1086
|
if (!p || !(o != null && o.id)) {
|
|
1077
1087
|
w(null);
|
|
@@ -1100,7 +1110,7 @@ const ie = [
|
|
|
1100
1110
|
j = !0;
|
|
1101
1111
|
};
|
|
1102
1112
|
}, [p, o == null ? void 0 : o.id]);
|
|
1103
|
-
const N = x ? k === null || k > 0 : !1, V =
|
|
1113
|
+
const N = x ? k === null || k > 0 : !1, V = i.length > 0 && B >= i.length, g = a && (i.length > 0 || N) && !(i.length > 0 && V && !N);
|
|
1104
1114
|
if (!g && !R) return null;
|
|
1105
1115
|
const M = y + B, H = R;
|
|
1106
1116
|
let T;
|
|
@@ -1130,7 +1140,7 @@ const ie = [
|
|
|
1130
1140
|
/* @__PURE__ */ n.jsx(
|
|
1131
1141
|
Kt,
|
|
1132
1142
|
{
|
|
1133
|
-
records:
|
|
1143
|
+
records: i,
|
|
1134
1144
|
onUnmappable: G,
|
|
1135
1145
|
datasetKey: e,
|
|
1136
1146
|
focalTaxon: o,
|
|
@@ -1156,4 +1166,4 @@ export {
|
|
|
1156
1166
|
dn as D,
|
|
1157
1167
|
bt as R
|
|
1158
1168
|
};
|
|
1159
|
-
//# sourceMappingURL=Distributions-
|
|
1169
|
+
//# sourceMappingURL=Distributions-B3TlCDkA.js.map
|