@abi-software/mapintegratedvuer 1.9.0-externalise.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,54 +1,54 @@
1
- import { markRaw as b } from "vue";
2
- import { u as I, b as M, E as h, T as F, c as w, d as A } from "./index-DPgI7wGR.js";
3
- import { mapStores as C } from "pinia";
4
- const d = function(e) {
1
+ import { markRaw as w } from "vue";
2
+ import { u as b, p as I, q as M, E as u, T as C, r as S, s as F, v as A, x as $ } from "./index-CVfAy4kK.js";
3
+ import { mapStores as H } from "pinia";
4
+ const m = function(e) {
5
5
  return e ? [...new Set(e.map((t) => JSON.stringify(t)))].map(
6
6
  (t) => JSON.parse(t)
7
7
  ) : [];
8
- }, g = [], S = async function(e, t) {
9
- const n = t.filter(
10
- (o) => g.some((a) => a.taxon === o)
11
- ), i = g.filter(
12
- (o) => n.includes(o.taxon)
13
- ), s = t.filter(
14
- (o) => !n.includes(o)
8
+ }, g = [], v = async function(e, t) {
9
+ const i = t.filter(
10
+ (s) => g.some((a) => a.taxon === s)
11
+ ), n = g.filter(
12
+ (s) => i.includes(s.taxon)
13
+ ), o = t.filter(
14
+ (s) => !i.includes(s)
15
15
  );
16
- if (s.length) {
17
- const o = await e.queryLabels(s);
18
- if (o.length)
19
- return o.forEach((a) => {
16
+ if (o.length) {
17
+ const s = await e.queryLabels(o);
18
+ if (s.length)
19
+ return s.forEach((a) => {
20
20
  let { entity: r, label: l } = a;
21
21
  l === "Mammalia" && (l = "Mammalia not otherwise specified");
22
22
  const c = { taxon: r, label: l };
23
- i.push(c), g.push(c);
24
- }), i;
23
+ n.push(c), g.push(c);
24
+ }), n;
25
25
  } else
26
- return i;
26
+ return n;
27
27
  }, y = function(e, t) {
28
28
  if (!e || !t) return !1;
29
- let n = JSON.stringify(e), i = JSON.stringify(t);
30
- return n.indexOf(i) !== -1;
29
+ let i = JSON.stringify(e), n = JSON.stringify(t);
30
+ return i.indexOf(n) !== -1;
31
31
  }, p = (e, t) => {
32
- const n = e.name ?? e, i = t.name ?? t, s = n.toUpperCase(), o = i.toUpperCase();
33
- return s < o ? -1 : s > o ? 1 : 0;
32
+ const i = e.name ?? e, n = t.name ?? t, o = i.toUpperCase(), s = n.toUpperCase();
33
+ return o < s ? -1 : o > s ? 1 : 0;
34
34
  };
35
- let $ = function() {
35
+ let N = function() {
36
36
  this.initialise = function(e) {
37
37
  this.flatmapAPI = e, this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], this.controller = void 0, this.uberons = [], this.lookUp = [], this.connectivitySource = "sckan";
38
38
  }, this.createTooltipData = async function(e, t) {
39
- let n = [];
40
- t.feature.hyperlinks && t.feature.hyperlinks.length > 0 ? n = t.feature.hyperlinks : n = this.rawURLs;
41
- let i;
39
+ let i = [];
40
+ t.feature.hyperlinks && t.feature.hyperlinks.length > 0 ? i = t.feature.hyperlinks : i = this.rawURLs;
41
+ let n;
42
42
  if (t.provenanceTaxonomy) {
43
- i = [];
43
+ n = [];
44
44
  try {
45
- const o = await S(e, t.provenanceTaxonomy);
46
- o.length && o.forEach((a) => {
45
+ const s = await v(e, t.provenanceTaxonomy);
46
+ s.length && s.forEach((a) => {
47
47
  const { label: r } = a;
48
- i.push(r);
48
+ n.push(r);
49
49
  });
50
- } catch (o) {
51
- console.log(o);
50
+ } catch (s) {
51
+ console.log(s);
52
52
  }
53
53
  }
54
54
  return {
@@ -60,9 +60,9 @@ let $ = function() {
60
60
  componentsWithDatasets: this.componentsWithDatasets,
61
61
  title: t.label,
62
62
  featureId: t.resource,
63
- hyperlinks: n,
63
+ hyperlinks: i,
64
64
  provenanceTaxonomy: t.provenanceTaxonomy,
65
- provenanceTaxonomyLabel: i,
65
+ provenanceTaxonomyLabel: n,
66
66
  connectivitySource: this.connectivitySource
67
67
  };
68
68
  }, this.updateTooltipData = function(e) {
@@ -77,109 +77,109 @@ let $ = function() {
77
77
  connectivitySource: this.connectivitySource
78
78
  };
79
79
  }, this.createComponentsLabelList = function(e, t) {
80
- let n = [];
81
- return e.forEach((i) => {
82
- n.push(this.createLabelFromNeuralNode(i[0]), t), i.length === 2 && n.push(this.createLabelFromNeuralNode(i[1]), t);
83
- }), n;
80
+ let i = [];
81
+ return e.forEach((n) => {
82
+ i.push(this.createLabelFromNeuralNode(n[0]), t), n.length === 2 && i.push(this.createLabelFromNeuralNode(n[1]), t);
83
+ }), i;
84
84
  }, this.createLabelLookup = function(e, t) {
85
- return new Promise(async (n) => {
86
- let i = {};
85
+ return new Promise(async (i) => {
86
+ let n = {};
87
87
  this.uberons = [];
88
- const s = await S(e, t);
89
- s.length && (s.forEach((o) => {
90
- const { taxon: a, label: r } = o;
91
- i[a] = r, this.uberons.push({
88
+ const o = await v(e, t);
89
+ o.length && (o.forEach((s) => {
90
+ const { taxon: a, label: r } = s;
91
+ n[a] = r, this.uberons.push({
92
92
  id: a,
93
93
  name: r
94
94
  });
95
- }), n(i));
95
+ }), i(n));
96
96
  });
97
97
  }, this.buildConnectivitySqlStatement = function(e) {
98
98
  let t = "select knowledge from knowledge where entity in (";
99
99
  if (e.length === 1)
100
100
  t += `'${e[0]}')`;
101
101
  else if (e.length > 1)
102
- for (let n in e)
103
- t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
102
+ for (let i in e)
103
+ t += `'${e[i]}'${i >= e.length - 1 ? ")" : ","} `;
104
104
  return t;
105
105
  }, this.buildLabelSqlStatement = function(e) {
106
106
  let t = "select entity, label from labels where entity in (";
107
107
  if (e.length === 1)
108
108
  t += `'${e[0]}')`;
109
109
  else if (e.length > 1)
110
- for (let n in e)
111
- t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
110
+ for (let i in e)
111
+ t += `'${e[i]}'${i >= e.length - 1 ? ")" : ","} `;
112
112
  return t;
113
113
  }, this.findAllIdsFromConnectivity = function(e) {
114
- let t = e.connectivity.flat(), n = [...new Set(t)], i = [];
115
- return n.forEach((s) => {
116
- Array.isArray(s) ? i.push(s.flat()) : i.push(s);
117
- }), [...new Set(i.flat())];
114
+ let t = e.connectivity.flat(), i = [...new Set(t)], n = [];
115
+ return i.forEach((o) => {
116
+ Array.isArray(o) ? n.push(o.flat()) : n.push(o);
117
+ }), [...new Set(n.flat())];
118
118
  }, this.flattenConnectivity = function(e) {
119
- let t = e.flat(), n = [...new Set(t)], i = [];
120
- return n.forEach((s) => {
121
- Array.isArray(s) ? i.push(s.flat()) : i.push(s);
122
- }), i.flat();
123
- }, this.findComponents = function(e, t, n, i) {
124
- let s = e.connectivity.flat(), o = d(s), a = [], r = !1;
125
- return o.forEach((l) => {
126
- r = !1, y(t, l) && (r = !0), i && y(i, l) && (r = !0), y(n, l) && (r = !0), r || a.push(l);
119
+ let t = e.flat(), i = [...new Set(t)], n = [];
120
+ return i.forEach((o) => {
121
+ Array.isArray(o) ? n.push(o.flat()) : n.push(o);
122
+ }), n.flat();
123
+ }, this.findComponents = function(e, t, i, n) {
124
+ let o = e.connectivity.flat(), s = m(o), a = [], r = !1;
125
+ return s.forEach((l) => {
126
+ r = !1, y(t, l) && (r = !0), n && y(n, l) && (r = !0), y(i, l) && (r = !0), r || a.push(l);
127
127
  }), a;
128
128
  }, this.retrieveFlatmapKnowledgeForEvent = async function(e, t) {
129
129
  this.controller && this.controller.abort(), this.controller = new AbortController(), this.controller.signal;
130
- const n = t.resource;
131
- if (this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], !n || n.length === 0 || !n[0]) return;
132
- let i = this.queryForConnectivityNew(e, n[0]);
133
- return await Promise.all([i]);
134
- }, this.queryForConnectivityNew = function(e, t, n = "sckan", i = !0) {
135
- return this.connectivitySource = n, new Promise((s) => {
136
- (n === "map" ? this.queryMapConnectivity(e.provenance.uuid, t) : e.queryKnowledge(t)).then((a) => {
130
+ const i = t.resource;
131
+ if (this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], !i || i.length === 0 || !i[0]) return;
132
+ let n = this.queryForConnectivityNew(e, i[0]);
133
+ return await Promise.all([n]);
134
+ }, this.queryForConnectivityNew = function(e, t, i = "sckan", n = !0) {
135
+ return this.connectivitySource = i, new Promise((o) => {
136
+ (i === "map" ? this.queryMapConnectivity(e.provenance.uuid, t) : e.queryKnowledge(t)).then((a) => {
137
137
  if (this.checkConnectivityExists(a)) {
138
138
  let r = a;
139
- i ? this.processConnectivity(e, r).then((l) => {
140
- a.references && (this.rawURLs = [...a.references]), s(l);
141
- }) : s(r);
139
+ n ? this.processConnectivity(e, r).then((l) => {
140
+ a.references && (this.rawURLs = [...a.references]), o(l);
141
+ }) : o(r);
142
142
  } else
143
- s(!1);
143
+ o(!1);
144
144
  }).catch((a) => {
145
- a.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${t}.`), s(!1);
145
+ a.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${t}.`), o(!1);
146
146
  });
147
147
  });
148
148
  }, this.queryMapConnectivity = async function(e, t) {
149
- const n = this.flatmapAPI + `flatmap/${e}/connectivity/${t}`;
150
- try {
151
- const i = await fetch(n);
152
- if (!i.ok)
153
- throw new Error(`Response status: ${i.status}`);
154
- return await i.json();
155
- } catch (i) {
156
- throw new Error(i);
157
- }
158
- }, this.queryMapPaths = async function(e) {
159
- const t = this.flatmapAPI + `flatmap/${e}/pathways`;
149
+ const i = this.flatmapAPI + `flatmap/${e}/connectivity/${t}`;
160
150
  try {
161
- const n = await fetch(t);
151
+ const n = await fetch(i);
162
152
  if (!n.ok)
163
153
  throw new Error(`Response status: ${n.status}`);
164
154
  return await n.json();
165
155
  } catch (n) {
166
156
  throw new Error(n);
167
157
  }
168
- }, this.queryForConnectivity = function(e, t, n, i = !0) {
169
- const s = { sql: this.buildConnectivitySqlStatement(t) }, o = {
158
+ }, this.queryMapPaths = async function(e) {
159
+ const t = this.flatmapAPI + `flatmap/${e}/pathways`;
160
+ try {
161
+ const i = await fetch(t);
162
+ if (!i.ok)
163
+ throw new Error(`Response status: ${i.status}`);
164
+ return await i.json();
165
+ } catch (i) {
166
+ throw new Error(i);
167
+ }
168
+ }, this.queryForConnectivity = function(e, t, i, n = !0) {
169
+ const o = { sql: this.buildConnectivitySqlStatement(t) }, s = {
170
170
  method: "POST",
171
171
  headers: {
172
172
  "Content-Type": "application/json"
173
173
  },
174
- body: JSON.stringify(s),
175
- ...n ? { signal: n } : {}
174
+ body: JSON.stringify(o),
175
+ ...i ? { signal: i } : {}
176
176
  // add signal to header if it exists
177
177
  };
178
178
  return new Promise((a) => {
179
- fetch(`${this.flatmapAPI}knowledge/query/`, o).then((r) => r.json()).then((r) => {
179
+ fetch(`${this.flatmapAPI}knowledge/query/`, s).then((r) => r.json()).then((r) => {
180
180
  if (this.connectivityExists(r)) {
181
181
  let l = JSON.parse(r.values[0][0]);
182
- i ? this.processConnectivity(e, l).then((c) => {
182
+ n ? this.processConnectivity(e, l).then((c) => {
183
183
  a(c);
184
184
  }) : a(l);
185
185
  } else
@@ -196,47 +196,47 @@ let $ = function() {
196
196
  }, this.findIfNodeIsSingle = function(e) {
197
197
  return e.length === 1 ? (console.error("Server returns a single node", e), e[0]) : e.length === 2 && e[1].length === 0 ? e[0] : !1;
198
198
  }, this.createLabelFromNeuralNode = function(e, t) {
199
- let n = this.findIfNodeIsSingle(e);
200
- if (n)
201
- return t[n];
202
- let i = t[e[0]];
203
- return e.length === 2 && e[1].length > 0 && e[1].forEach((s) => {
204
- t[s] == null ? i += `, ${s}` : i += `, ${t[s]}`;
205
- }), i;
206
- }, this.flattenAndFindDatasets = function(e, t, n) {
207
- let i = this.flattenConnectivity(e), s = this.flattenConnectivity(t), o = this.flattenConnectivity(n);
199
+ let i = this.findIfNodeIsSingle(e);
200
+ if (i)
201
+ return t[i];
202
+ let n = t[e[0]];
203
+ return e.length === 2 && e[1].length > 0 && e[1].forEach((o) => {
204
+ t[o] == null ? n += `, ${o}` : n += `, ${t[o]}`;
205
+ }), n;
206
+ }, this.flattenAndFindDatasets = function(e, t, i) {
207
+ let n = this.flattenConnectivity(e), o = this.flattenConnectivity(t), s = this.flattenConnectivity(i);
208
208
  this.originsWithDatasets = this.uberons.filter(
209
- (a) => i.indexOf(a.id) !== -1
209
+ (a) => n.indexOf(a.id) !== -1
210
210
  ).sort(p), this.componentsWithDatasets = this.uberons.filter(
211
- (a) => s.indexOf(a.id) !== -1
212
- ).sort(p), this.destinationsWithDatasets = this.uberons.filter(
213
211
  (a) => o.indexOf(a.id) !== -1
212
+ ).sort(p), this.destinationsWithDatasets = this.uberons.filter(
213
+ (a) => s.indexOf(a.id) !== -1
214
214
  ).sort(p);
215
215
  }, this.processConnectivity = function(e, t) {
216
- return new Promise((n) => {
217
- let i = [], s = [], o;
216
+ return new Promise((i) => {
217
+ let n = [], o = [], s;
218
218
  if (t && t["node-phenotypes"]) {
219
219
  const l = ["ilxtr:hasSomaLocatedIn"], c = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"];
220
- l.forEach((u) => {
221
- i.push(...t["node-phenotypes"][u]);
222
- }), i = d(i), c.forEach((u) => {
223
- s.push(...t["node-phenotypes"][u]);
224
- }), s = d(s);
220
+ l.forEach((h) => {
221
+ n.push(...t["node-phenotypes"][h]);
222
+ }), n = m(n), c.forEach((h) => {
223
+ o.push(...t["node-phenotypes"][h]);
224
+ }), o = m(o);
225
225
  } else
226
- s = d(t.axons), t.somas && t.somas.length > 0 && i.push(...t.somas), t.dendrites && t.dendrites.length > 0 && i.push(...t.dendrites), i = d(i), o = t.somas;
227
- const a = this.findComponents(t, s, i, o), r = this.findAllIdsFromConnectivity(t);
226
+ o = m(t.axons), t.somas && t.somas.length > 0 && n.push(...t.somas), t.dendrites && t.dendrites.length > 0 && n.push(...t.dendrites), n = m(n), s = t.somas;
227
+ const a = this.findComponents(t, o, n, s), r = this.findAllIdsFromConnectivity(t);
228
228
  this.createLabelLookup(e, r).then((l) => {
229
- this.origins = i.map(
229
+ this.origins = n.map(
230
230
  (c) => this.createLabelFromNeuralNode(c, l)
231
231
  ).sort(p), this.components = a.map(
232
232
  (c) => this.createLabelFromNeuralNode(c, l)
233
- ).sort(p), this.destinations = s.map(
233
+ ).sort(p), this.destinations = o.map(
234
234
  (c) => this.createLabelFromNeuralNode(c, l)
235
- ).sort(p), this.flattenAndFindDatasets(i, a, s), n({
235
+ ).sort(p), this.flattenAndFindDatasets(n, a, o), i({
236
236
  ids: {
237
- dendrites: i,
237
+ dendrites: n,
238
238
  components: a,
239
- axons: s
239
+ axons: o
240
240
  },
241
241
  labels: {
242
242
  origins: this.origins,
@@ -251,8 +251,8 @@ let $ = function() {
251
251
  if (e.length === 1)
252
252
  t += `'${e[0]}')`;
253
253
  else if (e.length > 1)
254
- for (let n in e)
255
- t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
254
+ for (let i in e)
255
+ t += `'${e[i]}'${i >= e.length - 1 ? ")" : ","} `;
256
256
  return t;
257
257
  }, this.buildPubmedSqlStatementForModels = function(e) {
258
258
  return `select distinct publication from publications where entity = '${e}'`;
@@ -264,53 +264,15 @@ let $ = function() {
264
264
  "Content-Type": "application/json"
265
265
  },
266
266
  body: JSON.stringify(t)
267
- }).then((n) => n.json()).catch((n) => {
268
- console.error("Error:", n);
267
+ }).then((i) => i.json()).catch((i) => {
268
+ console.error("Error:", i);
269
269
  });
270
270
  };
271
271
  };
272
- function v(e) {
273
- var n;
274
- let t = "";
275
- if ((n = e.provenance) != null && n.connectivity) {
276
- const i = e.provenance.connectivity;
277
- "knowledge-source" in i ? t = i["knowledge-source"] : "npo" in i && (t = `${i.npo.release}-npo`);
278
- }
279
- return t;
280
- }
281
- async function H(e, t) {
282
- const n = v(e), i = `select knowledge from knowledge
283
- where source="${n}"
284
- order by source desc`;
285
- E();
286
- const s = sessionStorage.getItem("flatmap-knowledge"), o = sessionStorage.getItem("flatmap-knowledge-source");
287
- if (!s || o !== n) {
288
- const l = (await t.flatmapQuery(i)).values.map((c) => c[0]).map((c) => JSON.parse(c));
289
- return sessionStorage.setItem("flatmap-knowledge", JSON.stringify(l)), sessionStorage.setItem("flatmap-knowledge-source", n), N(), l;
290
- }
291
- return JSON.parse(s);
292
- }
293
- function N() {
294
- const n = (/* @__PURE__ */ new Date()).getTime() + 864e5;
295
- sessionStorage.setItem("flatmap-knowledge-expiry", n);
296
- }
297
- function T() {
298
- [
299
- "flatmap-knowledge",
300
- "flatmap-knowledge-expiry",
301
- "flatmap-knowledge-source"
302
- ].forEach((t) => {
303
- sessionStorage.removeItem(t);
304
- });
305
- }
306
- function E() {
307
- const e = sessionStorage.getItem("flatmap-knowledge-expiry");
308
- (/* @__PURE__ */ new Date()).getTime() > e && T();
309
- }
310
272
  function P(e) {
311
273
  return e[0].toUpperCase() + e.substring(1);
312
274
  }
313
- const k = {
275
+ const D = {
314
276
  emits: ["flatmap-provenance-ready", "resource-selected", "species-changed"],
315
277
  props: {
316
278
  /**
@@ -328,7 +290,7 @@ const k = {
328
290
  }
329
291
  },
330
292
  computed: {
331
- ...C(I, M),
293
+ ...H(b, I, M),
332
294
  idNamePair() {
333
295
  return this.splitFlowStore.idNamePair;
334
296
  },
@@ -346,9 +308,9 @@ const k = {
346
308
  }
347
309
  },
348
310
  mounted: function() {
349
- h.on("startHelp", () => {
311
+ u.on("startHelp", () => {
350
312
  this.startHelp();
351
- }), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold;
313
+ }), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold, this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
352
314
  },
353
315
  methods: {
354
316
  toggleSyncMode: function() {
@@ -356,13 +318,13 @@ const k = {
356
318
  getState: function() {
357
319
  },
358
320
  openMap: function(e) {
359
- e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (h.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`));
321
+ e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (u.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`));
360
322
  },
361
323
  onMapmanagerLoaded: function(e) {
362
324
  this.settingsStore.updateMapManager(e);
363
325
  },
364
326
  trackOpenMap: function(e) {
365
- F.sendEvent({
327
+ C.sendEvent({
366
328
  event: "interaction_event",
367
329
  event_name: "portal_maps_open_map",
368
330
  category: e,
@@ -387,13 +349,13 @@ const k = {
387
349
  */
388
350
  resourceSelected: function(e, t) {
389
351
  var a, r, l, c;
390
- const n = t[0];
391
- if (this.resourceHasAction(n)) {
392
- h.emit("PopoverActionClick", n);
352
+ const i = t[0];
353
+ if (this.resourceHasAction(i)) {
354
+ u.emit("PopoverActionClick", i);
393
355
  return;
394
356
  }
395
- let i, s = !1;
396
- const o = {
357
+ let n, o = !1;
358
+ const s = {
397
359
  paneIndex: this.entry.id,
398
360
  type: e,
399
361
  resource: t,
@@ -401,41 +363,41 @@ const k = {
401
363
  eventType: void 0
402
364
  };
403
365
  if (e == "MultiFlatmap" || e == "Flatmap")
404
- if (o.internalName = (a = n == null ? void 0 : n.feature) != null && a.label ? n.feature.label : this.idNamePair[n.feature.models], n.eventType == "click")
405
- if (o.eventType = "selected", n.feature.type == "marker") {
406
- let u = o.internalName;
407
- if (this.settingsStore.isFeaturedMarkerIdentifier(n.feature.id))
408
- i = {
366
+ if (s.internalName = (a = i == null ? void 0 : i.feature) != null && a.label ? i.feature.label : this.idNamePair[i.feature.models], i.eventType == "click")
367
+ if (s.eventType = "selected", i.feature.type == "marker") {
368
+ let h = s.internalName;
369
+ if (this.settingsStore.isFeaturedMarkerIdentifier(i.feature.id))
370
+ n = {
409
371
  type: "Search",
410
- term: this.settingsStore.featuredMarkerDoi(n.feature.id),
372
+ term: this.settingsStore.featuredMarkerDoi(i.feature.id),
411
373
  featuredDataset: !0
412
374
  };
413
375
  else {
414
- i = {
376
+ n = {
415
377
  type: "Facet",
416
- facet: u,
378
+ facet: h,
417
379
  facetPropPath: "anatomy.organ.category.name",
418
380
  facetSubPropPath: "anatomy.organ.name",
419
381
  term: "Anatomical structure"
420
382
  };
421
- let f = /* @__PURE__ */ new Set();
422
- n.feature["marker-terms"].forEach((m) => {
423
- f.add(m.label);
424
- }), f.add(u), f.size > 0 && (i = {
383
+ let d = /* @__PURE__ */ new Set();
384
+ i.feature["marker-terms"].forEach((f) => {
385
+ d.add(f.label);
386
+ }), d.add(h), d.size > 0 && (n = {
425
387
  type: "Facets",
426
- labels: [...f]
388
+ labels: [...d]
427
389
  });
428
390
  }
429
- s = !0, e == "MultiFlatmap" && this.$refs.multiflatmap.getCurrentFlatmap().mapImp.clearSearchResults();
430
- } else n.feature.type == "feature" && this.syncMode && (s = !0);
431
- else n.eventType == "mouseenter" && (o.eventType = "highlighted", s = !0);
432
- else e == "Scaffold" && (n && ((((r = n.data) == null ? void 0 : r.id) === void 0 || ((l = n.data) == null ? void 0 : l.id) === "") && (n.data.id = (c = n.data) == null ? void 0 : c.group), o.internalName = n.data.id, n.data.lastActionOnMarker === !0 && (i = {
391
+ o = !0, e == "MultiFlatmap" && this.$refs.multiflatmap.getCurrentFlatmap().mapImp.clearSearchResults();
392
+ } else i.feature.type == "feature" && this.syncMode && (o = !0);
393
+ else i.eventType == "mouseenter" && (s.eventType = "highlighted", o = !0);
394
+ else e == "Scaffold" && (i && ((((r = i.data) == null ? void 0 : r.id) === void 0 || ((l = i.data) == null ? void 0 : l.id) === "") && (i.data.id = (c = i.data) == null ? void 0 : c.group), s.internalName = i.data.id, i.data.lastActionOnMarker === !0 && (n = {
433
395
  type: "Facet",
434
- facet: P(n.data.id),
396
+ facet: P(i.data.id),
435
397
  facetPropPath: "anatomy.organ.category.name",
436
398
  term: "Anatomical structure"
437
- })), o.eventType = "selected", s = !0);
438
- i && h.emit("PopoverActionClick", i), s && this.$emit("resource-selected", o);
399
+ })), s.eventType = "selected", o = !0);
400
+ n && u.emit("PopoverActionClick", n), o && this.$emit("resource-selected", s);
439
401
  },
440
402
  resourceHasAction: function(e) {
441
403
  return e.type === "URL" || e.type === "Search" || e.type === "Neuron Search" || e.type == "Facet" || e.type == "Facets";
@@ -456,63 +418,63 @@ const k = {
456
418
  getNameAndIdFromSyncData: async function(e) {
457
419
  let t = e.internalName;
458
420
  t === void 0 && e.resource && (t = e.resource.label);
459
- let n;
460
- if (e.resource && e.resource.resource && (n = e.resource.resource[0]), this.entry.type === "Scaffold") {
421
+ let i;
422
+ if (e.resource && e.resource.resource && (i = e.resource.resource[0]), this.entry.type === "Scaffold") {
461
423
  if (this.$refs.scaffold.findObjectsWithGroupName(t).length === 0) {
462
424
  if (e.resource && e.resource.feature) {
463
- const o = w(e.resource.feature.models);
464
- if (o.length > 0) return o;
425
+ const s = S(e.resource.feature.models);
426
+ if (s.length > 0) return s;
465
427
  }
466
- let s = A(t);
467
- if (s)
468
- return s;
469
- if (n && e.eventType === "selected")
470
- return fetch(`${this.apiLocation}get-related-terms/${n}`).then((o) => o.json()).then((o) => {
428
+ let o = F(t);
429
+ if (o)
430
+ return o;
431
+ if (i && e.eventType === "selected")
432
+ return fetch(`${this.apiLocation}get-related-terms/${i}`).then((s) => s.json()).then((s) => {
471
433
  var a;
472
- if (((a = o.uberon) == null ? void 0 : a.array.length) > 0)
473
- return t = o.uberon.array[0].name.charAt(0).toUpperCase() + o.uberon.array[0].name.slice(1), n = o.uberon.array[0].id.toUpperCase(), { id: n, name: t };
434
+ if (((a = s.uberon) == null ? void 0 : a.array.length) > 0)
435
+ return t = s.uberon.array[0].name.charAt(0).toUpperCase() + s.uberon.array[0].name.slice(1), i = s.uberon.array[0].id.toUpperCase(), { id: i, name: t };
474
436
  });
475
437
  }
476
438
  } else if (this.entry.type === "MultiFlatmap")
477
439
  if (t === "Bladder")
478
440
  t = "Urinary Bladder";
479
441
  else {
480
- const i = w(t);
481
- i.length > 0 && (t = i[0]);
442
+ const n = S(t);
443
+ n.length > 0 && (t = n[0]);
482
444
  }
483
- return { id: n, name: t };
445
+ return { id: i, name: t };
484
446
  },
485
447
  // Get the species and andaotmy info for the featured datasets
486
448
  getDatasetAnatomyInfo: function(e) {
487
449
  fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${e}`).then((t) => t.json()).then((t) => {
488
- const n = t.result[0];
489
- let i;
450
+ const i = t.result[0];
451
+ let n;
490
452
  try {
491
- i = n.anatomy.organ[0].curie;
453
+ n = i.anatomy.organ[0].curie;
492
454
  } catch {
493
- i = void 0;
455
+ n = void 0;
494
456
  }
495
- let s;
457
+ let o;
496
458
  try {
497
- s = n.item.curie;
459
+ o = i.item.curie;
498
460
  } catch {
499
- s = void 0;
461
+ o = void 0;
500
462
  }
501
- let o;
463
+ let s;
502
464
  try {
503
465
  let a = 0, r = !1;
504
- for (; !r && a < n.organisms.subject.length; ) {
505
- const l = n.organisms.subject[a];
506
- l.species && (o = l.species.name, r = !0), a += 1;
466
+ for (; !r && a < i.organisms.subject.length; ) {
467
+ const l = i.organisms.subject[a];
468
+ l.species && (s = l.species.name, r = !0), a += 1;
507
469
  }
508
470
  } catch {
509
- o = void 0;
471
+ s = void 0;
510
472
  }
511
473
  this.settingsStore.updateFeaturedMarker({
512
474
  identifier: e,
513
- marker: i,
514
- doi: s,
515
- species: o
475
+ marker: n,
476
+ doi: o,
477
+ species: s
516
478
  });
517
479
  });
518
480
  },
@@ -524,7 +486,7 @@ const k = {
524
486
  // Check if the new featured dataset api has any info
525
487
  newFeaturedDatasetApiHasInfo: async function() {
526
488
  let t = await (await fetch(`${this.apiLocation}get_featured_dataset`)).json();
527
- return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((n) => n.id);
489
+ return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((i) => i.id);
528
490
  },
529
491
  /**
530
492
  * Get a list of featured datasets to display.
@@ -533,11 +495,11 @@ const k = {
533
495
  let e = [], t = await this.oldFeaturedDatasetApiHasInfo();
534
496
  if (t) e = t;
535
497
  else {
536
- let n = await this.newFeaturedDatasetApiHasInfo();
537
- n && (e = n);
498
+ let i = await this.newFeaturedDatasetApiHasInfo();
499
+ i && (e = i);
538
500
  }
539
- this.settingsStore.updateFeatured(e), e.forEach((n) => {
540
- this.getDatasetAnatomyInfo(n);
501
+ this.settingsStore.updateFeatured(e), e.forEach((i) => {
502
+ this.getDatasetAnatomyInfo(i);
541
503
  });
542
504
  },
543
505
  zoomToFeatures: function() {
@@ -596,84 +558,100 @@ const k = {
596
558
  checkEndHelpMouseDown: function(e) {
597
559
  e.target.closest(".help-mode-dialog") || this.endHelp();
598
560
  },
599
- flatmapHighlight: async function(e, t, n, i) {
600
- let s = [...t, ...i];
601
- const o = this.settingsStore.globalSettings;
602
- if (o.highlightConnectedPaths) {
603
- const a = t.length ? t : i.length ? i : [], r = await e.retrieveConnectedPaths(a);
604
- r && s.push(...r);
561
+ flatmapHighlight: async function(e, t, i, n) {
562
+ let o = [...t, ...n];
563
+ const s = this.settingsStore.globalSettings;
564
+ if (s.highlightConnectedPaths) {
565
+ const a = t.length ? t : n.length ? n : [], r = await e.retrieveConnectedPaths(a);
566
+ r && o.push(...r);
605
567
  }
606
- if (o.highlightDOIPaths) {
607
- const a = await e.searchConnectivitiesByReference(n);
608
- a && s.push(...a);
568
+ if (s.highlightDOIPaths) {
569
+ const a = await e.searchConnectivitiesByReference(i);
570
+ a && o.push(...a);
609
571
  }
610
- return s = [...new Set(s)], s;
572
+ return o = [...new Set(o)], o;
611
573
  },
612
574
  cardHoverHighlight: function() {
613
575
  var e;
614
576
  if (this.visible) {
615
- const t = this.settingsStore.hoverAnatomies, n = this.settingsStore.hoverOrgans, i = this.settingsStore.hoverDOI, s = this.settingsStore.hoverConnectivity;
616
- let o = null, a = null;
617
- this.flatmapRef && (o = this.flatmapRef), this.multiflatmapRef && (o = this.multiflatmapRef.getCurrentFlatmap()), this.scaffoldRef && (a = this.scaffoldRef), clearTimeout(this.highlightDelay), !t.length && !n.length && !i && !s.length && ((this.multiflatmapRef || this.flatmapRef) && o ? (e = o.mapImp) == null || e.clearSearchResults() : this.scaffoldRef && a && a.changeHighlightedByName(n, "", !1)), this.highlightDelay = setTimeout(() => {
618
- (t.length || n.length || i || s.length) && ((this.multiflatmapRef || this.flatmapRef) && o ? this.flatmapHighlight(o, t, i, s).then((r) => {
577
+ const t = this.settingsStore.hoverAnatomies, i = this.settingsStore.hoverOrgans, n = this.settingsStore.hoverDOI, o = this.settingsStore.hoverConnectivity;
578
+ let s = null, a = null;
579
+ this.flatmapRef && (s = this.flatmapRef), this.multiflatmapRef && (s = this.multiflatmapRef.getCurrentFlatmap()), this.scaffoldRef && (a = this.scaffoldRef), clearTimeout(this.highlightDelay), !t.length && !i.length && !n && !o.length && ((this.multiflatmapRef || this.flatmapRef) && s ? (e = s.mapImp) == null || e.clearSearchResults() : this.scaffoldRef && a && a.changeHighlightedByName(i, "", !1)), this.highlightDelay = setTimeout(() => {
580
+ (t.length || i.length || n || o.length) && ((this.multiflatmapRef || this.flatmapRef) && s ? this.flatmapHighlight(s, t, n, o).then((r) => {
619
581
  try {
620
- o.zoomToFeatures(r);
582
+ s.zoomToFeatures(r);
621
583
  } catch (l) {
622
- console.log(l);
584
+ if (console.log(l), o.length && s.mapImp) {
585
+ const c = s.mapImp.uuid;
586
+ r.every(
587
+ (d) => this.connectivityKnowledge[c].some(
588
+ (f) => f.id === d
589
+ )
590
+ ) || s.mapImp.clearSearchResults();
591
+ }
623
592
  }
624
- }) : this.scaffoldRef && a && a.changeHighlightedByName(n, "", !1));
593
+ }) : this.scaffoldRef && a && a.changeHighlightedByName(i, "", !1));
625
594
  }, 100);
626
595
  }
627
596
  },
628
597
  onAnnotationOpen: function(e) {
629
- h.emit("annotation-open", e);
598
+ u.emit("annotation-open", e);
630
599
  },
631
600
  onAnnotationClose: function() {
632
- h.emit("annotation-close");
601
+ u.emit("annotation-close");
633
602
  },
634
603
  onConnectivityInfoOpen: function(e) {
635
- h.emit("connectivity-info-open", e);
604
+ u.emit("connectivity-info-open", e);
636
605
  },
637
- onConnectivityGraphError: function(e) {
638
- h.emit("connectivity-graph-error", e);
606
+ onConnectivityError: function(e) {
607
+ u.emit("connectivity-error", e);
639
608
  },
640
609
  loadConnectivityKnowledge: async function(e) {
641
- const t = v(e), n = b(new $());
642
- n.initialise(this.flatmapAPI);
643
- const i = await H(e, n), s = e.uuid, o = await n.queryMapPaths(s), a = o ? o.paths : {};
644
- this.connectivityKnowledge[s] = i.filter((r) => {
645
- var l;
646
- return !!(r.source === t && ((l = r.connectivity) != null && l.length) && r.id in a);
647
- }), h.emit("connectivity-knowledge", { type: "default", data: this.connectivityKnowledge[s] });
610
+ const t = A(e), i = w(new N());
611
+ i.initialise(this.flatmapAPI);
612
+ const n = await $(e, i), o = e.uuid;
613
+ if (this.connectivityKnowledge[t] || (this.connectivityKnowledge[t] = n.filter((s) => {
614
+ var a;
615
+ return s.source === t && ((a = s.connectivity) == null ? void 0 : a.length);
616
+ }).sort((s, a) => s.label.localeCompare(a.label))), !this.connectivitiesStore.globalConnectivities[o]) {
617
+ const s = await i.queryMapPaths(o), a = s ? s.paths : {};
618
+ this.connectivityKnowledge[o] = n.filter((r) => {
619
+ var l;
620
+ return r.source === t && ((l = r.connectivity) == null ? void 0 : l.length) && r.id in a;
621
+ }).sort((r, l) => r.label.localeCompare(l.label));
622
+ }
623
+ this.connectivitiesStore.updateGlobalConnectivities(this.connectivityKnowledge), u.emit("species-layout-connectivity-update");
648
624
  },
649
625
  getSearchedId: function(e, t) {
650
- let n = [];
651
- const i = e.mapImp.search(t);
652
- return (i.__featureIds || i.featureIds).forEach((o) => {
626
+ let i = [];
627
+ const n = e.mapImp.search(t);
628
+ return (n.__featureIds || n.featureIds).forEach((s) => {
653
629
  var r;
654
- const a = e.mapImp.annotation(o);
655
- (r = a.label) != null && r.toLowerCase().includes(t.toLowerCase()) && a.models && !n.includes(a.models) && n.push(a.models);
656
- }), n;
630
+ const a = e.mapImp.annotation(s);
631
+ (r = a.label) != null && r.toLowerCase().includes(t.toLowerCase()) && a.models && !i.includes(a.models) && i.push(a.models);
632
+ }), i;
657
633
  },
658
634
  connectivityQueryFilter: async function(e, t) {
659
- const n = e.mapImp.uuid;
660
- let i = {
661
- state: "default",
662
- data: [...this.connectivityKnowledge[n]]
663
- };
664
- if (t && (t.type === "query-update" ? (this.query !== t.value && (this.target = []), this.query = t.value) : t.type === "filter-update" && (this.filter = t.value)), this.query) {
665
- i.state = "processed";
666
- let s = [], o = {};
667
- const a = this.query.split(",").map((f) => f.trim());
668
- for (let f = 0; f < a.length; f++)
669
- s.push(this.getSearchedId(e, a[f]));
670
- const r = await Promise.all(s), l = [...new Set(r.flat())];
671
- let c = await e.retrieveConnectedPaths(l, o);
672
- c = [...l, ...c.filter((f) => !l.includes(f))];
673
- let u = this.connectivityKnowledge[n].filter((f) => c.includes(f.id));
674
- u.sort((f, m) => c.indexOf(f.id) - c.indexOf(m.id)), i.data = u;
635
+ const i = e.mapImp.uuid, n = this.connectivitiesStore.activeConnectivityKey || i;
636
+ if (e.$el.checkVisibility()) {
637
+ let o = {
638
+ state: "default",
639
+ data: [...this.connectivityKnowledge[n]]
640
+ };
641
+ if (t && (t.type === "query-update" ? (this.query !== t.value && (this.target = []), this.query = t.value) : t.type === "filter-update" && (this.filter = t.value)), this.query) {
642
+ o.state = "processed";
643
+ let s = [], a = {};
644
+ const r = this.query.split(",").map((f) => f.trim());
645
+ for (let f = 0; f < r.length; f++)
646
+ s.push(this.getSearchedId(e, r[f]));
647
+ const l = await Promise.all(s), c = [...new Set(l.flat())];
648
+ let h = await e.retrieveConnectedPaths(c, a);
649
+ h = [...c, ...h.filter((f) => !c.includes(f))];
650
+ let d = this.connectivityKnowledge[n].filter((f) => h.includes(f.id));
651
+ o.data = d;
652
+ }
653
+ u.emit("connectivity-knowledge", o);
675
654
  }
676
- h.emit("connectivity-knowledge", i);
677
655
  }
678
656
  },
679
657
  data: function() {
@@ -711,5 +689,5 @@ const k = {
711
689
  }
712
690
  };
713
691
  export {
714
- k as C
692
+ D as C
715
693
  };