col-browser 2.3.3 → 2.3.4
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-BzwnK_GR.js → Distributions-D_4NAlfr.js} +336 -330
- package/es/chunks/Distributions-D_4NAlfr.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 +18 -10
- 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-BzwnK_GR.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var nt = Object.defineProperty;
|
|
2
|
-
var rt = (e,
|
|
3
|
-
var X = (e,
|
|
4
|
-
import { j as
|
|
2
|
+
var rt = (e, r, s) => r in e ? nt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[r] = s;
|
|
3
|
+
var X = (e, r, s) => rt(e, typeof r != "symbol" ? r + "" : r, s);
|
|
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 it, Radio as ue } from "antd";
|
|
8
|
+
import { isArray as Le, get as O, keyBy as at, 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";
|
|
@@ -18,16 +18,16 @@ import { r as ht, w as gt } from "./storage-BgdCo9fV.js";
|
|
|
18
18
|
var mt = { 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" };
|
|
19
19
|
function ge() {
|
|
20
20
|
return ge = Object.assign ? Object.assign.bind() : function(e) {
|
|
21
|
-
for (var
|
|
22
|
-
var s = arguments[
|
|
23
|
-
for (var
|
|
24
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
21
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
22
|
+
var s = arguments[r];
|
|
23
|
+
for (var i in s)
|
|
24
|
+
Object.prototype.hasOwnProperty.call(s, i) && (e[i] = s[i]);
|
|
25
25
|
}
|
|
26
26
|
return e;
|
|
27
27
|
}, ge.apply(this, arguments);
|
|
28
28
|
}
|
|
29
|
-
const yt = (e,
|
|
30
|
-
ref:
|
|
29
|
+
const yt = (e, r) => /* @__PURE__ */ _e.createElement(ut, ge({}, e, {
|
|
30
|
+
ref: r,
|
|
31
31
|
icon: mt
|
|
32
32
|
})), $e = /* @__PURE__ */ _e.forwardRef(yt);
|
|
33
33
|
process.env.NODE_ENV !== "production" && ($e.displayName = "BookOutlined");
|
|
@@ -35,46 +35,52 @@ 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: i, references: o } = this.props;
|
|
39
39
|
if (s) {
|
|
40
|
-
const
|
|
40
|
+
const c = Le(s) ? s : [s], p = [];
|
|
41
41
|
this.setState({ loading: !0 }), Promise.allSettled(
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
`${z.dataApi}dataset/${
|
|
45
|
-
).then((u) =>
|
|
42
|
+
c.map(
|
|
43
|
+
(f) => O(o, f) ? Promise.resolve(p.push(o[f])) : ne(
|
|
44
|
+
`${z.dataApi}dataset/${i}/reference/${f}`
|
|
45
|
+
).then((u) => p.push(u.data)).catch((u) => this.setState({ error: u }))
|
|
46
46
|
)
|
|
47
|
-
).then(() => this.setState({ reference:
|
|
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__ */
|
|
51
|
+
const { error: s, reference: i, loading: o } = this.state;
|
|
52
|
+
return o ? /* @__PURE__ */ n.jsx(ot, {}) : s ? /* @__PURE__ */ n.jsx(dt, { error: s }) : i.length === 1 ? i[0].citation : /* @__PURE__ */ n.jsx("ul", { children: i.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, i) => {
|
|
55
|
+
const o = document.getElementById(`col-reference-${i}`);
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
const { referenceId: s, referenceIndexMap: i, trigger: o } = this.props, c = this.props.maxInline || 4, p = Le(s) ? s : [s];
|
|
60
|
+
let f = i && O(i, p[0]) ? (() => {
|
|
61
|
+
const u = p.slice(0, c), a = p.length - u.length;
|
|
62
|
+
return [
|
|
63
|
+
...u.map((y) => /* @__PURE__ */ n.jsx(
|
|
64
|
+
"a",
|
|
65
|
+
{
|
|
66
|
+
className: "col-reference-link",
|
|
67
|
+
href: `#col-reference-${y}`,
|
|
68
|
+
onClick: (x) => this.scrollToReference(x, y),
|
|
69
|
+
children: `[${i[y]}]`
|
|
70
|
+
},
|
|
71
|
+
y
|
|
72
|
+
)),
|
|
73
|
+
a > 0 ? /* @__PURE__ */ n.jsx("span", { className: "col-reference-link", children: ` +${a}` }, "overflow") : null
|
|
74
|
+
];
|
|
75
|
+
})() : /* @__PURE__ */ n.jsx($e, { style: { cursor: "pointer" } });
|
|
76
|
+
return s ? /* @__PURE__ */ n.jsx("div", { id: `reference_${s}`, style: this.props.style, children: /* @__PURE__ */ n.jsx(
|
|
77
|
+
it,
|
|
72
78
|
{
|
|
73
79
|
getPopupContainer: () => document.getElementById(`reference_${s}`),
|
|
74
80
|
placement: this.props.placement || "left",
|
|
75
81
|
title: "Reference",
|
|
76
|
-
onOpenChange: (
|
|
77
|
-
content: /* @__PURE__ */
|
|
82
|
+
onOpenChange: (u) => u && this.getData(),
|
|
83
|
+
content: /* @__PURE__ */ n.jsx("div", { style: { maxWidth: "500px" }, children: this.getContent() }),
|
|
78
84
|
trigger: o || "hover",
|
|
79
85
|
children: f
|
|
80
86
|
}
|
|
@@ -87,75 +93,75 @@ class bt extends st.Component {
|
|
|
87
93
|
};
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
|
-
const
|
|
96
|
+
const ie = [
|
|
91
97
|
"subspecies",
|
|
92
98
|
"variety",
|
|
93
99
|
"subvariety",
|
|
94
100
|
"form",
|
|
95
101
|
"subform",
|
|
96
102
|
"infraspecific name"
|
|
97
|
-
], Ae = (e,
|
|
98
|
-
const s =
|
|
99
|
-
return s === -1 ? [] :
|
|
103
|
+
], Ae = (e, r) => {
|
|
104
|
+
const s = r.indexOf(e);
|
|
105
|
+
return s === -1 ? [] : ie.filter((i) => r.indexOf(i) > s);
|
|
100
106
|
}, xt = 16, vt = (e) => {
|
|
101
|
-
var
|
|
102
|
-
return ((
|
|
103
|
-
},
|
|
104
|
-
const
|
|
107
|
+
var r, s;
|
|
108
|
+
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
|
+
}, jt = async (e, r, s) => {
|
|
110
|
+
const i = new Array(e.length);
|
|
105
111
|
let o = 0;
|
|
106
|
-
const
|
|
112
|
+
const c = Array.from({ length: Math.min(s, e.length) }, async () => {
|
|
107
113
|
for (; ; ) {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
|
|
114
|
+
const p = o++;
|
|
115
|
+
if (p >= e.length) return;
|
|
116
|
+
i[p] = await r(e[p], p);
|
|
111
117
|
}
|
|
112
118
|
});
|
|
113
|
-
return await Promise.all(
|
|
114
|
-
},
|
|
115
|
-
var
|
|
119
|
+
return await Promise.all(c), i;
|
|
120
|
+
}, St = async (e, r, s) => {
|
|
121
|
+
var f;
|
|
116
122
|
if (s.length === 0) return [];
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
(u) =>
|
|
120
|
-
),
|
|
121
|
-
const o = `${z.dataApi}dataset/${e}/nameusage/search?${
|
|
122
|
-
return (((
|
|
123
|
-
var
|
|
124
|
-
return (
|
|
123
|
+
const i = new URLSearchParams();
|
|
124
|
+
i.append("TAXON_ID", r), s.forEach((u) => i.append("rank", u)), ["accepted", "provisionally accepted"].forEach(
|
|
125
|
+
(u) => i.append("status", u)
|
|
126
|
+
), i.append("limit", "1000");
|
|
127
|
+
const o = `${z.dataApi}dataset/${e}/nameusage/search?${i}`, c = await ne(o);
|
|
128
|
+
return (((f = c == null ? void 0 : c.data) == null ? void 0 : f.result) || []).filter((u) => {
|
|
129
|
+
var a;
|
|
130
|
+
return (a = u == null ? void 0 : u.usage) == null ? void 0 : a.id;
|
|
125
131
|
}).map((u) => {
|
|
126
|
-
var
|
|
132
|
+
var a, y, x, R, E, I;
|
|
127
133
|
return {
|
|
128
134
|
id: u.usage.id,
|
|
129
|
-
scientificName: ((
|
|
135
|
+
scientificName: ((y = (a = u.usage) == null ? void 0 : a.name) == null ? void 0 : y.scientificName) || ((x = u.usage) == null ? void 0 : x.label) || u.usage.id,
|
|
130
136
|
rank: (E = (R = u.usage) == null ? void 0 : R.name) == null ? void 0 : E.rank,
|
|
131
137
|
parentId: (I = u.usage) == null ? void 0 : I.parentId
|
|
132
138
|
};
|
|
133
139
|
});
|
|
134
|
-
}, It = async (e,
|
|
135
|
-
const s = `${z.dataApi}dataset/${e}/taxon/${encodeURIComponent(
|
|
140
|
+
}, It = async (e, r) => {
|
|
141
|
+
const s = `${z.dataApi}dataset/${e}/taxon/${encodeURIComponent(r)}/distribution`;
|
|
136
142
|
try {
|
|
137
|
-
const
|
|
138
|
-
return Array.isArray(
|
|
143
|
+
const i = await ne(s);
|
|
144
|
+
return Array.isArray(i == null ? void 0 : i.data) ? i.data : [];
|
|
139
145
|
} catch {
|
|
140
146
|
return [];
|
|
141
147
|
}
|
|
142
|
-
}, wt = async ({ datasetKey: e, focalTaxon:
|
|
148
|
+
}, wt = async ({ datasetKey: e, focalTaxon: r, rankOrder: s }) => {
|
|
143
149
|
var u;
|
|
144
|
-
const
|
|
145
|
-
let o = !1,
|
|
150
|
+
const i = Ae((u = r == null ? void 0 : r.name) == null ? void 0 : u.rank, s);
|
|
151
|
+
let o = !1, c = [];
|
|
146
152
|
try {
|
|
147
|
-
|
|
153
|
+
c = await St(e, r.id, i);
|
|
148
154
|
} catch {
|
|
149
155
|
return o = !0, { taxa: [], descendantsFailed: o };
|
|
150
156
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
(
|
|
157
|
+
const p = await jt(
|
|
158
|
+
c,
|
|
159
|
+
(a) => It(e, a.id),
|
|
154
160
|
xt
|
|
155
161
|
);
|
|
156
|
-
return { taxa:
|
|
157
|
-
const
|
|
158
|
-
return { ...
|
|
162
|
+
return { taxa: c.map((a, y) => {
|
|
163
|
+
const x = p[y] || [];
|
|
164
|
+
return { ...a, distributions: x, mappable: x.filter(vt) };
|
|
159
165
|
}), descendantsFailed: o };
|
|
160
166
|
}, ke = [
|
|
161
167
|
"#E58606",
|
|
@@ -170,17 +176,17 @@ const ae = [
|
|
|
170
176
|
"#ED645A",
|
|
171
177
|
"#CC3A8E",
|
|
172
178
|
"#A5AA99"
|
|
173
|
-
], Ce = (e,
|
|
174
|
-
const s =
|
|
175
|
-
return s === -1 ?
|
|
176
|
-
}, Lt = (e,
|
|
177
|
-
const s = [...e].sort((o,
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
-
}),
|
|
181
|
-
return s.forEach((o,
|
|
182
|
-
|
|
183
|
-
}),
|
|
179
|
+
], Ce = (e, r) => {
|
|
180
|
+
const s = r.indexOf(e);
|
|
181
|
+
return s === -1 ? r.length : s;
|
|
182
|
+
}, Lt = (e, r) => {
|
|
183
|
+
const s = [...e].sort((o, c) => {
|
|
184
|
+
const p = Ce(o.rank, r), f = Ce(c.rank, r);
|
|
185
|
+
return p !== f ? p - f : o.scientificName.localeCompare(c.scientificName);
|
|
186
|
+
}), i = {};
|
|
187
|
+
return s.forEach((o, c) => {
|
|
188
|
+
i[o.id] = ke[c % ke.length];
|
|
189
|
+
}), i;
|
|
184
190
|
}, kt = {
|
|
185
191
|
position: "absolute",
|
|
186
192
|
bottom: 8,
|
|
@@ -231,11 +237,11 @@ const ae = [
|
|
|
231
237
|
}, Gt = {
|
|
232
238
|
...De,
|
|
233
239
|
marginTop: 0
|
|
234
|
-
},
|
|
240
|
+
}, Nt = {
|
|
235
241
|
fontStyle: "italic",
|
|
236
242
|
paddingLeft: 4
|
|
237
|
-
}, Re = (e) => e.reduce((
|
|
238
|
-
/* @__PURE__ */
|
|
243
|
+
}, Re = (e) => e.reduce((r, s) => r + s.taxa.length, 0), Mt = () => /* @__PURE__ */ n.jsxs("div", { style: Oe, children: [
|
|
244
|
+
/* @__PURE__ */ n.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ n.jsx(
|
|
239
245
|
"polygon",
|
|
240
246
|
{
|
|
241
247
|
points: "3,1 9,1 11,6 9,11 3,11 1,6",
|
|
@@ -244,44 +250,44 @@ const ae = [
|
|
|
244
250
|
strokeWidth: "0.75"
|
|
245
251
|
}
|
|
246
252
|
) }),
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
] }), _t = ({ visibleGroups: e, unmappableGroups:
|
|
249
|
-
const [
|
|
250
|
-
return
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
e.map((
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
] },
|
|
258
|
-
] },
|
|
259
|
-
s && /* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ n.jsx("span", { children: "GBIF occurrences" })
|
|
254
|
+
] }), _t = ({ visibleGroups: e, unmappableGroups: r, showGbif: s }) => {
|
|
255
|
+
const [i, o] = L(!1), c = Re(e), p = Re(r);
|
|
256
|
+
return c === 0 && p === 0 && !s ? null : /* @__PURE__ */ n.jsxs("div", { style: kt, children: [
|
|
257
|
+
/* @__PURE__ */ n.jsxs("div", { style: Ct, children: [
|
|
258
|
+
e.map((f, u) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
259
|
+
/* @__PURE__ */ n.jsx("div", { style: u === 0 ? Rt : Pe, children: f.label }),
|
|
260
|
+
f.taxa.map((a) => /* @__PURE__ */ n.jsxs("div", { style: Oe, children: [
|
|
261
|
+
/* @__PURE__ */ n.jsx("span", { style: Et(a.color) }),
|
|
262
|
+
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: a.displayName || a.scientificName })
|
|
263
|
+
] }, a.id))
|
|
264
|
+
] }, f.rank)),
|
|
265
|
+
s && /* @__PURE__ */ n.jsx(Mt, {})
|
|
260
266
|
] }),
|
|
261
|
-
|
|
262
|
-
/* @__PURE__ */
|
|
267
|
+
p > 0 && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
268
|
+
/* @__PURE__ */ n.jsxs(
|
|
263
269
|
"div",
|
|
264
270
|
{
|
|
265
271
|
style: Ft,
|
|
266
|
-
onClick: () => o((
|
|
272
|
+
onClick: () => o((f) => !f),
|
|
267
273
|
children: [
|
|
268
|
-
|
|
274
|
+
i ? "− Hide" : "+",
|
|
269
275
|
" ",
|
|
270
|
-
|
|
276
|
+
p,
|
|
271
277
|
" without map data"
|
|
272
278
|
]
|
|
273
279
|
}
|
|
274
280
|
),
|
|
275
|
-
|
|
276
|
-
/* @__PURE__ */
|
|
281
|
+
i && /* @__PURE__ */ n.jsx("div", { style: Bt, children: r.map((f, u) => /* @__PURE__ */ n.jsxs("div", { children: [
|
|
282
|
+
/* @__PURE__ */ n.jsx(
|
|
277
283
|
"div",
|
|
278
284
|
{
|
|
279
285
|
style: u === 0 ? Gt : De,
|
|
280
|
-
children:
|
|
286
|
+
children: f.label
|
|
281
287
|
}
|
|
282
288
|
),
|
|
283
|
-
|
|
284
|
-
] },
|
|
289
|
+
f.taxa.map((a) => /* @__PURE__ */ n.jsx("div", { style: Nt, children: a.displayName || a.scientificName }, a.id))
|
|
290
|
+
] }, f.rank)) })
|
|
285
291
|
] })
|
|
286
292
|
] });
|
|
287
293
|
}, $t = [
|
|
@@ -305,35 +311,35 @@ const ae = [
|
|
|
305
311
|
{ key: "uncertain", label: "Uncertain", color: "#8BE0A4" }
|
|
306
312
|
], He = Object.fromEntries(
|
|
307
313
|
ze.map((e) => [e.key, e.color])
|
|
308
|
-
),
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
const s = At(
|
|
314
|
+
), ae = "#66C5CC", At = (e) => String(e || "").toLowerCase().replace(/[^a-z]/g, ""), Ve = (e) => {
|
|
315
|
+
const r = e == null ? void 0 : e.establishmentMeans;
|
|
316
|
+
if (r == null || r === "") return null;
|
|
317
|
+
const s = At(r);
|
|
312
318
|
return He[s] ? s : "uncertain";
|
|
313
319
|
}, Pt = (e) => {
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
}, 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,
|
|
317
|
-
const s = `${e}:${
|
|
320
|
+
const r = Ve(e);
|
|
321
|
+
return r == null ? ae : He[r];
|
|
322
|
+
}, 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
|
+
const s = `${e}:${r}`;
|
|
318
324
|
if (he.has(s)) return he.get(s);
|
|
319
|
-
const
|
|
325
|
+
const i = `${z.dataApi}vocab/area/${s}`, o = ne(i, {
|
|
320
326
|
headers: { Accept: "application/geo+json" }
|
|
321
327
|
}).then(
|
|
322
|
-
(
|
|
328
|
+
(c) => c.data,
|
|
323
329
|
() => null
|
|
324
330
|
);
|
|
325
331
|
return he.set(s, o), o;
|
|
326
332
|
}, te = (e) => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), We = (e) => {
|
|
327
|
-
var
|
|
328
|
-
const
|
|
329
|
-
([
|
|
333
|
+
var i, o;
|
|
334
|
+
const r = ((i = e == null ? void 0 : e.area) == null ? void 0 : i.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
|
+
([c, p]) => `<div><strong>${te(c)}:</strong> ${te(p)}</div>`
|
|
330
336
|
).join("");
|
|
331
337
|
return `<div style="min-width:180px"><div style="font-weight:600;margin-bottom:4px">${te(
|
|
332
|
-
|
|
338
|
+
r
|
|
333
339
|
)}</div>${s}</div>`;
|
|
334
|
-
}, Ht = (e,
|
|
340
|
+
}, Ht = (e, r) => `<div style="font-weight:600;font-style:italic;margin-bottom:4px">${te(
|
|
335
341
|
e.scientificName
|
|
336
|
-
)}</div><div style="color:#888;margin-bottom:4px">${te(e.rank || "")}</div>` + We(
|
|
342
|
+
)}</div><div style="color:#888;margin-bottom:4px">${te(e.rank || "")}</div>` + We(r), Vt = {
|
|
337
343
|
subspecies: "subspecies",
|
|
338
344
|
variety: "varieties",
|
|
339
345
|
subvariety: "subvarieties",
|
|
@@ -342,10 +348,10 @@ const ae = [
|
|
|
342
348
|
"infraspecific name": "infraspecific names"
|
|
343
349
|
}, Be = (e) => Vt[e] || e, Ke = (e) => {
|
|
344
350
|
if (!e) return "";
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
}, Ut = () => /* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
351
|
+
const r = e.trim().split(/\s+/);
|
|
352
|
+
return r[r.length - 1];
|
|
353
|
+
}, Ut = () => /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
354
|
+
/* @__PURE__ */ n.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ n.jsx(
|
|
349
355
|
"polygon",
|
|
350
356
|
{
|
|
351
357
|
points: "3,1 9,1 11,6 9,11 3,11 1,6",
|
|
@@ -354,46 +360,46 @@ const ae = [
|
|
|
354
360
|
strokeWidth: "0.75"
|
|
355
361
|
}
|
|
356
362
|
) }),
|
|
357
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ n.jsx("span", { children: "GBIF occurrences" })
|
|
358
364
|
] }), Wt = (e) => {
|
|
359
|
-
var
|
|
360
|
-
let
|
|
361
|
-
const
|
|
362
|
-
if (typeof
|
|
363
|
-
const [u,
|
|
364
|
-
u <
|
|
365
|
+
var p;
|
|
366
|
+
let r = 1 / 0, s = 1 / 0, i = -1 / 0, o = -1 / 0;
|
|
367
|
+
const c = (f) => {
|
|
368
|
+
if (typeof f[0] == "number") {
|
|
369
|
+
const [u, a] = f;
|
|
370
|
+
u < r && (r = u), u > i && (i = u), a < s && (s = a), a > o && (o = a);
|
|
365
371
|
} else
|
|
366
|
-
for (let u = 0; u <
|
|
372
|
+
for (let u = 0; u < f.length; u++) c(f[u]);
|
|
367
373
|
};
|
|
368
|
-
for (let
|
|
369
|
-
const u = (
|
|
370
|
-
u != null && u.coordinates &&
|
|
374
|
+
for (let f = 0; f < e.length; f++) {
|
|
375
|
+
const u = (p = e[f]) == null ? void 0 : p.geometry;
|
|
376
|
+
u != null && u.coordinates && c(u.coordinates);
|
|
371
377
|
}
|
|
372
|
-
return
|
|
373
|
-
[
|
|
374
|
-
[
|
|
378
|
+
return r === 1 / 0 ? null : [
|
|
379
|
+
[r, s],
|
|
380
|
+
[i, o]
|
|
375
381
|
];
|
|
376
|
-
}, Ge = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [],
|
|
382
|
+
}, Ge = (e) => e ? e.type === "FeatureCollection" ? e.features || [] : [e] : [], Ne = () => {
|
|
377
383
|
var e;
|
|
378
384
|
return typeof ((e = D) == null ? void 0 : e.supported) == "function" ? D.supported() : typeof WebGLRenderingContext < "u";
|
|
379
385
|
}, Kt = ({
|
|
380
386
|
records: e,
|
|
381
|
-
onUnmappable:
|
|
387
|
+
onUnmappable: r,
|
|
382
388
|
datasetKey: s,
|
|
383
|
-
focalTaxon:
|
|
389
|
+
focalTaxon: i,
|
|
384
390
|
rankOrder: o,
|
|
385
|
-
gbifChecklistKey:
|
|
391
|
+
gbifChecklistKey: c,
|
|
386
392
|
// true | null → show GBIF layer; false → GBIF API returned 0 occurrences,
|
|
387
393
|
// grey out the toggle and skip loading tiles. Defaults to true so the
|
|
388
394
|
// component works without the count check.
|
|
389
|
-
gbifAvailable:
|
|
395
|
+
gbifAvailable: p = !0
|
|
390
396
|
}) => {
|
|
391
397
|
var we;
|
|
392
|
-
const
|
|
398
|
+
const f = C(null), u = C(null), a = 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({
|
|
393
399
|
status: "idle",
|
|
394
400
|
// idle | loading | ready | empty | error
|
|
395
401
|
taxa: []
|
|
396
|
-
}), [H, T] = L(!0), re = !!
|
|
402
|
+
}), [H, T] = L(!0), re = !!c && (!e || e.length === 0), [j, A] = L(
|
|
397
403
|
() => Dt(!0)
|
|
398
404
|
), [P, me] = L(/* @__PURE__ */ new Set()), [Te, ye] = L(!1), ce = C(!1), Ye = () => {
|
|
399
405
|
A((t) => {
|
|
@@ -420,13 +426,13 @@ const ae = [
|
|
|
420
426
|
color: Y[h.id],
|
|
421
427
|
displayName: Ke(h.scientificName)
|
|
422
428
|
}), d = (h) => {
|
|
423
|
-
const
|
|
424
|
-
return h.forEach((
|
|
425
|
-
(
|
|
426
|
-
}),
|
|
427
|
-
rank:
|
|
428
|
-
label: Be(
|
|
429
|
-
taxa:
|
|
429
|
+
const v = {};
|
|
430
|
+
return h.forEach((b) => {
|
|
431
|
+
(v[b.rank] = v[b.rank] || []).push(t(b));
|
|
432
|
+
}), ie.filter((b) => v[b]).map((b) => ({
|
|
433
|
+
rank: b,
|
|
434
|
+
label: Be(b),
|
|
435
|
+
taxa: v[b]
|
|
430
436
|
}));
|
|
431
437
|
}, l = d(
|
|
432
438
|
g.taxa.filter(
|
|
@@ -438,9 +444,9 @@ const ae = [
|
|
|
438
444
|
return { visibleGroups: l, unmappableGroups: m };
|
|
439
445
|
}, [g, Y, P]), ve = le.visibleGroups.length > 0;
|
|
440
446
|
$(() => {
|
|
441
|
-
if (!
|
|
447
|
+
if (!f.current || a.current || !Ne()) return;
|
|
442
448
|
const t = new D.Map({
|
|
443
|
-
container:
|
|
449
|
+
container: f.current,
|
|
444
450
|
style: Ot,
|
|
445
451
|
center: [0, 20],
|
|
446
452
|
zoom: 1,
|
|
@@ -457,18 +463,18 @@ const ae = [
|
|
|
457
463
|
), t.addControl(
|
|
458
464
|
new D.FullscreenControl({ container: u.current }),
|
|
459
465
|
"top-right"
|
|
460
|
-
),
|
|
466
|
+
), a.current = t, t.on("load", () => {
|
|
461
467
|
w(!0);
|
|
462
468
|
const l = t.getContainer().querySelector(".maplibregl-ctrl-attrib");
|
|
463
469
|
l && l.classList.remove("maplibregl-compact-show");
|
|
464
470
|
});
|
|
465
471
|
const d = typeof ResizeObserver < "u" ? new ResizeObserver(() => t.resize()) : null;
|
|
466
|
-
return d && d.observe(
|
|
467
|
-
d && d.disconnect(),
|
|
472
|
+
return d && d.observe(f.current), () => {
|
|
473
|
+
d && d.disconnect(), y.current && (y.current.remove(), y.current = null), t.remove(), a.current = null, I.current = !1, B.current = !1, G.current = /* @__PURE__ */ new Set();
|
|
468
474
|
};
|
|
469
475
|
}, []), $(() => {
|
|
470
476
|
if (!k || !(e != null && e.length)) return;
|
|
471
|
-
const t =
|
|
477
|
+
const t = a.current;
|
|
472
478
|
if (!t) return;
|
|
473
479
|
let d = !1;
|
|
474
480
|
return V(!1), Promise.allSettled(
|
|
@@ -481,10 +487,10 @@ const ae = [
|
|
|
481
487
|
).then((l) => {
|
|
482
488
|
if (d) return;
|
|
483
489
|
const m = [], h = /* @__PURE__ */ new Map();
|
|
484
|
-
let
|
|
490
|
+
let v = 0;
|
|
485
491
|
l.forEach((S, F) => {
|
|
486
492
|
if (S.status !== "fulfilled" || !S.value.geojson) {
|
|
487
|
-
|
|
493
|
+
v += 1;
|
|
488
494
|
return;
|
|
489
495
|
}
|
|
490
496
|
const { record: U, geojson: W } = S.value, de = Pt(U), q = `focal-${F}`;
|
|
@@ -498,19 +504,19 @@ const ae = [
|
|
|
498
504
|
}
|
|
499
505
|
});
|
|
500
506
|
});
|
|
501
|
-
}),
|
|
502
|
-
const
|
|
507
|
+
}), x.current = h;
|
|
508
|
+
const b = { type: "FeatureCollection", features: m };
|
|
503
509
|
if (t.getSource(J))
|
|
504
|
-
t.getSource(J).setData(
|
|
510
|
+
t.getSource(J).setData(b);
|
|
505
511
|
else {
|
|
506
512
|
const S = t.getLayer(_) ? _ : void 0;
|
|
507
|
-
t.addSource(J, { type: "geojson", data:
|
|
513
|
+
t.addSource(J, { type: "geojson", data: b }), t.addLayer(
|
|
508
514
|
{
|
|
509
515
|
id: K,
|
|
510
516
|
type: "fill",
|
|
511
517
|
source: J,
|
|
512
518
|
paint: {
|
|
513
|
-
"fill-color": ["coalesce", ["get", "_color"],
|
|
519
|
+
"fill-color": ["coalesce", ["get", "_color"], ae],
|
|
514
520
|
"fill-opacity": 0.65
|
|
515
521
|
}
|
|
516
522
|
},
|
|
@@ -521,47 +527,47 @@ const ae = [
|
|
|
521
527
|
type: "line",
|
|
522
528
|
source: J,
|
|
523
529
|
paint: {
|
|
524
|
-
"line-color": ["coalesce", ["get", "_color"],
|
|
530
|
+
"line-color": ["coalesce", ["get", "_color"], ae],
|
|
525
531
|
"line-width": 1
|
|
526
532
|
}
|
|
527
533
|
},
|
|
528
534
|
S
|
|
529
|
-
), t.on("click", K, qe), t.on("mouseenter", K,
|
|
535
|
+
), t.on("click", K, qe), t.on("mouseenter", K, je), t.on("mouseleave", K, Se), I.current = !0;
|
|
530
536
|
}
|
|
531
537
|
if (m.length > 0) {
|
|
532
538
|
const S = Wt(m);
|
|
533
539
|
S && t.fitBounds(S, { padding: 20, animate: !1 });
|
|
534
540
|
}
|
|
535
|
-
typeof
|
|
541
|
+
typeof r == "function" && r(v), V(!0);
|
|
536
542
|
}), () => {
|
|
537
543
|
d = !0;
|
|
538
544
|
};
|
|
539
545
|
}, [k, e]);
|
|
540
546
|
const qe = (t) => {
|
|
541
|
-
var
|
|
542
|
-
const d =
|
|
547
|
+
var v, b;
|
|
548
|
+
const d = a.current;
|
|
543
549
|
if (!d) return;
|
|
544
|
-
const l = (
|
|
545
|
-
h && (
|
|
546
|
-
}, Se = () => {
|
|
547
|
-
const t = c.current;
|
|
548
|
-
t && (t.getCanvas().style.cursor = "pointer");
|
|
550
|
+
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
|
+
h && (y.current && y.current.remove(), y.current = new D.Popup({ closeButton: !0, maxWidth: "320px" }).setLngLat(t.lngLat).setHTML(We(h)).addTo(d));
|
|
549
552
|
}, je = () => {
|
|
550
|
-
const t =
|
|
553
|
+
const t = a.current;
|
|
554
|
+
t && (t.getCanvas().style.cursor = "pointer");
|
|
555
|
+
}, Se = () => {
|
|
556
|
+
const t = a.current;
|
|
551
557
|
t && (t.getCanvas().style.cursor = "");
|
|
552
558
|
};
|
|
553
559
|
$(() => {
|
|
554
|
-
const t =
|
|
560
|
+
const t = a.current;
|
|
555
561
|
if (!t || !I.current) return;
|
|
556
562
|
const d = H ? "visible" : "none";
|
|
557
563
|
t.getLayer(K) && t.setLayoutProperty(K, "visibility", d), t.getLayer(pe) && t.setLayoutProperty(pe, "visibility", d);
|
|
558
|
-
}, [H,
|
|
564
|
+
}, [H, N]), $(() => {
|
|
559
565
|
if (!k) return;
|
|
560
|
-
const t =
|
|
566
|
+
const t = a.current;
|
|
561
567
|
if (!t || ((() => {
|
|
562
568
|
t.getLayer(_) && t.removeLayer(_), t.getSource(oe) && t.removeSource(oe), B.current = !1;
|
|
563
|
-
})(), !
|
|
564
|
-
const l = (z.gbifApi + zt).replace("{checklistKey}", encodeURIComponent(
|
|
569
|
+
})(), !c || !(i != null && i.id)) || p === !1) return;
|
|
570
|
+
const l = (z.gbifApi + zt).replace("{checklistKey}", encodeURIComponent(c)).replace("{taxonKey}", encodeURIComponent(i.id)), m = z.gbifPortal + "/occurrence/search?checklist_key=" + encodeURIComponent(c) + "&taxon_key=" + encodeURIComponent(i.id);
|
|
565
571
|
t.addSource(oe, {
|
|
566
572
|
type: "raster",
|
|
567
573
|
tiles: [l],
|
|
@@ -572,16 +578,16 @@ const ae = [
|
|
|
572
578
|
type: "raster",
|
|
573
579
|
source: oe,
|
|
574
580
|
paint: { "raster-opacity": 0.9 },
|
|
575
|
-
layout: { visibility:
|
|
581
|
+
layout: { visibility: j ? "visible" : "none" }
|
|
576
582
|
}), B.current = !0;
|
|
577
|
-
}, [k,
|
|
578
|
-
const t =
|
|
583
|
+
}, [k, c, i == null ? void 0 : i.id, p]), $(() => {
|
|
584
|
+
const t = a.current;
|
|
579
585
|
if (!t || !B.current) return;
|
|
580
|
-
const d =
|
|
586
|
+
const d = j ? "visible" : "none";
|
|
581
587
|
t.getLayer(_) && t.setLayoutProperty(_, "visibility", d);
|
|
582
|
-
}, [
|
|
588
|
+
}, [j]), $(() => {
|
|
583
589
|
if (!k) return;
|
|
584
|
-
const t =
|
|
590
|
+
const t = a.current;
|
|
585
591
|
if (!t || (G.current.forEach((l) => {
|
|
586
592
|
t.getLayer(Q(l)) && t.removeLayer(Q(l)), t.getLayer(ee(l)) && t.removeLayer(ee(l)), t.getSource(fe(l)) && t.removeSource(fe(l));
|
|
587
593
|
}), G.current = /* @__PURE__ */ new Set(), R.current = /* @__PURE__ */ new Map(), E.current = /* @__PURE__ */ new Map(), g.status !== "ready")) return;
|
|
@@ -595,7 +601,7 @@ const ae = [
|
|
|
595
601
|
}))
|
|
596
602
|
)
|
|
597
603
|
).then((m) => {
|
|
598
|
-
if (!
|
|
604
|
+
if (!a.current) return;
|
|
599
605
|
const h = [];
|
|
600
606
|
m.forEach((F, U) => {
|
|
601
607
|
if (F.status !== "fulfilled" || !F.value.geojson) return;
|
|
@@ -610,44 +616,44 @@ const ae = [
|
|
|
610
616
|
});
|
|
611
617
|
});
|
|
612
618
|
});
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
|
|
619
|
+
const v = d[l.id] || ae, b = { type: "FeatureCollection", features: h }, S = fe(l.id);
|
|
620
|
+
if (a.current.getSource(S))
|
|
621
|
+
a.current.getSource(S).setData(b);
|
|
616
622
|
else {
|
|
617
|
-
|
|
618
|
-
const F = Q(l.id), U = ee(l.id), W =
|
|
619
|
-
|
|
623
|
+
a.current.addSource(S, { type: "geojson", data: b });
|
|
624
|
+
const F = Q(l.id), U = ee(l.id), W = a.current.getLayer(_) ? _ : void 0;
|
|
625
|
+
a.current.addLayer(
|
|
620
626
|
{
|
|
621
627
|
id: F,
|
|
622
628
|
type: "fill",
|
|
623
629
|
source: S,
|
|
624
|
-
paint: { "fill-color":
|
|
630
|
+
paint: { "fill-color": v, "fill-opacity": 0.55 },
|
|
625
631
|
layout: { visibility: "none" }
|
|
626
632
|
},
|
|
627
633
|
W
|
|
628
|
-
),
|
|
634
|
+
), a.current.addLayer(
|
|
629
635
|
{
|
|
630
636
|
id: U,
|
|
631
637
|
type: "line",
|
|
632
638
|
source: S,
|
|
633
|
-
paint: { "line-color":
|
|
639
|
+
paint: { "line-color": v, "line-width": 2 },
|
|
634
640
|
layout: { visibility: "none" }
|
|
635
641
|
},
|
|
636
642
|
W
|
|
637
|
-
),
|
|
643
|
+
), a.current.on("click", F, Ze), a.current.on("mouseenter", F, je), a.current.on("mouseleave", F, Se), G.current.add(l.id);
|
|
638
644
|
}
|
|
639
645
|
}));
|
|
640
646
|
});
|
|
641
647
|
}, [k, g, Y]);
|
|
642
648
|
const Ze = (t) => {
|
|
643
|
-
var
|
|
644
|
-
const d =
|
|
649
|
+
var v, b;
|
|
650
|
+
const d = a.current;
|
|
645
651
|
if (!d) return;
|
|
646
|
-
const l = (
|
|
647
|
-
h && (
|
|
652
|
+
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
|
+
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));
|
|
648
654
|
};
|
|
649
655
|
$(() => {
|
|
650
|
-
const t =
|
|
656
|
+
const t = a.current;
|
|
651
657
|
t && G.current.forEach((d) => {
|
|
652
658
|
const l = P.has(d) ? "visible" : "none";
|
|
653
659
|
t.getLayer(Q(d)) && t.setLayoutProperty(Q(d), "visibility", l), t.getLayer(ee(d)) && t.setLayoutProperty(ee(d), "visibility", l);
|
|
@@ -655,19 +661,19 @@ const ae = [
|
|
|
655
661
|
}, [P, g]);
|
|
656
662
|
const Ie = () => {
|
|
657
663
|
var l;
|
|
658
|
-
if (ce.current || !s || !
|
|
659
|
-
const t = (l =
|
|
660
|
-
!t || t !== "species" && !
|
|
664
|
+
if (ce.current || !s || !i || !o) return;
|
|
665
|
+
const t = (l = i == null ? void 0 : i.name) == null ? void 0 : l.rank;
|
|
666
|
+
!t || t !== "species" && !ie.includes(t) || Ae(t, o).length === 0 || (ce.current = !0, M({ status: "loading", taxa: [] }), wt({ datasetKey: s, focalTaxon: i, rankOrder: o }).then(
|
|
661
667
|
({ taxa: m, descendantsFailed: h }) => {
|
|
662
668
|
if (h) {
|
|
663
|
-
|
|
669
|
+
M({ status: "error", taxa: [] });
|
|
664
670
|
return;
|
|
665
671
|
}
|
|
666
672
|
if (m.length === 0) {
|
|
667
|
-
|
|
673
|
+
M({ status: "empty", taxa: [] });
|
|
668
674
|
return;
|
|
669
675
|
}
|
|
670
|
-
|
|
676
|
+
M({ status: "ready", taxa: m });
|
|
671
677
|
}
|
|
672
678
|
));
|
|
673
679
|
}, Xe = () => {
|
|
@@ -677,7 +683,7 @@ const ae = [
|
|
|
677
683
|
const t = {};
|
|
678
684
|
return g.taxa.filter((d) => d.mappable.length > 0).forEach((d) => {
|
|
679
685
|
(t[d.rank] = t[d.rank] || []).push(d);
|
|
680
|
-
}),
|
|
686
|
+
}), ie.filter((d) => t[d]).map((d) => ({
|
|
681
687
|
rank: d,
|
|
682
688
|
label: Be(d),
|
|
683
689
|
taxa: t[d].slice().sort(
|
|
@@ -697,8 +703,8 @@ const ae = [
|
|
|
697
703
|
}), l;
|
|
698
704
|
});
|
|
699
705
|
};
|
|
700
|
-
if (!
|
|
701
|
-
return /* @__PURE__ */
|
|
706
|
+
if (!Ne())
|
|
707
|
+
return /* @__PURE__ */ n.jsx(
|
|
702
708
|
"div",
|
|
703
709
|
{
|
|
704
710
|
style: {
|
|
@@ -712,8 +718,8 @@ const ae = [
|
|
|
712
718
|
children: "Maps require WebGL, which your browser doesn't support."
|
|
713
719
|
}
|
|
714
720
|
);
|
|
715
|
-
if (re && !
|
|
716
|
-
return /* @__PURE__ */
|
|
721
|
+
if (re && !j)
|
|
722
|
+
return /* @__PURE__ */ n.jsxs(
|
|
717
723
|
"div",
|
|
718
724
|
{
|
|
719
725
|
className: "col-distributions-map col-distributions-map--collapsed",
|
|
@@ -729,8 +735,8 @@ const ae = [
|
|
|
729
735
|
fontSize: 12
|
|
730
736
|
},
|
|
731
737
|
children: [
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
738
|
+
/* @__PURE__ */ n.jsx("span", { children: "No curated distribution data." }),
|
|
739
|
+
/* @__PURE__ */ n.jsx(
|
|
734
740
|
"a",
|
|
735
741
|
{
|
|
736
742
|
role: "button",
|
|
@@ -746,35 +752,35 @@ const ae = [
|
|
|
746
752
|
]
|
|
747
753
|
}
|
|
748
754
|
);
|
|
749
|
-
const tt = ((we =
|
|
750
|
-
return /* @__PURE__ */
|
|
755
|
+
const tt = ((we = i == null ? void 0 : i.name) == null ? void 0 : we.scientificName) || "This taxon";
|
|
756
|
+
return /* @__PURE__ */ n.jsxs(
|
|
751
757
|
"div",
|
|
752
758
|
{
|
|
753
759
|
className: "col-distributions-map",
|
|
754
760
|
ref: u,
|
|
755
761
|
style: { position: "relative" },
|
|
756
762
|
children: [
|
|
757
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ n.jsx(
|
|
758
764
|
"div",
|
|
759
765
|
{
|
|
760
|
-
ref:
|
|
766
|
+
ref: f,
|
|
761
767
|
className: "col-distributions-map__canvas",
|
|
762
768
|
style: { height: 360, width: "100%", background: "#f5f5f5" }
|
|
763
769
|
}
|
|
764
770
|
),
|
|
765
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ n.jsx(
|
|
766
772
|
Tt,
|
|
767
773
|
{
|
|
768
774
|
open: Te,
|
|
769
775
|
onOpen: Xe,
|
|
770
776
|
onClose: () => ye(!1),
|
|
771
777
|
focalName: tt,
|
|
772
|
-
focalReady:
|
|
778
|
+
focalReady: N,
|
|
773
779
|
focalVisible: H,
|
|
774
780
|
onToggleFocal: () => T((t) => !t),
|
|
775
|
-
gbifEnabled: !!
|
|
776
|
-
gbifVisible:
|
|
777
|
-
gbifAvailable:
|
|
781
|
+
gbifEnabled: !!c,
|
|
782
|
+
gbifVisible: j,
|
|
783
|
+
gbifAvailable: p,
|
|
778
784
|
onToggleGbif: Ye,
|
|
779
785
|
descendantStatus: g.status,
|
|
780
786
|
descendantsByRank: Je,
|
|
@@ -783,11 +789,11 @@ const ae = [
|
|
|
783
789
|
onToggleTaxon: Qe,
|
|
784
790
|
onToggleRankGroup: et,
|
|
785
791
|
onRetry: () => {
|
|
786
|
-
ce.current = !1,
|
|
792
|
+
ce.current = !1, M({ status: "idle", taxa: [] }), Ie();
|
|
787
793
|
}
|
|
788
794
|
}
|
|
789
795
|
),
|
|
790
|
-
!ve && (xe.length > 0 ||
|
|
796
|
+
!ve && (xe.length > 0 || c && p !== !1 && j) && /* @__PURE__ */ n.jsxs(
|
|
791
797
|
"div",
|
|
792
798
|
{
|
|
793
799
|
style: {
|
|
@@ -803,12 +809,12 @@ const ae = [
|
|
|
803
809
|
lineHeight: 1.5
|
|
804
810
|
},
|
|
805
811
|
children: [
|
|
806
|
-
xe.map((t) => /* @__PURE__ */
|
|
812
|
+
xe.map((t) => /* @__PURE__ */ n.jsxs(
|
|
807
813
|
"div",
|
|
808
814
|
{
|
|
809
815
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
810
816
|
children: [
|
|
811
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ n.jsx(
|
|
812
818
|
"span",
|
|
813
819
|
{
|
|
814
820
|
style: {
|
|
@@ -821,21 +827,21 @@ const ae = [
|
|
|
821
827
|
}
|
|
822
828
|
}
|
|
823
829
|
),
|
|
824
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ n.jsx("span", { children: t.label })
|
|
825
831
|
]
|
|
826
832
|
},
|
|
827
833
|
t.key
|
|
828
834
|
)),
|
|
829
|
-
|
|
835
|
+
c && p !== !1 && j && /* @__PURE__ */ n.jsx(Ut, {})
|
|
830
836
|
]
|
|
831
837
|
}
|
|
832
838
|
),
|
|
833
|
-
ve && /* @__PURE__ */
|
|
839
|
+
ve && /* @__PURE__ */ n.jsx(
|
|
834
840
|
_t,
|
|
835
841
|
{
|
|
836
842
|
visibleGroups: le.visibleGroups,
|
|
837
843
|
unmappableGroups: le.unmappableGroups,
|
|
838
|
-
showGbif: !!
|
|
844
|
+
showGbif: !!c && p !== !1 && j
|
|
839
845
|
}
|
|
840
846
|
)
|
|
841
847
|
]
|
|
@@ -843,24 +849,24 @@ const ae = [
|
|
|
843
849
|
);
|
|
844
850
|
}, Tt = ({
|
|
845
851
|
open: e,
|
|
846
|
-
onOpen:
|
|
852
|
+
onOpen: r,
|
|
847
853
|
onClose: s,
|
|
848
|
-
focalName:
|
|
854
|
+
focalName: i,
|
|
849
855
|
focalReady: o,
|
|
850
|
-
focalVisible:
|
|
851
|
-
onToggleFocal:
|
|
852
|
-
gbifEnabled:
|
|
856
|
+
focalVisible: c,
|
|
857
|
+
onToggleFocal: p,
|
|
858
|
+
gbifEnabled: f,
|
|
853
859
|
gbifVisible: u,
|
|
854
|
-
gbifAvailable:
|
|
855
|
-
onToggleGbif:
|
|
856
|
-
descendantStatus:
|
|
860
|
+
gbifAvailable: a,
|
|
861
|
+
onToggleGbif: y,
|
|
862
|
+
descendantStatus: x,
|
|
857
863
|
descendantsByRank: R,
|
|
858
864
|
descendantColors: E,
|
|
859
865
|
visibleTaxonIds: I,
|
|
860
866
|
onToggleTaxon: B,
|
|
861
867
|
onToggleRankGroup: G,
|
|
862
868
|
onRetry: k
|
|
863
|
-
}) => e ? /* @__PURE__ */
|
|
869
|
+
}) => e ? /* @__PURE__ */ n.jsxs(
|
|
864
870
|
"div",
|
|
865
871
|
{
|
|
866
872
|
style: {
|
|
@@ -881,52 +887,52 @@ const ae = [
|
|
|
881
887
|
},
|
|
882
888
|
onMouseLeave: s,
|
|
883
889
|
children: [
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ n.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
891
|
+
/* @__PURE__ */ n.jsx(
|
|
886
892
|
"input",
|
|
887
893
|
{
|
|
888
894
|
type: "checkbox",
|
|
889
|
-
checked:
|
|
895
|
+
checked: c,
|
|
890
896
|
disabled: !o,
|
|
891
|
-
onChange:
|
|
897
|
+
onChange: p
|
|
892
898
|
}
|
|
893
899
|
),
|
|
894
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: i })
|
|
895
901
|
] }),
|
|
896
|
-
|
|
902
|
+
f && /* @__PURE__ */ n.jsxs(
|
|
897
903
|
"div",
|
|
898
904
|
{
|
|
899
905
|
style: {
|
|
900
906
|
display: "flex",
|
|
901
907
|
alignItems: "center",
|
|
902
908
|
gap: 6,
|
|
903
|
-
opacity:
|
|
909
|
+
opacity: a === !1 ? 0.5 : 1
|
|
904
910
|
},
|
|
905
|
-
title:
|
|
911
|
+
title: a === !1 ? "GBIF has no occurrence records for this taxon." : void 0,
|
|
906
912
|
children: [
|
|
907
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ n.jsx(
|
|
908
914
|
"input",
|
|
909
915
|
{
|
|
910
916
|
type: "checkbox",
|
|
911
|
-
checked:
|
|
912
|
-
disabled:
|
|
913
|
-
onChange:
|
|
917
|
+
checked: a === !1 ? !1 : u,
|
|
918
|
+
disabled: a === !1,
|
|
919
|
+
onChange: y
|
|
914
920
|
}
|
|
915
921
|
),
|
|
916
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ n.jsx("span", { children: "GBIF occurrences" })
|
|
917
923
|
]
|
|
918
924
|
}
|
|
919
925
|
),
|
|
920
|
-
|
|
921
|
-
|
|
926
|
+
x === "loading" && /* @__PURE__ */ n.jsx("div", { style: { marginTop: 6, color: "#888" }, children: "Loading descendants…" }),
|
|
927
|
+
x === "error" && /* @__PURE__ */ n.jsxs("div", { style: { marginTop: 6, color: "#888" }, children: [
|
|
922
928
|
"Couldn't load descendants.",
|
|
923
929
|
" ",
|
|
924
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ n.jsx("a", { onClick: k, style: { cursor: "pointer" }, children: "Retry" })
|
|
925
931
|
] }),
|
|
926
|
-
|
|
927
|
-
const
|
|
928
|
-
return /* @__PURE__ */
|
|
929
|
-
/* @__PURE__ */
|
|
932
|
+
x === "ready" && R.map((w) => {
|
|
933
|
+
const N = w.taxa.every((g) => I.has(g.id)), V = w.taxa.some((g) => I.has(g.id));
|
|
934
|
+
return /* @__PURE__ */ n.jsxs("div", { style: { marginTop: 6 }, children: [
|
|
935
|
+
/* @__PURE__ */ n.jsxs(
|
|
930
936
|
"label",
|
|
931
937
|
{
|
|
932
938
|
style: {
|
|
@@ -936,13 +942,13 @@ const ae = [
|
|
|
936
942
|
fontWeight: 600
|
|
937
943
|
},
|
|
938
944
|
children: [
|
|
939
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ n.jsx(
|
|
940
946
|
"input",
|
|
941
947
|
{
|
|
942
948
|
type: "checkbox",
|
|
943
|
-
checked:
|
|
949
|
+
checked: N,
|
|
944
950
|
ref: (g) => {
|
|
945
|
-
g && (g.indeterminate = !
|
|
951
|
+
g && (g.indeterminate = !N && V);
|
|
946
952
|
},
|
|
947
953
|
onChange: () => G(w.taxa)
|
|
948
954
|
}
|
|
@@ -951,7 +957,7 @@ const ae = [
|
|
|
951
957
|
]
|
|
952
958
|
}
|
|
953
959
|
),
|
|
954
|
-
/* @__PURE__ */
|
|
960
|
+
/* @__PURE__ */ n.jsx("div", { style: { paddingLeft: 18 }, children: w.taxa.map((g) => /* @__PURE__ */ n.jsxs(
|
|
955
961
|
"label",
|
|
956
962
|
{
|
|
957
963
|
style: {
|
|
@@ -960,7 +966,7 @@ const ae = [
|
|
|
960
966
|
gap: 6
|
|
961
967
|
},
|
|
962
968
|
children: [
|
|
963
|
-
/* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ n.jsx(
|
|
964
970
|
"input",
|
|
965
971
|
{
|
|
966
972
|
type: "checkbox",
|
|
@@ -968,7 +974,7 @@ const ae = [
|
|
|
968
974
|
onChange: () => B(g.id)
|
|
969
975
|
}
|
|
970
976
|
),
|
|
971
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ n.jsx(
|
|
972
978
|
"span",
|
|
973
979
|
{
|
|
974
980
|
style: {
|
|
@@ -981,7 +987,7 @@ const ae = [
|
|
|
981
987
|
}
|
|
982
988
|
}
|
|
983
989
|
),
|
|
984
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ n.jsx("span", { style: { fontStyle: "italic" }, children: Ke(g.scientificName) })
|
|
985
991
|
]
|
|
986
992
|
},
|
|
987
993
|
g.id
|
|
@@ -990,12 +996,12 @@ const ae = [
|
|
|
990
996
|
})
|
|
991
997
|
]
|
|
992
998
|
}
|
|
993
|
-
) : /* @__PURE__ */
|
|
999
|
+
) : /* @__PURE__ */ n.jsx(
|
|
994
1000
|
"button",
|
|
995
1001
|
{
|
|
996
1002
|
type: "button",
|
|
997
|
-
onClick:
|
|
998
|
-
onMouseEnter:
|
|
1003
|
+
onClick: r,
|
|
1004
|
+
onMouseEnter: r,
|
|
999
1005
|
title: "Layers",
|
|
1000
1006
|
style: {
|
|
1001
1007
|
position: "absolute",
|
|
@@ -1017,22 +1023,22 @@ const ae = [
|
|
|
1017
1023
|
children: "+"
|
|
1018
1024
|
}
|
|
1019
1025
|
), Yt = (e) => {
|
|
1020
|
-
var
|
|
1021
|
-
return ((
|
|
1022
|
-
},
|
|
1023
|
-
const [s,
|
|
1026
|
+
var r, s;
|
|
1027
|
+
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
|
+
}, Me = ({ datasetKey: e, data: r }) => {
|
|
1029
|
+
const [s, i] = L({});
|
|
1024
1030
|
return $(() => {
|
|
1025
1031
|
let o = !1;
|
|
1026
|
-
for (let
|
|
1027
|
-
if (
|
|
1032
|
+
for (let c = 0; c < r.length; c++)
|
|
1033
|
+
if (r[c].gazetteer === "iso") {
|
|
1028
1034
|
o = !0;
|
|
1029
1035
|
break;
|
|
1030
1036
|
}
|
|
1031
|
-
o && ne(`${z.dataApi}vocab/country`).then((
|
|
1032
|
-
|
|
1037
|
+
o && ne(`${z.dataApi}vocab/country`).then((c) => {
|
|
1038
|
+
i(at(c.data, "alpha3"));
|
|
1033
1039
|
});
|
|
1034
|
-
}, []), /* @__PURE__ */
|
|
1035
|
-
(o == null ? void 0 : o.merged) && /* @__PURE__ */
|
|
1040
|
+
}, []), /* @__PURE__ */ n.jsx("div", { children: r.map((o, c) => /* @__PURE__ */ n.jsxs("span", { children: [
|
|
1041
|
+
(o == null ? void 0 : o.merged) && /* @__PURE__ */ n.jsx(
|
|
1036
1042
|
pt,
|
|
1037
1043
|
{
|
|
1038
1044
|
createdBy: o == null ? void 0 : o.createdBy,
|
|
@@ -1044,7 +1050,7 @@ const ae = [
|
|
|
1044
1050
|
),
|
|
1045
1051
|
(O(s, `[${O(o, "area.name")}].name`) ? ct(O(s, `[${O(o, "area.name")}].name`)) : null) || O(o, "area.name") || O(o, "area.globalId"),
|
|
1046
1052
|
" ",
|
|
1047
|
-
o.referenceId && /* @__PURE__ */
|
|
1053
|
+
o.referenceId && /* @__PURE__ */ n.jsx(
|
|
1048
1054
|
bt,
|
|
1049
1055
|
{
|
|
1050
1056
|
datasetKey: e,
|
|
@@ -1052,30 +1058,30 @@ const ae = [
|
|
|
1052
1058
|
placement: "bottom"
|
|
1053
1059
|
}
|
|
1054
1060
|
),
|
|
1055
|
-
|
|
1056
|
-
] },
|
|
1061
|
+
c < r.length - 1 && ", "
|
|
1062
|
+
] }, c)) });
|
|
1057
1063
|
}, dn = ({
|
|
1058
1064
|
datasetKey: e,
|
|
1059
|
-
data:
|
|
1065
|
+
data: r,
|
|
1060
1066
|
style: s,
|
|
1061
|
-
showDistributionMap:
|
|
1067
|
+
showDistributionMap: i,
|
|
1062
1068
|
focalTaxon: o,
|
|
1063
|
-
rankOrder:
|
|
1064
|
-
gbifChecklistKey:
|
|
1065
|
-
label:
|
|
1069
|
+
rankOrder: c,
|
|
1070
|
+
gbifChecklistKey: p,
|
|
1071
|
+
label: f,
|
|
1066
1072
|
md: u
|
|
1067
1073
|
}) => {
|
|
1068
|
-
const
|
|
1074
|
+
const a = r.filter(Yt), y = r.length - a.length, x = !!p, R = r.length > 0, [E, I] = L("map"), [B, G] = L(0), [k, w] = L(null);
|
|
1069
1075
|
$(() => {
|
|
1070
|
-
if (!
|
|
1076
|
+
if (!p || !(o != null && o.id)) {
|
|
1071
1077
|
w(null);
|
|
1072
1078
|
return;
|
|
1073
1079
|
}
|
|
1074
1080
|
w(null);
|
|
1075
|
-
let
|
|
1081
|
+
let j = !1;
|
|
1076
1082
|
return lt.get(`${z.gbifApi}/v1/occurrence/search`, {
|
|
1077
1083
|
params: {
|
|
1078
|
-
checklistKey:
|
|
1084
|
+
checklistKey: p,
|
|
1079
1085
|
taxonKey: o.id,
|
|
1080
1086
|
hasCoordinate: !0,
|
|
1081
1087
|
hasGeospatialIssue: !1,
|
|
@@ -1085,69 +1091,69 @@ const ae = [
|
|
|
1085
1091
|
}).then(
|
|
1086
1092
|
(A) => {
|
|
1087
1093
|
var P;
|
|
1088
|
-
|
|
1094
|
+
j || w(((P = A == null ? void 0 : A.data) == null ? void 0 : P.count) ?? 0);
|
|
1089
1095
|
},
|
|
1090
1096
|
() => {
|
|
1091
|
-
|
|
1097
|
+
j || w(null);
|
|
1092
1098
|
}
|
|
1093
1099
|
), () => {
|
|
1094
|
-
|
|
1100
|
+
j = !0;
|
|
1095
1101
|
};
|
|
1096
|
-
}, [
|
|
1097
|
-
const
|
|
1102
|
+
}, [p, o == null ? void 0 : o.id]);
|
|
1103
|
+
const N = x ? k === null || k > 0 : !1, V = a.length > 0 && B >= a.length, g = i && (a.length > 0 || N) && !(a.length > 0 && V && !N);
|
|
1098
1104
|
if (!g && !R) return null;
|
|
1099
|
-
const
|
|
1105
|
+
const M = y + B, H = R;
|
|
1100
1106
|
let T;
|
|
1101
1107
|
if (!g)
|
|
1102
|
-
T = /* @__PURE__ */
|
|
1108
|
+
T = /* @__PURE__ */ n.jsx(Me, { datasetKey: e, data: r });
|
|
1103
1109
|
else {
|
|
1104
|
-
const
|
|
1105
|
-
T = /* @__PURE__ */
|
|
1106
|
-
H ? /* @__PURE__ */
|
|
1110
|
+
const j = H ? E : "map";
|
|
1111
|
+
T = /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
1112
|
+
H ? /* @__PURE__ */ n.jsxs(
|
|
1107
1113
|
ue.Group,
|
|
1108
1114
|
{
|
|
1109
1115
|
size: "small",
|
|
1110
|
-
value:
|
|
1116
|
+
value: j,
|
|
1111
1117
|
onChange: (A) => I(A.target.value),
|
|
1112
1118
|
style: { marginBottom: 8 },
|
|
1113
1119
|
children: [
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1120
|
+
/* @__PURE__ */ n.jsx(ue.Button, { value: "map", children: "Map" }),
|
|
1121
|
+
/* @__PURE__ */ n.jsx(ue.Button, { value: "list", children: "List" })
|
|
1116
1122
|
]
|
|
1117
1123
|
}
|
|
1118
1124
|
) : (
|
|
1119
1125
|
// Reserve the vertical space the Map/List toggle would occupy so the
|
|
1120
1126
|
// map's top edge lines up with the "Distributions" label.
|
|
1121
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ n.jsx("div", { style: { height: 24, marginBottom: 8 } })
|
|
1122
1128
|
),
|
|
1123
|
-
|
|
1124
|
-
/* @__PURE__ */
|
|
1129
|
+
j === "map" ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
1130
|
+
/* @__PURE__ */ n.jsx(
|
|
1125
1131
|
Kt,
|
|
1126
1132
|
{
|
|
1127
|
-
records:
|
|
1133
|
+
records: a,
|
|
1128
1134
|
onUnmappable: G,
|
|
1129
1135
|
datasetKey: e,
|
|
1130
1136
|
focalTaxon: o,
|
|
1131
|
-
rankOrder:
|
|
1132
|
-
gbifChecklistKey:
|
|
1133
|
-
gbifAvailable:
|
|
1137
|
+
rankOrder: c,
|
|
1138
|
+
gbifChecklistKey: p,
|
|
1139
|
+
gbifAvailable: N
|
|
1134
1140
|
}
|
|
1135
1141
|
),
|
|
1136
|
-
H &&
|
|
1142
|
+
H && M > 0 && /* @__PURE__ */ n.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ n.jsxs("a", { onClick: () => I("list"), style: { cursor: "pointer" }, children: [
|
|
1137
1143
|
"+",
|
|
1138
|
-
|
|
1144
|
+
M,
|
|
1139
1145
|
" distribution",
|
|
1140
|
-
|
|
1146
|
+
M === 1 ? "" : "s",
|
|
1141
1147
|
" not on map"
|
|
1142
1148
|
] }) })
|
|
1143
|
-
] }) : /* @__PURE__ */
|
|
1149
|
+
] }) : /* @__PURE__ */ n.jsx(Me, { datasetKey: e, data: r })
|
|
1144
1150
|
] });
|
|
1145
1151
|
}
|
|
1146
|
-
const re = /* @__PURE__ */
|
|
1147
|
-
return
|
|
1152
|
+
const re = /* @__PURE__ */ n.jsx("div", { style: s, children: T });
|
|
1153
|
+
return f ? /* @__PURE__ */ n.jsx(ft, { md: u, label: f, children: re }) : re;
|
|
1148
1154
|
};
|
|
1149
1155
|
export {
|
|
1150
1156
|
dn as D,
|
|
1151
1157
|
bt as R
|
|
1152
1158
|
};
|
|
1153
|
-
//# sourceMappingURL=Distributions-
|
|
1159
|
+
//# sourceMappingURL=Distributions-D_4NAlfr.js.map
|