col-browser 2.6.5 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/tree.js CHANGED
@@ -1,147 +1,147 @@
1
- var Y = Object.defineProperty;
2
- var tt = (x, y, t) => y in x ? Y(x, y, { enumerable: !0, configurable: !0, writable: !0, value: t }) : x[y] = t;
3
- var u = (x, y, t) => tt(x, typeof y != "symbol" ? y + "" : y, t);
4
- import { a as et } from "./chunks/withDatasetKey-BgMY05XE.js";
5
- import { w as st } from "./chunks/withTheme-Dh6PRuII.js";
1
+ var tt = Object.defineProperty;
2
+ var et = (y, m, t) => m in y ? tt(y, m, { enumerable: !0, configurable: !0, writable: !0, value: t }) : y[m] = t;
3
+ var h = (y, m, t) => et(y, typeof m != "symbol" ? m + "" : m, t);
4
+ import { a as st } from "./chunks/withDatasetKey-BgMY05XE.js";
5
+ import { w as at } from "./chunks/withTheme-Dh6PRuII.js";
6
6
  import { j as e } from "./chunks/jsx-runtime-BzflLqGi.js";
7
- import j, { createContext as at } from "react";
8
- import { Popover as ot, Divider as it, Spin as q, Tag as nt, Alert as w, Skeleton as rt, Tree as lt, Button as dt, Row as ht, Col as I, Checkbox as N } from "antd";
9
- import { sortBy as _, get as m, isUndefined as A, flatten as ct, isArray as O } from "lodash-es";
10
- import { L as P, c as K, R as H, s as ut, b as pt } from "./chunks/router-CssZk5qZ.js";
7
+ import S, { createContext as ot } from "react";
8
+ import { Popover as it, Divider as nt, Spin as H, Tag as rt, Alert as w, Skeleton as lt, Tree as dt, Button as ht, Row as ct, Col as N, Checkbox as _ } from "antd";
9
+ import { sortBy as A, get as j, isUndefined as F, flatten as ut, isArray as O } from "lodash-es";
10
+ import { L as P, c as K, R as V, s as pt, b as ft } from "./chunks/router-CssZk5qZ.js";
11
11
  import { c as D } from "./chunks/config--bs_09I6.js";
12
12
  import L from "dataloader";
