col-browser 2.2.0 → 2.2.2
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/README.md +1 -1
- package/es/chunks/DatasetlogoWithFallback-B9WXvNCA.js +24 -0
- package/es/chunks/DatasetlogoWithFallback-B9WXvNCA.js.map +1 -0
- package/es/chunks/{Distributions-CXIEJ6e6.js → Distributions-Cwl_75VG.js} +349 -348
- package/es/chunks/{Distributions-CXIEJ6e6.js.map → Distributions-Cwl_75VG.js.map} +1 -1
- package/es/chunks/{MetricsPresentation-U_CO8JoH.js → MetricsPresentation-DKCJQOtf.js} +2 -2
- package/es/chunks/{MetricsPresentation-U_CO8JoH.js.map → MetricsPresentation-DKCJQOtf.js.map} +1 -1
- package/es/chunks/{DatasetlogoWithFallback-CbP7vRs_.js → PresentationItem-C4yZ555-.js} +243 -262
- package/es/chunks/PresentationItem-C4yZ555-.js.map +1 -0
- package/es/chunks/index-BmhRLlZh.js +100 -0
- package/es/chunks/index-BmhRLlZh.js.map +1 -0
- package/es/index.js +1 -1
- package/es/routing.js +1 -1
- package/es/sourceDataset.js +57 -56
- package/es/sourceDataset.js.map +1 -1
- package/es/sourceDatasetList.js +5 -4
- package/es/sourceDatasetList.js.map +1 -1
- package/es/taxon.js +18 -12
- package/es/taxon.js.map +1 -1
- package/es/taxonDistribution.js +1 -1
- package/es/tree.js +60 -57
- package/es/tree.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +13 -0
- package/umd/col-browser.js +150 -134
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +5 -5
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/DatasetlogoWithFallback-CbP7vRs_.js.map +0 -1
- package/es/chunks/index-CNK3JADR.js +0 -95
- package/es/chunks/index-CNK3JADR.js.map +0 -1
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var tt = (e, n, r) => n in e ? et(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
|
|
3
|
+
var X = (e, n, r) => tt(e, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { j as s } from "./jsx-runtime-BzflLqGi.js";
|
|
5
5
|
import * as Ne from "react";
|
|
6
|
-
import
|
|
7
|
-
import { Spin as
|
|
8
|
-
import { isArray as
|
|
9
|
-
import { c as
|
|
10
|
-
import { c as
|
|
11
|
-
import { E as
|
|
12
|
-
import { I as
|
|
13
|
-
import { M as
|
|
6
|
+
import nt, { useState as w, useRef as M, useMemo as se, useEffect as $ } from "react";
|
|
7
|
+
import { Spin as rt, Popover as st, Radio as ue } from "antd";
|
|
8
|
+
import { isArray as Le, get as A, keyBy as ot, startCase as at } from "lodash-es";
|
|
9
|
+
import { c as ne, p as it } from "./router-CssZk5qZ.js";
|
|
10
|
+
import { c as P } from "./config-BPRXv9x8.js";
|
|
11
|
+
import { E as ct } from "./ErrorMsg-K8k5PPTp.js";
|
|
12
|
+
import { I as lt } from "./AntdIcon-B1nMlqyh.js";
|
|
13
|
+
import { M as dt } from "./MergedDataBadge-DsTsn5Xu.js";
|
|
14
|
+
import { P as ut } from "./PresentationItem-C4yZ555-.js";
|
|
14
15
|
import D from "maplibre-gl";
|
|
15
16
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
16
17
|
import { r as pt, w as ft } from "./storage-BgdCo9fV.js";
|
|
17
18
|
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" };
|
|
18
|
-
function
|
|
19
|
-
return
|
|
19
|
+
function ge() {
|
|
20
|
+
return ge = Object.assign ? Object.assign.bind() : function(e) {
|
|
20
21
|
for (var n = 1; n < arguments.length; n++) {
|
|
21
22
|
var r = arguments[n];
|
|
22
|
-
for (var
|
|
23
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
23
|
+
for (var a in r)
|
|
24
|
+
Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
|
|
24
25
|
}
|
|
25
26
|
return e;
|
|
26
|
-
},
|
|
27
|
+
}, ge.apply(this, arguments);
|
|
27
28
|
}
|
|
28
|
-
const gt = (e, n) => /* @__PURE__ */ Ne.createElement(
|
|
29
|
+
const gt = (e, n) => /* @__PURE__ */ Ne.createElement(lt, ge({}, e, {
|
|
29
30
|
ref: n,
|
|
30
31
|
icon: ht
|
|
31
32
|
})), _e = /* @__PURE__ */ Ne.forwardRef(gt);
|
|
32
33
|
process.env.NODE_ENV !== "production" && (_e.displayName = "BookOutlined");
|
|
33
|
-
class mt extends
|
|
34
|
+
class mt extends nt.Component {
|
|
34
35
|
constructor(r) {
|
|
35
36
|
super(r);
|
|
36
|
-
|
|
37
|
-
const { referenceId: r, datasetKey:
|
|
37
|
+
X(this, "getData", () => {
|
|
38
|
+
const { referenceId: r, datasetKey: a, references: o } = this.props;
|
|
38
39
|
if (r) {
|
|
39
|
-
const c =
|
|
40
|
+
const c = Le(r) ? r : [r], f = [];
|
|
40
41
|
this.setState({ loading: !0 }), Promise.allSettled(
|
|
41
42
|
c.map(
|
|
42
|
-
(u) =>
|
|
43
|
-
`${
|
|
44
|
-
).then((
|
|
43
|
+
(u) => A(o, u) ? Promise.resolve(f.push(o[u])) : ne(
|
|
44
|
+
`${P.dataApi}dataset/${a}/reference/${u}`
|
|
45
|
+
).then((i) => f.push(i.data)).catch((i) => this.setState({ error: i }))
|
|
45
46
|
)
|
|
46
47
|
).then(() => this.setState({ reference: f, loading: !1 }));
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
-
const { error: r, reference:
|
|
51
|
-
return o ? /* @__PURE__ */ s.jsx(
|
|
50
|
+
X(this, "getContent", () => {
|
|
51
|
+
const { error: r, reference: a, loading: o } = this.state;
|
|
52
|
+
return o ? /* @__PURE__ */ s.jsx(rt, {}) : r ? /* @__PURE__ */ s.jsx(ct, { error: r }) : a.length === 1 ? a[0].citation : /* @__PURE__ */ s.jsx("ul", { children: a.map((c) => /* @__PURE__ */ s.jsx("li", { children: c.citation }, c.id)) });
|
|
52
53
|
});
|
|
53
|
-
|
|
54
|
-
const o = document.getElementById(`col-reference-${
|
|
54
|
+
X(this, "scrollToReference", (r, a) => {
|
|
55
|
+
const o = document.getElementById(`col-reference-${a}`);
|
|
55
56
|
o && (r.preventDefault(), o.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
56
57
|
});
|
|
57
|
-
|
|
58
|
-
const { referenceId: r, referenceIndexMap:
|
|
59
|
-
let f =
|
|
58
|
+
X(this, "render", () => {
|
|
59
|
+
const { referenceId: r, referenceIndexMap: a, trigger: o } = this.props, c = Le(r) ? r : [r];
|
|
60
|
+
let f = a && A(a, c[0]) ? c.map((u) => /* @__PURE__ */ s.jsx(
|
|
60
61
|
"a",
|
|
61
62
|
{
|
|
62
63
|
className: "col-reference-link",
|
|
63
64
|
href: `#col-reference-${u}`,
|
|
64
|
-
onClick: (
|
|
65
|
-
children: `[${
|
|
65
|
+
onClick: (i) => this.scrollToReference(i, u),
|
|
66
|
+
children: `[${a[u]}]`
|
|
66
67
|
},
|
|
67
68
|
u
|
|
68
69
|
)) : /* @__PURE__ */ s.jsx(_e, { style: { cursor: "pointer" } });
|
|
69
70
|
return r ? /* @__PURE__ */ s.jsx("div", { id: `reference_${r}`, style: this.props.style, children: /* @__PURE__ */ s.jsx(
|
|
70
|
-
|
|
71
|
+
st,
|
|
71
72
|
{
|
|
72
73
|
getPopupContainer: () => document.getElementById(`reference_${r}`),
|
|
73
74
|
placement: this.props.placement || "left",
|
|
@@ -86,7 +87,7 @@ class mt extends rt.Component {
|
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
const
|
|
90
|
+
const ae = [
|
|
90
91
|
"subspecies",
|
|
91
92
|
"variety",
|
|
92
93
|
"subvariety",
|
|
@@ -95,68 +96,68 @@ const se = [
|
|
|
95
96
|
"infraspecific name"
|
|
96
97
|
], $e = (e, n) => {
|
|
97
98
|
const r = n.indexOf(e);
|
|
98
|
-
return r === -1 ? [] :
|
|
99
|
+
return r === -1 ? [] : ae.filter((a) => n.indexOf(a) > r);
|
|
99
100
|
}, yt = 16, bt = (e) => {
|
|
100
101
|
var n, r;
|
|
101
102
|
return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
|
|
102
103
|
}, xt = async (e, n, r) => {
|
|
103
|
-
const
|
|
104
|
+
const a = new Array(e.length);
|
|
104
105
|
let o = 0;
|
|
105
106
|
const c = Array.from({ length: Math.min(r, e.length) }, async () => {
|
|
106
107
|
for (; ; ) {
|
|
107
108
|
const f = o++;
|
|
108
109
|
if (f >= e.length) return;
|
|
109
|
-
|
|
110
|
+
a[f] = await n(e[f], f);
|
|
110
111
|
}
|
|
111
112
|
});
|
|
112
|
-
return await Promise.all(c),
|
|
113
|
+
return await Promise.all(c), a;
|
|
113
114
|
}, vt = async (e, n, r) => {
|
|
114
115
|
var u;
|
|
115
116
|
if (r.length === 0) return [];
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
(
|
|
119
|
-
),
|
|
120
|
-
const o = `${
|
|
121
|
-
return (((u = c == null ? void 0 : c.data) == null ? void 0 : u.result) || []).filter((
|
|
117
|
+
const a = new URLSearchParams();
|
|
118
|
+
a.append("TAXON_ID", n), r.forEach((i) => a.append("rank", i)), ["accepted", "provisionally accepted"].forEach(
|
|
119
|
+
(i) => a.append("status", i)
|
|
120
|
+
), a.append("limit", "1000");
|
|
121
|
+
const o = `${P.dataApi}dataset/${e}/nameusage/search?${a}`, c = await ne(o);
|
|
122
|
+
return (((u = c == null ? void 0 : c.data) == null ? void 0 : u.result) || []).filter((i) => {
|
|
122
123
|
var p;
|
|
123
|
-
return (p =
|
|
124
|
-
}).map((
|
|
125
|
-
var p,
|
|
124
|
+
return (p = i == null ? void 0 : i.usage) == null ? void 0 : p.id;
|
|
125
|
+
}).map((i) => {
|
|
126
|
+
var p, L, S, k, C, j;
|
|
126
127
|
return {
|
|
127
|
-
id:
|
|
128
|
-
scientificName: ((
|
|
129
|
-
rank: (C = (k =
|
|
130
|
-
parentId: (
|
|
128
|
+
id: i.usage.id,
|
|
129
|
+
scientificName: ((L = (p = i.usage) == null ? void 0 : p.name) == null ? void 0 : L.scientificName) || ((S = i.usage) == null ? void 0 : S.label) || i.usage.id,
|
|
130
|
+
rank: (C = (k = i.usage) == null ? void 0 : k.name) == null ? void 0 : C.rank,
|
|
131
|
+
parentId: (j = i.usage) == null ? void 0 : j.parentId
|
|
131
132
|
};
|
|
132
133
|
});
|
|
133
|
-
},
|
|
134
|
-
const r = `${
|
|
134
|
+
}, St = async (e, n) => {
|
|
135
|
+
const r = `${P.dataApi}dataset/${e}/taxon/${encodeURIComponent(n)}/distribution`;
|
|
135
136
|
try {
|
|
136
|
-
const
|
|
137
|
-
return Array.isArray(
|
|
137
|
+
const a = await ne(r);
|
|
138
|
+
return Array.isArray(a == null ? void 0 : a.data) ? a.data : [];
|
|
138
139
|
} catch {
|
|
139
140
|
return [];
|
|
140
141
|
}
|
|
141
|
-
},
|
|
142
|
-
var
|
|
143
|
-
const
|
|
142
|
+
}, jt = async ({ datasetKey: e, focalTaxon: n, rankOrder: r }) => {
|
|
143
|
+
var i;
|
|
144
|
+
const a = $e((i = n == null ? void 0 : n.name) == null ? void 0 : i.rank, r);
|
|
144
145
|
let o = !1, c = [];
|
|
145
146
|
try {
|
|
146
|
-
c = await vt(e, n.id,
|
|
147
|
+
c = await vt(e, n.id, a);
|
|
147
148
|
} catch {
|
|
148
149
|
return o = !0, { taxa: [], descendantsFailed: o };
|
|
149
150
|
}
|
|
150
151
|
const f = await xt(
|
|
151
152
|
c,
|
|
152
|
-
(p) =>
|
|
153
|
+
(p) => St(e, p.id),
|
|
153
154
|
yt
|
|
154
155
|
);
|
|
155
|
-
return { taxa: c.map((p,
|
|
156
|
-
const
|
|
157
|
-
return { ...p, distributions:
|
|
156
|
+
return { taxa: c.map((p, L) => {
|
|
157
|
+
const S = f[L] || [];
|
|
158
|
+
return { ...p, distributions: S, mappable: S.filter(bt) };
|
|
158
159
|
}), descendantsFailed: o };
|
|
159
|
-
},
|
|
160
|
+
}, ke = [
|
|
160
161
|
"#E58606",
|
|
161
162
|
"#5D69B1",
|
|
162
163
|
"#52BCA3",
|
|
@@ -169,17 +170,17 @@ const se = [
|
|
|
169
170
|
"#ED645A",
|
|
170
171
|
"#CC3A8E",
|
|
171
172
|
"#A5AA99"
|
|
172
|
-
],
|
|
173
|
+
], Ce = (e, n) => {
|
|
173
174
|
const r = n.indexOf(e);
|
|
174
175
|
return r === -1 ? n.length : r;
|
|
175
176
|
}, It = (e, n) => {
|
|
176
177
|
const r = [...e].sort((o, c) => {
|
|
177
|
-
const f =
|
|
178
|
+
const f = Ce(o.rank, n), u = Ce(c.rank, n);
|
|
178
179
|
return f !== u ? f - u : o.scientificName.localeCompare(c.scientificName);
|
|
179
|
-
}),
|
|
180
|
+
}), a = {};
|
|
180
181
|
return r.forEach((o, c) => {
|
|
181
|
-
|
|
182
|
-
}),
|
|
182
|
+
a[o.id] = ke[c % ke.length];
|
|
183
|
+
}), a;
|
|
183
184
|
}, wt = {
|
|
184
185
|
position: "absolute",
|
|
185
186
|
bottom: 8,
|
|
@@ -233,7 +234,7 @@ const se = [
|
|
|
233
234
|
}, Ft = {
|
|
234
235
|
fontStyle: "italic",
|
|
235
236
|
paddingLeft: 4
|
|
236
|
-
},
|
|
237
|
+
}, Re = (e) => e.reduce((n, r) => n + r.taxa.length, 0), Gt = () => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
|
|
237
238
|
/* @__PURE__ */ s.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ s.jsx(
|
|
238
239
|
"polygon",
|
|
239
240
|
{
|
|
@@ -245,11 +246,11 @@ const se = [
|
|
|
245
246
|
) }),
|
|
246
247
|
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
247
248
|
] }), Mt = ({ visibleGroups: e, unmappableGroups: n, showGbif: r }) => {
|
|
248
|
-
const [
|
|
249
|
+
const [a, o] = w(!1), c = Re(e), f = Re(n);
|
|
249
250
|
return c === 0 && f === 0 && !r ? null : /* @__PURE__ */ s.jsxs("div", { style: wt, children: [
|
|
250
251
|
/* @__PURE__ */ s.jsxs("div", { style: Lt, children: [
|
|
251
|
-
e.map((u,
|
|
252
|
-
/* @__PURE__ */ s.jsx("div", { style:
|
|
252
|
+
e.map((u, i) => /* @__PURE__ */ s.jsxs("div", { children: [
|
|
253
|
+
/* @__PURE__ */ s.jsx("div", { style: i === 0 ? kt : Ae, children: u.label }),
|
|
253
254
|
u.taxa.map((p) => /* @__PURE__ */ s.jsxs("div", { style: Pe, children: [
|
|
254
255
|
/* @__PURE__ */ s.jsx("span", { style: Ct(p.color) }),
|
|
255
256
|
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: p.displayName || p.scientificName })
|
|
@@ -264,18 +265,18 @@ const se = [
|
|
|
264
265
|
style: Rt,
|
|
265
266
|
onClick: () => o((u) => !u),
|
|
266
267
|
children: [
|
|
267
|
-
|
|
268
|
+
a ? "− Hide" : "+",
|
|
268
269
|
" ",
|
|
269
270
|
f,
|
|
270
271
|
" without map data"
|
|
271
272
|
]
|
|
272
273
|
}
|
|
273
274
|
),
|
|
274
|
-
|
|
275
|
+
a && /* @__PURE__ */ s.jsx("div", { style: Et, children: n.map((u, i) => /* @__PURE__ */ s.jsxs("div", { children: [
|
|
275
276
|
/* @__PURE__ */ s.jsx(
|
|
276
277
|
"div",
|
|
277
278
|
{
|
|
278
|
-
style:
|
|
279
|
+
style: i === 0 ? Bt : Oe,
|
|
279
280
|
children: u.label
|
|
280
281
|
}
|
|
281
282
|
),
|
|
@@ -304,42 +305,42 @@ const se = [
|
|
|
304
305
|
{ key: "uncertain", label: "Uncertain", color: "#8BE0A4" }
|
|
305
306
|
], ze = Object.fromEntries(
|
|
306
307
|
De.map((e) => [e.key, e.color])
|
|
307
|
-
),
|
|
308
|
+
), ie = "#66C5CC", _t = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), He = (e) => {
|
|
308
309
|
const n = e == null ? void 0 : e.establishmentMeans;
|
|
309
310
|
if (n == null || n === "") return null;
|
|
310
311
|
const r = _t(n);
|
|
311
312
|
return ze[r] ? r : "uncertain";
|
|
312
313
|
}, $t = (e) => {
|
|
313
314
|
const n = He(e);
|
|
314
|
-
return n == null ?
|
|
315
|
-
}, At = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", Ve = "gbif-visible", Pt = (e) => pt(Ve, e),
|
|
315
|
+
return n == null ? ie : ze[n];
|
|
316
|
+
}, At = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json", Ve = "gbif-visible", Pt = (e) => pt(Ve, e), Ee = (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}", J = "col-focal-distributions", W = "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(), Be = (e, n) => {
|
|
316
317
|
const r = `${e}:${n}`;
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
318
|
+
if (he.has(r)) return he.get(r);
|
|
319
|
+
const a = `${P.dataApi}vocab/area/${r}`, o = ne(a, {
|
|
319
320
|
headers: { Accept: "application/geo+json" }
|
|
320
321
|
}).then(
|
|
321
322
|
(c) => c.data,
|
|
322
323
|
() => null
|
|
323
324
|
);
|
|
324
|
-
return
|
|
325
|
-
},
|
|
326
|
-
var
|
|
327
|
-
const n = ((
|
|
328
|
-
([c, f]) => `<div><strong>${
|
|
325
|
+
return he.set(r, o), o;
|
|
326
|
+
}, te = (e) => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Ue = (e) => {
|
|
327
|
+
var a, o;
|
|
328
|
+
const n = ((a = e == null ? void 0 : e.area) == null ? void 0 : a.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(
|
|
329
|
+
([c, f]) => `<div><strong>${te(c)}:</strong> ${te(f)}</div>`
|
|
329
330
|
).join("");
|
|
330
|
-
return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${
|
|
331
|
+
return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${te(
|
|
331
332
|
n
|
|
332
333
|
)}</div>${r}</div>`;
|
|
333
|
-
}, Dt = (e, n) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${
|
|
334
|
+
}, Dt = (e, n) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${te(
|
|
334
335
|
e.scientificName
|
|
335
|
-
)}</div><div style="color:#888;margin-bottom:4px">${
|
|
336
|
+
)}</div><div style="color:#888;margin-bottom:4px">${te(e.rank || "")}</div>` + Ue(n), zt = {
|
|
336
337
|
subspecies: "subspecies",
|
|
337
338
|
variety: "varieties",
|
|
338
339
|
subvariety: "subvarieties",
|
|
339
340
|
form: "forms",
|
|
340
341
|
subform: "subforms",
|
|
341
342
|
"infraspecific name": "infraspecific names"
|
|
342
|
-
},
|
|
343
|
+
}, Fe = (e) => zt[e] || e, We = (e) => {
|
|
343
344
|
if (!e) return "";
|
|
344
345
|
const n = e.trim().split(/\s+/);
|
|
345
346
|
return n[n.length - 1];
|
|
@@ -356,30 +357,30 @@ const se = [
|
|
|
356
357
|
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
357
358
|
] }), Vt = (e) => {
|
|
358
359
|
var f;
|
|
359
|
-
let n = 1 / 0, r = 1 / 0,
|
|
360
|
+
let n = 1 / 0, r = 1 / 0, a = -1 / 0, o = -1 / 0;
|
|
360
361
|
const c = (u) => {
|
|
361
362
|
if (typeof u[0] == "number") {
|
|
362
|
-
const [
|
|
363
|
-
|
|
363
|
+
const [i, p] = u;
|
|
364
|
+
i < n && (n = i), i > a && (a = i), p < r && (r = p), p > o && (o = p);
|
|
364
365
|
} else
|
|
365
|
-
for (let
|
|
366
|
+
for (let i = 0; i < u.length; i++) c(u[i]);
|
|
366
367
|
};
|
|
367
368
|
for (let u = 0; u < e.length; u++) {
|
|
368
|
-
const
|
|
369
|
-
|
|
369
|
+
const i = (f = e[u]) == null ? void 0 : f.geometry;
|
|
370
|
+
i != null && i.coordinates && c(i.coordinates);
|
|
370
371
|
}
|
|
371
372
|
return n === 1 / 0 ? null : [
|
|
372
373
|
[n, r],
|
|
373
|
-
[
|
|
374
|
+
[a, o]
|
|
374
375
|
];
|
|
375
|
-
},
|
|
376
|
+
}, Ge = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Me = () => {
|
|
376
377
|
var e;
|
|
377
378
|
return typeof ((e = D) == null ? void 0 : e.supported) == "function" ? D.supported() : typeof WebGLRenderingContext < "u";
|
|
378
379
|
}, Ut = ({
|
|
379
380
|
records: e,
|
|
380
381
|
onUnmappable: n,
|
|
381
382
|
datasetKey: r,
|
|
382
|
-
focalTaxon:
|
|
383
|
+
focalTaxon: a,
|
|
383
384
|
rankOrder: o,
|
|
384
385
|
gbifChecklistKey: c,
|
|
385
386
|
// true | null → show GBIF layer; false → GBIF API returned 0 occurrences,
|
|
@@ -387,57 +388,57 @@ const se = [
|
|
|
387
388
|
// component works without the count check.
|
|
388
389
|
gbifAvailable: f = !0
|
|
389
390
|
}) => {
|
|
390
|
-
var
|
|
391
|
-
const u =
|
|
391
|
+
var we;
|
|
392
|
+
const u = M(null), i = M(null), p = M(null), L = M(/* @__PURE__ */ new Map()), S = M(/* @__PURE__ */ new Map()), k = M(/* @__PURE__ */ new Map()), C = M(!1), j = M(!1), E = M(/* @__PURE__ */ new Set()), [B, z] = w(!1), [I, N] = w(!1), [b, m] = w({
|
|
392
393
|
status: "idle",
|
|
393
394
|
// idle | loading | ready | empty | error
|
|
394
395
|
taxa: []
|
|
395
|
-
}), [
|
|
396
|
+
}), [O, K] = w(!0), me = !!c && (!e || e.length === 0), [F, T] = w(
|
|
396
397
|
() => Pt(!0)
|
|
397
|
-
), [
|
|
398
|
-
|
|
398
|
+
), [R, H] = w(/* @__PURE__ */ new Set()), [re, ye] = w(!1), ce = M(!1), Ke = () => {
|
|
399
|
+
T((t) => {
|
|
399
400
|
const d = !t;
|
|
400
|
-
return
|
|
401
|
+
return Ee(d), d;
|
|
401
402
|
});
|
|
402
|
-
},
|
|
403
|
-
|
|
404
|
-
},
|
|
403
|
+
}, be = () => {
|
|
404
|
+
T(!0), Ee(!0);
|
|
405
|
+
}, xe = se(() => {
|
|
405
406
|
if (!(e != null && e.length)) return [];
|
|
406
407
|
const t = /* @__PURE__ */ new Set();
|
|
407
408
|
return e.forEach((d) => {
|
|
408
409
|
const l = He(d);
|
|
409
410
|
l != null && t.add(l);
|
|
410
411
|
}), De.filter((d) => t.has(d.key));
|
|
411
|
-
}, [e]),
|
|
412
|
-
|
|
412
|
+
}, [e]), Y = se(() => b.status !== "ready" ? {} : It(
|
|
413
|
+
b.taxa.filter((t) => t.mappable.length > 0),
|
|
413
414
|
o || []
|
|
414
|
-
), [
|
|
415
|
-
if (
|
|
415
|
+
), [b, o]), le = se(() => {
|
|
416
|
+
if (b.status !== "ready")
|
|
416
417
|
return { visibleGroups: [], unmappableGroups: [] };
|
|
417
418
|
const t = (h) => ({
|
|
418
419
|
...h,
|
|
419
|
-
color:
|
|
420
|
+
color: Y[h.id],
|
|
420
421
|
displayName: We(h.scientificName)
|
|
421
422
|
}), d = (h) => {
|
|
422
423
|
const x = {};
|
|
423
|
-
return h.forEach((
|
|
424
|
-
(x[
|
|
425
|
-
}),
|
|
426
|
-
rank:
|
|
427
|
-
label:
|
|
428
|
-
taxa: x[
|
|
424
|
+
return h.forEach((y) => {
|
|
425
|
+
(x[y.rank] = x[y.rank] || []).push(t(y));
|
|
426
|
+
}), ae.filter((y) => x[y]).map((y) => ({
|
|
427
|
+
rank: y,
|
|
428
|
+
label: Fe(y),
|
|
429
|
+
taxa: x[y]
|
|
429
430
|
}));
|
|
430
431
|
}, l = d(
|
|
431
|
-
|
|
432
|
-
(h) => h.mappable.length > 0 &&
|
|
432
|
+
b.taxa.filter(
|
|
433
|
+
(h) => h.mappable.length > 0 && R.has(h.id)
|
|
433
434
|
)
|
|
434
435
|
), g = d(
|
|
435
|
-
|
|
436
|
+
b.taxa.filter((h) => h.mappable.length === 0)
|
|
436
437
|
);
|
|
437
438
|
return { visibleGroups: l, unmappableGroups: g };
|
|
438
|
-
}, [
|
|
439
|
-
|
|
440
|
-
if (!u.current ||
|
|
439
|
+
}, [b, Y, R]), ve = le.visibleGroups.length > 0;
|
|
440
|
+
$(() => {
|
|
441
|
+
if (!u.current || i.current || !Me()) return;
|
|
441
442
|
const t = new D.Map({
|
|
442
443
|
container: u.current,
|
|
443
444
|
style: At,
|
|
@@ -453,23 +454,23 @@ const se = [
|
|
|
453
454
|
), t.addControl(
|
|
454
455
|
new D.NavigationControl({ showCompass: !1 }),
|
|
455
456
|
"top-left"
|
|
456
|
-
),
|
|
457
|
-
|
|
457
|
+
), i.current = t, t.on("load", () => {
|
|
458
|
+
z(!0);
|
|
458
459
|
const l = t.getContainer().querySelector(".maplibregl-ctrl-attrib");
|
|
459
460
|
l && l.classList.remove("maplibregl-compact-show");
|
|
460
461
|
});
|
|
461
462
|
const d = typeof ResizeObserver < "u" ? new ResizeObserver(() => t.resize()) : null;
|
|
462
463
|
return d && d.observe(u.current), () => {
|
|
463
|
-
d && d.disconnect(), p.current && (p.current.remove(), p.current = null), t.remove(),
|
|
464
|
+
d && d.disconnect(), p.current && (p.current.remove(), p.current = null), t.remove(), i.current = null, C.current = !1, j.current = !1, E.current = /* @__PURE__ */ new Set();
|
|
464
465
|
};
|
|
465
|
-
}, []),
|
|
466
|
-
if (!
|
|
467
|
-
const t =
|
|
466
|
+
}, []), $(() => {
|
|
467
|
+
if (!B || !(e != null && e.length)) return;
|
|
468
|
+
const t = i.current;
|
|
468
469
|
if (!t) return;
|
|
469
470
|
let d = !1;
|
|
470
|
-
return
|
|
471
|
+
return N(!1), Promise.allSettled(
|
|
471
472
|
e.map(
|
|
472
|
-
(l) =>
|
|
473
|
+
(l) => Be(l.area.gazetteer, l.area.id).then((g) => ({
|
|
473
474
|
record: l,
|
|
474
475
|
geojson: g
|
|
475
476
|
}))
|
|
@@ -478,182 +479,182 @@ const se = [
|
|
|
478
479
|
if (d) return;
|
|
479
480
|
const g = [], h = /* @__PURE__ */ new Map();
|
|
480
481
|
let x = 0;
|
|
481
|
-
l.forEach((v,
|
|
482
|
+
l.forEach((v, G) => {
|
|
482
483
|
if (v.status !== "fulfilled" || !v.value.geojson) {
|
|
483
484
|
x += 1;
|
|
484
485
|
return;
|
|
485
486
|
}
|
|
486
|
-
const { record:
|
|
487
|
-
h.set(
|
|
487
|
+
const { record: V, geojson: U } = v.value, de = $t(V), q = `focal-${G}`;
|
|
488
|
+
h.set(q, V), Ge(U).forEach((Z) => {
|
|
488
489
|
g.push({
|
|
489
|
-
...
|
|
490
|
+
...Z,
|
|
490
491
|
properties: {
|
|
491
|
-
...
|
|
492
|
-
_recordKey:
|
|
493
|
-
_color:
|
|
492
|
+
...Z.properties || {},
|
|
493
|
+
_recordKey: q,
|
|
494
|
+
_color: de
|
|
494
495
|
}
|
|
495
496
|
});
|
|
496
497
|
});
|
|
497
|
-
}),
|
|
498
|
-
const
|
|
499
|
-
if (t.getSource(
|
|
500
|
-
t.getSource(
|
|
498
|
+
}), L.current = h;
|
|
499
|
+
const y = { type: "FeatureCollection", features: g };
|
|
500
|
+
if (t.getSource(J))
|
|
501
|
+
t.getSource(J).setData(y);
|
|
501
502
|
else {
|
|
502
|
-
const v = t.getLayer(
|
|
503
|
-
t.addSource(
|
|
503
|
+
const v = t.getLayer(_) ? _ : void 0;
|
|
504
|
+
t.addSource(J, { type: "geojson", data: y }), t.addLayer(
|
|
504
505
|
{
|
|
505
|
-
id:
|
|
506
|
+
id: W,
|
|
506
507
|
type: "fill",
|
|
507
|
-
source:
|
|
508
|
+
source: J,
|
|
508
509
|
paint: {
|
|
509
|
-
"fill-color": ["coalesce", ["get", "_color"],
|
|
510
|
+
"fill-color": ["coalesce", ["get", "_color"], ie],
|
|
510
511
|
"fill-opacity": 0.65
|
|
511
512
|
}
|
|
512
513
|
},
|
|
513
514
|
v
|
|
514
515
|
), t.addLayer(
|
|
515
516
|
{
|
|
516
|
-
id:
|
|
517
|
+
id: pe,
|
|
517
518
|
type: "line",
|
|
518
|
-
source:
|
|
519
|
+
source: J,
|
|
519
520
|
paint: {
|
|
520
|
-
"line-color": ["coalesce", ["get", "_color"],
|
|
521
|
+
"line-color": ["coalesce", ["get", "_color"], ie],
|
|
521
522
|
"line-width": 1
|
|
522
523
|
}
|
|
523
524
|
},
|
|
524
525
|
v
|
|
525
|
-
), t.on("click",
|
|
526
|
+
), t.on("click", W, Te), t.on("mouseenter", W, Se), t.on("mouseleave", W, je), C.current = !0;
|
|
526
527
|
}
|
|
527
528
|
if (g.length > 0) {
|
|
528
529
|
const v = Vt(g);
|
|
529
530
|
v && t.fitBounds(v, { padding: 20, animate: !1 });
|
|
530
531
|
}
|
|
531
|
-
typeof n == "function" && n(x),
|
|
532
|
+
typeof n == "function" && n(x), N(!0);
|
|
532
533
|
}), () => {
|
|
533
534
|
d = !0;
|
|
534
535
|
};
|
|
535
|
-
}, [
|
|
536
|
-
const
|
|
537
|
-
var x,
|
|
538
|
-
const d =
|
|
536
|
+
}, [B, e]);
|
|
537
|
+
const Te = (t) => {
|
|
538
|
+
var x, y;
|
|
539
|
+
const d = i.current;
|
|
539
540
|
if (!d) return;
|
|
540
|
-
const l = (x = t.features) == null ? void 0 : x[0], g = (
|
|
541
|
+
const l = (x = t.features) == null ? void 0 : x[0], g = (y = l == null ? void 0 : l.properties) == null ? void 0 : y._recordKey, h = g ? L.current.get(g) : null;
|
|
541
542
|
h && (p.current && p.current.remove(), p.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(Ue(h)).addTo(d));
|
|
542
|
-
},
|
|
543
|
-
const t =
|
|
543
|
+
}, Se = () => {
|
|
544
|
+
const t = i.current;
|
|
544
545
|
t && (t.getCanvas().style.cursor = "pointer");
|
|
545
546
|
}, je = () => {
|
|
546
|
-
const t =
|
|
547
|
+
const t = i.current;
|
|
547
548
|
t && (t.getCanvas().style.cursor = "");
|
|
548
549
|
};
|
|
549
|
-
|
|
550
|
-
const t =
|
|
550
|
+
$(() => {
|
|
551
|
+
const t = i.current;
|
|
551
552
|
if (!t || !C.current) return;
|
|
552
|
-
const d =
|
|
553
|
-
t.getLayer(
|
|
554
|
-
}, [
|
|
555
|
-
if (!
|
|
556
|
-
const t =
|
|
553
|
+
const d = O ? "visible" : "none";
|
|
554
|
+
t.getLayer(W) && t.setLayoutProperty(W, "visibility", d), t.getLayer(pe) && t.setLayoutProperty(pe, "visibility", d);
|
|
555
|
+
}, [O, I]), $(() => {
|
|
556
|
+
if (!B) return;
|
|
557
|
+
const t = i.current;
|
|
557
558
|
if (!t || ((() => {
|
|
558
|
-
t.getLayer(
|
|
559
|
-
})(), !c || !(
|
|
560
|
-
const l = (
|
|
561
|
-
t.addSource(
|
|
559
|
+
t.getLayer(_) && t.removeLayer(_), t.getSource(oe) && t.removeSource(oe), j.current = !1;
|
|
560
|
+
})(), !c || !(a != null && a.id)) || f === !1) return;
|
|
561
|
+
const l = (P.gbifApi + Ot).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(a.id)), g = P.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(a.id);
|
|
562
|
+
t.addSource(oe, {
|
|
562
563
|
type: "raster",
|
|
563
564
|
tiles: [l],
|
|
564
565
|
tileSize: 256,
|
|
565
566
|
attribution: '<a href="' + g + '" target="_blank" rel="noopener">GBIF</a> occurrence data'
|
|
566
567
|
}), t.addLayer({
|
|
567
|
-
id:
|
|
568
|
+
id: _,
|
|
568
569
|
type: "raster",
|
|
569
|
-
source:
|
|
570
|
+
source: oe,
|
|
570
571
|
paint: { "raster-opacity": 0.9 },
|
|
571
|
-
layout: { visibility:
|
|
572
|
-
}),
|
|
573
|
-
}, [
|
|
574
|
-
const t =
|
|
575
|
-
if (!t || !
|
|
576
|
-
const d =
|
|
577
|
-
t.getLayer(
|
|
578
|
-
}, [
|
|
579
|
-
if (!
|
|
580
|
-
const t =
|
|
581
|
-
if (!t || (
|
|
582
|
-
t.getLayer(
|
|
583
|
-
}),
|
|
584
|
-
const d =
|
|
585
|
-
|
|
586
|
-
l.mappable.length !== 0 && (
|
|
572
|
+
layout: { visibility: F ? "visible" : "none" }
|
|
573
|
+
}), j.current = !0;
|
|
574
|
+
}, [B, c, a == null ? void 0 : a.id, f]), $(() => {
|
|
575
|
+
const t = i.current;
|
|
576
|
+
if (!t || !j.current) return;
|
|
577
|
+
const d = F ? "visible" : "none";
|
|
578
|
+
t.getLayer(_) && t.setLayoutProperty(_, "visibility", d);
|
|
579
|
+
}, [F]), $(() => {
|
|
580
|
+
if (!B) return;
|
|
581
|
+
const t = i.current;
|
|
582
|
+
if (!t || (E.current.forEach((l) => {
|
|
583
|
+
t.getLayer(Q(l)) && t.removeLayer(Q(l)), t.getLayer(ee(l)) && t.removeLayer(ee(l)), t.getSource(fe(l)) && t.removeSource(fe(l));
|
|
584
|
+
}), E.current = /* @__PURE__ */ new Set(), S.current = /* @__PURE__ */ new Map(), k.current = /* @__PURE__ */ new Map(), b.status !== "ready")) return;
|
|
585
|
+
const d = Y;
|
|
586
|
+
b.taxa.forEach((l) => {
|
|
587
|
+
l.mappable.length !== 0 && (S.current.set(l.id, l), Promise.allSettled(
|
|
587
588
|
l.mappable.map(
|
|
588
|
-
(g) =>
|
|
589
|
+
(g) => Be(g.area.gazetteer, g.area.id).then((h) => ({
|
|
589
590
|
record: g,
|
|
590
591
|
geojson: h
|
|
591
592
|
}))
|
|
592
593
|
)
|
|
593
594
|
).then((g) => {
|
|
594
|
-
if (!
|
|
595
|
+
if (!i.current) return;
|
|
595
596
|
const h = [];
|
|
596
|
-
g.forEach((
|
|
597
|
-
if (
|
|
598
|
-
const { record:
|
|
599
|
-
k.current.set(
|
|
597
|
+
g.forEach((G, V) => {
|
|
598
|
+
if (G.status !== "fulfilled" || !G.value.geojson) return;
|
|
599
|
+
const { record: U, geojson: de } = G.value, q = `desc-${l.id}-${V}`;
|
|
600
|
+
k.current.set(q, { taxon: l, record: U }), Ge(de).forEach((Z) => {
|
|
600
601
|
h.push({
|
|
601
|
-
...
|
|
602
|
+
...Z,
|
|
602
603
|
properties: {
|
|
603
|
-
...
|
|
604
|
-
_recordKey:
|
|
604
|
+
...Z.properties || {},
|
|
605
|
+
_recordKey: q
|
|
605
606
|
}
|
|
606
607
|
});
|
|
607
608
|
});
|
|
608
609
|
});
|
|
609
|
-
const x = d[l.id] ||
|
|
610
|
-
if (
|
|
611
|
-
|
|
610
|
+
const x = d[l.id] || ie, y = { type: "FeatureCollection", features: h }, v = fe(l.id);
|
|
611
|
+
if (i.current.getSource(v))
|
|
612
|
+
i.current.getSource(v).setData(y);
|
|
612
613
|
else {
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
|
|
614
|
+
i.current.addSource(v, { type: "geojson", data: y });
|
|
615
|
+
const G = Q(l.id), V = ee(l.id), U = i.current.getLayer(_) ? _ : void 0;
|
|
616
|
+
i.current.addLayer(
|
|
616
617
|
{
|
|
617
|
-
id:
|
|
618
|
+
id: G,
|
|
618
619
|
type: "fill",
|
|
619
620
|
source: v,
|
|
620
621
|
paint: { "fill-color": x, "fill-opacity": 0.55 },
|
|
621
622
|
layout: { visibility: "none" }
|
|
622
623
|
},
|
|
623
|
-
|
|
624
|
-
),
|
|
624
|
+
U
|
|
625
|
+
), i.current.addLayer(
|
|
625
626
|
{
|
|
626
|
-
id:
|
|
627
|
+
id: V,
|
|
627
628
|
type: "line",
|
|
628
629
|
source: v,
|
|
629
630
|
paint: { "line-color": x, "line-width": 2 },
|
|
630
631
|
layout: { visibility: "none" }
|
|
631
632
|
},
|
|
632
|
-
|
|
633
|
-
),
|
|
633
|
+
U
|
|
634
|
+
), i.current.on("click", G, Ye), i.current.on("mouseenter", G, Se), i.current.on("mouseleave", G, je), E.current.add(l.id);
|
|
634
635
|
}
|
|
635
636
|
}));
|
|
636
637
|
});
|
|
637
|
-
}, [
|
|
638
|
-
const
|
|
639
|
-
var x,
|
|
640
|
-
const d =
|
|
638
|
+
}, [B, b, Y]);
|
|
639
|
+
const Ye = (t) => {
|
|
640
|
+
var x, y;
|
|
641
|
+
const d = i.current;
|
|
641
642
|
if (!d) return;
|
|
642
|
-
const l = (x = t.features) == null ? void 0 : x[0], g = (
|
|
643
|
+
const l = (x = t.features) == null ? void 0 : x[0], g = (y = l == null ? void 0 : l.properties) == null ? void 0 : y._recordKey, h = g ? k.current.get(g) : null;
|
|
643
644
|
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));
|
|
644
645
|
};
|
|
645
|
-
|
|
646
|
-
const t =
|
|
647
|
-
t &&
|
|
648
|
-
const l =
|
|
649
|
-
t.getLayer(
|
|
646
|
+
$(() => {
|
|
647
|
+
const t = i.current;
|
|
648
|
+
t && E.current.forEach((d) => {
|
|
649
|
+
const l = R.has(d) ? "visible" : "none";
|
|
650
|
+
t.getLayer(Q(d)) && t.setLayoutProperty(Q(d), "visibility", l), t.getLayer(ee(d)) && t.setLayoutProperty(ee(d), "visibility", l);
|
|
650
651
|
});
|
|
651
|
-
}, [
|
|
652
|
-
const
|
|
652
|
+
}, [R, b]);
|
|
653
|
+
const Ie = () => {
|
|
653
654
|
var l;
|
|
654
|
-
if (
|
|
655
|
-
const t = (l =
|
|
656
|
-
!t || t !== "species" && !
|
|
655
|
+
if (ce.current || !r || !a || !o) return;
|
|
656
|
+
const t = (l = a == null ? void 0 : a.name) == null ? void 0 : l.rank;
|
|
657
|
+
!t || t !== "species" && !ae.includes(t) || $e(t, o).length === 0 || (ce.current = !0, m({ status: "loading", taxa: [] }), jt({ datasetKey: r, focalTaxon: a, rankOrder: o }).then(
|
|
657
658
|
({ taxa: g, descendantsFailed: h }) => {
|
|
658
659
|
if (h) {
|
|
659
660
|
m({ status: "error", taxa: [] });
|
|
@@ -666,34 +667,34 @@ const se = [
|
|
|
666
667
|
m({ status: "ready", taxa: g });
|
|
667
668
|
}
|
|
668
669
|
));
|
|
669
|
-
},
|
|
670
|
-
|
|
671
|
-
},
|
|
672
|
-
if (
|
|
670
|
+
}, qe = () => {
|
|
671
|
+
ye(!0), Ie();
|
|
672
|
+
}, Ze = se(() => {
|
|
673
|
+
if (b.status !== "ready") return [];
|
|
673
674
|
const t = {};
|
|
674
|
-
return
|
|
675
|
+
return b.taxa.filter((d) => d.mappable.length > 0).forEach((d) => {
|
|
675
676
|
(t[d.rank] = t[d.rank] || []).push(d);
|
|
676
|
-
}),
|
|
677
|
+
}), ae.filter((d) => t[d]).map((d) => ({
|
|
677
678
|
rank: d,
|
|
678
|
-
label:
|
|
679
|
+
label: Fe(d),
|
|
679
680
|
taxa: t[d].slice().sort(
|
|
680
681
|
(l, g) => l.scientificName.localeCompare(g.scientificName)
|
|
681
682
|
)
|
|
682
683
|
}));
|
|
683
|
-
}, [
|
|
684
|
-
|
|
684
|
+
}, [b]), Xe = (t) => {
|
|
685
|
+
H((d) => {
|
|
685
686
|
const l = new Set(d);
|
|
686
687
|
return l.has(t) ? l.delete(t) : l.add(t), l;
|
|
687
688
|
});
|
|
688
|
-
},
|
|
689
|
-
|
|
689
|
+
}, Je = (t) => {
|
|
690
|
+
H((d) => {
|
|
690
691
|
const l = new Set(d), g = t.every((h) => d.has(h.id));
|
|
691
692
|
return t.forEach((h) => {
|
|
692
693
|
g ? l.delete(h.id) : l.add(h.id);
|
|
693
694
|
}), l;
|
|
694
695
|
});
|
|
695
696
|
};
|
|
696
|
-
if (!
|
|
697
|
+
if (!Me())
|
|
697
698
|
return /* @__PURE__ */ s.jsx(
|
|
698
699
|
"div",
|
|
699
700
|
{
|
|
@@ -708,7 +709,7 @@ const se = [
|
|
|
708
709
|
children: "Maps require WebGL, which your browser doesn't support."
|
|
709
710
|
}
|
|
710
711
|
);
|
|
711
|
-
if (
|
|
712
|
+
if (me && !F)
|
|
712
713
|
return /* @__PURE__ */ s.jsxs(
|
|
713
714
|
"div",
|
|
714
715
|
{
|
|
@@ -732,9 +733,9 @@ const se = [
|
|
|
732
733
|
role: "button",
|
|
733
734
|
tabIndex: 0,
|
|
734
735
|
style: { cursor: "pointer" },
|
|
735
|
-
onClick:
|
|
736
|
+
onClick: be,
|
|
736
737
|
onKeyDown: (t) => {
|
|
737
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
738
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), be());
|
|
738
739
|
},
|
|
739
740
|
children: "Show GBIF occurrences"
|
|
740
741
|
}
|
|
@@ -742,7 +743,7 @@ const se = [
|
|
|
742
743
|
]
|
|
743
744
|
}
|
|
744
745
|
);
|
|
745
|
-
const
|
|
746
|
+
const Qe = ((we = a == null ? void 0 : a.name) == null ? void 0 : we.scientificName) || "This taxon";
|
|
746
747
|
return /* @__PURE__ */ s.jsxs("div", { className: "col-distributions-map", style: { position: "relative" }, children: [
|
|
747
748
|
/* @__PURE__ */ s.jsx(
|
|
748
749
|
"div",
|
|
@@ -754,29 +755,29 @@ const se = [
|
|
|
754
755
|
/* @__PURE__ */ s.jsx(
|
|
755
756
|
Wt,
|
|
756
757
|
{
|
|
757
|
-
open:
|
|
758
|
-
onOpen:
|
|
759
|
-
onClose: () =>
|
|
760
|
-
focalName:
|
|
761
|
-
focalReady:
|
|
762
|
-
focalVisible:
|
|
763
|
-
onToggleFocal: () =>
|
|
758
|
+
open: re,
|
|
759
|
+
onOpen: qe,
|
|
760
|
+
onClose: () => ye(!1),
|
|
761
|
+
focalName: Qe,
|
|
762
|
+
focalReady: I,
|
|
763
|
+
focalVisible: O,
|
|
764
|
+
onToggleFocal: () => K((t) => !t),
|
|
764
765
|
gbifEnabled: !!c,
|
|
765
|
-
gbifVisible:
|
|
766
|
+
gbifVisible: F,
|
|
766
767
|
gbifAvailable: f,
|
|
767
|
-
onToggleGbif:
|
|
768
|
-
descendantStatus:
|
|
769
|
-
descendantsByRank:
|
|
770
|
-
descendantColors:
|
|
771
|
-
visibleTaxonIds:
|
|
772
|
-
onToggleTaxon:
|
|
773
|
-
onToggleRankGroup:
|
|
768
|
+
onToggleGbif: Ke,
|
|
769
|
+
descendantStatus: b.status,
|
|
770
|
+
descendantsByRank: Ze,
|
|
771
|
+
descendantColors: Y,
|
|
772
|
+
visibleTaxonIds: R,
|
|
773
|
+
onToggleTaxon: Xe,
|
|
774
|
+
onToggleRankGroup: Je,
|
|
774
775
|
onRetry: () => {
|
|
775
|
-
|
|
776
|
+
ce.current = !1, m({ status: "idle", taxa: [] }), Ie();
|
|
776
777
|
}
|
|
777
778
|
}
|
|
778
779
|
),
|
|
779
|
-
!
|
|
780
|
+
!ve && (xe.length > 0 || c && f !== !1 && F) && /* @__PURE__ */ s.jsxs(
|
|
780
781
|
"div",
|
|
781
782
|
{
|
|
782
783
|
style: {
|
|
@@ -792,7 +793,7 @@ const se = [
|
|
|
792
793
|
lineHeight: 1.5
|
|
793
794
|
},
|
|
794
795
|
children: [
|
|
795
|
-
|
|
796
|
+
xe.map((t) => /* @__PURE__ */ s.jsxs(
|
|
796
797
|
"div",
|
|
797
798
|
{
|
|
798
799
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
@@ -815,16 +816,16 @@ const se = [
|
|
|
815
816
|
},
|
|
816
817
|
t.key
|
|
817
818
|
)),
|
|
818
|
-
c && f !== !1 &&
|
|
819
|
+
c && f !== !1 && F && /* @__PURE__ */ s.jsx(Ht, {})
|
|
819
820
|
]
|
|
820
821
|
}
|
|
821
822
|
),
|
|
822
|
-
|
|
823
|
+
ve && /* @__PURE__ */ s.jsx(
|
|
823
824
|
Mt,
|
|
824
825
|
{
|
|
825
|
-
visibleGroups:
|
|
826
|
-
unmappableGroups:
|
|
827
|
-
showGbif: !!c && f !== !1 &&
|
|
826
|
+
visibleGroups: le.visibleGroups,
|
|
827
|
+
unmappableGroups: le.unmappableGroups,
|
|
828
|
+
showGbif: !!c && f !== !1 && F
|
|
828
829
|
}
|
|
829
830
|
)
|
|
830
831
|
] });
|
|
@@ -832,21 +833,21 @@ const se = [
|
|
|
832
833
|
open: e,
|
|
833
834
|
onOpen: n,
|
|
834
835
|
onClose: r,
|
|
835
|
-
focalName:
|
|
836
|
+
focalName: a,
|
|
836
837
|
focalReady: o,
|
|
837
838
|
focalVisible: c,
|
|
838
839
|
onToggleFocal: f,
|
|
839
840
|
gbifEnabled: u,
|
|
840
|
-
gbifVisible:
|
|
841
|
+
gbifVisible: i,
|
|
841
842
|
gbifAvailable: p,
|
|
842
|
-
onToggleGbif:
|
|
843
|
-
descendantStatus:
|
|
843
|
+
onToggleGbif: L,
|
|
844
|
+
descendantStatus: S,
|
|
844
845
|
descendantsByRank: k,
|
|
845
846
|
descendantColors: C,
|
|
846
|
-
visibleTaxonIds:
|
|
847
|
-
onToggleTaxon:
|
|
848
|
-
onToggleRankGroup:
|
|
849
|
-
onRetry:
|
|
847
|
+
visibleTaxonIds: j,
|
|
848
|
+
onToggleTaxon: E,
|
|
849
|
+
onToggleRankGroup: B,
|
|
850
|
+
onRetry: z
|
|
850
851
|
}) => e ? /* @__PURE__ */ s.jsxs(
|
|
851
852
|
"div",
|
|
852
853
|
{
|
|
@@ -877,7 +878,7 @@ const se = [
|
|
|
877
878
|
onChange: f
|
|
878
879
|
}
|
|
879
880
|
),
|
|
880
|
-
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children:
|
|
881
|
+
/* @__PURE__ */ s.jsx("span", { style: { fontStyle: "italic" }, children: a })
|
|
881
882
|
] }),
|
|
882
883
|
u && /* @__PURE__ */ s.jsxs(
|
|
883
884
|
"div",
|
|
@@ -894,23 +895,23 @@ const se = [
|
|
|
894
895
|
"input",
|
|
895
896
|
{
|
|
896
897
|
type: "checkbox",
|
|
897
|
-
checked: p === !1 ? !1 :
|
|
898
|
+
checked: p === !1 ? !1 : i,
|
|
898
899
|
disabled: p === !1,
|
|
899
|
-
onChange:
|
|
900
|
+
onChange: L
|
|
900
901
|
}
|
|
901
902
|
),
|
|
902
903
|
/* @__PURE__ */ s.jsx("span", { children: "GBIF occurrences" })
|
|
903
904
|
]
|
|
904
905
|
}
|
|
905
906
|
),
|
|
906
|
-
|
|
907
|
-
|
|
907
|
+
S === "loading" && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
|
|
908
|
+
S === "error" && /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
|
|
908
909
|
"Couldn't load descendants.",
|
|
909
910
|
" ",
|
|
910
|
-
/* @__PURE__ */ s.jsx("a", { onClick:
|
|
911
|
+
/* @__PURE__ */ s.jsx("a", { onClick: z, style: { cursor: "pointer" }, children: "Retry" })
|
|
911
912
|
] }),
|
|
912
|
-
|
|
913
|
-
const
|
|
913
|
+
S === "ready" && k.map((I) => {
|
|
914
|
+
const N = I.taxa.every((m) => j.has(m.id)), b = I.taxa.some((m) => j.has(m.id));
|
|
914
915
|
return /* @__PURE__ */ s.jsxs("div", { style: { marginTop: 6 }, children: [
|
|
915
916
|
/* @__PURE__ */ s.jsxs(
|
|
916
917
|
"label",
|
|
@@ -926,18 +927,18 @@ const se = [
|
|
|
926
927
|
"input",
|
|
927
928
|
{
|
|
928
929
|
type: "checkbox",
|
|
929
|
-
checked:
|
|
930
|
+
checked: N,
|
|
930
931
|
ref: (m) => {
|
|
931
|
-
m && (m.indeterminate = !
|
|
932
|
+
m && (m.indeterminate = !N && b);
|
|
932
933
|
},
|
|
933
|
-
onChange: () => I
|
|
934
|
+
onChange: () => B(I.taxa)
|
|
934
935
|
}
|
|
935
936
|
),
|
|
936
|
-
|
|
937
|
+
I.label
|
|
937
938
|
]
|
|
938
939
|
}
|
|
939
940
|
),
|
|
940
|
-
/* @__PURE__ */ s.jsx("div", { style: { paddingLeft: 18 }, children:
|
|
941
|
+
/* @__PURE__ */ s.jsx("div", { style: { paddingLeft: 18 }, children: I.taxa.map((m) => /* @__PURE__ */ s.jsxs(
|
|
941
942
|
"label",
|
|
942
943
|
{
|
|
943
944
|
style: {
|
|
@@ -950,8 +951,8 @@ const se = [
|
|
|
950
951
|
"input",
|
|
951
952
|
{
|
|
952
953
|
type: "checkbox",
|
|
953
|
-
checked:
|
|
954
|
-
onChange: () =>
|
|
954
|
+
checked: j.has(m.id),
|
|
955
|
+
onChange: () => E(m.id)
|
|
955
956
|
}
|
|
956
957
|
),
|
|
957
958
|
/* @__PURE__ */ s.jsx(
|
|
@@ -972,7 +973,7 @@ const se = [
|
|
|
972
973
|
},
|
|
973
974
|
m.id
|
|
974
975
|
)) })
|
|
975
|
-
] },
|
|
976
|
+
] }, I.rank);
|
|
976
977
|
})
|
|
977
978
|
]
|
|
978
979
|
}
|
|
@@ -1004,21 +1005,21 @@ const se = [
|
|
|
1004
1005
|
), Kt = (e) => {
|
|
1005
1006
|
var n, r;
|
|
1006
1007
|
return ((n = e == null ? void 0 : e.area) == null ? void 0 : n.gazetteer) !== "text" && !!((r = e == null ? void 0 : e.area) != null && r.globalId);
|
|
1007
|
-
},
|
|
1008
|
-
const [r,
|
|
1009
|
-
return
|
|
1008
|
+
}, Tt = ({ datasetKey: e, data: n }) => {
|
|
1009
|
+
const [r, a] = w({});
|
|
1010
|
+
return $(() => {
|
|
1010
1011
|
let o = !1;
|
|
1011
1012
|
for (let c = 0; c < n.length; c++)
|
|
1012
1013
|
if (n[c].gazetteer === "iso") {
|
|
1013
1014
|
o = !0;
|
|
1014
1015
|
break;
|
|
1015
1016
|
}
|
|
1016
|
-
o &&
|
|
1017
|
-
|
|
1017
|
+
o && ne(`${P.dataApi}vocab/country`).then((c) => {
|
|
1018
|
+
a(ot(c.data, "alpha3"));
|
|
1018
1019
|
});
|
|
1019
1020
|
}, []), /* @__PURE__ */ s.jsx("div", { children: n.map((o, c) => /* @__PURE__ */ s.jsxs("span", { children: [
|
|
1020
1021
|
(o == null ? void 0 : o.merged) && /* @__PURE__ */ s.jsx(
|
|
1021
|
-
|
|
1022
|
+
dt,
|
|
1022
1023
|
{
|
|
1023
1024
|
createdBy: o == null ? void 0 : o.createdBy,
|
|
1024
1025
|
datasetKey: o.datasetKey,
|
|
@@ -1027,7 +1028,7 @@ const se = [
|
|
|
1027
1028
|
style: { marginRight: "4px" }
|
|
1028
1029
|
}
|
|
1029
1030
|
),
|
|
1030
|
-
(
|
|
1031
|
+
(A(r, `[${A(o, "area.name")}].name`) ? at(A(r, `[${A(o, "area.name")}].name`)) : null) || A(o, "area.name") || A(o, "area.globalId"),
|
|
1031
1032
|
" ",
|
|
1032
1033
|
o.referenceId && /* @__PURE__ */ s.jsx(
|
|
1033
1034
|
mt,
|
|
@@ -1039,24 +1040,26 @@ const se = [
|
|
|
1039
1040
|
),
|
|
1040
1041
|
c < n.length - 1 && ", "
|
|
1041
1042
|
] }, c)) });
|
|
1042
|
-
},
|
|
1043
|
+
}, ln = ({
|
|
1043
1044
|
datasetKey: e,
|
|
1044
1045
|
data: n,
|
|
1045
1046
|
style: r,
|
|
1046
|
-
showDistributionMap:
|
|
1047
|
+
showDistributionMap: a,
|
|
1047
1048
|
focalTaxon: o,
|
|
1048
1049
|
rankOrder: c,
|
|
1049
|
-
gbifChecklistKey: f
|
|
1050
|
+
gbifChecklistKey: f,
|
|
1051
|
+
label: u,
|
|
1052
|
+
md: i
|
|
1050
1053
|
}) => {
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1054
|
+
const p = n.filter(Kt), L = n.length - p.length, S = !!f, k = n.length > 0, [C, j] = w("map"), [E, B] = w(0), [z, I] = w(null);
|
|
1055
|
+
$(() => {
|
|
1053
1056
|
if (!f || !(o != null && o.id)) {
|
|
1054
1057
|
I(null);
|
|
1055
1058
|
return;
|
|
1056
1059
|
}
|
|
1057
1060
|
I(null);
|
|
1058
|
-
let
|
|
1059
|
-
return
|
|
1061
|
+
let R = !1;
|
|
1062
|
+
return it.get(`${P.gbifApi}/v1/occurrence/search`, {
|
|
1060
1063
|
params: {
|
|
1061
1064
|
checklistKey: f,
|
|
1062
1065
|
taxonKey: o.id,
|
|
@@ -1066,34 +1069,30 @@ const se = [
|
|
|
1066
1069
|
limit: 0
|
|
1067
1070
|
}
|
|
1068
1071
|
}).then(
|
|
1069
|
-
(
|
|
1070
|
-
var
|
|
1071
|
-
|
|
1072
|
+
(H) => {
|
|
1073
|
+
var re;
|
|
1074
|
+
R || I(((re = H == null ? void 0 : H.data) == null ? void 0 : re.count) ?? 0);
|
|
1072
1075
|
},
|
|
1073
1076
|
() => {
|
|
1074
|
-
|
|
1077
|
+
R || I(null);
|
|
1075
1078
|
}
|
|
1076
1079
|
), () => {
|
|
1077
|
-
|
|
1080
|
+
R = !0;
|
|
1078
1081
|
};
|
|
1079
1082
|
}, [f, o == null ? void 0 : o.id]);
|
|
1080
|
-
const
|
|
1081
|
-
if (!
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
const y = a + C, m = w, z = m ? j : "map";
|
|
1086
|
-
return /* @__PURE__ */ s.jsxs("div", { style: r, children: [
|
|
1087
|
-
m ? /* @__PURE__ */ s.jsxs(
|
|
1088
|
-
le.Group,
|
|
1083
|
+
const N = S ? z === null || z > 0 : !1, b = p.length > 0 && E >= p.length, m = a && (p.length > 0 || N) && !(p.length > 0 && b && !N);
|
|
1084
|
+
if (!m && !k) return null;
|
|
1085
|
+
const O = L + E, K = k, F = (m && K ? C : m ? "map" : "list") === "map" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
1086
|
+
K ? /* @__PURE__ */ s.jsxs(
|
|
1087
|
+
ue.Group,
|
|
1089
1088
|
{
|
|
1090
1089
|
size: "small",
|
|
1091
|
-
value:
|
|
1092
|
-
onChange: (
|
|
1090
|
+
value: C,
|
|
1091
|
+
onChange: (R) => j(R.target.value),
|
|
1093
1092
|
style: { marginBottom: 8 },
|
|
1094
1093
|
children: [
|
|
1095
|
-
/* @__PURE__ */ s.jsx(
|
|
1096
|
-
/* @__PURE__ */ s.jsx(
|
|
1094
|
+
/* @__PURE__ */ s.jsx(ue.Button, { value: "map", children: "Map" }),
|
|
1095
|
+
/* @__PURE__ */ s.jsx(ue.Button, { value: "list", children: "List" })
|
|
1097
1096
|
]
|
|
1098
1097
|
}
|
|
1099
1098
|
) : (
|
|
@@ -1101,31 +1100,33 @@ const se = [
|
|
|
1101
1100
|
// map's top edge lines up with the "Distributions" label.
|
|
1102
1101
|
/* @__PURE__ */ s.jsx("div", { style: { height: 24, marginBottom: 8 } })
|
|
1103
1102
|
),
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1103
|
+
/* @__PURE__ */ s.jsx(
|
|
1104
|
+
Ut,
|
|
1105
|
+
{
|
|
1106
|
+
records: p,
|
|
1107
|
+
onUnmappable: B,
|
|
1108
|
+
datasetKey: e,
|
|
1109
|
+
focalTaxon: o,
|
|
1110
|
+
rankOrder: c,
|
|
1111
|
+
gbifChecklistKey: f,
|
|
1112
|
+
gbifAvailable: N
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
K && O > 0 && /* @__PURE__ */ s.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ s.jsxs("a", { onClick: () => j("list"), style: { cursor: "pointer" }, children: [
|
|
1116
|
+
"+",
|
|
1117
|
+
O,
|
|
1118
|
+
" distribution",
|
|
1119
|
+
O === 1 ? "" : "s",
|
|
1120
|
+
" not on map"
|
|
1121
|
+
] }) })
|
|
1122
|
+
] }) : (
|
|
1123
|
+
// List view: either the user toggled to it, or there is no map to show.
|
|
1124
|
+
/* @__PURE__ */ s.jsx(Tt, { datasetKey: e, data: n })
|
|
1125
|
+
), T = /* @__PURE__ */ s.jsx("div", { style: r, children: F });
|
|
1126
|
+
return u ? /* @__PURE__ */ s.jsx(ut, { md: i, label: u, children: T }) : T;
|
|
1126
1127
|
};
|
|
1127
1128
|
export {
|
|
1128
|
-
|
|
1129
|
+
ln as D,
|
|
1129
1130
|
mt as R
|
|
1130
1131
|
};
|
|
1131
|
-
//# sourceMappingURL=Distributions-
|
|
1132
|
+
//# sourceMappingURL=Distributions-Cwl_75VG.js.map
|