13
- import { c as V, b as z, g as ft } from "./chunks/dataset-BZpjo3Yq.js";
14
- import { M as xt, E as gt } from "./chunks/ErrorMsg-D5nALHuK.js";
15
- import { g as yt } from "./chunks/sector-ucUgPp75.js";
16
- import { C as R, N as mt } from "./chunks/DatasetCitation-Cep2dces.js";
17
- import { r as F, w as M } from "./chunks/storage-BgdCo9fV.js";
18
- const E = at({
13
+ import { c as z, b as G, g as xt } from "./chunks/dataset-BZpjo3Yq.js";
14
+ import { M as gt, E as yt } from "./chunks/ErrorMsg-D5nALHuK.js";
15
+ import { g as mt } from "./chunks/sector-ucUgPp75.js";
16
+ import { C as R, N as Ct } from "./chunks/DatasetCitation-Cep2dces.js";
17
+ import { r as M, w as B } from "./chunks/storage-BgdCo9fV.js";
18
+ const E = ot({
19
19
  datasetLoader: null,
20
20
  publisherLoader: null
21
- }), B = (x) => ({
22
- datasetLoader: new L((y) => z(y, x)),
21
+ }), W = (y) => ({
22
+ datasetLoader: new L((m) => G(m, y)),
23
23
  publisherLoader: new L(
24
- (y) => V(y, x)
24
+ (m) => z(m, y)
25
25
  )
26
26
  });
27
- class G extends j.Component {
27
+ class X extends S.Component {
28
28
  constructor(t) {
29
29
  super(t);
30
30
  // Returns the shared cache from TreeCacheContext if available, or a
31
31
  // throwaway local DataLoader so the popover still works even if context
32
32
  // doesn't reach this instance (which used to leave the spinner stuck
33
33
  // because getData early-returned with no loading state set).
34
- u(this, "getDatasetLoader", () => {
35
- var a;
34
+ h(this, "getDatasetLoader", () => {
35
+ var s;
36
36
  const { datasetKey: t } = this.props;
37
- return (a = this.context) != null && a.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new L(
38
- (o) => z(o, t)
37
+ return (s = this.context) != null && s.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new L(
38
+ (o) => G(o, t)
39
39
  )), this._localDatasetLoader);
40
40
  });
41
- u(this, "getPublisherLoader", () => {
42
- var a;
41
+ h(this, "getPublisherLoader", () => {
42
+ var s;
43
43
  const { datasetKey: t } = this.props;
44
- return (a = this.context) != null && a.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new L(
45
- (o) => V(o, t)
44
+ return (s = this.context) != null && s.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new L(
45
+ (o) => z(o, t)
46
46
  )), this._localPublisherLoader);
47
47
  });
48
- u(this, "componentDidMount", () => {
48
+ h(this, "componentDidMount", () => {
49
49
  const { sourceDatasetKeys: t } = this.props;
50
50
  t && t.length < 4 && this.setState({ showInNode: !0 }, this.getData);
51
51
  });
52
- u(this, "getData", () => {
52
+ h(this, "getData", () => {
53
53
  const { sourceDatasetKeys: t } = this.props;
54
54
  if (!(t != null && t.length)) return;
55
55
  this.setState({ loading: !0 });
56
- const a = this.getDatasetLoader();
56
+ const s = this.getDatasetLoader();
57
57
  Promise.all(
58
- t.map((o) => a.load(o).catch(() => null))
58
+ t.map((o) => s.load(o).catch(() => null))
59
59
  ).then((o) => {
60
- this.setState({ data: _(o, ["alias"]), loading: !1 });
60
+ this.setState({ data: A(o, ["alias"]), loading: !1 });
61
61
  }).catch(() => {
62
62
  this.setState({ data: [], loading: !1 });
63
63
  });
64
64
  });
65
- u(this, "getPublisherData", () => {
65
+ h(this, "getPublisherData", () => {
66
66
  const { publisherDatasetKeys: t } = this.props;
67
67
  if (!t) return;
68
- const a = this.getPublisherLoader();
68
+ const s = this.getPublisherLoader();
69
69
  Promise.all(
70
70
  Object.keys(t).map(
71
- (o) => a.load(o).then((r) => ({
72
- ...r,
71
+ (o) => s.load(o).then((i) => ({
72
+ ...i,
73
73
  datasets: t[o]
74
74
  })).catch(() => null)
75
75
  )
76
76
  ).then((o) => {
77
- this.setState({ publishers: _(o.filter(Boolean), ["alias"]) });
77
+ this.setState({ publishers: A(o.filter(Boolean), ["alias"]) });
78
78
  }).catch(() => {
79
79
  this.setState({ publishers: [] });
80
80
  });
81
81
  });
82
- u(this, "render", () => {
83
- const { data: t, showInNode: a, popOverVisible: o, loading: r } = this.state, { taxon: l, datasetKey: d } = this.props, i = { color: "orange", fontSize: "11px" }, f = (s) => `${D.clbPortal}/dataset/${d}/publisher/${s}`;
84
- return a ? t.filter((s) => !!s).map((s, n) => /* @__PURE__ */ e.jsx(
82
+ h(this, "render", () => {
83
+ const { data: t, showInNode: s, popOverVisible: o, loading: i } = this.state, { taxon: c, datasetKey: x } = this.props, n = { color: "orange", fontSize: "11px" }, r = (a) => `${D.clbPortal}/dataset/${x}/publisher/${a}`;
84
+ return s ? t.filter((a) => !!a).map((a, d) => /* @__PURE__ */ e.jsx(
85
85
  P,
86
86
  {
87
87
  to: "source",
88
- args: s.key,
88
+ args: a.key,
89
89
  className: "col-tree-data-source",
90
- style: i,
91
- children: (n ? ", " : "") + (s.alias || s.key)
90
+ style: n,
91
+ children: (d ? ", " : "") + (a.alias || a.key)
92
92
  },
93
- s.key
94
- )) : /* @__PURE__ */ e.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${l.id}`, children: /* @__PURE__ */ e.jsx(
95
- ot,
93
+ a.key
94
+ )) : /* @__PURE__ */ e.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${c.id}`, children: /* @__PURE__ */ e.jsx(
95
+ it,
96
96
  {
97
- getPopupContainer: () => document.getElementById(`taxon_sources_${l.id}`),
98
- content: r || t.length === 0 ? /* @__PURE__ */ e.jsx(
97
+ getPopupContainer: () => document.getElementById(`taxon_sources_${c.id}`),
98
+ content: i || t.length === 0 ? /* @__PURE__ */ e.jsx(
99
99
  "div",
100
100
  {
101
101
  style: { minWidth: "200px", textAlign: "center", padding: "8px 0" },
102
- children: /* @__PURE__ */ e.jsx(q, { size: "small" })
102
+ children: /* @__PURE__ */ e.jsx(H, { size: "small" })
103
103
  }
104
104
  ) : /* @__PURE__ */ e.jsxs("div", { style: { maxWidth: "500px" }, children: [
105
- t.length > 0 && /* @__PURE__ */ e.jsx("div", { children: t.filter((s) => !!s).map((s, n) => /* @__PURE__ */ e.jsx(
105
+ t.length > 0 && /* @__PURE__ */ e.jsx("div", { children: t.filter((a) => !!a).map((a, d) => /* @__PURE__ */ e.jsx(
106
106
  P,
107
107
  {
108
108
  to: "source",
109
- args: s.key,
109
+ args: a.key,
110
110
  className: "col-tree-data-source",
111
- style: i,
112
- children: (n ? ", " : "") + (s.alias || s.key)
111
+ style: n,
112
+ children: (d ? ", " : "") + (a.alias || a.key)
113
113
  },
114
- s.key
114
+ a.key
115
115
  )) }),
116
116
  this.state.publishers && this.state.publishers.length > 0 && /* @__PURE__ */ e.jsxs("div", { style: { marginTop: "12px" }, children: [
117
117
  /* @__PURE__ */ e.jsx("strong", { children: "Publishers" }),
118
- /* @__PURE__ */ e.jsx("div", { children: this.state.publishers.filter((s) => !!s).map((s, n) => {
119
- var p;
118
+ /* @__PURE__ */ e.jsx("div", { children: this.state.publishers.filter((a) => !!a).map((a, d) => {
119
+ var l;
120
120
  return /* @__PURE__ */ e.jsxs(
121
121
  "a",
122
122
  {
123
- href: f(s.id),
123
+ href: r(a.id),
124
124
  target: "_blank",
125
125
  rel: "noopener noreferrer",
126
- style: i,
126
+ style: n,
127
127
  children: [
128
- (n ? ", " : "") + (s.alias || s.id),
129
- (p = s.datasets) != null && p.length ? ` (${s.datasets.length.toLocaleString("en-GB")})` : ""
128
+ (d ? ", " : "") + (a.alias || a.id),
129
+ (l = a.datasets) != null && l.length ? ` (${a.datasets.length.toLocaleString("en-GB")})` : ""
130
130
  ]
131
131
  },
132
- s.id
132
+ a.id
133
133
  );
134
134
  }) })
135
135
  ] })
136
136
  ] }),
137
137
  title: /* @__PURE__ */ e.jsxs("div", { style: { padding: "4px 0" }, children: [
138
138
  /* @__PURE__ */ e.jsx("span", { style: { fontWeight: 500 }, children: "Sources for " }),
139
- /* @__PURE__ */ e.jsx("em", { children: l == null ? void 0 : l.name }),
140
- /* @__PURE__ */ e.jsx(it, { style: { margin: "8px 0 0" } })
139
+ /* @__PURE__ */ e.jsx("em", { children: c == null ? void 0 : c.name }),
140
+ /* @__PURE__ */ e.jsx(nt, { style: { margin: "8px 0 0" } })
141
141
  ] }),
142
142
  open: o,
143
- onOpenChange: (s) => this.setState({ popOverVisible: s }, () => {
144
- s && this.state.data.length === 0 && this.getData(), s && this.props.publisherDatasetKeys && !this.state.publishers && this.getPublisherData();
143
+ onOpenChange: (a) => this.setState({ popOverVisible: a }, () => {
144
+ a && this.state.data.length === 0 && this.getData(), a && this.props.publisherDatasetKeys && !this.state.publishers && this.getPublisherData();
145
145
  }),
146
146
  trigger: "click",
147
147
  placement: "rightTop",
@@ -152,7 +152,7 @@ class G extends j.Component {
152
152
  role: "button",
153
153
  tabIndex: 0,
154
154
  style: { cursor: "pointer", color: "orange", fontSize: "11px" },
155
- onClick: (s) => s.preventDefault(),
155
+ onClick: (a) => a.preventDefault(),
156
156
  children: "Multiple sources"
157
157
  }
158
158
  )
@@ -166,39 +166,39 @@ class G extends j.Component {
166
166
  };
167
167
  }
168
168
  }
169
- u(G, "contextType", E);
170
- const X = j.createContext();
171
- class k extends j.Component {
169
+ h(X, "contextType", E);
170
+ const Z = S.createContext();
171
+ class k extends S.Component {
172
172
  constructor(t) {
173
173
  super(t);
174
- u(this, "rankIsAboveSpecies", (t) => this.props.rank.indexOf(t) < this.props.rank.indexOf("species"));
175
- u(this, "render", () => {
174
+ h(this, "rankIsAboveSpecies", (t) => this.props.rank.indexOf(t) < this.props.rank.indexOf("species"));
175
+ h(this, "render", () => {
176
176
  const {
177
177
  taxon: t,
178
- taxon: { sector: a, sourceDatasetKeys: o, publisherDatasetKeys: r },
179
- datasetKey: l
180
- } = this.props, d = m(a, "dataset"), i = (o || []).filter((s) => (a == null ? void 0 : a.subjectDatasetKey) !== s).length > 0;
181
- t.estimate && t.estimates && t.estimates.find((s) => s.estimate === t.estimate);
182
- const f = typeof t.id == "string" && t.id.indexOf("incertae-sedis") > -1;
183
- return /* @__PURE__ */ e.jsx(X.Consumer, { children: ({ showInfo: s }) => /* @__PURE__ */ e.jsxs("div", { id: t.id, children: [
178
+ taxon: { sector: s, sourceDatasetKeys: o, publisherDatasetKeys: i },
179
+ datasetKey: c
180
+ } = this.props, x = j(s, "dataset"), n = (o || []).filter((a) => (s == null ? void 0 : s.subjectDatasetKey) !== a).length > 0;
181
+ t.estimate && t.estimates && t.estimates.find((a) => a.estimate === t.estimate);
182
+ const r = typeof t.id == "string" && t.id.indexOf("incertae-sedis") > -1;
183
+ return /* @__PURE__ */ e.jsx(Z.Consumer, { children: ({ showInfo: a }) => /* @__PURE__ */ e.jsxs("div", { id: t.id, children: [
184
184
  /* @__PURE__ */ e.jsxs("span", { children: [
185
185
  /* @__PURE__ */ e.jsxs("span", { className: "tree-node-rank", children: [
186
186
  t.rank,
187
187
  ": "
188
188
  ] }),
189
- f ? /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) : /* @__PURE__ */ e.jsx(P, { to: "taxon", args: t.id, children: /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) }),
190
- (t == null ? void 0 : t.merged) && /* @__PURE__ */ e.jsx(xt, { style: { marginLeft: "4px" }, datasetKey: t == null ? void 0 : t.datasetKey, verbatimSourceKey: t == null ? void 0 : t.verbatimSourceKey })
189
+ r ? /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) : /* @__PURE__ */ e.jsx(P, { to: "taxon", args: t.id, children: /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) }),
190
+ (t == null ? void 0 : t.merged) && /* @__PURE__ */ e.jsx(gt, { style: { marginLeft: "4px" }, datasetKey: t == null ? void 0 : t.datasetKey, verbatimSourceKey: t == null ? void 0 : t.verbatimSourceKey })
191
191
  ] }),
192
- s && t.status === "provisionally accepted" && /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
192
+ a && t.status === "provisionally accepted" && /* @__PURE__ */ e.jsxs(S.Fragment, { children: [
193
193
  " • ",
194
- /* @__PURE__ */ e.jsx(nt, { color: "warning", style: { marginRight: 0 }, children: "prov." })
194
+ /* @__PURE__ */ e.jsx(rt, { color: "warning", style: { marginRight: 0 }, children: "prov." })
195
195
  ] }),
196
- !A(t.count) && this.rankIsAboveSpecies(t == null ? void 0 : t.rank) && /* @__PURE__ */ e.jsxs("span", { children: [
196
+ !F(t.count) && this.rankIsAboveSpecies(t == null ? void 0 : t.rank) && /* @__PURE__ */ e.jsxs("span", { children: [
197
197
  " ",
198
198
  "• ",
199
199
  Number(t.count).toLocaleString(),
200
200
  " ",
201
- s && !A(t.speciesEstimate) && /* @__PURE__ */ e.jsxs("span", { children: [
201
+ a && !F(t.speciesEstimate) && /* @__PURE__ */ e.jsxs("span", { children: [
202
202
  " ",
203
203
  "of",
204
204
  " ",
@@ -211,31 +211,31 @@ class k extends j.Component {
211
211
  ] }),
212
212
  "spp."
213
213
  ] }),
214
- s && a && /* @__PURE__ */ e.jsxs("span", { children: [
214
+ a && s && /* @__PURE__ */ e.jsxs("span", { children: [
215
215
  /* @__PURE__ */ e.jsx("span", { children: " • " }),
216
216
  /* @__PURE__ */ e.jsxs(
217
217
  P,
218
218
  {
219
219
  to: "source",
220
- args: a.subjectDatasetKey,
221
- style: i ? { fontWeight: "bold" } : null,
220
+ args: s.subjectDatasetKey,
221
+ style: n ? { fontWeight: "bold" } : null,
222
222
  className: "col-tree-data-source",
223
223
  children: [
224
- m(d, "alias") || a.subjectDatasetKey,
225
- i && ", "
224
+ j(x, "alias") || s.subjectDatasetKey,
225
+ n && ", "
226
226
  ]
227
227
  }
228
228
  )
229
229
  ] }),
230
- s && i && /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
230
+ a && n && /* @__PURE__ */ e.jsxs(S.Fragment, { children: [
231
231
  " ",
232
232
  /* @__PURE__ */ e.jsx(
233
- G,
233
+ X,
234
234
  {
235
235
  sourceDatasetKeys: o,
236
- publisherDatasetKeys: r,
236
+ publisherDatasetKeys: i,
237
237
  taxon: t,
238
- datasetKey: l
238
+ datasetKey: c
239
239
  }
240
240
  )
241
241
  ] })
@@ -248,46 +248,46 @@ class k extends j.Component {
248
248
  };
249
249
  }
250
250
  }
251
- const b = 1e3, Z = "__loadMoreBTN__", W = (x) => `${Z}${x}`, U = (x) => typeof x == "string" && x.startsWith(Z);
252
- class Ct extends j.Component {
251
+ const b = 1e3, J = "__loadMoreBTN__", U = (y) => `${J}${y}`, q = (y) => typeof y == "string" && y.startsWith(J);
252
+ class jt extends S.Component {
253
253
  constructor(t) {
254
254
  super(t);
255
- u(this, "onClick", () => {
255
+ h(this, "onClick", () => {
256
256
  this.setState(
257
257
  { loading: !0 },
258
258
  () => this.props.onClick().then(() => this.setState({ loading: !1 }))
259
259
  );
260
260
  });
261
- u(this, "render", () => {
261
+ h(this, "render", () => {
262
262
  const { loading: t } = this.state;
263
- return /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
264
- t && /* @__PURE__ */ e.jsx(q, {}),
263
+ return /* @__PURE__ */ e.jsxs(S.Fragment, { children: [
264
+ t && /* @__PURE__ */ e.jsx(H, {}),
265
265
  !t && /* @__PURE__ */ e.jsx("a", { onClick: this.onClick, children: /* @__PURE__ */ e.jsx("strong", { children: "Load more..." }) })
266
266
  ] });
267
267
  });
268
268
  this.state = { loading: !1 };
269
269
  }
270
270
  }
271
- class J extends j.Component {
271
+ class Q extends S.Component {
272
272
  constructor(t) {
273
273
  super(t);
274
- u(this, "componentDidMount", () => {
274
+ h(this, "componentDidMount", () => {
275
275
  const { datasetKey: t } = this.props;
276
276
  this.loadRoot(), this.sectorLoader = new L(
277
- (o) => yt(o, t)
277
+ (o) => mt(o, t)
278
278
  ), this.getRank();
279
- const { treeRef: a } = this.props;
280
- a(this);
279
+ const { treeRef: s } = this.props;
280
+ s(this);
281
281
  });
282
- u(this, "componentDidUpdate", (t) => {
282
+ h(this, "componentDidUpdate", (t) => {
283
283
  (t.defaultExpandKey !== this.props.defaultExpandKey || t.hideExtinct !== this.props.hideExtinct || t.insertPlaceholder !== this.props.insertPlaceholder) && this.reloadRoot();
284
284
  });
285
- u(this, "getRank", () => {
285
+ h(this, "getRank", () => {
286
286
  K(`${D.dataApi}vocab/rank`).then(
287
- (t) => this.setState({ rank: t.data.map((a) => a.name) })
287
+ (t) => this.setState({ rank: t.data.map((s) => s.name) })
288
288
  );
289
289
  });
290
- u(this, "reloadRoot", () => this.setState(
290
+ h(this, "reloadRoot", () => this.setState(
291
291
  {
292
292
  rootLoading: !0,
293
293
  treeData: [],
@@ -305,46 +305,46 @@ class J extends j.Component {
305
305
  // StrictMode's double mount in dev, or a prop change while a load is in
306
306
  // flight — both merged their page into treeData, so every root appeared
307
307
  // twice and antd warned "Same 'key' exist in the Tree" (issue #59).
308
- u(this, "loadRoot", async (t = !1) => {
308
+ h(this, "loadRoot", async (t = !1) => {
309
309
  const {
310
- showSourceTaxon: a,
310
+ showSourceTaxon: s,
311
311
  datasetKey: o,
312
- hideExtinct: r,
313
- insertPlaceholder: l,
314
- type: d,
315
- expandedTaxonKey: i
316
- } = this.props, f = i, { defaultTaxonKey: s } = this.props, n = ++this.rootRequestId, p = t ? this.state.treeData.length : 0;
312
+ hideExtinct: i,
313
+ insertPlaceholder: c,
314
+ type: x,
315
+ expandedTaxonKey: n
316
+ } = this.props, r = n, { defaultTaxonKey: a } = this.props, d = ++this.rootRequestId, l = t ? this.state.treeData.length : 0;
317
317
  return this.setState(
318
318
  t ? { rootLoading: !0 } : { rootLoading: !0, treeData: [] }
319
319
  ), K(
320
- `${D.dataApi}dataset/${o}/tree?projectKey=${o}${d ? "&type=" + d : ""}&limit=${b}&offset=${p}${r ? "&extinct=false&extinct=" : ""}${l ? "&insertPlaceholder=true" : ""}`
321
- ).then(this.decorateWithSectorsAndDataset).then((C) => {
322
- if (n !== this.rootRequestId) return;
323
- const c = C.data.result || [], h = C.data.total, g = c.map((S) => {
320
+ `${D.dataApi}dataset/${o}/tree?projectKey=${o}${x ? "&type=" + x : ""}&limit=${b}&offset=${l}${i ? "&extinct=false&extinct=" : ""}${c ? "&insertPlaceholder=true" : ""}`
321
+ ).then(this.decorateWithSectorsAndDataset).then((p) => {
322
+ if (d !== this.rootRequestId) return;
323
+ const g = p.data.result || [], u = p.data.total, f = g.map((C) => {
324
324
  let T = {
325
- taxon: S,
326
- key: S.id,
325
+ taxon: C,
326
+ key: C.id,
327
327
  datasetKey: o,
328
- childCount: S.childCount,
329
- isLeaf: S.childCount === 0,
328
+ childCount: C.childCount,
329
+ isLeaf: C.childCount === 0,
330
330
  childOffset: 0
331
331
  };
332
332
  return T.title = /* @__PURE__ */ e.jsx(
333
333
  k,
334
334
  {
335
- taxon: S,
335
+ taxon: C,
336
336
  datasetKey: o,
337
- showSourceTaxon: a,
337
+ showSourceTaxon: s,
338
338
  reloadChildren: () => this.fetchChildPage(T, !0),
339
339
  rank: this.state.rank
340
340
  }
341
341
  ), T.ref = T, T;
342
342
  });
343
343
  this.setState(
344
- (S) => ({
345
- rootTotal: h,
344
+ (C) => ({
345
+ rootTotal: u,
346
346
  rootLoading: !1,
347
- treeData: t ? [...S.treeData, ...g] : g,
347
+ treeData: t ? [...C.treeData, ...f] : f,
348
348
  // Nothing is auto-expanded by default. Consumers open a specific root
349
349
  // (or deep taxon) by passing `defaultTaxonKey`/`expandedTaxonKey` —
350
350
  // e.g. defaultTaxonKey="CS5HF" opens Eukaryota in current COL releases.
@@ -352,40 +352,40 @@ class J extends j.Component {
352
352
  error: null
353
353
  }),
354
354
  () => {
355
- if (f)
356
- return this.expandToTaxon(f);
357
- if (s)
358
- return this.expandToTaxon(s);
355
+ if (r)
356
+ return this.expandToTaxon(r);
357
+ if (a)
358
+ return this.expandToTaxon(a, !1);
359
359
  }
360
- ), g.length === 1 && this.fetchChildPage(g[g.length - 1]);
361
- }).catch((C) => {
362
- n === this.rootRequestId && this.setState({
360
+ ), f.length === 1 && this.fetchChildPage(f[f.length - 1]);
361
+ }).catch((p) => {
362
+ d === this.rootRequestId && this.setState({
363
363
  treeData: [],
364
364
  rootLoading: !1,
365
365
  expandedKeys: [],
366
- error: C
366
+ error: p
367
367
  });
368
368
  });
369
369
  });
370
- u(this, "expandToTaxon", async (t) => {
370
+ h(this, "expandToTaxon", async (t, s = !0) => {
371
371
  const {
372
- showSourceTaxon: a,
373
- datasetKey: o,
374
- hideExtinct: r,
375
- type: l
372
+ showSourceTaxon: o,
373
+ datasetKey: i,
374
+ hideExtinct: c,
375
+ type: x
376
376
  } = this.props;
377
377
  this.setState({
378
378
  rootLoading: !0
379
379
  /* , treeData: [] */
380
380
  });
381
- const { data: d } = await K(
382
- `${D.dataApi}dataset/${o}/tree/${t}?projectKey=${o}&insertPlaceholder=true${l ? "&type=" + l : ""}${r ? "&extinct=false" : ""}`
381
+ const { data: n } = await K(
382
+ `${D.dataApi}dataset/${i}/tree/${t}?projectKey=${i}&insertPlaceholder=true${x ? "&type=" + x : ""}${c ? "&extinct=false" : ""}`
383
383
  ).then(
384
- (c) => this.decorateWithSectorsAndDataset({
385
- data: { result: c.data }
386
- }).then(() => c)
384
+ (u) => this.decorateWithSectorsAndDataset({
385
+ data: { result: u.data }
386
+ }).then(() => u)
387
387
  );
388
- if (d.length === 0)
388
+ if (n.length === 0)
389
389
  return this.setState(
390
390
  {
391
391
  error: {
@@ -394,159 +394,159 @@ class J extends j.Component {
394
394
  },
395
395
  this.loadRoot
396
396
  );
397
- const i = d[d.length - 1];
398
- let f = {
399
- taxon: i,
400
- key: i.id,
401
- datasetKey: o,
402
- childCount: i.childCount,
403
- isLeaf: i.childCount === 0,
397
+ const r = n[n.length - 1];
398
+ let a = {
399
+ taxon: r,
400
+ key: r.id,
401
+ datasetKey: i,
402
+ childCount: r.childCount,
403
+ isLeaf: r.childCount === 0,
404
404
  childOffset: 0
405
405
  };
406
- f.title = /* @__PURE__ */ e.jsx(
406
+ a.title = /* @__PURE__ */ e.jsx(
407
407
  k,
408
408
  {
409
- taxon: i,
410
- datasetKey: o,
411
- showSourceTaxon: a,
409
+ taxon: r,
410
+ datasetKey: i,
411
+ showSourceTaxon: o,
412
412
  rank: this.state.rank,
413
- reloadChildren: () => this.fetchChildPage(f, !0)
413
+ reloadChildren: () => this.fetchChildPage(a, !0)
414
414
  }
415
- ), f.ref = f;
416
- const s = f;
417
- for (let c = d.length - 2; c >= 0; c--) {
418
- const h = d[c], g = {
419
- taxon: h,
420
- key: h.id,
421
- datasetKey: o,
422
- childCount: h.childCount,
423
- isLeaf: h.childCount === 0,
415
+ ), a.ref = a;
416
+ const d = a;
417
+ for (let u = n.length - 2; u >= 0; u--) {
418
+ const f = n[u], C = {
419
+ taxon: f,
420
+ key: f.id,
421
+ datasetKey: i,
422
+ childCount: f.childCount,
423
+ isLeaf: f.childCount === 0,
424
424
  childOffset: 0
425
425
  };
426
- g.ref = g, g.title = /* @__PURE__ */ e.jsx(
426
+ C.ref = C, C.title = /* @__PURE__ */ e.jsx(
427
427
  k,
428
428
  {
429
- taxon: h,
430
- datasetKey: o,
431
- showSourceTaxon: a,
429
+ taxon: f,
430
+ datasetKey: i,
431
+ showSourceTaxon: o,
432
432
  rank: this.state.rank,
433
- reloadChildren: () => this.fetchChildPage(g, !0)
433
+ reloadChildren: () => this.fetchChildPage(C, !0)
434
434
  }
435
- ), f.children = [g], f = g;
435
+ ), a.children = [C], a = C;
436
436
  }
437
- const { treeData: n } = this.state;
438
- var p = n.findIndex((c) => c.key == s.key);
439
- n[p] = s;
440
- const C = [...d.map((c) => c.id).reverse()];
437
+ const { treeData: l } = this.state;
438
+ var p = l.findIndex((u) => u.key == d.key);
439
+ l[p] = d;
440
+ const g = [...n.map((u) => u.id).reverse()];
441
441
  this.setState(
442
- { treeData: n },
443
- () => this.reloadLoadedKeys(C, t)
442
+ { treeData: l },
443
+ () => this.reloadLoadedKeys(g, t, !0, s)
444
444
  );
445
445
  });
446
- u(this, "fetchChildPage", async (t, a, o) => {
446
+ h(this, "fetchChildPage", async (t, s, o) => {
447
447
  const {
448
- showSourceTaxon: r,
449
- datasetKey: l,
450
- hideExtinct: d,
451
- insertPlaceholder: i,
452
- type: f
448
+ showSourceTaxon: i,
449
+ datasetKey: c,
450
+ hideExtinct: x,
451
+ insertPlaceholder: n,
452
+ type: r
453
453
  } = this.props;
454
- m(t, "childCount");
455
- const s = b, n = m(t, "childOffset"), p = await K(
456
- `${D.dataApi}dataset/${l}/tree/${t.taxon.id}/children?limit=${s}&offset=${n}&projectKey=${l}${f ? "&type=" + f : ""}${d ? "&extinct=false" : ""}${i ? "&insertPlaceholder=true" : ""}`
454
+ j(t, "childCount");
455
+ const a = b, d = j(t, "childOffset"), l = await K(
456
+ `${D.dataApi}dataset/${c}/tree/${t.taxon.id}/children?limit=${a}&offset=${d}&projectKey=${c}${r ? "&type=" + r : ""}${x ? "&extinct=false" : ""}${n ? "&insertPlaceholder=true" : ""}`
457
457
  );
458
- await this.decorateWithSectorsAndDataset(p);
459
- const C = p.data.result ? p.data.result.map((c) => {
460
- let h = {
461
- taxon: c,
462
- key: c.id,
463
- datasetKey: l,
464
- childCount: c.childCount,
465
- isLeaf: c.childCount === 0,
458
+ await this.decorateWithSectorsAndDataset(l);
459
+ const p = l.data.result ? l.data.result.map((g) => {
460
+ let u = {
461
+ taxon: g,
462
+ key: g.id,
463
+ datasetKey: c,
464
+ childCount: g.childCount,
465
+ isLeaf: g.childCount === 0,
466
466
  childOffset: 0,
467
467
  parent: t,
468
- name: c.name
468
+ name: g.name
469
469
  };
470
- return h.title = /* @__PURE__ */ e.jsx(
470
+ return u.title = /* @__PURE__ */ e.jsx(
471
471
  k,
472
472
  {
473
- taxon: c,
474
- datasetKey: l,
475
- showSourceTaxon: r,
473
+ taxon: g,
474
+ datasetKey: c,
475
+ showSourceTaxon: i,
476
476
  rank: this.state.rank,
477
- reloadChildren: () => this.fetchChildPage(h, !0)
477
+ reloadChildren: () => this.fetchChildPage(u, !0)
478
478
  }
479
- ), h.ref = h, h;
479
+ ), u.ref = u, u;
480
480
  }) : [];
481
- if (t.children = t.children && n !== 0 && !a ? [...t.children, ...C] : C, p.data.last && t.childCount > t.children.length && (t.childCount = t.children.length), !p.data.last) {
482
- const c = () => (t.childOffset += b, U(m(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), this.fetchChildPage(t, !1));
481
+ if (t.children = t.children && d !== 0 && !s ? [...t.children, ...p] : p, l.data.last && t.childCount > t.children.length && (t.childCount = t.children.length), !l.data.last) {
482
+ const g = () => (t.childOffset += b, q(j(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), this.fetchChildPage(t, !1));
483
483
  t.children = [
484
484
  ...t.children,
485
485
  {
486
486
  title: /* @__PURE__ */ e.jsx(
487
- Ct,
487
+ jt,
488
488
  {
489
- onClick: c
489
+ onClick: g
490
490
  },
491
- W(t.key)
491
+ U(t.key)
492
492
  ),
493
- key: W(t.key),
493
+ key: U(t.key),
494
494
  childCount: 0,
495
495
  isLeaf: !0
496
496
  }
497
497
  ];
498
498
  }
499
- o || this.setState((c) => ({
500
- treeData: [...c.treeData],
501
- loadedKeys: [.../* @__PURE__ */ new Set([...c.loadedKeys, t.key])]
499
+ o || this.setState((g) => ({
500
+ treeData: [...g.treeData],
501
+ loadedKeys: [.../* @__PURE__ */ new Set([...g.loadedKeys, t.key])]
502
502
  }));
503
503
  });
504
- u(this, "decorateWithSectorsAndDataset", (t) => t.data.result ? Promise.all(
505
- t.data.result.filter((a) => !!a.sectorDatasetKey).map(
506
- (a) => this.datasetLoader.load(a.sectorDatasetKey).then(
507
- (o) => a.sector = {
508
- id: a.sectorKey,
509
- subjectDatasetKey: a.sectorDatasetKey,
504
+ h(this, "decorateWithSectorsAndDataset", (t) => t.data.result ? Promise.all(
505
+ t.data.result.filter((s) => !!s.sectorDatasetKey).map(
506
+ (s) => this.datasetLoader.load(s.sectorDatasetKey).then(
507
+ (o) => s.sector = {
508
+ id: s.sectorKey,
509
+ subjectDatasetKey: s.sectorDatasetKey,
510
510
  dataset: o
511
511
  }
512
512
  )
513
513
  )
514
514
  ).then(() => t) : t);
515
- u(this, "onLoadData", (t, a = !1) => (a && (t.childOffset = 0), this.fetchChildPage(t.ref, a)));
516
- u(this, "findNode", (t, a) => {
515
+ h(this, "onLoadData", (t, s = !1) => (s && (t.childOffset = 0), this.fetchChildPage(t.ref, s)));
516
+ h(this, "findNode", (t, s) => {
517
517
  let o = null;
518
- if (o = a.find((r) => m(r, "taxon.id") === t), o)
518
+ if (o = s.find((i) => j(i, "taxon.id") === t), o)
519
519
  return o;
520
520
  {
521
- const r = a.map((d) => m(d, "children") || []), l = ct(r);
522
- return l.length === 0 ? null : this.findNode(t, l);
521
+ const i = s.map((x) => j(x, "children") || []), c = ut(i);
522
+ return c.length === 0 ? null : this.findNode(t, c);
523
523
  }
524
524
  });
525
- u(this, "pageThroughChildrenUntilTaxonFound", async (t, a) => {
525
+ h(this, "pageThroughChildrenUntilTaxonFound", async (t, s) => {
526
526
  let o;
527
527
  for (; !o && t.children.length < t.childCount; )
528
- t.childOffset += b, U(m(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), await this.fetchChildPage(t, !1, !0), o = this.findNode(a, t.children);
528
+ t.childOffset += b, q(j(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), await this.fetchChildPage(t, !1, !0), o = this.findNode(s, t.children);
529
529
  return o || (o = t.children.find(
530
- (r) => m(r, "taxon.id") ? r.taxon.id.indexOf("incertae-sedis") > -1 : !1
530
+ (i) => j(i, "taxon.id") ? i.taxon.id.indexOf("incertae-sedis") > -1 : !1
531
531
  )), o;
532
532
  });
533
- u(this, "reloadLoadedKeys", async (t, a, o = !0) => {
533
+ h(this, "reloadLoadedKeys", async (t, s, o = !0, i = !0) => {
534
534
  this.setState({ rootLoading: !0 });
535
- const { loadedKeys: r } = this.state;
536
- let { treeData: l } = this.state;
537
- const d = a ? this.findNode(a, l) : null, i = t ? [...t] : [...r];
538
- for (let s = 0; s < i.length; s++) {
539
- let n = this.findNode(i[s], l);
540
- if (!n && d && i[s - 1]) {
541
- const p = this.findNode(i[s - 1], l);
542
- p && O(m(p, "children")) && p.children.length > 0 && (n = await this.pageThroughChildrenUntilTaxonFound(
535
+ const { loadedKeys: c } = this.state;
536
+ let { treeData: x } = this.state;
537
+ const n = s ? this.findNode(s, x) : null, r = t ? [...t] : [...c];
538
+ for (let d = 0; d < r.length; d++) {
539
+ let l = this.findNode(r[d], x);
540
+ if (!l && n && r[d - 1]) {
541
+ const p = this.findNode(r[d - 1], x);
542
+ p && O(j(p, "children")) && p.children.length > 0 && (l = await this.pageThroughChildrenUntilTaxonFound(
543
543
  p,
544
- i[s]
545
- ), n ? i.splice(s, 0, n.taxon.id) : this.setState(
544
+ r[d]
545
+ ), l ? r.splice(d, 0, l.taxon.id) : this.setState(
546
546
  {
547
547
  nodeNotFoundErr: /* @__PURE__ */ e.jsxs("span", { children: [
548
548
  "Cannot find taxon ",
549
- a,
549
+ s,
550
550
  " in tree 😥"
551
551
  ] }),
552
552
  rootLoading: !1
@@ -562,37 +562,37 @@ class J extends j.Component {
562
562
  } */
563
563
  ));
564
564
  }
565
- if (n) {
566
- await this.fetchChildPage(n, !0, !0);
567
- let p = n.children.find(
568
- (C) => m(C, "taxon.id") === m(d, "taxon.id")
565
+ if (l) {
566
+ await this.fetchChildPage(l, !0, !0);
567
+ let p = l.children.find(
568
+ (g) => j(g, "taxon.id") === j(n, "taxon.id")
569
569
  );
570
- d && s === i.length - 2 && m(n, "taxon.id") !== m(d, "taxon.id") && O(n.children) && !p && n.children.length < n.childCount && (p = await this.pageThroughChildrenUntilTaxonFound(
571
- n,
572
- m(d, "taxon.id")
570
+ n && d === r.length - 2 && j(l, "taxon.id") !== j(n, "taxon.id") && O(l.children) && !p && l.children.length < l.childCount && (p = await this.pageThroughChildrenUntilTaxonFound(
571
+ l,
572
+ j(n, "taxon.id")
573
573
  ), p ? this.setState({ treeData: [...this.state.treeData] }, () => {
574
- setTimeout(() => {
575
- document.getElementById(a).scrollIntoView({ behavior: "smooth", block: "center" });
574
+ i && setTimeout(() => {
575
+ document.getElementById(s).scrollIntoView({ behavior: "smooth", block: "center" });
576
576
  }, 100);
577
577
  }) : this.setState(
578
578
  {
579
579
  nodeNotFoundErr: /* @__PURE__ */ e.jsxs("span", { children: [
580
580
  "Cannot find taxon ",
581
- a,
581
+ s,
582
582
  " in tree 😥"
583
583
  ] }),
584
584
  rootLoading: !1
585
585
  },
586
586
  () => {
587
- this.props.treeType === "CATALOGUE" && typeof this.props.addMissingTargetKey == "function" && this.props.addMissingTargetKey(a);
587
+ this.props.treeType === "CATALOGUE" && typeof this.props.addMissingTargetKey == "function" && this.props.addMissingTargetKey(s);
588
588
  }
589
589
  ));
590
590
  }
591
591
  }
592
- const f = { loadedKeys: i, rootLoading: !1 };
593
- o && (f.expandedKeys = i), this.setState(f, () => {
594
- a && setTimeout(() => {
595
- document.getElementById(a).scrollIntoView({ behavior: "smooth", block: "center" });
592
+ const a = { loadedKeys: r, rootLoading: !1 };
593
+ o && (a.expandedKeys = r), this.setState(a, () => {
594
+ s && i && setTimeout(() => {
595
+ document.getElementById(s).scrollIntoView({ behavior: "smooth", block: "center" });
596
596
  }, 100);
597
597
  });
598
598
  });
@@ -605,7 +605,7 @@ class J extends j.Component {
605
605
  error: null,
606
606
  nodeNotFoundErr: null,
607
607
  rank: []
608
- }, this.treeRef = j.createRef(), this.rootRequestId = 0;
608
+ }, this.treeRef = S.createRef(), this.rootRequestId = 0;
609
609
  }
610
610
  // datasetLoader comes from the shared TreeCacheContext so multiple tree
611
611
  // nodes (and TaxonSources instances) share one in-memory cache instead
@@ -616,22 +616,22 @@ class J extends j.Component {
616
616
  render() {
617
617
  const {
618
618
  error: t,
619
- rootTotal: a,
619
+ rootTotal: s,
620
620
  rootLoading: o,
621
- treeData: r,
622
- defaultExpandAll: l,
623
- nodeNotFoundErr: d,
624
- loadedKeys: i,
625
- expandedKeys: f
626
- } = this.state, { treeType: s, dataset: n, height: p, expandedTaxonKey: C } = this.props, c = C;
621
+ treeData: i,
622
+ defaultExpandAll: c,
623
+ nodeNotFoundErr: x,
624
+ loadedKeys: n,
625
+ expandedKeys: r
626
+ } = this.state, { treeType: a, dataset: d, height: l, expandedTaxonKey: p } = this.props, g = p;
627
627
  return /* @__PURE__ */ e.jsxs("div", { children: [
628
- t && /* @__PURE__ */ e.jsx(j.Fragment, { children: m(t, "response.data.code") !== 404 ? /* @__PURE__ */ e.jsx(
628
+ t && /* @__PURE__ */ e.jsx(S.Fragment, { children: j(t, "response.data.code") !== 404 ? /* @__PURE__ */ e.jsx(
629
629
  w,
630
630
  {
631
631
  closable: !0,
632
632
  onClose: () => this.setState({ error: null }),
633
633
  style: { marginTop: "8px" },
634
- message: /* @__PURE__ */ e.jsx(gt, { error: t }),
634
+ message: /* @__PURE__ */ e.jsx(yt, { error: t }),
635
635
  type: "error"
636
636
  }
637
637
  ) : /* @__PURE__ */ e.jsx(
@@ -644,100 +644,101 @@ class J extends j.Component {
644
644
  Custom404,
645
645
  {
646
646
  error: t,
647
- treeType: s,
648
- dataset: n,
647
+ treeType: a,
648
+ dataset: d,
649
649
  loadRoot: this.loadRoot
650
650
  }
651
651
  ),
652
652
  type: "warning"
653
653
  }
654
654
  ) }),
655
- d && /* @__PURE__ */ e.jsx(
655
+ x && /* @__PURE__ */ e.jsx(
656
656
  w,
657
657
  {
658
658
  closable: !0,
659
659
  onClose: () => this.setState({ nodeNotFoundErr: null }),
660
660
  style: { marginTop: "8px" },
661
- message: d,
661
+ message: x,
662
662
  type: "warning"
663
663
  }
664
664
  ),
665
- o && /* @__PURE__ */ e.jsx(rt, { paragraph: { rows: 10 }, active: !0 }),
666
- !o && r.length > 0 && /* @__PURE__ */ e.jsx(
667
- lt,
665
+ o && /* @__PURE__ */ e.jsx(lt, { paragraph: { rows: 10 }, active: !0 }),
666
+ !o && i.length > 0 && /* @__PURE__ */ e.jsx(
667
+ dt,
668
668
  {
669
669
  ref: this.treeRef,
670
- defaultExpandAll: l,
670
+ defaultExpandAll: c,
671
671
  loadData: this.onLoadData,
672
- onLoad: (h) => this.setState({ loadedKeys: h }),
673
- loadedKeys: i,
674
- expandedKeys: f,
675
- treeData: r,
676
- filterTreeNode: (h) => h.key === c,
677
- onExpand: (h, g) => {
678
- this.setState({ expandedKeys: h }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
679
- g.expanded ? g.node.key : null
672
+ onLoad: (u) => this.setState({ loadedKeys: u }),
673
+ loadedKeys: n,
674
+ expandedKeys: r,
675
+ treeData: i,
676
+ filterTreeNode: (u) => u.key === g,
677
+ onExpand: (u, f) => {
678
+ this.setState({ expandedKeys: u }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
679
+ f.expanded ? f.node.key : null
680
680
  );
681
681
  }
682
682
  }
683
683
  ),
684
- !t && r.length < a && /* @__PURE__ */ e.jsxs(dt, { loading: o, onClick: () => this.loadRoot(!0), children: [
684
+ !t && i.length < s && /* @__PURE__ */ e.jsxs(ht, { loading: o, onClick: () => this.loadRoot(!0), children: [
685
685
  "Load more",
686
686
  " "
687
687
  ] })
688
688
  ] });
689
689
  }
690
690
  }
691
- u(J, "contextType", E);
692
- const jt = [
691
+ h(Q, "contextType", E);
692
+ const St = [
693
693
  "infraspecific name",
694
694
  "species",
695
695
  "variety",
696
696
  "form"
697
697
  ];
698
- class Q extends j.Component {
698
+ class Y extends S.Component {
699
699
  constructor(t) {
700
700
  super(t);
701
- u(this, "componentDidMount", async () => {
702
- const { datasetKey: t, citation: a } = this.props;
703
- if (a)
701
+ h(this, "componentDidMount", async () => {
702
+ const { datasetKey: t, citation: s } = this.props;
703
+ if (s)
704
704
  try {
705
- const { data: o } = await ft(t);
705
+ const { data: o } = await xt(t);
706
706
  this.setState({ dataset: o });
707
707
  } catch {
708
708
  }
709
709
  });
710
- u(this, "render", () => {
710
+ h(this, "render", () => {
711
711
  const {
712
712
  datasetKey: t,
713
- defaultTaxonKey: a,
713
+ defaultTaxonKey: s,
714
714
  expandedTaxonKey: o,
715
- onExpandedTaxonKeyChange: r,
716
- showTreeOptions: l,
717
- linkToSpeciesPage: d,
718
- citation: i,
719
- type: f,
720
- insertPlaceholder: s = !0
721
- } = this.props, { hideExtinct: n, dataset: p } = this.state, C = (h) => {
722
- var T, $;
723
- const g = m(h, "key");
724
- if (!g) return;
725
- const S = m(h, "rank");
726
- if (d && jt.includes(S)) {
727
- const v = ($ = (T = this.context) == null ? void 0 : T.taxon) == null ? void 0 : $.onNavigate;
728
- v && v(g);
729
- } else r && (r(g), this.treeRef && this.treeRef.reloadRoot && this.treeRef.reloadRoot());
730
- }, c = () => {
731
- r && r(null);
715
+ onExpandedTaxonKeyChange: i,
716
+ showTreeOptions: c,
717
+ linkToSpeciesPage: x,
718
+ citation: n,
719
+ type: r,
720
+ insertPlaceholder: a = !0,
721
+ autoFocus: d
722
+ } = this.props, { hideExtinct: l, dataset: p } = this.state, g = (f) => {
723
+ var $, v;
724
+ const C = j(f, "key");
725
+ if (!C) return;
726
+ const T = j(f, "rank");
727
+ if (x && St.includes(T)) {
728
+ const I = (v = ($ = this.context) == null ? void 0 : $.taxon) == null ? void 0 : v.onNavigate;
729
+ I && I(C);
730
+ } else i && (i(C), this.treeRef && this.treeRef.reloadRoot && this.treeRef.reloadRoot());
731
+ }, u = () => {
732
+ i && i(null);
732
733
  };
733
734
  return /* @__PURE__ */ e.jsxs("div", { className: "catalogue-of-life", children: [
734
- i === "top" && p && /* @__PURE__ */ e.jsx(R, { dataset: p }),
735
- /* @__PURE__ */ e.jsx(E.Provider, { value: this.cache, children: /* @__PURE__ */ e.jsxs(X.Provider, { value: this.state, children: [
736
- /* @__PURE__ */ e.jsxs(ht, { children: [
737
- /* @__PURE__ */ e.jsx(I, { flex: "auto", children: /* @__PURE__ */ e.jsx(
738
- mt,
735
+ n === "top" && p && /* @__PURE__ */ e.jsx(R, { dataset: p }),
736
+ /* @__PURE__ */ e.jsx(E.Provider, { value: this.cache, children: /* @__PURE__ */ e.jsxs(Z.Provider, { value: this.state, children: [
737
+ /* @__PURE__ */ e.jsxs(ct, { children: [
738
+ /* @__PURE__ */ e.jsx(N, { flex: "auto", children: /* @__PURE__ */ e.jsx(
739
+ Ct,
739
740
  {
740
- hideExtinct: n,
741
+ hideExtinct: l,
741
742
  datasetKey: t,
742
743
  style: {
743
744
  width: "100%",
@@ -745,27 +746,28 @@ class Q extends j.Component {
745
746
  paddingBottom: "5px"
746
747
  },
747
748
  defaultTaxonKey: o || null,
748
- onSelectName: C,
749
- onResetSearch: c
749
+ onSelectName: g,
750
+ onResetSearch: u,
751
+ autoFocus: d
750
752
  }
751
753
  ) }),
752
- l && /* @__PURE__ */ e.jsxs(I, { style: { paddingLeft: "8px" }, children: [
754
+ c && /* @__PURE__ */ e.jsxs(N, { style: { paddingLeft: "8px" }, children: [
753
755
  /* @__PURE__ */ e.jsx(
754
- N,
756
+ _,
755
757
  {
756
758
  defaultChecked: this.state.showInfo,
757
- onChange: ({ target: { checked: h } }) => {
758
- this.setState({ showInfo: h }), M("tree-show-source", h);
759
+ onChange: ({ target: { checked: f } }) => {
760
+ this.setState({ showInfo: f }), B("tree-show-source", f);
759
761
  },
760
762
  children: "Source"
761
763
  }
762
764
  ),
763
765
  /* @__PURE__ */ e.jsx(
764
- N,
766
+ _,
765
767
  {
766
768
  defaultChecked: this.state.hideExtinct,
767
- onChange: ({ target: { checked: h } }) => {
768
- this.setState({ hideExtinct: h }), M("tree-extant-only", h);
769
+ onChange: ({ target: { checked: f } }) => {
770
+ this.setState({ hideExtinct: f }), B("tree-extant-only", f);
769
771
  },
770
772
  children: "Extant only"
771
773
  }
@@ -773,63 +775,65 @@ class Q extends j.Component {
773
775
  ] })
774
776
  ] }),
775
777
  /* @__PURE__ */ e.jsx(
776
- J,
778
+ Q,
777
779
  {
778
- insertPlaceholder: s,
779
- hideExtinct: n,
780
+ insertPlaceholder: a,
781
+ hideExtinct: l,
780
782
  datasetKey: t,
781
- defaultTaxonKey: a,
783
+ defaultTaxonKey: s,
782
784
  expandedTaxonKey: o,
783
- onExpandedTaxonKeyChange: r,
784
- treeRef: (h) => this.treeRef = h,
785
- type: f
785
+ onExpandedTaxonKeyChange: i,
786
+ treeRef: (f) => this.treeRef = f,
787
+ type: r
786
788
  }
787
789
  )
788
790
  ] }) }),
789
- i === "bottom" && p && /* @__PURE__ */ e.jsx(R, { dataset: p })
791
+ n === "bottom" && p && /* @__PURE__ */ e.jsx(R, { dataset: p })
790
792
  ] });
791
793
  });
792
- ut(this.props.auth), this.state = {
793
- hideExtinct: F("tree-extant-only", !1),
794
- showInfo: F("tree-show-source", !1),
794
+ pt(this.props.auth), this.state = {
795
+ hideExtinct: M("tree-extant-only", !1),
796
+ showInfo: M("tree-show-source", !1),
795
797
  dataset: null
796
- }, this.cache = B(this.props.datasetKey);
798
+ }, this.cache = W(this.props.datasetKey);
797
799
  }
798
800
  componentDidUpdate(t) {
799
- t.datasetKey !== this.props.datasetKey && (this.cache = B(this.props.datasetKey));
801
+ t.datasetKey !== this.props.datasetKey && (this.cache = W(this.props.datasetKey));
800
802
  }
801
803
  }
802
- u(Q, "contextType", H);
803
- function St({
804
- datasetKey: x,
805
- defaultTaxonKey: y,
804
+ h(Y, "contextType", V);
805
+ function Tt({
806
+ datasetKey: y,
807
+ defaultTaxonKey: m,
806
808
  expandedTaxonKey: t,
807
- onExpandedTaxonKeyChange: a,
809
+ onExpandedTaxonKeyChange: s,
808
810
  showTreeOptions: o,
809
- linkToSpeciesPage: r,
810
- citation: l,
811
- type: d,
812
- insertPlaceholder: i,
813
- auth: f,
814
- ...s
811
+ linkToSpeciesPage: i,
812
+ citation: c,
813
+ type: x,
814
+ insertPlaceholder: n,
815
+ autoFocus: r,
816
+ auth: a,
817
+ ...d
815
818
  }) {
816
- return /* @__PURE__ */ e.jsx(H.Provider, { value: pt(s), children: /* @__PURE__ */ e.jsx(
817
- Q,
819
+ return /* @__PURE__ */ e.jsx(V.Provider, { value: ft(d), children: /* @__PURE__ */ e.jsx(
820
+ Y,
818
821
  {
819
- datasetKey: x,
820
- defaultTaxonKey: y,
822
+ datasetKey: y,
823
+ defaultTaxonKey: m,
821
824
  expandedTaxonKey: t,
822
- onExpandedTaxonKeyChange: a,
825
+ onExpandedTaxonKeyChange: s,
823
826
  showTreeOptions: o,
824
- linkToSpeciesPage: r,
825
- citation: l,
826
- type: d,
827
- insertPlaceholder: i,
828
- auth: f
827
+ linkToSpeciesPage: i,
828
+ citation: c,
829
+ type: x,
830
+ insertPlaceholder: n,
831
+ autoFocus: r,
832
+ auth: a
829
833
  }
830
834
  ) });
831
835
  }
832
- const Ot = st(et(St));
836
+ const Ot = at(st(Tt));
833
837
  export {
834
838
  Ot as Tree
835
839
  };