@abi-software/flatmapvuer 1.10.0 → 1.10.1-beta.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,7 +1,7 @@
1
1
  import { Loading as Tr, CircleCheck as Nl, CircleClose as Ar, Close as ri, ArrowDown as Ii, Warning as Or, WarningFilled as Mr, ArrowLeft as _r } from "@element-plus/icons-vue";
2
2
  import { getCurrentScope as Bl, onScopeDispose as Pr, unref as v, getCurrentInstance as me, onMounted as pe, nextTick as ue, ref as M, readonly as xr, watch as W, warn as Vl, watchEffect as Lr, onBeforeUnmount as Be, inject as G, computed as y, isRef as lt, shallowRef as po, onBeforeMount as zl, provide as fe, defineComponent as B, openBlock as C, createElementBlock as F, mergeProps as Nt, renderSlot as H, toRef as Ye, onUnmounted as Hl, createBlock as V, Transition as Bn, withCtx as k, withDirectives as oe, createElementVNode as R, normalizeClass as P, normalizeStyle as ce, vShow as Ee, Fragment as ye, createVNode as x, reactive as ut, onActivated as jl, onUpdated as Ul, resolveDynamicComponent as $e, createCommentVNode as z, cloneVNode as Kl, Text as Rr, Comment as Wl, Teleport as Gl, onDeactivated as ql, toDisplayString as ie, useSlots as Eo, toRaw as ho, withModifiers as se, vModelCheckbox as vo, createTextVNode as Z, toRefs as un, vModelRadio as $r, h as Jt, createSlots as Fr, resolveComponent as Re, resolveDirective as Yl, toHandlerKey as Jl, renderList as at, withKeys as Cn, vModelText as Zl, createApp as Ql, createStaticVNode as Xl, markRaw as qe } from "vue";
3
3
  import { MapSvgIcon as eu, MapSvgSpriteColor as tu } from "@abi-software/svg-sprite";
4
- import * as Dr from "https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm";
4
+ import * as Dr from "https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.5/+esm";
5
5
  import { AnnotationService as nu } from "@abi-software/sparc-annotation";
6
6
  import { defineStore as ou, mapState as iu } from "pinia";
7
7
  import { Tooltip as au, TreeControls as ru, DrawToolbar as su } from "@abi-software/map-utilities";
@@ -8490,6 +8490,16 @@ const Ei = new dy(), fy = "cannot be found on the map.", py = (e) => {
8490
8490
  return t || (t = qe(new nu(`${e.flatmapAPI}annotator`)), fe("$annotator", t)), { annotator: t };
8491
8491
  },
8492
8492
  methods: {
8493
+ enableFeatureResetOnClick: function(e) {
8494
+ this.mapImp && this.mapImp.enableFeatureResetOnClick(e);
8495
+ },
8496
+ /**
8497
+ *
8498
+ * @param filter format should follow #makeStyleFilter (flatmap-viewer)
8499
+ */
8500
+ setVisibilityFilter: function(e) {
8501
+ this.mapImp && (e ? this.mapImp.setVisibilityFilter(e) : this.mapImp.clearVisibilityFilter());
8502
+ },
8493
8503
  /**
8494
8504
  * @public
8495
8505
  * Function to manually send aborted signal when annotation tooltip popup or sidebar tab closed.
@@ -10966,7 +10976,7 @@ function Ay(e, t, n, o, i, a) {
10966
10976
  [j, e.loading]
10967
10977
  ]);
10968
10978
  }
10969
- const yl = /* @__PURE__ */ zo(hy, [["render", Ay], ["__scopeId", "data-v-f9a00745"]]), kr = {
10979
+ const yl = /* @__PURE__ */ zo(hy, [["render", Ay], ["__scopeId", "data-v-6b5fa883"]]), kr = {
10970
10980
  "NCBITaxon:10114": "01fedbf9-d783-509c-a10c-827941ab13da",
10971
10981
  "NCBITaxon:9823": "a336ac04-24db-561f-a25f-1c994fe17410",
10972
10982
  "NCBITaxon:9606": "42ed6323-f645-5fbe-bada-9581819cf689",
@@ -11636,7 +11646,7 @@ function xy(e, t, n, o, i, a) {
11636
11646
  ])), 128))
11637
11647
  ], 512);
11638
11648
  }
11639
- const By = /* @__PURE__ */ zo(Oy, [["render", xy], ["__scopeId", "data-v-8937352a"]]);
11649
+ const By = /* @__PURE__ */ zo(Oy, [["render", xy], ["__scopeId", "data-v-f9adfd5e"]]);
11640
11650
  export {
11641
11651
  yl as FlatmapVuer,
11642
11652
  By as MultiFlatmapVuer
@@ -1,4 +1,4 @@
1
- (function(H,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("@element-plus/icons-vue"),require("vue"),require("@abi-software/svg-sprite"),require("https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm"),require("@abi-software/sparc-annotation"),require("pinia"),require("@abi-software/map-utilities")):typeof define=="function"&&define.amd?define(["exports","@element-plus/icons-vue","vue","@abi-software/svg-sprite","https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm","@abi-software/sparc-annotation","pinia","@abi-software/map-utilities"],U):(H=typeof globalThis<"u"?globalThis:H||self,U(H.FlatmapVuer={},H["@element-plus/icons-vue"],H.Vue,H["@abi-software/svg-sprite"],H.flatmap,H["@abi-software/sparc-annotation"],H.pinia,H["@abi-software/map-utilities"]))})(this,function(H,U,n,ha,Es,Is,ma,to){"use strict";function Ts(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const ga=Ts(Es),Ae=(e,t,{checkForDefaultPrevented:o=!0}={})=>i=>{const r=e==null?void 0:e(i);if(o===!1||!r)return t==null?void 0:t(i)};var ba;const K=typeof window<"u",As=e=>typeof e=="string",ya=()=>{},no=K&&((ba=window==null?void 0:window.navigator)==null?void 0:ba.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function oo(e){return typeof e=="function"?e():n.unref(e)}function Os(e){return e}function _t(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ms(e,t=!0){n.getCurrentInstance()?n.onMounted(e):t?e():n.nextTick(e)}function wa(e,t,o={}){const{immediate:a=!0}=o,i=n.ref(!1);let r=null;function s(){r&&(clearTimeout(r),r=null)}function l(){i.value=!1,s()}function d(...c){s(),i.value=!0,r=setTimeout(()=>{i.value=!1,r=null,e(...c)},oo(t))}return a&&(i.value=!0,K&&d()),_t(l),{isPending:n.readonly(i),start:d,stop:l}}function Oe(e){var t;const o=oo(e);return(t=o==null?void 0:o.$el)!=null?t:o}const dn=K?window:void 0;function he(...e){let t,o,a,i;if(As(e[0])||Array.isArray(e[0])?([o,a,i]=e,t=dn):[t,o,a,i]=e,!t)return ya;Array.isArray(o)||(o=[o]),Array.isArray(a)||(a=[a]);const r=[],s=()=>{r.forEach(f=>f()),r.length=0},l=(f,u,p,g)=>(f.addEventListener(u,p,g),()=>f.removeEventListener(u,p,g)),d=n.watch(()=>[Oe(t),oo(i)],([f,u])=>{s(),f&&r.push(...o.flatMap(p=>a.map(g=>l(f,p,g,u))))},{immediate:!0,flush:"post"}),c=()=>{d(),s()};return _t(c),c}let Ca=!1;function xs(e,t,o={}){const{window:a=dn,ignore:i=[],capture:r=!0,detectIframe:s=!1}=o;if(!a)return;no&&!Ca&&(Ca=!0,Array.from(a.document.body.children).forEach(p=>p.addEventListener("click",ya)));let l=!0;const d=p=>i.some(g=>{if(typeof g=="string")return Array.from(a.document.querySelectorAll(g)).some(h=>h===p.target||p.composedPath().includes(h));{const h=Oe(g);return h&&(p.target===h||p.composedPath().includes(h))}}),f=[he(a,"click",p=>{const g=Oe(e);if(!(!g||g===p.target||p.composedPath().includes(g))){if(p.detail===0&&(l=!d(p)),!l){l=!0;return}t(p)}},{passive:!0,capture:r}),he(a,"pointerdown",p=>{const g=Oe(e);g&&(l=!p.composedPath().includes(g)&&!d(p))},{passive:!0}),s&&he(a,"blur",p=>{var g;const h=Oe(e);((g=a.document.activeElement)==null?void 0:g.tagName)==="IFRAME"&&!(h!=null&&h.contains(a.document.activeElement))&&t(p)})].filter(Boolean);return()=>f.forEach(p=>p())}function va(e,t=!1){const o=n.ref(),a=()=>o.value=!!e();return a(),Ms(a,t),o}const Sa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ka="__vueuse_ssr_handlers__";Sa[ka]=Sa[ka]||{};var Ea=Object.getOwnPropertySymbols,Bs=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable,_s=(e,t)=>{var o={};for(var a in e)Bs.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&Ea)for(var a of Ea(e))t.indexOf(a)<0&&Ns.call(e,a)&&(o[a]=e[a]);return o};function Le(e,t,o={}){const a=o,{window:i=dn}=a,r=_s(a,["window"]);let s;const l=va(()=>i&&"ResizeObserver"in i),d=()=>{s&&(s.disconnect(),s=void 0)},c=n.watch(()=>Oe(e),u=>{d(),l.value&&i&&u&&(s=new ResizeObserver(t),s.observe(u,r))},{immediate:!0,flush:"post"}),f=()=>{d(),c()};return _t(f),{isSupported:l,stop:f}}var Ia=Object.getOwnPropertySymbols,Ps=Object.prototype.hasOwnProperty,Vs=Object.prototype.propertyIsEnumerable,Rs=(e,t)=>{var o={};for(var a in e)Ps.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&Ia)for(var a of Ia(e))t.indexOf(a)<0&&Vs.call(e,a)&&(o[a]=e[a]);return o};function Ls(e,t,o={}){const a=o,{window:i=dn}=a,r=Rs(a,["window"]);let s;const l=va(()=>i&&"MutationObserver"in i),d=()=>{s&&(s.disconnect(),s=void 0)},c=n.watch(()=>Oe(e),u=>{d(),l.value&&i&&u&&(s=new MutationObserver(t),s.observe(u,r))},{immediate:!0}),f=()=>{d(),c()};return _t(f),{isSupported:l,stop:f}}var Ta;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(Ta||(Ta={}));var Ds=Object.defineProperty,Aa=Object.getOwnPropertySymbols,Fs=Object.prototype.hasOwnProperty,$s=Object.prototype.propertyIsEnumerable,Oa=(e,t,o)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,zs=(e,t)=>{for(var o in t||(t={}))Fs.call(t,o)&&Oa(e,o,t[o]);if(Aa)for(var o of Aa(t))$s.call(t,o)&&Oa(e,o,t[o]);return e};zs({linear:Os},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});/**
1
+ (function(H,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("@element-plus/icons-vue"),require("vue"),require("@abi-software/svg-sprite"),require("https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.5/+esm"),require("@abi-software/sparc-annotation"),require("pinia"),require("@abi-software/map-utilities")):typeof define=="function"&&define.amd?define(["exports","@element-plus/icons-vue","vue","@abi-software/svg-sprite","https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.5/+esm","@abi-software/sparc-annotation","pinia","@abi-software/map-utilities"],U):(H=typeof globalThis<"u"?globalThis:H||self,U(H.FlatmapVuer={},H["@element-plus/icons-vue"],H.Vue,H["@abi-software/svg-sprite"],H.flatmap,H["@abi-software/sparc-annotation"],H.pinia,H["@abi-software/map-utilities"]))})(this,function(H,U,n,ha,Es,Is,ma,to){"use strict";function Ts(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const ga=Ts(Es),Ae=(e,t,{checkForDefaultPrevented:o=!0}={})=>i=>{const r=e==null?void 0:e(i);if(o===!1||!r)return t==null?void 0:t(i)};var ba;const K=typeof window<"u",As=e=>typeof e=="string",ya=()=>{},no=K&&((ba=window==null?void 0:window.navigator)==null?void 0:ba.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function oo(e){return typeof e=="function"?e():n.unref(e)}function Os(e){return e}function _t(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ms(e,t=!0){n.getCurrentInstance()?n.onMounted(e):t?e():n.nextTick(e)}function wa(e,t,o={}){const{immediate:a=!0}=o,i=n.ref(!1);let r=null;function s(){r&&(clearTimeout(r),r=null)}function l(){i.value=!1,s()}function d(...c){s(),i.value=!0,r=setTimeout(()=>{i.value=!1,r=null,e(...c)},oo(t))}return a&&(i.value=!0,K&&d()),_t(l),{isPending:n.readonly(i),start:d,stop:l}}function Oe(e){var t;const o=oo(e);return(t=o==null?void 0:o.$el)!=null?t:o}const dn=K?window:void 0;function he(...e){let t,o,a,i;if(As(e[0])||Array.isArray(e[0])?([o,a,i]=e,t=dn):[t,o,a,i]=e,!t)return ya;Array.isArray(o)||(o=[o]),Array.isArray(a)||(a=[a]);const r=[],s=()=>{r.forEach(f=>f()),r.length=0},l=(f,u,p,g)=>(f.addEventListener(u,p,g),()=>f.removeEventListener(u,p,g)),d=n.watch(()=>[Oe(t),oo(i)],([f,u])=>{s(),f&&r.push(...o.flatMap(p=>a.map(g=>l(f,p,g,u))))},{immediate:!0,flush:"post"}),c=()=>{d(),s()};return _t(c),c}let Ca=!1;function xs(e,t,o={}){const{window:a=dn,ignore:i=[],capture:r=!0,detectIframe:s=!1}=o;if(!a)return;no&&!Ca&&(Ca=!0,Array.from(a.document.body.children).forEach(p=>p.addEventListener("click",ya)));let l=!0;const d=p=>i.some(g=>{if(typeof g=="string")return Array.from(a.document.querySelectorAll(g)).some(h=>h===p.target||p.composedPath().includes(h));{const h=Oe(g);return h&&(p.target===h||p.composedPath().includes(h))}}),f=[he(a,"click",p=>{const g=Oe(e);if(!(!g||g===p.target||p.composedPath().includes(g))){if(p.detail===0&&(l=!d(p)),!l){l=!0;return}t(p)}},{passive:!0,capture:r}),he(a,"pointerdown",p=>{const g=Oe(e);g&&(l=!p.composedPath().includes(g)&&!d(p))},{passive:!0}),s&&he(a,"blur",p=>{var g;const h=Oe(e);((g=a.document.activeElement)==null?void 0:g.tagName)==="IFRAME"&&!(h!=null&&h.contains(a.document.activeElement))&&t(p)})].filter(Boolean);return()=>f.forEach(p=>p())}function va(e,t=!1){const o=n.ref(),a=()=>o.value=!!e();return a(),Ms(a,t),o}const Sa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ka="__vueuse_ssr_handlers__";Sa[ka]=Sa[ka]||{};var Ea=Object.getOwnPropertySymbols,Bs=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable,_s=(e,t)=>{var o={};for(var a in e)Bs.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&Ea)for(var a of Ea(e))t.indexOf(a)<0&&Ns.call(e,a)&&(o[a]=e[a]);return o};function Le(e,t,o={}){const a=o,{window:i=dn}=a,r=_s(a,["window"]);let s;const l=va(()=>i&&"ResizeObserver"in i),d=()=>{s&&(s.disconnect(),s=void 0)},c=n.watch(()=>Oe(e),u=>{d(),l.value&&i&&u&&(s=new ResizeObserver(t),s.observe(u,r))},{immediate:!0,flush:"post"}),f=()=>{d(),c()};return _t(f),{isSupported:l,stop:f}}var Ia=Object.getOwnPropertySymbols,Ps=Object.prototype.hasOwnProperty,Vs=Object.prototype.propertyIsEnumerable,Rs=(e,t)=>{var o={};for(var a in e)Ps.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&Ia)for(var a of Ia(e))t.indexOf(a)<0&&Vs.call(e,a)&&(o[a]=e[a]);return o};function Ls(e,t,o={}){const a=o,{window:i=dn}=a,r=Rs(a,["window"]);let s;const l=va(()=>i&&"MutationObserver"in i),d=()=>{s&&(s.disconnect(),s=void 0)},c=n.watch(()=>Oe(e),u=>{d(),l.value&&i&&u&&(s=new MutationObserver(t),s.observe(u,r))},{immediate:!0}),f=()=>{d(),c()};return _t(f),{isSupported:l,stop:f}}var Ta;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(Ta||(Ta={}));var Ds=Object.defineProperty,Aa=Object.getOwnPropertySymbols,Fs=Object.prototype.hasOwnProperty,$s=Object.prototype.propertyIsEnumerable,Oa=(e,t,o)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,zs=(e,t)=>{for(var o in t||(t={}))Fs.call(t,o)&&Oa(e,o,t[o]);if(Aa)for(var o of Aa(t))$s.call(t,o)&&Oa(e,o,t[o]);return e};zs({linear:Os},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});/**
2
2
  * @vue/shared v3.5.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
@@ -21,4 +21,4 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:a,curr
21
21
  where source="${sa(e)}" and
22
22
  knowledge like "%${t}%" order by source desc`;return(await o.flatmapQuery(i)).values.map(c=>c[0]).map(c=>JSON.parse(c)).map(c=>c.id)}function sa(e){return ub(e.provenance)}function ub(e){let t="";if(e!=null&&e.connectivity){const o=e.connectivity;"knowledge-source"in o?t=o["knowledge-source"]:"npo"in o&&(t=`${o.npo.release}-npo`)}return t}async function pb(e,t){const o=sa(e),a=`select knowledge from knowledge
23
23
  where source="${o}"
24
- order by source desc`;us();const i=sessionStorage.getItem("flatmap-knowledge"),r=sessionStorage.getItem("flatmap-knowledge-source");if(!i||r!==o){const d=(await t.flatmapQuery(a)).values.map(c=>c[0]).map(c=>JSON.parse(c));return sessionStorage.setItem("flatmap-knowledge",JSON.stringify(d)),sessionStorage.setItem("flatmap-knowledge-source",o),hb(),d}return JSON.parse(i)}function hb(){const o=new Date().getTime()+864e5;sessionStorage.setItem("flatmap-knowledge-expiry",o)}function mb(){["flatmap-knowledge","flatmap-knowledge-expiry","flatmap-knowledge-source"].forEach(t=>{sessionStorage.removeItem(t)})}function us(){const e=sessionStorage.getItem("flatmap-knowledge-expiry");new Date().getTime()>e&&mb()}const ps=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),gb='<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow"><path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/><text x="47" y="52%" style="white-space: pre" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#333333">Featured dataset marker</text></svg>';var hs={exports:{}};(function(e,t){(function(o,a){e.exports=a()})(typeof window<"u"?window:hm,function(){if(typeof window>"u")return null;var o=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")(),a=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||function(f){return o.setTimeout(f,20)},i=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||function(f){o.clearTimeout(f)};function r(f,u){var p=Object.prototype.toString.call(f),g=p==="[object Array]"||p==="[object NodeList]"||p==="[object HTMLCollection]"||p==="[object Object]"||typeof jQuery<"u"&&f instanceof jQuery||typeof Elements<"u"&&f instanceof Elements,h=0,m=f.length;if(g)for(;h<m;h++)u(f[h]);else u(f)}function s(f){if(!f.getBoundingClientRect)return{width:f.offsetWidth,height:f.offsetHeight};var u=f.getBoundingClientRect();return{width:Math.round(u.width),height:Math.round(u.height)}}function l(f,u){Object.keys(u).forEach(function(p){f.style[p]=u[p]})}var d=function(f,u){var p=0;function g(){var m=[];this.add=function(w){m.push(w)};var b,y;this.call=function(w){for(b=0,y=m.length;b<y;b++)m[b].call(this,w)},this.remove=function(w){var T=[];for(b=0,y=m.length;b<y;b++)m[b]!==w&&T.push(m[b]);m=T},this.length=function(){return m.length}}function h(m,b){if(m){if(m.resizedAttached){m.resizedAttached.add(b);return}m.resizedAttached=new g,m.resizedAttached.add(b),m.resizeSensor=document.createElement("div"),m.resizeSensor.dir="ltr",m.resizeSensor.className="resize-sensor";var y={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},w={position:"absolute",left:"0px",top:"0px",transition:"0s"};l(m.resizeSensor,y);var T=document.createElement("div");T.className="resize-sensor-expand",l(T,y);var k=document.createElement("div");l(k,w),T.appendChild(k);var S=document.createElement("div");S.className="resize-sensor-shrink",l(S,y);var E=document.createElement("div");l(E,w),l(E,{width:"200%",height:"200%"}),S.appendChild(E),m.resizeSensor.appendChild(T),m.resizeSensor.appendChild(S),m.appendChild(m.resizeSensor);var I=window.getComputedStyle(m),M=I?I.getPropertyValue("position"):null;M!=="absolute"&&M!=="relative"&&M!=="fixed"&&M!=="sticky"&&(m.style.position="relative");var x=!1,B=0,v=s(m),_=0,V=0,q=!0;p=0;var D=function(){var Z=m.offsetWidth,ce=m.offsetHeight;k.style.width=Z+10+"px",k.style.height=ce+10+"px",T.scrollLeft=Z+10,T.scrollTop=ce+10,S.scrollLeft=Z+10,S.scrollTop=ce+10},O=function(){if(q){var Z=m.offsetWidth===0&&m.offsetHeight===0;if(Z){p||(p=a(function(){p=0,O()}));return}else q=!1}D()};m.resizeSensor.resetSensor=O;var $=function(){B=0,x&&(_=v.width,V=v.height,m.resizedAttached&&m.resizedAttached.call(v))},pe=function(){v=s(m),x=v.width!==_||v.height!==V,x&&!B&&(B=a($)),O()},J=function(Z,ce,Ee){Z.attachEvent?Z.attachEvent("on"+ce,Ee):Z.addEventListener(ce,Ee)};J(T,"scroll",pe),J(S,"scroll",pe),p=a(function(){p=0,O()})}}r(f,function(m){h(m,u)}),this.detach=function(m){p||(i(p),p=0),d.detach(f,m)},this.reset=function(){f.resizeSensor.resetSensor()}};if(d.reset=function(f){r(f,function(u){u.resizeSensor.resetSensor()})},d.detach=function(f,u){r(f,function(p){p&&(p.resizedAttached&&typeof u=="function"&&(p.resizedAttached.remove(u),p.resizedAttached.length())||p.resizeSensor&&(p.contains(p.resizeSensor)&&p.removeChild(p.resizeSensor),delete p.resizeSensor,delete p.resizedAttached))})},typeof MutationObserver<"u"){var c=new MutationObserver(function(f){for(var u in f)if(f.hasOwnProperty(u))for(var p=f[u].addedNodes,g=0;g<p.length;g++)p[g].resizeSensor&&d.reset(p[g])});document.addEventListener("DOMContentLoaded",function(f){c.observe(document.body,{childList:!0,subtree:!0})})}return d})})(hs);var bb=hs.exports;const yb=mm(bb),wb=ma.defineStore("main",{state:()=>({userProfile:{token:""}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function Cb(e){return{all:e=e||new Map,on:function(t,o){var a=e.get(t);a?a.push(o):e.set(t,[o])},off:function(t,o){var a=e.get(t);a&&(o?a.splice(a.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var a=e.get(t);a&&a.slice().map(function(i){i(o)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,o)})}}}const la=new Cb,vb="cannot be found on the map.",Sb=e=>{let t={lng:0,lat:0},o;return e.type==="Polygon"?e.coordinates.length&&(o=e.coordinates[0]):o=e.coordinates,o&&(e.type!=="Point"?(o.map(a=>{t.lng+=parseFloat(a[0]),t.lat+=parseFloat(a[1])}),t.lng=t.lng/o.length,t.lat=t.lat/o.length):(t.lng+=parseFloat(o[0]),t.lat+=parseFloat(o[1]))),t},ms=(e,t)=>{const o=[];let a=e.organs?e.organs:e.ftus;const i=a?a.filter((r,s)=>a.findIndex(l=>l.label===r.label)===s):void 0;return i&&i.forEach(r=>{const s={label:r.label,models:r.models,key:`${t}.${r.label}`},l=ms(r,s.key);l.length>0&&(s.children=l),o.push(s)}),o},kb={name:"FlatmapVuer",components:{Button:Lr,Col:Xt,Loading:Jg,Radio:Qr,Icon:ke,RadioGroup:Xr,Row:Qt,Select:zn,Dialog:mg,MapSvgIcon:ha.MapSvgIcon,MapSvgSpriteColor:ha.MapSvgSpriteColor,Tooltip:to.Tooltip,TreeControls:to.TreeControls,SelectionsGroup:ds,SvgLegends:fs,ElIconWarningFilled:U.WarningFilled,ElIconArrowDown:U.ArrowDown,ElIconArrowLeft:U.ArrowLeft,DrawToolbar:to.DrawToolbar},beforeCreate:function(){this.setStateRequired=!1},setup(e){let t=n.inject("$annotator");return t||(t=n.markRaw(new Is.AnnotationService(`${e.flatmapAPI}annotator`)),n.provide("$annotator",t)),{annotator:t}},methods:{manualAbortedOnClose:function(){this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEventCallback({},{type:"aborted"}),this.initialiseDrawing()},initialiseDrawing:function(){this.connectionEntry={},this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.drawnCreatedEvent={}},cancelDrawnFeature:function(){this.isValidDrawnCreated&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[{...this.drawnCreatedEvent.feature,resourceId:this.serverURL}],this.rollbackAnnotationEvent(),this.initialiseDrawing())},connectedFeatureTooltip:function(e){if(this.mapImp)if(e){const t=Number(e);let a={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(i=>i.id===e.trim())}};this.checkAndCreatePopups([a])}else this.closeTooltip()},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent]),Object.keys(this.connectionEntry).length>0&&(this.annotationEntry[0].feature.connection=this.connectionEntry),this.initialiseDrawing())},toolbarEvent:function(e,t){if(!this.isValidDrawnCreated){if(this.manualAbortedOnClose(),this.doubleClickedFeature=!1,this.changeAnnotationDrawMode({mode:"simple_select"}),e==="mode")this.activeDrawMode=t;else if(e==="tool"){if(this.cancelDrawnFeature(),t){const o=t.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${o}`})}this.activeDrawTool=t}}},annotationDrawModeEvent:function(e){this.activeDrawMode==="Edit"?this.doubleClickedFeature&&(e.feature.feature.geometry.type!=="Point"&&(this.changeAnnotationDrawMode({mode:"direct_select",options:{featureId:e.feature.feature.id}}),this.modifyAnnotationFeature()),this.doubleClickedFeature=!1):this.activeDrawMode==="Delete"&&(this.changeAnnotationDrawMode({mode:"simple_select",options:{featureIds:[e.feature.feature.id]}}),this.modifyAnnotationFeature())},createConnectivityBody:function(){if(Object.keys(this.connectionEntry).length>0){const e=Object.values(this.connectionEntry),t={type:"connectivity",source:e[0],target:e[e.length-1],intermediates:e.filter((o,a)=>a!==0&&a!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},modifyAnnotationFeature:function(){this.mapImp&&this.mapImp.removeAnnotationFeature()},rollbackAnnotationEvent:function(){this.mapImp&&this.annotationEntry.length>0&&["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0]),this.annotationEntry=[])},commitAnnotationEvent:function(e){this.mapImp&&(this.offlineAnnotationEnabled&&(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],this.offlineAnnotations.push(e),this.annotationEntry[0].type==="deleted"&&(this.offlineAnnotations=this.offlineAnnotations.filter(t=>t.resource!==this.serverURL||t.item.id!==e.item.id)),sessionStorage.setItem("anonymous-annotation",JSON.stringify(this.offlineAnnotations))),["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.featureAnnotationSubmitted=!0,this.mapImp.commitAnnotationEvent(this.annotationEntry[0]),e.body.comment==="Position Updated"?this.annotationEntry[0].positionUpdated=!1:this.annotationEntry[0].type==="deleted"&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[]),this.addAnnotationFeature()))},fetchAnnotatedItemIds:async function(e=void 0,t=void 0){let o;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.resource===this.serverURL).map(a=>a.item.id)):(o=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),"resource"in o&&(o=o.itemIds)),o},setFeatureAnnotated:async function(){if(this.mapImp){const e=await this.fetchAnnotatedItemIds();for(const t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let o;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.feature&&a.resource===this.serverURL).map(a=>a.feature);else{const a=await this.fetchAnnotatedItemIds(e,t);o=await this.annotator.drawnFeatures(this.userToken,this.serverURL,a),"resource"in o&&(o=o.features)}return o},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);const e=this.annotationFrom==="Anyone"?void 0:this.authorisedUser.orcid?this.authorisedUser.orcid:"0000-0000-0000-0000",t=this.annotationFrom==="Anyone"?void 0:this.annotationFrom==="Me",o=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=o,this.loading=!1,!this.featureAnnotationSubmitted)for(const a of o)this.mapImp.addAnnotationFeature(a)}},showAnnotator:function(e){this.mapImp&&(this.mapImp.showAnnotator(e),this.$el.querySelector(".maplibregl-ctrl-group").style.display="none")},setAnnotationFrom:function(e){this.annotationFrom=e,this.mapImp&&(this.manualAbortedOnClose(),this.addAnnotationFeature())},emitOfflineAnnotationUpdate:function(){this.$emit("update-offline-annotation-enabled",this.offlineAnnotationEnabled)},setFlightPath3D:function(e){this.flightPath3DRadio=e,this.mapImp&&this.mapImp.enableFlightPaths(e)},viewLatestMap:function(){let e=this.biologicalSex?this.biologicalSex:void 0;this.entry==="NCBITaxon:9606"&&(e="PATO:0000384");const t={entry:this.entry,biologicalSex:e,viewport:this.mapImp.getState()};this.$emit("view-latest-map",t)},backgroundChangeCallback:function(e){this.currentBackground=e,this.mapImp&&this.mapImp.setBackgroundColour(this.currentBackground,1)},processSystems:function(e){if(this.systems.length=0,e&&e.length>0){const t={label:"All",key:"All",children:[]};e.forEach(o=>{const a={colour:o.colour,enabled:o.enabled,label:o.id,key:o.id},i=ms(o,a.key);i.length>0&&(a.children=i),t.children.push(a)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,Wn(this.mapImp,e).then(o=>{o.length&&o.forEach(a=>{let i=!0;t&&(i=t.checkAll?!0:t.checked.includes(a.taxon)),this.taxonConnectivity.push({...a,enabled:i}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(a.taxon,i)})})},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},setColour:function(e){this.colourRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:e,outlined:this.outlinesRadio})},setOutlines:function(e){this.outlinesRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:this.colourRadio,outlined:e})},setInitMapState:function(){if(this.mapImp){const e=this.mapImp.map,t=this.mapImp.options.bounds,o=[[t[0],t[1]],[t[2],t[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=n.markRaw({initBounds:o})}},resetView:function(){if(this.mapImp){const e=this.mapImp.map,{initBounds:t}=this.initMapState;e.resetNorthPitch({animate:!1}),t&&e.fitBounds(t,{animate:!1}),this.$refs.skcanSelection&&this.$refs.skcanSelection.reset(),this.$refs.layersSelection&&this.$refs.layersSelection.reset(),this.$refs.systemsSelection&&this.$refs.pathwaysSelection.reset(),this.$refs.pathwaysSelection&&this.$refs.pathwaysSelection.reset()}},zoomIn:function(){this.mapImp&&this.mapImp.zoomIn()},zoomOut:function(){this.mapImp&&this.mapImp.zoomOut()},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},sckanSelected:function(e){this.mapImp&&this.mapImp.enableSckanPath(e.key,e.value)},checkAllSCKAN:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableSckanPath(t,e.value))},zoomToFeatures:function(e){this.mapImp&&this.mapImp.zoomToFeatures(e)},retrieveConnectedPaths:async function(e,t={}){var o,a,i,r,s;if(this.mapImp){let l=[],d=(o=t.target)!=null&&o.length?t.target:[];const c=[...this.mapImp.pathModelNodes(e)],f=await this.mapImp.queryPathsForFeatures(e);if(c.length){if(!d.length){const u=(a=t.type)!=null&&a.length?t.type:["all"],p=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),g=(i=p==null?void 0:p.ids)==null?void 0:i.dendrites.flat(1/0),h=(r=p==null?void 0:p.ids)==null?void 0:r.components.flat(1/0),m=(s=p==null?void 0:p.ids)==null?void 0:s.axons.flat(1/0);let b=[];u.includes("origins")&&b.push(...g),u.includes("components")&&b.push(...h),u.includes("destinations")&&b.push(...m),u.includes("all")&&b.push(...g,...h,...m),d=[...new Set(b)]}c.forEach(u=>{this.mapImp.nodePathModels(u).forEach(g=>{const m=this.mapImp.pathModelNodes(g).map(y=>this.mapImp.featureProperties(y).models);d.filter(y=>m.includes(y)).length&&!l.includes(g)&&l.push(g)})})}else f.length&&(d.length?f.forEach(u=>{const g=this.mapImp.pathModelNodes(u).map(m=>this.mapImp.featureProperties(m).models);d.filter(m=>g.includes(m)).length&&!l.includes(u)&&l.push(u)}):l=f);return l=[...new Set([...l,...e])],l}},resetMapFilter:function(){const e=this.mapFilters.alert;let t;e.with?e.without||(t={HAS:"alert"}):e.without?t={NOT:{HAS:"alert"}}:t={AND:[{NOT:{HAS:"alert"}},{HAS:"alert"}]},t?this.mapImp.setVisibilityFilter(t):this.mapImp.clearVisibilityFilter()},alertMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){let t;e.key==="alert"?t={HAS:"alert"}:e.key==="withoutAlert"&&(t={NOT:{HAS:"alert"}}),this.mapImp.setVisibilityFilter(t)}else this.resetMapFilter()},alertSelected:function(e){this.mapImp&&(e.key==="alert"?e.value?this.mapFilters.alert.with=!0:this.mapFilters.alert.with=!1:e.key==="withoutAlert"&&(e.value?this.mapFilters.alert.without=!0:this.mapFilters.alert.without=!1),this.resetMapFilter())},checkAllAlerts:function(e){this.mapImp&&(e.value?(this.mapFilters.alert.without=!0,this.mapFilters.alert.with=!0):(this.mapFilters.alert.without=!1,this.mapFilters.alert.with=!1),this.resetMapFilter())},systemSelected:function(e){this.mapImp&&this.mapImp.enableSystem(e.key,e.value)},checkAllSystems:function(e){this.mapImp&&this.systems[0].children.forEach(t=>this.mapImp.enableSystem(t.label,e))},ftuSelected:function(e){this.searchAndShowResult(e,!0)},layersSelected:function(e){this.mapImp&&this.mapImp.enableLayer(e.key,e.value)},checkAllLayers:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableLayer(t,e.value))},taxonsSelected:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.key,e.value)},taxonMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){clearTimeout(this.taxonLeaveDelay);let t=this.mapImp.taxonFeatureIds(e.key);this.mapImp.enableConnectivityByTaxonIds(e.key,e.value),this.mapImp.zoomToGeoJSONFeatures(t,{noZoomIn:!0})}else this.taxonLeaveDelay=setTimeout(()=>{this.mapImp.unselectGeoJSONFeatures(),e.selections.forEach(t=>{let o=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,o)})},1e3)},checkAllTaxons:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.keys,e.value)},pathwaysSelected:function(e){this.mapImp&&this.mapImp.enablePath(e.key,e.value)},checkAllPathways:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enablePath(t,e.value))},enablePanZoomEvents:function(e){this.mapImp.enablePanZoomEvents(e)},annotationEventCallback:function(e,t){if(t.type==="aborted")this.featureAnnotationSubmitted?this.featureAnnotationSubmitted=!1:this.rollbackAnnotationEvent(),this.annotationEntry=[];else if(t.type==="modeChanged")t.feature.mode==="direct_select"&&(this.doubleClickedFeature=!0),this.annotationSidebar&&t.feature.mode==="simple_select"&&this.activeDrawMode==="Deleted"&&this.annotationEventCallback({},{type:"aborted"});else if(t.type==="selectionChanged"){if(this.selectedDrawnFeature=t.feature.features.length===0?void 0:t.feature.features[0],e.feature.feature=this.selectedDrawnFeature,!this.activeDrawTool)if(this.connectionEntry={},this.selectedDrawnFeature){const o=this.existDrawnFeatures.find(a=>a.id===this.selectedDrawnFeature.id);o&&o.connection&&(this.connectionEntry=o.connection),this.annotationDrawModeEvent(e)}else this.annotationSidebar&&this.previousEditEvent.type==="updated"&&(this.annotationEntry=[{...this.previousEditEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.previousEditEvent={}}else{if(t.type==="created"||t.type==="updated"){t.type==="updated"&&t.feature.action&&(t.positionUpdated=t.feature.action==="move");const o=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=o}t.type==="created"?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type==="updated"&&(this.previousEditEvent=t),t.type==="deleted"?this.previousDeletedEvent=t:this.previousDeletedEvent={}},eventCallback:function(){return(e,t,...o)=>{if(e==="annotation"){const a={feature:t,userData:o,eventType:e};this.annotationEventCallback(a,t)}else if(e!=="pan-zoom"){const a=t.label,i=[t.models],r=this.entry,s=this.biologicalSex,l=t.alert;let d;t.taxons&&(typeof t.taxons!="object"?d=JSON.parse(t.taxons):d=t.taxons);let c=[{dataset:t.dataset,biologicalSex:s,taxonomy:r,resource:i,label:a,feature:t,userData:o,eventType:e,provenanceTaxonomy:d,alert:l}];if(e==="click"){const f=Object.keys(t).includes("id");if(!f){c=[];const p=t.mapUUID,g=new Set;for(let[h,m]of Object.entries(t))if(h!=="mapUUID"){const b=m.id,y=m.label,w=[m.models];let T;if(m.taxons&&(typeof m.taxons!="object"?T=JSON.parse(m.taxons):T=m.taxons),g.has(b))continue;g.add(b),c.push({dataset:m.dataset,biologicalSex:s,taxonomy:r,resource:w,label:y,feature:m,userData:o,eventType:e,provenanceTaxonomy:T,alert:m.alert,mapUUID:p})}}const u=f?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,u),this.viewingMode==="Neuron Connection")this.retrieveConnectedPaths([u.models]).then(p=>{this.zoomToFeatures(p)});else if(this.currentActive=u.models?u.models:"",this.activeDrawTool&&!this.isValidDrawnCreated){const p=u.featureId||this.existDrawnFeatures.find(g=>g.id===u.id);if(this.activeDrawTool==="LineString"&&p){const g=u.featureId?u.featureId:u.id,h=u.label?u.label:`Feature ${u.id}`;this.connectionEntry[` ${g}`]=Object.assign({label:h},Object.fromEntries(Object.entries(u).filter(([m])=>["featureId","models"].includes(m)).map(([m,b])=>[m==="featureId"?"id":m,b])))}}}else e==="mouseenter"&&this.viewingMode!=="Neuron Connection"&&(this.currentHover=t.models?t.models:"");t&&t.type!=="marker"&&e==="click"&&this.viewingMode!=="Neuron Connection"&&!this.activeDrawTool&&this.checkAndCreatePopups(c),this.$emit("resource-selected",c)}else this.$emit("pan-zoom-callback",t)}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=t.source,(e==="Neuron Connection"||e==="Annotation")&&(this.connectivityDataSource=t.featureId)},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(".flatmap-tooltip-popup").forEach(t=>t.remove())},createTooltipForConnectivity:function(e,t){const o=document.createElement("div");o.classList.add("flatmap-feature-label"),e.forEach((a,i)=>{const{label:r}=a;if(o.append(ps(r)),i+1<e.length){const s=document.createElement("hr");o.appendChild(s)}}),this.mapImp.showPopup(t,o,{className:"custom-popup flatmap-tooltip-popup",positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){const{connectivityInfo:t,data:o}=e,a=[],i=[],r=[],s=[];if(t&&t.featureId&&a.push(...t.featureId),this.mapImp){if(o.forEach(c=>{const f=this.mapImp.search(c.id);if(f!=null&&f.results.length){const u=f==null?void 0:f.results[0].featureId;r.push({featureId:u,...c})}else s.push(c)}),r.length){let c=r[0].featureId;this.mapImp.annotations.forEach(f=>{const u=f["anatomical-nodes"];if(u){const p=u.join("");r.every(h=>p.indexOf(h.id)!==-1)&&(c=f.featureId,i.push(c))}}),this.createTooltipForConnectivity(r,c)}else this.removeActiveTooltips();this.emitConnectivityError(s);const d=[...this.mapImp.modelFeatureIdList(a),...i];this.mapImp.selectGeoJSONFeatures(d)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(t=>{this.mapImp.selectFeatures(t)})},searchConnectivitiesByReference:async function(e){const t=sessionStorage.getItem("flatmap-knowledge");let o=[];return t?o=await db(e):o=await fb(this.mapImp,e,this.flatmapQueries),o},emitConnectivityError:function(e){this.$emit("connectivity-error",{data:{errorData:e,errorMessage:vb}})},checkConnectivityTooltipEntry:function(e){return e!=null&&e.length?e.find(t=>{var o,a;return((o=t==null?void 0:t.destinations)==null?void 0:o.length)||((a=t==null?void 0:t.components)==null?void 0:a.length)})!==void 0:!1},changeConnectivitySource:async function(e){const{entry:t,connectivitySource:o}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],o),this.tooltipEntry=this.tooltipEntry.map(a=>a.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(a):a),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry))},checkAndCreatePopups:async function(e){if(this.viewingMode==="Annotation"){const t=e.filter(o=>o.feature).map(o=>o.feature);if(t.length>0)if(this.annotationSidebar&&this.previousDeletedEvent.type==="deleted"&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.annotationEntry=[],t.forEach(o=>{var a;this.annotationEntry.push({...o,resourceId:this.serverURL,featureId:o.featureId?o.featureId:(a=o.feature)==null?void 0:a.id,offline:this.offlineAnnotationEnabled})}),t[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(t[0].feature.id,Sb(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{const o=this.annotationEntry.filter(a=>a.featureId&&a.models).map(a=>a.models);o.length>0&&this.displayTooltip(o)}else this.annotation={}}else{pb(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(o=>o.resource[0]in this.mapImp.pathways.paths).map(o=>({title:o.label,featureId:o.resource,ready:!1})),this.tooltipEntry.length){this.$emit("connectivity-info-open",this.tooltipEntry);for(let a=0;a<e.length;a++)t.push(await this.getKnowledgeTooltip(e[a]));this.tooltipEntry=await Promise.all(t);const o=this.tooltipEntry.map(a=>a.featureId[0]);o.length>0&&this.displayTooltip(o)}}},getKnowledgeTooltip:async function(e){const t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e);let o=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(o.featuresAlert=e.alert,o.knowledgeSource=sa(this.mapImp),o.mapId=this.mapImp.provenance.id,o.mapuuid=this.mapImp.provenance.uuid),o.ready=!0,o},popUpCssHacks:function(){const e=document.querySelector(".flatmap-tooltip-popup"),t=document.querySelector(".maplibregl-popup-close-button");e&&(e.style.display="none"),t.style.display="block",this.$refs.tooltip.$el.style.display="flex",t.onclick=()=>{this.$emit("connectivity-info-close"),e&&(e.style.display="block")}},closeTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.$el.style.display="none"),document.querySelectorAll(".maplibregl-popup").forEach(e=>{e.style.display="none"})},showPopup:function(e,t,o){let a=o;this.mapImp&&(a?a.className||(a.className="custom-popup"):a={className:"custom-popup",positionAtLastClick:!0},this.mapImp.showPopup(e,t,a))},showMarkerPopup:function(e,t,o){this.mapImp&&this.mapImp.showMarkerPopup(e,t,o)},closeMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");this.minimapSmall?(e.classList.add("enlarge"),e.classList.remove("shrink")):(e.classList.add("shrink"),e.classList.remove("enlarge")),this.minimapSmall=!this.minimapSmall},addResizeButtonToMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");e&&(this.$refs.minimapResize&&this.$refs.minimapResize.$el.parentNode&&this.$refs.minimapResize.$el.parentNode.removeChild(this.$refs.minimapResize.$el),e.appendChild(this.$refs.minimapResize.$el),this.minimapResizeShow=!0)},setHelpMode:function(e){const t=this.hoverVisibilities.length,o=t-1,a=this.hoverVisibilities[this.helpModeActiveIndex];if(a){const i=a==null?void 0:a.refs,r=a==null?void 0:a.ref,s=this.$refs[i||r];if(s){const{parentElement:l,nextElementSibling:d}=s.$el,c=f=>f&&(f.classList.contains("pathway-container")||f.classList.contains("pathway-location"));(c(l)||c(d))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!=="Annotation"&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=o),e&&this.helpModeActiveIndex>=o&&this.$emit("help-mode-last-item",!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(i=>{i.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.closeFlatmapHelpPopup())},showTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit("shown-tooltip")},t))},hideTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},displayTooltip:function(e,t=void 0){let o,a={className:"flatmapvuer-popover"};if(t)o=e,a.annotationFeatureGeometry=t;else{const i=Array.isArray(e)?e[0]:e;i&&(o=this.mapImp.modelFeatureIds(i)[0]),this.activeDrawTool||(a.positionAtLastClick=!0)}this.connectivityInfoSidebar&&this.tooltipEntry.length&&this.viewingMode!=="Annotation"&&this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry),this.annotationSidebar&&this.viewingMode==="Annotation"&&this.$emit("annotation-open",{annotationEntry:this.annotationEntry,commitCallback:this.commitAnnotationEvent}),o&&!this.disableUI&&(this.viewingMode==="Annotation"&&!this.annotationSidebar||this.viewingMode==="Exploration"&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(o,this.$refs.tooltip.$el,a),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){const{offsetX:o=0,offsetY:a=0,zoom:i=4}=t,r=this.mapImp.map,s=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),s!=null&&s.length&&setTimeout(()=>{r.fitBounds(s,{offset:[o,a],zoom:i,animate:!0})})}},openFlatmapHelpPopup:function(){if(this.mapImp){let e=this.mapImp.modelFeatureIds("UBERON:0000948");e&&e.length>0&&(this.mapImp.showPopup(e[0],"Click for more information",{anchor:"top",className:"flatmap-popup-popper"}),this.$emit("shown-map-tooltip"))}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(".maplibregl-popup-close-button").forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let o of t.values())o.label&&e.push(o.label);return Array.from(new Set(e))}},getVisibilityState:function(e){if(["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{let a=this.$refs[o];a&&(e[o]=a.getState())}),this.$refs.treeControls){const o=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();e.systemsSelection=o.filter(a=>!a.includes("."))}},setVisibilityState:function(e){["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{const a=e[o];if(a){const i=this.$refs[o];i&&i.setState(a)}}),"systemsSelection"in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(o=>{this.mapImp.enableSystem(o.key,e.systemsSelection.includes(o.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()};const t=this.mapImp.getIdentifier();return this.biologicalSex?e.biologicalSex=this.biologicalSex:t&&t.biologicalSex&&(e.biologicalSex=t.biologicalSex),t&&t.uuid&&(e.uuid=t.uuid),e.viewingMode=this.viewingMode,e.searchTerm=this.searchTerm,e.flightPath3D=this.flightPath3DRadio,e.colour=this.colourRadio,e.outlines=this.outlinesRadio,e.background=this.currentBackground,this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem("anonymous-annotation")),this.getVisibilityState(e),e}},setState:function(e){e&&(this.mapImp&&e.entry&&this.entry==e.entry&&(!e.biologicalSex||e.biologicalSex===this.biologicalSex)?this.restoreMapState(e):this.createFlatmap(e),this.setStateRequired=!1)},restoreMapState:function(e){if(e){if(e.viewport&&this.mapImp.setState(e.viewport),e.offlineAnnotations&&sessionStorage.setItem("anonymous-annotation",e.offlineAnnotations),e.viewingMode&&this.changeViewingMode(e.viewingMode),"flightPath3D"in e&&this.setFlightPath3D(e.flightPath3D),"colour"in e&&this.setColour(e.colour),"outlines"in e&&this.setOutlines(e.outlines),e.background&&this.backgroundChangeCallback(e.background),e.searchTerm){const t=e.searchTerm;this.searchAndShowResult(t,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){(e===1.6||e>1.6)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0;let t=!1;this.displayMinimap&&(t={position:"top-right"});let o={taxon:this.entry};this.uuid&&(o.uuid=this.uuid),e?(e.uuid?o={uuid:e.uuid}:e.entry&&(o.taxon=e.entry),e.biologicalSex?o.biologicalSex=e.biologicalSex:o.taxon==="NCBITaxon:9606"&&(o.biologicalSex="PATO:0000384")):this.biologicalSex&&(o.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(o,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:t,container:this.$refs.display}).then(i=>{this.mapImp=i,this.serverURL=this.mapImp.makeServerUrl("").slice(0,-1);let r=this.mapImp.details.version;this.setFlightPathInfo(r);const s=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(s),this.$nextTick(()=>this.restoreMapState(s))})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){const e=this.$refs.display;if(e){const t=getComputedStyle(e),o=parseInt(t.paddingTop)+parseInt(t.paddingBottom),a=e.clientHeight-o;this.pathwaysMaxHeight=a-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&(this.mapImp.resize(),this.showMinimap(this.displayMinimap))}catch{console.error("Map resize error")}},getFilterSources:function(){const e=["kind","taxons"];let t=new Set,o=new Set,a=new Map;for(const r of this.mapImp.annotations.values())if(r.source){"alert"in r?t.add(r.source):o.add(r.source);for(const[s,l]of Object.entries(r))if(e.includes(s)){a.has(s)||a.set(s,new Map);const d=a.get(s),c=f=>{const u=f;d.has(u)||d.set(u,new Set),d.get(u).add(`${r.source}`)};Array.isArray(l)?l.forEach(c):c(l)}}let i={alert:{with:[...t],without:[...o]}};for(const[r,s]of a.entries()){i[r]={};for(const[l,d]of s.entries())i[r][l]=[...d.values()]}return i},getFilterOptions:async function(){if(this.mapImp){let e=[];const t=this.mapImp.featureFilterRanges();for(const[o,a]of Object.entries(t)){let i={key:`flatmap.connectivity.${o}`,label:"",children:[]};if(o==="kind"){i.label="Pathways";for(const r of a){const s=this.pathways.find(l=>l.type!=="centreline"&&l.type===r);s&&i.children.push({key:`${i.key}.${r}`,label:s.label,colour:s.colour,colourStyle:"line",dashed:s.dashed})}}else if(o==="taxons"){i.label="Studied in";const r=await Wn(this.mapImp,this.mapImp.taxonIdentifiers);if(r.length)for(const s of a){const l=r.find(d=>d.taxon===s);l&&i.children.push({key:`${i.key}.${s}`,label:l.label})}}else if(o==="alert"){i.label="Alert";for(const r of["with","without"])i.children.push({key:`${i.key}.${r}`,label:`${r} alerts`})}i.label&&i.children.length&&e.push(i)}return e}},onFlatmapReady:function(e){var t;this.sensor=n.markRaw(new yb(this.$refs.display,this.mapResize)),((t=this.mapImp.options)==null?void 0:t.style)==="functional"&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert="alert"in this.mapImp.featureFilterRanges(),this.addResizeButtonToMinimap(),this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.$emit("ready",this)},handleMapClick:function(){const e=this.mapImp.map;e&&e.on("click",t=>{this.connectivityDataSource||this.$emit("connectivity-info-close"),this.connectivityDataSource=""})},showMinimap:function(e){this.mapImp&&this.mapImp.showMinimap(e)},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t){var o;if(this.mapImp){if(e===void 0||e==="")return this.mapImp.clearSearchResults(),this.viewingMode==="Exploration"?this.$emit("connectivity-info-close"):this.viewingMode==="Annotation"&&this.manualAbortedOnClose(),this.searchTerm="",!0;{const a=this.mapImp.search(e);if((o=a==null?void 0:a.results)!=null&&o.length){if(this.mapImp.showSearchResults(a),t){let i;for(let r=0;r<a.results.length;r++){i=a.results[r].featureId;const s=this.mapImp.annotation(i);if(i&&(s!=null&&s.label))break}if(i){const r=this.mapImp.featureProperties(i),s={resource:[r.models],feature:r,label:r.label,provenanceTaxonomy:r.taxons,alert:r.alert};this.viewingMode==="Exploration"||this.viewingMode==="Annotation"?this.checkAndCreatePopups([s]):this.viewingMode==="Neuron Connection"&&this.retrieveConnectedPaths(s.resource).then(l=>{this.zoomToFeatures(l)}),this.mapImp.showPopup(i,ps(r.label),{className:"custom-popup",positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}else this.mapImp.clearSearchResults()}}return!1},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){la.emit("onActionClick",e)}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:""},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},renderAtMounted:{type:Boolean,default:!0},displayMinimap:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},showStarInLegend:{type:Boolean,default:!1},isLegacy:{type:Boolean,default:!1},displayLatestChanges:{type:Boolean,default:!1},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:n.markRaw({}),sckanDisplay:[{label:"Display Path with SCKAN",key:"VALID"}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:n.markRaw([]),hoverVisibilities:[{value:!1,ref:"markerPopover"},{value:!1,ref:"zoomInPopover"},{value:!1,ref:"zoomOutPopover"},{value:!1,ref:"zoomFitPopover"},{value:!1,ref:"openMapPopover"},{value:!1,ref:"settingsPopover"},{value:!1,ref:"checkBoxPopover"},{value:!1,ref:"warningPopover"},{value:!1,ref:"whatsNewPopover"},{value:!1,ref:"featuredMarkerPopover"},{value:!1,refs:"toolbarPopover",ref:"editPopover"},{value:!1,refs:"toolbarPopover",ref:"deletePopover"},{value:!1,refs:"toolbarPopover",ref:"pointPopover"},{value:!1,refs:"toolbarPopover",ref:"lineStringPopover"},{value:!1,refs:"toolbarPopover",ref:"polygonPopover"},{value:!1,refs:"toolbarPopover",ref:"connectionPopover"}],helpModeActiveIndex:this.helpModeInitialIndex,yellowstar:gb,isFC:!1,inHelp:!1,currentBackground:"white",availableBackground:["white","lightskyblue","black"],loading:!1,flatmapMarker:lb,tooltipEntry:[],connectivityDataSource:"",connectivityTooltipVisible:!1,drawerOpen:!1,flightPath3DRadio:!1,displayFlightPathOption:!1,colourRadio:!0,outlinesRadio:!0,minimapResizeShow:!1,minimapSmall:!1,currentActive:"",selectedDrawnFeature:void 0,currentHover:"",viewingMode:"Exploration",viewingModes:{Exploration:"Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources","Neuron Connection":"Discover Neuron connections by selecting a neuron and viewing its associated network connections",Annotation:["View feature annotations","Add, comment on and view feature annotations"]},offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:"Anyone",annotatedSource:["Anyone","Me","Others"],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:["Edit","Delete","Point","LineString","Polygon","Connection"],annotator:void 0,authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:"Display Path With Alerts",key:"alert",enabled:!0},{label:"Display Path Without Alerts",key:"withoutAlert",enabled:!0}],mapFilters:n.markRaw({alert:{with:!0,without:!0}}),searchTerm:"",taxonLeaveDelay:void 0}},computed:{...ma.mapState(wb,["userToken"]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){var e,t,o;if(this.loading)return this.drawerOpen=!1,!1;if(this.isFC){if(((e=this.systems)==null?void 0:e.length)>0||this.containsAlert&&this.alertOptions||((t=this.pathways)==null?void 0:t.length)>0||((o=this.taxonConnectivity)==null?void 0:o.length)>0)return this.drawerOpen=!0,!0}else return this.drawerOpen=!0,!0;return this.drawerOpen=!1,!0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode==="Annotation"?this.authorisedUser?e[1]:e[0]:e}},watch:{entry:function(){this.state||this.createFlatmap()},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},state:{handler:function(e,t){e!==t&&(this.mapManagerRef?this.setState(e):this.setStateRequired=!0)},immediate:!0,deep:!0},viewingMode:function(e){this.clearAnnotationFeature(),e==="Annotation"&&(this.loading=!0,this.annotator.authenticate(this.userToken).then(t=>{t.name&&t.email&&t.canUpdate?(this.authorisedUser=t,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.setFeatureAnnotated(),this.addAnnotationFeature(),this.loading=!1}))},disableUI:function(e){e&&this.closeTooltip()},activeDrawTool:function(e){let t=[],o={x:null,y:null};const a=this.$el.querySelector(".maplibregl-canvas"),i=()=>{a.removeEventListener("keydown",r),a.removeEventListener("click",s)},r=l=>{if(!["Escape","Enter"].includes(l.key))return;const d=e==="Point"&&t.length===1||e==="LineString"&&t.length>=2||e==="Polygon"&&t.length>=3;(l.key==="Escape"||l.key==="Enter"&&!d)&&(this.activeDrawTool=void 0),i()},s=l=>{const d=a.getBoundingClientRect(),c=l.clientX-d.left,f=l.clientY-d.top;if(Math.sqrt((c-o.x)**2+(f-o.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}o={x:c,y:f},t.push(o)};e&&(i(),a.addEventListener("keydown",r),a.addEventListener("click",s))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ga.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef))},mounted:function(){this.openMapRef=n.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=n.shallowRef(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=n.markRaw(new cb),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),us()}},Eb={class:"flatmap-container",ref:"flatmapContainer","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},Ib={style:{height:"100%",width:"100%",position:"relative","overflow-y":"none"}},Tb={style:{height:"100%",width:"100%"},ref:"display"},Ab={class:"beta-popovers"},Ob={key:2,class:"warning-text"},Mb={class:"bottom-right-control"},xb=["innerHTML"],Bb=["innerHTML"],Nb={style:{"margin-bottom":"2px"}},_b={key:0,class:"viewing-mode-title"},Pb=["onClick"],Vb=["onClick"];function Rb(e,t,o,a,i,r){const s=n.resolveComponent("map-svg-sprite-color"),l=U.WarningFilled,d=ke,c=jn,f=U.ArrowDown,u=n.resolveComponent("DrawToolbar"),p=n.resolveComponent("map-svg-icon"),g=fs,h=n.resolveComponent("tree-controls"),m=ds,b=U.ArrowLeft,y=Lr,w=Qt,T=Xt,k=na,S=zn,E=Qr,I=Xr,M=n.resolveComponent("Tooltip"),x=ss,B=aa;return n.withDirectives((n.openBlock(),n.createElementBlock("div",Eb,[n.createVNode(s),n.createElementVNode("div",Ib,[n.createElementVNode("div",Tb,null,512),n.withDirectives(n.createElementVNode("div",Ab,[n.createElementVNode("div",null,[n.createVNode(c,{placement:"right","popper-class":"warning-popper flatmap-popper",teleported:!1,visible:e.hoverVisibilities[7].value,ref:"warningPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"warning-icon",onMouseover:t[7]||(t[7]=v=>r.showTooltip(7)),onMouseout:t[8]||(t[8]=v=>r.hideTooltip(7))},[o.displayWarning||o.isLegacy?(n.openBlock(),n.createBlock(d,{key:0},{default:n.withCtx(()=>[n.createVNode(l)]),_:1})):n.createCommentVNode("",!0),o.isLegacy?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t[33]||(t[33]=n.createElementVNode("span",{class:"warning-text"},"Legacy Map",-1)),n.createElementVNode("div",{class:"latest-map-text",onClick:t[6]||(t[6]=(...v)=>r.viewLatestMap&&r.viewLatestMap(...v))}," Click here for the latest map ")],64)):o.displayWarning?(n.openBlock(),n.createElementBlock("span",Ob,"Beta")):n.createCommentVNode("",!0)],32)]),default:n.withCtx(()=>[o.isLegacy?(n.openBlock(),n.createElementBlock("p",{key:0,onMouseover:t[0]||(t[0]=v=>r.showTooltip(7)),onMouseout:t[1]||(t[1]=v=>r.hideTooltip(7))}," This is a legacy map, you may view the latest map instead. ",32)):e.isFC?(n.openBlock(),n.createElementBlock("p",{key:1,onMouseover:t[2]||(t[2]=v=>r.showTooltip(7)),onMouseout:t[3]||(t[3]=v=>r.hideTooltip(7))},t[31]||(t[31]=[n.createTextVNode(" This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". ")]),32)):(n.openBlock(),n.createElementBlock("p",{key:2,onMouseover:t[4]||(t[4]=v=>r.showTooltip(7)),onMouseout:t[5]||(t[5]=v=>r.hideTooltip(7))},t[32]||(t[32]=[n.createTextVNode(" This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". New connectivity and species specificity will be added as the SPARC program progresses. ")]),32))]),_:1},8,["visible"])]),o.displayLatestChanges?(n.openBlock(),n.createBlock(c,{key:0,placement:"right",teleported:!1,trigger:"manual","popper-class":"warning-popper flatmap-popper",visible:e.hoverVisibilities[8].value,ref:"whatsNewPopover"},{reference:n.withCtx(()=>[o.displayLatestChanges?(n.openBlock(),n.createElementBlock("div",{key:0,class:"latest-changesicon",onMouseover:t[9]||(t[9]=v=>r.showTooltip(8)),onMouseout:t[10]||(t[10]=v=>r.hideTooltip(8))},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(l)]),_:1}),t[34]||(t[34]=n.createElementVNode("span",{class:"warning-text"},"What's new?",-1))],32)):n.createCommentVNode("",!0)]),default:n.withCtx(()=>t[35]||(t[35]=[n.createElementVNode("b",null,"Connectivity References",-1),n.createElementVNode("p",null," Connectivity references have been improved and available in various formats. ",-1),n.createElementVNode("b",null,"Improved state storing",-1),n.createElementVNode("p",null," Current selection and visibility filters are now stored when creating a permalink. ",-1)])),_:1},8,["visible"])):n.createCommentVNode("",!0)],512),[[n.vShow,!o.disableUI]]),n.withDirectives(n.createVNode(d,{class:n.normalizeClass(["minimap-resize",{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:"minimapResize",onClick:r.closeMinimap},{default:n.withCtx(()=>[n.createVNode(f)]),_:1},8,["class","onClick"]),[[n.vShow,e.minimapResizeShow]]),e.viewingMode==="Annotation"&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!o.disableUI?(n.openBlock(),n.createBlock(u,{key:0,mapCanvas:{containerHTML:this.$el,class:".maplibregl-canvas"},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,hoverVisibilities:e.hoverVisibilities,onClickToolbar:r.toolbarEvent,onFeatureTooltip:r.connectedFeatureTooltip,onConfirmDrawn:r.confirmDrawnFeature,onCancelDrawn:r.cancelDrawnFeature,onShowTooltip:r.showTooltip,onHideTooltip:r.hideTooltip,ref:"toolbarPopover"},null,8,["mapCanvas","toolbarOptions","activeDrawTool","activeDrawMode","newlyDrawnEntry","connectionEntry","hoverVisibilities","onClickToolbar","onFeatureTooltip","onConfirmDrawn","onCancelDrawn","onShowTooltip","onHideTooltip"])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",Mb,[n.createVNode(c,{content:"Zoom in",placement:"left",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[1].value,ref:"zoomInPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[11]||(t[11]=v=>r.zoomIn()),onMouseover:t[12]||(t[12]=v=>r.showTooltip(1)),onMouseout:t[13]||(t[13]=v=>r.hideTooltip(1))},[n.createVNode(p,{class:"icon-button zoomIn",icon:"zoomIn"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[2].value,ref:"zoomOutPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[14]||(t[14]=v=>r.zoomOut()),onMouseover:t[15]||(t[15]=v=>r.showTooltip(2)),onMouseout:t[16]||(t[16]=v=>r.hideTooltip(2))},[n.createVNode(p,{class:"icon-button zoomOut",icon:"zoomOut"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Reset",placement:"top",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[3].value,ref:"zoomFitPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[17]||(t[17]=v=>r.resetView()),onMouseover:t[18]||(t[18]=v=>r.showTooltip(3)),onMouseout:t[19]||(t[19]=v=>r.hideTooltip(3))},[n.createVNode(p,{class:"icon-button fitWindow",icon:"fitWindow"})],32)]),default:n.withCtx(()=>[t[36]||(t[36]=n.createElementVNode("div",null,[n.createTextVNode(" Fit to "),n.createElementVNode("br"),n.createTextVNode(" window ")],-1))]),_:1},8,["visible"])],512),[[n.vShow,!o.disableUI]]),n.createVNode(c,{content:"Change pathway visibility",placement:"right",teleported:!1,trigger:"manual",offset:-18,"popper-class":"flatmap-popper",visible:e.hoverVisibilities[6].value,ref:"checkBoxPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["pathway-location",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["pathway-container",{open:e.drawerOpen,close:!e.drawerOpen}]),style:n.normalizeStyle({"max-height":e.pathwaysMaxHeight+"px"})},[e.isFC?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(g,{key:0,class:"svg-legends-container"})),o.showStarInLegend?(n.openBlock(),n.createBlock(c,{key:1,content:"Location of the featured dataset",placement:"right",teleported:!0,trigger:"manual",width:"max-content",offset:-10,"popper-class":"flatmap-popper flatmap-teleport-popper",visible:e.hoverVisibilities[9].value,ref:"featuredMarkerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"yellow-star-legend",innerHTML:e.yellowstar,onMouseover:t[20]||(t[20]=v=>r.showTooltip(9)),onMouseout:t[21]||(t[21]=v=>r.hideTooltip(9))},null,40,xb),[[x,void 0,"featuredMarkerPopover"]])]),_:1},8,["visible"])):n.createCommentVNode("",!0),n.createVNode(c,{content:"Find these markers for data. The number inside the markers is the number of datasets available for each marker.",placement:"right",teleported:!1,width:"200",trigger:"manual","popper-class":"flatmap-popper flatmap-marker-popper",visible:e.hoverVisibilities[0].value,ref:"markerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"flatmap-marker-help",innerHTML:e.flatmapMarker},null,8,Bb),[[n.vShow,e.hoverVisibilities[0].value],[x,void 0,"markerPopover"]])]),_:1},8,["visible"]),e.isFC&&e.systems&&e.systems.length>0?(n.openBlock(),n.createBlock(h,{key:2,class:"treeControls",mapType:"flatmap",title:"Systems",treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:r.systemSelected,onCheckAll:r.checkAllSystems,onChangeActive:r.ftuSelected,ref:"treeControls"},null,8,["treeData","active","hover","onCheckChanged","onCheckAll","onChangeActive"])):n.createCommentVNode("",!0),e.containsAlert&&e.alertOptions&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Alert",labelKey:"label",identifierKey:"key",selections:e.alertOptions,onChanged:r.alertSelected,onCheckboxMouseEnter:r.alertMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllAlerts,ref:"alertSelection",key:"alertSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.pathways&&e.pathways.length>0&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Pathways",labelKey:"label",identifierKey:"type",colourStyle:"line",selections:e.pathways,onChanged:r.pathwaysSelected,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllPathways,ref:"pathwaysSelection",key:"pathwaysSelection"},null,8,["selections","onChanged","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Studied in",labelKey:"label",identifierKey:"taxon",helpMessage:"Evidence exists that this set of neuron populations have been studied in the given species.",selections:e.taxonConnectivity,onChanged:r.taxonsSelected,onCheckboxMouseEnter:r.taxonMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllTaxons,ref:"taxonSelection",key:"taxonSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0)],6)),[[x,void 0,"checkBoxPopover"]]),n.createElementVNode("div",{onClick:t[22]||(t[22]=(...v)=>r.toggleDrawer&&r.toggleDrawer(...v)),class:n.normalizeClass(["drawer-button",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(b)]),_:1})],2)],2),[[n.vShow,!o.disableUI&&r.requiresDrawer]])]),_:1},8,["visible"]),e.openMapRef?(n.openBlock(),n.createBlock(c,{key:1,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"136",teleported:!1,trigger:"click","popper-class":"open-map-popper non-selectable","virtual-triggering":""},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.openMapOptions,v=>(n.openBlock(),n.createBlock(w,{key:v.key},{default:n.withCtx(()=>[n.createVNode(y,{type:"primary",plain:"",onClick:_=>e.$emit("open-map",v.key)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(v.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):n.createCommentVNode("",!0),n.createVNode(c,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"320",teleported:!1,trigger:"click","popper-class":"background-popper h-auto","virtual-triggering":""},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[37]||(t[37]=[n.createTextVNode("Viewing Mode")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createElementVNode("div",Nb,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.viewingModes,(v,_,V)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:_},[_===e.viewingMode?(n.openBlock(),n.createElementBlock("span",_b,[n.createElementVNode("b",null,n.toDisplayString(_),1)])):(n.openBlock(),n.createElementBlock("span",{key:1,class:"viewing-mode-unselected",onClick:q=>r.changeViewingMode(_)},n.toDisplayString(_),9,Pb))],64))),128))]),n.createVNode(w,{class:"viewing-mode-description"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.modeDescription),1)]),_:1}),e.viewingMode==="Annotation"&&e.offlineAnnotationEnabled?(n.openBlock(),n.createBlock(w,{key:0,class:"viewing-mode-description"},{default:n.withCtx(()=>t[38]||(t[38]=[n.createTextVNode(" (Anonymous annotate) ")])),_:1})):n.createCommentVNode("",!0)]),_:1}),e.viewingMode==="Annotation"&&e.authorisedUser?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[39]||(t[39]=[n.createTextVNode("Annotations From")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(S,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":t[23]||(t[23]=v=>e.annotationFrom=v),placeholder:"Select",class:"select-box","popper-class":"flatmap_dropdown",onChange:r.setAnnotationFrom},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.annotatedSource,v=>(n.openBlock(),n.createBlock(k,{key:v,label:v,value:v},{default:n.withCtx(()=>[n.createVNode(w,null,{default:n.withCtx(()=>[n.createVNode(T,{span:12},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(v),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1})],64)):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:1,class:"backgroundSpacer"})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:2,class:"backgroundText"},{default:n.withCtx(()=>t[40]||(t[40]=[n.createTextVNode("Flight path display")])),_:1})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:3,class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":t[24]||(t[24]=v=>e.flightPath3DRadio=v),class:"flatmap-radio",onChange:r.setFlightPath3D},{default:n.withCtx(()=>[n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[41]||(t[41]=[n.createTextVNode("2D")])),_:1}),n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[42]||(t[42]=[n.createTextVNode("3D")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[43]||(t[43]=[n.createTextVNode("Organs display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.colourRadio,"onUpdate:modelValue":t[25]||(t[25]=v=>e.colourRadio=v),class:"flatmap-radio",onChange:r.setColour},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[44]||(t[44]=[n.createTextVNode("Colour")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[45]||(t[45]=[n.createTextVNode("Greyscale")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[46]||(t[46]=[n.createTextVNode("Outlines display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.outlinesRadio,"onUpdate:modelValue":t[26]||(t[26]=v=>e.outlinesRadio=v),class:"flatmap-radio",onChange:r.setOutlines},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[47]||(t[47]=[n.createTextVNode("Show")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[48]||(t[48]=[n.createTextVNode("Hide")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[49]||(t[49]=[n.createTextVNode("Change background")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.availableBackground,v=>(n.openBlock(),n.createElementBlock("div",{key:v,class:n.normalizeClass(["backgroundChoice",v,v==e.currentBackground?"active":""]),onClick:_=>r.backgroundChangeCallback(v)},null,10,Vb))),128))]),_:1})])]),_:1},8,["virtual-ref"]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[o.showOpenMapButton?(n.openBlock(),n.createBlock(w,{key:0},{default:n.withCtx(()=>[n.createVNode(c,{visible:e.hoverVisibilities[4].value,content:"Open new map",placement:"right",teleported:!1,"popper-class":"flatmap-popper",ref:"openMapPopover"},{reference:n.withCtx(()=>[o.enableOpenMapUI&&o.openMapOptions.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,ref:"openMapRef",class:"icon-button-container",onMouseover:t[27]||(t[27]=v=>r.showTooltip(4)),onMouseout:t[28]||(t[28]=v=>r.hideTooltip(4))},[n.createVNode(p,{icon:"openMap",class:"icon-button open-map-button"})],544)):n.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0),o.showLocalSettings?(n.openBlock(),n.createBlock(w,{key:1},{default:n.withCtx(()=>[n.createVNode(c,{content:"Change settings",placement:"right",visible:e.hoverVisibilities[5].value,teleported:!1,trigger:"manual","popper-class":"flatmap-popper",ref:"settingsPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{ref:"backgroundIconRef",class:"icon-button-container",onMouseover:t[29]||(t[29]=v=>r.showTooltip(5)),onMouseout:t[30]||(t[30]=v=>r.hideTooltip(5))},[n.createVNode(p,{icon:"changeBckgd",class:"icon-button"})],544)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0)],2),[[n.vShow,!o.disableUI]]),e.tooltipDisplay?(n.openBlock(),n.createBlock(M,{key:2,ref:"tooltip",class:"tooltip",annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode==="Annotation",onAnnotation:r.commitAnnotationEvent,onOnActionClick:r.onActionClick},null,8,["annotationEntry","tooltipEntry","annotationDisplay","onAnnotation","onOnActionClick"])):n.createCommentVNode("",!0)])])),[[B,e.loading]])}const ca=Kn(kb,[["render",Rb],["__scopeId","data-v-f9a00745"]]),gs={"NCBITaxon:10114":"01fedbf9-d783-509c-a10c-827941ab13da","NCBITaxon:9823":"a336ac04-24db-561f-a25f-1c994fe17410","NCBITaxon:9606":"42ed6323-f645-5fbe-bada-9581819cf689","NCBITaxon:10090":"25285fab-48a0-5620-a6a0-f9a0374837d5","NCBITaxon:9685":"73060497-46a6-52bf-b975-cac511c127cb"},Lb={name:"MultiFlatmapVuer",components:{Col:Xt,Row:Qt,Option:na,Select:zn,Popover:jn,FlatmapVuer:ca},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),la.on("onActionClick",e=>{this.resourceSelected(e)}),la.on("open-pubmed-url",e=>{this.$emit("open-pubmed-url",e)})},methods:{initialise:function(){return new Promise(e=>{this.requireInitialisation?(this.requireInitialisation=!1,fetch(this.flatmapAPI).then(t=>t.json()).then(t=>{Object.keys(this.availableSpecies).forEach(a=>{const i=this.availableSpecies[a].uuid;if(i&&t.map(r=>r.uuid).indexOf(i)>0)this.speciesList[a]=this.availableSpecies[a];else for(let r=0;r<t.length;r++)if(this.availableSpecies[a].taxo===t[r].taxon)if(this.availableSpecies[a].biologicalSex){if(t[r].biologicalSex&&t[r].biologicalSex===this.availableSpecies[a].biologicalSex){this.speciesList[a]=this.availableSpecies[a];break}}else{this.speciesList[a]=this.availableSpecies[a];break}});let o=this.initial;if(this.state){const a=this.state.state;(!a||!a.uuid&&!a.entry)&&this.state.species?o=this.state.species:o=void 0}o&&(o&&this.speciesList[o]!==void 0?this.activeSpecies=o:this.activeSpecies=Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(a=>{a()})})):this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ga.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef)))},resourceSelected:function(e){this.$emit("resource-selected",e)},FlatmapReady:function(e){this.$emit("ready",e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},panZoomCallback:function(e){this.$emit("pan-zoom-callback",e)},onAnnotationClose:function(){this.$emit("annotation-close")},onAnnotationOpen:function(e){this.$emit("annotation-open",e)},updateOfflineAnnotationEnabled:function(e){this.$emit("update-offline-annotation-enabled",e)},onConnectivityInfoClose:function(){this.$emit("connectivity-info-close")},onConnectivityInfoOpen:function(e){this.$emit("connectivity-info-open",e)},onConnectivityError:function(e){this.$emit("connectivity-error",e)},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},showPopup:function(e,t,o){this.getCurrentFlatmap().showPopup(e,t,o)},showMarkerPopup:function(e,t,o){this.getCurrentFlatmap().showMarkerPopup(e,t,o)},setSpecies:function(e,t,o){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit("flatmapChanged",this.activeSpecies);else if(o){const a=o-1;a>=0&&this.$nextTick(()=>{this.setSpecies(e,t,a)})}},viewLatestMap:function(e){const t=Object.keys(this.speciesList);for(let o=0;o<t.length;o++){const a=this.speciesList[t[o]];if(!a.isLegacy&&a.taxo===e.entry&&a.biologicalSex===e.biologicalSex){this.setSpecies(t[o],e,0);return}}},createLegacyEntry:function(e,t,o){if(o&&t){let a="Legacy";return e.species&&(e.species.slice(0,6)==="Legacy"?a=e.species:a=a+` ${e.species}`),this.speciesList[a]={taxo:t,isLegacy:!0,displayWarning:!0},{species:a,state:{entry:t,uuid:o,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){const o=e.state;if(o.uuid){if(o.entry)return new Promise(()=>{const a={taxon:o.entry};o.biologicalSex&&(a.biologicalSex=o.biologicalSex),this.mapManagerRef.findMap(a).then(i=>{if(i.uuid!==o.uuid)return this.createLegacyEntry(e,o.entry,o.uuid)}).then(i=>{t(i||e)}).catch(()=>{t(e)})})}else if(o.entry){const a=o.entry in gs?gs[o.entry]:void 0,i=this.createLegacyEntry(e,o.entry,a);t(i||e)}}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0},t=this.getCurrentFlatmap();return e.state=t.getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(t=>{this.initialise().then(()=>{t.species&&t.species!==this.activeSpecies?this.setSpecies(t.species,t.state,5):t.state&&this.getCurrentFlatmap().setState(t.state)})}))},activateTooltipByIndex:function(e){return e===this.helpModeActiveItem&&this.helpMode},onHelpModeLastItem:function(e){e&&this.$emit("help-mode-last-item",!0)},onTooltipShown:function(){this.$emit("shown-tooltip")},onMapTooltipShown:function(){this.$emit("shown-map-tooltip")},changeViewingMode:function(e){this.getCurrentFlatmap().changeViewingMode(e)}},props:{initial:{type:String,default:""},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},displayMinimap:{type:Boolean,default:!1},showStarInLegend:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array},availableSpecies:{type:Object,default:function(){return{"Human Female":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000383",iconClass:"mapicon-icon_human",displayWarning:!0},"Human Male":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000384",iconClass:"mapicon-icon_human",displayWarning:!0},Rat:{taxo:"NCBITaxon:10114",iconClass:"mapicon-icon_rat",displayLatestChanges:!0},Mouse:{taxo:"NCBITaxon:10090",iconClass:"mapicon-icon_mouse",displayWarning:!0},Pig:{taxo:"NCBITaxon:9823",iconClass:"mapicon-icon_pig",displayWarning:!0},Cat:{taxo:"NCBITaxon:9685",iconClass:"mapicon-icon_cat",displayWarning:!0}}}},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:n.markRaw([]),initialised:!1,mapManagerRef:void 0}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0}}},Db={class:"multi-container",ref:"multiContainer"},Fb={key:0,style:{position:"absolute","z-index":"100"}},$b={class:"select-box-icon"};function zb(e,t,o,a,i,r){const s=na,l=zn,d=jn,c=ca;return n.openBlock(),n.createElementBlock("div",Db,[o.disableUI?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Fb,[t[2]||(t[2]=n.createElementVNode("div",{class:"species-display-text"},"Species",-1)),n.createVNode(d,{content:"Select a species",placement:"right",trigger:"manual","popper-class":"flatmap-popper flatmap-teleport-popper right-popper",width:"max-content",visible:r.activateTooltipByIndex(0),teleported:!1,ref:"selectPopover"},{reference:n.withCtx(()=>[n.createVNode(l,{id:"flatmap-select",teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":t[0]||(t[0]=f=>e.activeSpecies=f),placeholder:"Select",class:"select-box","popper-class":"flatmap-dropdown",onChange:r.setSpecies},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,u)=>(n.openBlock(),n.createBlock(s,{key:u,label:u,value:u},{default:n.withCtx(()=>[n.createElementVNode("span",$b,[n.createElementVNode("i",{class:n.normalizeClass(f.iconClass)},null,2)]),n.createTextVNode(" "+n.toDisplayString(u),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["visible"])])),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,u)=>n.withDirectives((n.openBlock(),n.createBlock(c,{key:u,entry:f.taxo,uuid:f.uuid,biologicalSex:f.biologicalSex,displayWarning:f.displayWarning,displayLatestChanges:f.displayLatestChanges,isLegacy:f.isLegacy,ref_for:!0,ref:u,enableOpenMapUI:o.enableOpenMapUI,openMapOptions:o.openMapOptions,disableUI:o.disableUI,onViewLatestMap:r.viewLatestMap,onResourceSelected:r.resourceSelected,onReady:r.FlatmapReady,onPanZoomCallback:r.panZoomCallback,annotationSidebar:o.annotationSidebar,onAnnotationOpen:r.onAnnotationOpen,onAnnotationClose:r.onAnnotationClose,onUpdateOfflineAnnotationEnabled:r.updateOfflineAnnotationEnabled,connectivityInfoSidebar:o.connectivityInfoSidebar,onConnectivityInfoOpen:r.onConnectivityInfoOpen,onConnectivityInfoClose:r.onConnectivityInfoClose,onConnectivityError:r.onConnectivityError,onOpenMap:t[1]||(t[1]=p=>e.$emit("open-map",p)),onPathwaySelectionChanged:r.onSelectionsDataChanged,minZoom:o.minZoom,helpMode:e.activeSpecies==u&&o.helpMode,helpModeActiveItem:o.helpModeActiveItem,helpModeDialog:o.helpModeDialog,helpModeInitialIndex:-2,onHelpModeLastItem:r.onHelpModeLastItem,onShownTooltip:r.onTooltipShown,onShownMapTooltip:r.onMapTooltipShown,renderAtMounted:o.renderAtMounted,displayMinimap:o.displayMinimap,showStarInLegend:o.showStarInLegend,style:{height:"100%"},mapManager:e.mapManagerRef,flatmapAPI:o.flatmapAPI,sparcAPI:o.sparcAPI,showLocalSettings:o.showLocalSettings,showOpenMapButton:o.showOpenMapButton,showPathwayFilter:o.showPathwayFilter},null,8,["entry","uuid","biologicalSex","displayWarning","displayLatestChanges","isLegacy","enableOpenMapUI","openMapOptions","disableUI","onViewLatestMap","onResourceSelected","onReady","onPanZoomCallback","annotationSidebar","onAnnotationOpen","onAnnotationClose","onUpdateOfflineAnnotationEnabled","connectivityInfoSidebar","onConnectivityInfoOpen","onConnectivityInfoClose","onConnectivityError","onPathwaySelectionChanged","minZoom","helpMode","helpModeActiveItem","helpModeDialog","onHelpModeLastItem","onShownTooltip","onShownMapTooltip","renderAtMounted","displayMinimap","showStarInLegend","mapManager","flatmapAPI","sparcAPI","showLocalSettings","showOpenMapButton","showPathwayFilter"])),[[n.vShow,e.activeSpecies==u]])),128))],512)}const jb=Kn(Lb,[["render",zb],["__scopeId","data-v-8937352a"]]);H.FlatmapVuer=ca,H.MultiFlatmapVuer=jb,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
24
+ order by source desc`;us();const i=sessionStorage.getItem("flatmap-knowledge"),r=sessionStorage.getItem("flatmap-knowledge-source");if(!i||r!==o){const d=(await t.flatmapQuery(a)).values.map(c=>c[0]).map(c=>JSON.parse(c));return sessionStorage.setItem("flatmap-knowledge",JSON.stringify(d)),sessionStorage.setItem("flatmap-knowledge-source",o),hb(),d}return JSON.parse(i)}function hb(){const o=new Date().getTime()+864e5;sessionStorage.setItem("flatmap-knowledge-expiry",o)}function mb(){["flatmap-knowledge","flatmap-knowledge-expiry","flatmap-knowledge-source"].forEach(t=>{sessionStorage.removeItem(t)})}function us(){const e=sessionStorage.getItem("flatmap-knowledge-expiry");new Date().getTime()>e&&mb()}const ps=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),gb='<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow"><path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/><text x="47" y="52%" style="white-space: pre" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#333333">Featured dataset marker</text></svg>';var hs={exports:{}};(function(e,t){(function(o,a){e.exports=a()})(typeof window<"u"?window:hm,function(){if(typeof window>"u")return null;var o=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")(),a=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||function(f){return o.setTimeout(f,20)},i=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||function(f){o.clearTimeout(f)};function r(f,u){var p=Object.prototype.toString.call(f),g=p==="[object Array]"||p==="[object NodeList]"||p==="[object HTMLCollection]"||p==="[object Object]"||typeof jQuery<"u"&&f instanceof jQuery||typeof Elements<"u"&&f instanceof Elements,h=0,m=f.length;if(g)for(;h<m;h++)u(f[h]);else u(f)}function s(f){if(!f.getBoundingClientRect)return{width:f.offsetWidth,height:f.offsetHeight};var u=f.getBoundingClientRect();return{width:Math.round(u.width),height:Math.round(u.height)}}function l(f,u){Object.keys(u).forEach(function(p){f.style[p]=u[p]})}var d=function(f,u){var p=0;function g(){var m=[];this.add=function(w){m.push(w)};var b,y;this.call=function(w){for(b=0,y=m.length;b<y;b++)m[b].call(this,w)},this.remove=function(w){var T=[];for(b=0,y=m.length;b<y;b++)m[b]!==w&&T.push(m[b]);m=T},this.length=function(){return m.length}}function h(m,b){if(m){if(m.resizedAttached){m.resizedAttached.add(b);return}m.resizedAttached=new g,m.resizedAttached.add(b),m.resizeSensor=document.createElement("div"),m.resizeSensor.dir="ltr",m.resizeSensor.className="resize-sensor";var y={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},w={position:"absolute",left:"0px",top:"0px",transition:"0s"};l(m.resizeSensor,y);var T=document.createElement("div");T.className="resize-sensor-expand",l(T,y);var k=document.createElement("div");l(k,w),T.appendChild(k);var S=document.createElement("div");S.className="resize-sensor-shrink",l(S,y);var E=document.createElement("div");l(E,w),l(E,{width:"200%",height:"200%"}),S.appendChild(E),m.resizeSensor.appendChild(T),m.resizeSensor.appendChild(S),m.appendChild(m.resizeSensor);var I=window.getComputedStyle(m),M=I?I.getPropertyValue("position"):null;M!=="absolute"&&M!=="relative"&&M!=="fixed"&&M!=="sticky"&&(m.style.position="relative");var x=!1,B=0,v=s(m),_=0,V=0,q=!0;p=0;var D=function(){var Z=m.offsetWidth,ce=m.offsetHeight;k.style.width=Z+10+"px",k.style.height=ce+10+"px",T.scrollLeft=Z+10,T.scrollTop=ce+10,S.scrollLeft=Z+10,S.scrollTop=ce+10},O=function(){if(q){var Z=m.offsetWidth===0&&m.offsetHeight===0;if(Z){p||(p=a(function(){p=0,O()}));return}else q=!1}D()};m.resizeSensor.resetSensor=O;var $=function(){B=0,x&&(_=v.width,V=v.height,m.resizedAttached&&m.resizedAttached.call(v))},pe=function(){v=s(m),x=v.width!==_||v.height!==V,x&&!B&&(B=a($)),O()},J=function(Z,ce,Ee){Z.attachEvent?Z.attachEvent("on"+ce,Ee):Z.addEventListener(ce,Ee)};J(T,"scroll",pe),J(S,"scroll",pe),p=a(function(){p=0,O()})}}r(f,function(m){h(m,u)}),this.detach=function(m){p||(i(p),p=0),d.detach(f,m)},this.reset=function(){f.resizeSensor.resetSensor()}};if(d.reset=function(f){r(f,function(u){u.resizeSensor.resetSensor()})},d.detach=function(f,u){r(f,function(p){p&&(p.resizedAttached&&typeof u=="function"&&(p.resizedAttached.remove(u),p.resizedAttached.length())||p.resizeSensor&&(p.contains(p.resizeSensor)&&p.removeChild(p.resizeSensor),delete p.resizeSensor,delete p.resizedAttached))})},typeof MutationObserver<"u"){var c=new MutationObserver(function(f){for(var u in f)if(f.hasOwnProperty(u))for(var p=f[u].addedNodes,g=0;g<p.length;g++)p[g].resizeSensor&&d.reset(p[g])});document.addEventListener("DOMContentLoaded",function(f){c.observe(document.body,{childList:!0,subtree:!0})})}return d})})(hs);var bb=hs.exports;const yb=mm(bb),wb=ma.defineStore("main",{state:()=>({userProfile:{token:""}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function Cb(e){return{all:e=e||new Map,on:function(t,o){var a=e.get(t);a?a.push(o):e.set(t,[o])},off:function(t,o){var a=e.get(t);a&&(o?a.splice(a.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var a=e.get(t);a&&a.slice().map(function(i){i(o)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,o)})}}}const la=new Cb,vb="cannot be found on the map.",Sb=e=>{let t={lng:0,lat:0},o;return e.type==="Polygon"?e.coordinates.length&&(o=e.coordinates[0]):o=e.coordinates,o&&(e.type!=="Point"?(o.map(a=>{t.lng+=parseFloat(a[0]),t.lat+=parseFloat(a[1])}),t.lng=t.lng/o.length,t.lat=t.lat/o.length):(t.lng+=parseFloat(o[0]),t.lat+=parseFloat(o[1]))),t},ms=(e,t)=>{const o=[];let a=e.organs?e.organs:e.ftus;const i=a?a.filter((r,s)=>a.findIndex(l=>l.label===r.label)===s):void 0;return i&&i.forEach(r=>{const s={label:r.label,models:r.models,key:`${t}.${r.label}`},l=ms(r,s.key);l.length>0&&(s.children=l),o.push(s)}),o},kb={name:"FlatmapVuer",components:{Button:Lr,Col:Xt,Loading:Jg,Radio:Qr,Icon:ke,RadioGroup:Xr,Row:Qt,Select:zn,Dialog:mg,MapSvgIcon:ha.MapSvgIcon,MapSvgSpriteColor:ha.MapSvgSpriteColor,Tooltip:to.Tooltip,TreeControls:to.TreeControls,SelectionsGroup:ds,SvgLegends:fs,ElIconWarningFilled:U.WarningFilled,ElIconArrowDown:U.ArrowDown,ElIconArrowLeft:U.ArrowLeft,DrawToolbar:to.DrawToolbar},beforeCreate:function(){this.setStateRequired=!1},setup(e){let t=n.inject("$annotator");return t||(t=n.markRaw(new Is.AnnotationService(`${e.flatmapAPI}annotator`)),n.provide("$annotator",t)),{annotator:t}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter())},manualAbortedOnClose:function(){this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEventCallback({},{type:"aborted"}),this.initialiseDrawing()},initialiseDrawing:function(){this.connectionEntry={},this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.drawnCreatedEvent={}},cancelDrawnFeature:function(){this.isValidDrawnCreated&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[{...this.drawnCreatedEvent.feature,resourceId:this.serverURL}],this.rollbackAnnotationEvent(),this.initialiseDrawing())},connectedFeatureTooltip:function(e){if(this.mapImp)if(e){const t=Number(e);let a={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(i=>i.id===e.trim())}};this.checkAndCreatePopups([a])}else this.closeTooltip()},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent]),Object.keys(this.connectionEntry).length>0&&(this.annotationEntry[0].feature.connection=this.connectionEntry),this.initialiseDrawing())},toolbarEvent:function(e,t){if(!this.isValidDrawnCreated){if(this.manualAbortedOnClose(),this.doubleClickedFeature=!1,this.changeAnnotationDrawMode({mode:"simple_select"}),e==="mode")this.activeDrawMode=t;else if(e==="tool"){if(this.cancelDrawnFeature(),t){const o=t.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${o}`})}this.activeDrawTool=t}}},annotationDrawModeEvent:function(e){this.activeDrawMode==="Edit"?this.doubleClickedFeature&&(e.feature.feature.geometry.type!=="Point"&&(this.changeAnnotationDrawMode({mode:"direct_select",options:{featureId:e.feature.feature.id}}),this.modifyAnnotationFeature()),this.doubleClickedFeature=!1):this.activeDrawMode==="Delete"&&(this.changeAnnotationDrawMode({mode:"simple_select",options:{featureIds:[e.feature.feature.id]}}),this.modifyAnnotationFeature())},createConnectivityBody:function(){if(Object.keys(this.connectionEntry).length>0){const e=Object.values(this.connectionEntry),t={type:"connectivity",source:e[0],target:e[e.length-1],intermediates:e.filter((o,a)=>a!==0&&a!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},modifyAnnotationFeature:function(){this.mapImp&&this.mapImp.removeAnnotationFeature()},rollbackAnnotationEvent:function(){this.mapImp&&this.annotationEntry.length>0&&["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0]),this.annotationEntry=[])},commitAnnotationEvent:function(e){this.mapImp&&(this.offlineAnnotationEnabled&&(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],this.offlineAnnotations.push(e),this.annotationEntry[0].type==="deleted"&&(this.offlineAnnotations=this.offlineAnnotations.filter(t=>t.resource!==this.serverURL||t.item.id!==e.item.id)),sessionStorage.setItem("anonymous-annotation",JSON.stringify(this.offlineAnnotations))),["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.featureAnnotationSubmitted=!0,this.mapImp.commitAnnotationEvent(this.annotationEntry[0]),e.body.comment==="Position Updated"?this.annotationEntry[0].positionUpdated=!1:this.annotationEntry[0].type==="deleted"&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[]),this.addAnnotationFeature()))},fetchAnnotatedItemIds:async function(e=void 0,t=void 0){let o;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.resource===this.serverURL).map(a=>a.item.id)):(o=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),"resource"in o&&(o=o.itemIds)),o},setFeatureAnnotated:async function(){if(this.mapImp){const e=await this.fetchAnnotatedItemIds();for(const t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let o;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.feature&&a.resource===this.serverURL).map(a=>a.feature);else{const a=await this.fetchAnnotatedItemIds(e,t);o=await this.annotator.drawnFeatures(this.userToken,this.serverURL,a),"resource"in o&&(o=o.features)}return o},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);const e=this.annotationFrom==="Anyone"?void 0:this.authorisedUser.orcid?this.authorisedUser.orcid:"0000-0000-0000-0000",t=this.annotationFrom==="Anyone"?void 0:this.annotationFrom==="Me",o=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=o,this.loading=!1,!this.featureAnnotationSubmitted)for(const a of o)this.mapImp.addAnnotationFeature(a)}},showAnnotator:function(e){this.mapImp&&(this.mapImp.showAnnotator(e),this.$el.querySelector(".maplibregl-ctrl-group").style.display="none")},setAnnotationFrom:function(e){this.annotationFrom=e,this.mapImp&&(this.manualAbortedOnClose(),this.addAnnotationFeature())},emitOfflineAnnotationUpdate:function(){this.$emit("update-offline-annotation-enabled",this.offlineAnnotationEnabled)},setFlightPath3D:function(e){this.flightPath3DRadio=e,this.mapImp&&this.mapImp.enableFlightPaths(e)},viewLatestMap:function(){let e=this.biologicalSex?this.biologicalSex:void 0;this.entry==="NCBITaxon:9606"&&(e="PATO:0000384");const t={entry:this.entry,biologicalSex:e,viewport:this.mapImp.getState()};this.$emit("view-latest-map",t)},backgroundChangeCallback:function(e){this.currentBackground=e,this.mapImp&&this.mapImp.setBackgroundColour(this.currentBackground,1)},processSystems:function(e){if(this.systems.length=0,e&&e.length>0){const t={label:"All",key:"All",children:[]};e.forEach(o=>{const a={colour:o.colour,enabled:o.enabled,label:o.id,key:o.id},i=ms(o,a.key);i.length>0&&(a.children=i),t.children.push(a)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,Wn(this.mapImp,e).then(o=>{o.length&&o.forEach(a=>{let i=!0;t&&(i=t.checkAll?!0:t.checked.includes(a.taxon)),this.taxonConnectivity.push({...a,enabled:i}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(a.taxon,i)})})},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},setColour:function(e){this.colourRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:e,outlined:this.outlinesRadio})},setOutlines:function(e){this.outlinesRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:this.colourRadio,outlined:e})},setInitMapState:function(){if(this.mapImp){const e=this.mapImp.map,t=this.mapImp.options.bounds,o=[[t[0],t[1]],[t[2],t[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=n.markRaw({initBounds:o})}},resetView:function(){if(this.mapImp){const e=this.mapImp.map,{initBounds:t}=this.initMapState;e.resetNorthPitch({animate:!1}),t&&e.fitBounds(t,{animate:!1}),this.$refs.skcanSelection&&this.$refs.skcanSelection.reset(),this.$refs.layersSelection&&this.$refs.layersSelection.reset(),this.$refs.systemsSelection&&this.$refs.pathwaysSelection.reset(),this.$refs.pathwaysSelection&&this.$refs.pathwaysSelection.reset()}},zoomIn:function(){this.mapImp&&this.mapImp.zoomIn()},zoomOut:function(){this.mapImp&&this.mapImp.zoomOut()},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},sckanSelected:function(e){this.mapImp&&this.mapImp.enableSckanPath(e.key,e.value)},checkAllSCKAN:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableSckanPath(t,e.value))},zoomToFeatures:function(e){this.mapImp&&this.mapImp.zoomToFeatures(e)},retrieveConnectedPaths:async function(e,t={}){var o,a,i,r,s;if(this.mapImp){let l=[],d=(o=t.target)!=null&&o.length?t.target:[];const c=[...this.mapImp.pathModelNodes(e)],f=await this.mapImp.queryPathsForFeatures(e);if(c.length){if(!d.length){const u=(a=t.type)!=null&&a.length?t.type:["all"],p=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),g=(i=p==null?void 0:p.ids)==null?void 0:i.dendrites.flat(1/0),h=(r=p==null?void 0:p.ids)==null?void 0:r.components.flat(1/0),m=(s=p==null?void 0:p.ids)==null?void 0:s.axons.flat(1/0);let b=[];u.includes("origins")&&b.push(...g),u.includes("components")&&b.push(...h),u.includes("destinations")&&b.push(...m),u.includes("all")&&b.push(...g,...h,...m),d=[...new Set(b)]}c.forEach(u=>{this.mapImp.nodePathModels(u).forEach(g=>{const m=this.mapImp.pathModelNodes(g).map(y=>this.mapImp.featureProperties(y).models);d.filter(y=>m.includes(y)).length&&!l.includes(g)&&l.push(g)})})}else f.length&&(d.length?f.forEach(u=>{const g=this.mapImp.pathModelNodes(u).map(m=>this.mapImp.featureProperties(m).models);d.filter(m=>g.includes(m)).length&&!l.includes(u)&&l.push(u)}):l=f);return l=[...new Set([...l,...e])],l}},resetMapFilter:function(){const e=this.mapFilters.alert;let t;e.with?e.without||(t={HAS:"alert"}):e.without?t={NOT:{HAS:"alert"}}:t={AND:[{NOT:{HAS:"alert"}},{HAS:"alert"}]},t?this.mapImp.setVisibilityFilter(t):this.mapImp.clearVisibilityFilter()},alertMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){let t;e.key==="alert"?t={HAS:"alert"}:e.key==="withoutAlert"&&(t={NOT:{HAS:"alert"}}),this.mapImp.setVisibilityFilter(t)}else this.resetMapFilter()},alertSelected:function(e){this.mapImp&&(e.key==="alert"?e.value?this.mapFilters.alert.with=!0:this.mapFilters.alert.with=!1:e.key==="withoutAlert"&&(e.value?this.mapFilters.alert.without=!0:this.mapFilters.alert.without=!1),this.resetMapFilter())},checkAllAlerts:function(e){this.mapImp&&(e.value?(this.mapFilters.alert.without=!0,this.mapFilters.alert.with=!0):(this.mapFilters.alert.without=!1,this.mapFilters.alert.with=!1),this.resetMapFilter())},systemSelected:function(e){this.mapImp&&this.mapImp.enableSystem(e.key,e.value)},checkAllSystems:function(e){this.mapImp&&this.systems[0].children.forEach(t=>this.mapImp.enableSystem(t.label,e))},ftuSelected:function(e){this.searchAndShowResult(e,!0)},layersSelected:function(e){this.mapImp&&this.mapImp.enableLayer(e.key,e.value)},checkAllLayers:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableLayer(t,e.value))},taxonsSelected:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.key,e.value)},taxonMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){clearTimeout(this.taxonLeaveDelay);let t=this.mapImp.taxonFeatureIds(e.key);this.mapImp.enableConnectivityByTaxonIds(e.key,e.value),this.mapImp.zoomToGeoJSONFeatures(t,{noZoomIn:!0})}else this.taxonLeaveDelay=setTimeout(()=>{this.mapImp.unselectGeoJSONFeatures(),e.selections.forEach(t=>{let o=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,o)})},1e3)},checkAllTaxons:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.keys,e.value)},pathwaysSelected:function(e){this.mapImp&&this.mapImp.enablePath(e.key,e.value)},checkAllPathways:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enablePath(t,e.value))},enablePanZoomEvents:function(e){this.mapImp.enablePanZoomEvents(e)},annotationEventCallback:function(e,t){if(t.type==="aborted")this.featureAnnotationSubmitted?this.featureAnnotationSubmitted=!1:this.rollbackAnnotationEvent(),this.annotationEntry=[];else if(t.type==="modeChanged")t.feature.mode==="direct_select"&&(this.doubleClickedFeature=!0),this.annotationSidebar&&t.feature.mode==="simple_select"&&this.activeDrawMode==="Deleted"&&this.annotationEventCallback({},{type:"aborted"});else if(t.type==="selectionChanged"){if(this.selectedDrawnFeature=t.feature.features.length===0?void 0:t.feature.features[0],e.feature.feature=this.selectedDrawnFeature,!this.activeDrawTool)if(this.connectionEntry={},this.selectedDrawnFeature){const o=this.existDrawnFeatures.find(a=>a.id===this.selectedDrawnFeature.id);o&&o.connection&&(this.connectionEntry=o.connection),this.annotationDrawModeEvent(e)}else this.annotationSidebar&&this.previousEditEvent.type==="updated"&&(this.annotationEntry=[{...this.previousEditEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.previousEditEvent={}}else{if(t.type==="created"||t.type==="updated"){t.type==="updated"&&t.feature.action&&(t.positionUpdated=t.feature.action==="move");const o=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=o}t.type==="created"?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type==="updated"&&(this.previousEditEvent=t),t.type==="deleted"?this.previousDeletedEvent=t:this.previousDeletedEvent={}},eventCallback:function(){return(e,t,...o)=>{if(e==="annotation"){const a={feature:t,userData:o,eventType:e};this.annotationEventCallback(a,t)}else if(e!=="pan-zoom"){const a=t.label,i=[t.models],r=this.entry,s=this.biologicalSex,l=t.alert;let d;t.taxons&&(typeof t.taxons!="object"?d=JSON.parse(t.taxons):d=t.taxons);let c=[{dataset:t.dataset,biologicalSex:s,taxonomy:r,resource:i,label:a,feature:t,userData:o,eventType:e,provenanceTaxonomy:d,alert:l}];if(e==="click"){const f=Object.keys(t).includes("id");if(!f){c=[];const p=t.mapUUID,g=new Set;for(let[h,m]of Object.entries(t))if(h!=="mapUUID"){const b=m.id,y=m.label,w=[m.models];let T;if(m.taxons&&(typeof m.taxons!="object"?T=JSON.parse(m.taxons):T=m.taxons),g.has(b))continue;g.add(b),c.push({dataset:m.dataset,biologicalSex:s,taxonomy:r,resource:w,label:y,feature:m,userData:o,eventType:e,provenanceTaxonomy:T,alert:m.alert,mapUUID:p})}}const u=f?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,u),this.viewingMode==="Neuron Connection")this.retrieveConnectedPaths([u.models]).then(p=>{this.zoomToFeatures(p)});else if(this.currentActive=u.models?u.models:"",this.activeDrawTool&&!this.isValidDrawnCreated){const p=u.featureId||this.existDrawnFeatures.find(g=>g.id===u.id);if(this.activeDrawTool==="LineString"&&p){const g=u.featureId?u.featureId:u.id,h=u.label?u.label:`Feature ${u.id}`;this.connectionEntry[` ${g}`]=Object.assign({label:h},Object.fromEntries(Object.entries(u).filter(([m])=>["featureId","models"].includes(m)).map(([m,b])=>[m==="featureId"?"id":m,b])))}}}else e==="mouseenter"&&this.viewingMode!=="Neuron Connection"&&(this.currentHover=t.models?t.models:"");t&&t.type!=="marker"&&e==="click"&&this.viewingMode!=="Neuron Connection"&&!this.activeDrawTool&&this.checkAndCreatePopups(c),this.$emit("resource-selected",c)}else this.$emit("pan-zoom-callback",t)}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=t.source,(e==="Neuron Connection"||e==="Annotation")&&(this.connectivityDataSource=t.featureId)},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(".flatmap-tooltip-popup").forEach(t=>t.remove())},createTooltipForConnectivity:function(e,t){const o=document.createElement("div");o.classList.add("flatmap-feature-label"),e.forEach((a,i)=>{const{label:r}=a;if(o.append(ps(r)),i+1<e.length){const s=document.createElement("hr");o.appendChild(s)}}),this.mapImp.showPopup(t,o,{className:"custom-popup flatmap-tooltip-popup",positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){const{connectivityInfo:t,data:o}=e,a=[],i=[],r=[],s=[];if(t&&t.featureId&&a.push(...t.featureId),this.mapImp){if(o.forEach(c=>{const f=this.mapImp.search(c.id);if(f!=null&&f.results.length){const u=f==null?void 0:f.results[0].featureId;r.push({featureId:u,...c})}else s.push(c)}),r.length){let c=r[0].featureId;this.mapImp.annotations.forEach(f=>{const u=f["anatomical-nodes"];if(u){const p=u.join("");r.every(h=>p.indexOf(h.id)!==-1)&&(c=f.featureId,i.push(c))}}),this.createTooltipForConnectivity(r,c)}else this.removeActiveTooltips();this.emitConnectivityError(s);const d=[...this.mapImp.modelFeatureIdList(a),...i];this.mapImp.selectGeoJSONFeatures(d)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(t=>{this.mapImp.selectFeatures(t)})},searchConnectivitiesByReference:async function(e){const t=sessionStorage.getItem("flatmap-knowledge");let o=[];return t?o=await db(e):o=await fb(this.mapImp,e,this.flatmapQueries),o},emitConnectivityError:function(e){this.$emit("connectivity-error",{data:{errorData:e,errorMessage:vb}})},checkConnectivityTooltipEntry:function(e){return e!=null&&e.length?e.find(t=>{var o,a;return((o=t==null?void 0:t.destinations)==null?void 0:o.length)||((a=t==null?void 0:t.components)==null?void 0:a.length)})!==void 0:!1},changeConnectivitySource:async function(e){const{entry:t,connectivitySource:o}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],o),this.tooltipEntry=this.tooltipEntry.map(a=>a.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(a):a),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry))},checkAndCreatePopups:async function(e){if(this.viewingMode==="Annotation"){const t=e.filter(o=>o.feature).map(o=>o.feature);if(t.length>0)if(this.annotationSidebar&&this.previousDeletedEvent.type==="deleted"&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.annotationEntry=[],t.forEach(o=>{var a;this.annotationEntry.push({...o,resourceId:this.serverURL,featureId:o.featureId?o.featureId:(a=o.feature)==null?void 0:a.id,offline:this.offlineAnnotationEnabled})}),t[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(t[0].feature.id,Sb(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{const o=this.annotationEntry.filter(a=>a.featureId&&a.models).map(a=>a.models);o.length>0&&this.displayTooltip(o)}else this.annotation={}}else{pb(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(o=>o.resource[0]in this.mapImp.pathways.paths).map(o=>({title:o.label,featureId:o.resource,ready:!1})),this.tooltipEntry.length){this.$emit("connectivity-info-open",this.tooltipEntry);for(let a=0;a<e.length;a++)t.push(await this.getKnowledgeTooltip(e[a]));this.tooltipEntry=await Promise.all(t);const o=this.tooltipEntry.map(a=>a.featureId[0]);o.length>0&&this.displayTooltip(o)}}},getKnowledgeTooltip:async function(e){const t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e);let o=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(o.featuresAlert=e.alert,o.knowledgeSource=sa(this.mapImp),o.mapId=this.mapImp.provenance.id,o.mapuuid=this.mapImp.provenance.uuid),o.ready=!0,o},popUpCssHacks:function(){const e=document.querySelector(".flatmap-tooltip-popup"),t=document.querySelector(".maplibregl-popup-close-button");e&&(e.style.display="none"),t.style.display="block",this.$refs.tooltip.$el.style.display="flex",t.onclick=()=>{this.$emit("connectivity-info-close"),e&&(e.style.display="block")}},closeTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.$el.style.display="none"),document.querySelectorAll(".maplibregl-popup").forEach(e=>{e.style.display="none"})},showPopup:function(e,t,o){let a=o;this.mapImp&&(a?a.className||(a.className="custom-popup"):a={className:"custom-popup",positionAtLastClick:!0},this.mapImp.showPopup(e,t,a))},showMarkerPopup:function(e,t,o){this.mapImp&&this.mapImp.showMarkerPopup(e,t,o)},closeMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");this.minimapSmall?(e.classList.add("enlarge"),e.classList.remove("shrink")):(e.classList.add("shrink"),e.classList.remove("enlarge")),this.minimapSmall=!this.minimapSmall},addResizeButtonToMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");e&&(this.$refs.minimapResize&&this.$refs.minimapResize.$el.parentNode&&this.$refs.minimapResize.$el.parentNode.removeChild(this.$refs.minimapResize.$el),e.appendChild(this.$refs.minimapResize.$el),this.minimapResizeShow=!0)},setHelpMode:function(e){const t=this.hoverVisibilities.length,o=t-1,a=this.hoverVisibilities[this.helpModeActiveIndex];if(a){const i=a==null?void 0:a.refs,r=a==null?void 0:a.ref,s=this.$refs[i||r];if(s){const{parentElement:l,nextElementSibling:d}=s.$el,c=f=>f&&(f.classList.contains("pathway-container")||f.classList.contains("pathway-location"));(c(l)||c(d))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!=="Annotation"&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=o),e&&this.helpModeActiveIndex>=o&&this.$emit("help-mode-last-item",!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(i=>{i.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.closeFlatmapHelpPopup())},showTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit("shown-tooltip")},t))},hideTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},displayTooltip:function(e,t=void 0){let o,a={className:"flatmapvuer-popover"};if(t)o=e,a.annotationFeatureGeometry=t;else{const i=Array.isArray(e)?e[0]:e;i&&(o=this.mapImp.modelFeatureIds(i)[0]),this.activeDrawTool||(a.positionAtLastClick=!0)}this.connectivityInfoSidebar&&this.tooltipEntry.length&&this.viewingMode!=="Annotation"&&this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry),this.annotationSidebar&&this.viewingMode==="Annotation"&&this.$emit("annotation-open",{annotationEntry:this.annotationEntry,commitCallback:this.commitAnnotationEvent}),o&&!this.disableUI&&(this.viewingMode==="Annotation"&&!this.annotationSidebar||this.viewingMode==="Exploration"&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(o,this.$refs.tooltip.$el,a),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){const{offsetX:o=0,offsetY:a=0,zoom:i=4}=t,r=this.mapImp.map,s=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),s!=null&&s.length&&setTimeout(()=>{r.fitBounds(s,{offset:[o,a],zoom:i,animate:!0})})}},openFlatmapHelpPopup:function(){if(this.mapImp){let e=this.mapImp.modelFeatureIds("UBERON:0000948");e&&e.length>0&&(this.mapImp.showPopup(e[0],"Click for more information",{anchor:"top",className:"flatmap-popup-popper"}),this.$emit("shown-map-tooltip"))}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(".maplibregl-popup-close-button").forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let o of t.values())o.label&&e.push(o.label);return Array.from(new Set(e))}},getVisibilityState:function(e){if(["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{let a=this.$refs[o];a&&(e[o]=a.getState())}),this.$refs.treeControls){const o=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();e.systemsSelection=o.filter(a=>!a.includes("."))}},setVisibilityState:function(e){["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{const a=e[o];if(a){const i=this.$refs[o];i&&i.setState(a)}}),"systemsSelection"in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(o=>{this.mapImp.enableSystem(o.key,e.systemsSelection.includes(o.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()};const t=this.mapImp.getIdentifier();return this.biologicalSex?e.biologicalSex=this.biologicalSex:t&&t.biologicalSex&&(e.biologicalSex=t.biologicalSex),t&&t.uuid&&(e.uuid=t.uuid),e.viewingMode=this.viewingMode,e.searchTerm=this.searchTerm,e.flightPath3D=this.flightPath3DRadio,e.colour=this.colourRadio,e.outlines=this.outlinesRadio,e.background=this.currentBackground,this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem("anonymous-annotation")),this.getVisibilityState(e),e}},setState:function(e){e&&(this.mapImp&&e.entry&&this.entry==e.entry&&(!e.biologicalSex||e.biologicalSex===this.biologicalSex)?this.restoreMapState(e):this.createFlatmap(e),this.setStateRequired=!1)},restoreMapState:function(e){if(e){if(e.viewport&&this.mapImp.setState(e.viewport),e.offlineAnnotations&&sessionStorage.setItem("anonymous-annotation",e.offlineAnnotations),e.viewingMode&&this.changeViewingMode(e.viewingMode),"flightPath3D"in e&&this.setFlightPath3D(e.flightPath3D),"colour"in e&&this.setColour(e.colour),"outlines"in e&&this.setOutlines(e.outlines),e.background&&this.backgroundChangeCallback(e.background),e.searchTerm){const t=e.searchTerm;this.searchAndShowResult(t,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){(e===1.6||e>1.6)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0;let t=!1;this.displayMinimap&&(t={position:"top-right"});let o={taxon:this.entry};this.uuid&&(o.uuid=this.uuid),e?(e.uuid?o={uuid:e.uuid}:e.entry&&(o.taxon=e.entry),e.biologicalSex?o.biologicalSex=e.biologicalSex:o.taxon==="NCBITaxon:9606"&&(o.biologicalSex="PATO:0000384")):this.biologicalSex&&(o.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(o,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:t,container:this.$refs.display}).then(i=>{this.mapImp=i,this.serverURL=this.mapImp.makeServerUrl("").slice(0,-1);let r=this.mapImp.details.version;this.setFlightPathInfo(r);const s=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(s),this.$nextTick(()=>this.restoreMapState(s))})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){const e=this.$refs.display;if(e){const t=getComputedStyle(e),o=parseInt(t.paddingTop)+parseInt(t.paddingBottom),a=e.clientHeight-o;this.pathwaysMaxHeight=a-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&(this.mapImp.resize(),this.showMinimap(this.displayMinimap))}catch{console.error("Map resize error")}},getFilterSources:function(){const e=["kind","taxons"];let t=new Set,o=new Set,a=new Map;for(const r of this.mapImp.annotations.values())if(r.source){"alert"in r?t.add(r.source):o.add(r.source);for(const[s,l]of Object.entries(r))if(e.includes(s)){a.has(s)||a.set(s,new Map);const d=a.get(s),c=f=>{const u=f;d.has(u)||d.set(u,new Set),d.get(u).add(`${r.source}`)};Array.isArray(l)?l.forEach(c):c(l)}}let i={alert:{with:[...t],without:[...o]}};for(const[r,s]of a.entries()){i[r]={};for(const[l,d]of s.entries())i[r][l]=[...d.values()]}return i},getFilterOptions:async function(){if(this.mapImp){let e=[];const t=this.mapImp.featureFilterRanges();for(const[o,a]of Object.entries(t)){let i={key:`flatmap.connectivity.${o}`,label:"",children:[]};if(o==="kind"){i.label="Pathways";for(const r of a){const s=this.pathways.find(l=>l.type!=="centreline"&&l.type===r);s&&i.children.push({key:`${i.key}.${r}`,label:s.label,colour:s.colour,colourStyle:"line",dashed:s.dashed})}}else if(o==="taxons"){i.label="Studied in";const r=await Wn(this.mapImp,this.mapImp.taxonIdentifiers);if(r.length)for(const s of a){const l=r.find(d=>d.taxon===s);l&&i.children.push({key:`${i.key}.${s}`,label:l.label})}}else if(o==="alert"){i.label="Alert";for(const r of["with","without"])i.children.push({key:`${i.key}.${r}`,label:`${r} alerts`})}i.label&&i.children.length&&e.push(i)}return e}},onFlatmapReady:function(e){var t;this.sensor=n.markRaw(new yb(this.$refs.display,this.mapResize)),((t=this.mapImp.options)==null?void 0:t.style)==="functional"&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert="alert"in this.mapImp.featureFilterRanges(),this.addResizeButtonToMinimap(),this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.$emit("ready",this)},handleMapClick:function(){const e=this.mapImp.map;e&&e.on("click",t=>{this.connectivityDataSource||this.$emit("connectivity-info-close"),this.connectivityDataSource=""})},showMinimap:function(e){this.mapImp&&this.mapImp.showMinimap(e)},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t){var o;if(this.mapImp){if(e===void 0||e==="")return this.mapImp.clearSearchResults(),this.viewingMode==="Exploration"?this.$emit("connectivity-info-close"):this.viewingMode==="Annotation"&&this.manualAbortedOnClose(),this.searchTerm="",!0;{const a=this.mapImp.search(e);if((o=a==null?void 0:a.results)!=null&&o.length){if(this.mapImp.showSearchResults(a),t){let i;for(let r=0;r<a.results.length;r++){i=a.results[r].featureId;const s=this.mapImp.annotation(i);if(i&&(s!=null&&s.label))break}if(i){const r=this.mapImp.featureProperties(i),s={resource:[r.models],feature:r,label:r.label,provenanceTaxonomy:r.taxons,alert:r.alert};this.viewingMode==="Exploration"||this.viewingMode==="Annotation"?this.checkAndCreatePopups([s]):this.viewingMode==="Neuron Connection"&&this.retrieveConnectedPaths(s.resource).then(l=>{this.zoomToFeatures(l)}),this.mapImp.showPopup(i,ps(r.label),{className:"custom-popup",positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}else this.mapImp.clearSearchResults()}}return!1},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){la.emit("onActionClick",e)}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:""},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},renderAtMounted:{type:Boolean,default:!0},displayMinimap:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},showStarInLegend:{type:Boolean,default:!1},isLegacy:{type:Boolean,default:!1},displayLatestChanges:{type:Boolean,default:!1},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:n.markRaw({}),sckanDisplay:[{label:"Display Path with SCKAN",key:"VALID"}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:n.markRaw([]),hoverVisibilities:[{value:!1,ref:"markerPopover"},{value:!1,ref:"zoomInPopover"},{value:!1,ref:"zoomOutPopover"},{value:!1,ref:"zoomFitPopover"},{value:!1,ref:"openMapPopover"},{value:!1,ref:"settingsPopover"},{value:!1,ref:"checkBoxPopover"},{value:!1,ref:"warningPopover"},{value:!1,ref:"whatsNewPopover"},{value:!1,ref:"featuredMarkerPopover"},{value:!1,refs:"toolbarPopover",ref:"editPopover"},{value:!1,refs:"toolbarPopover",ref:"deletePopover"},{value:!1,refs:"toolbarPopover",ref:"pointPopover"},{value:!1,refs:"toolbarPopover",ref:"lineStringPopover"},{value:!1,refs:"toolbarPopover",ref:"polygonPopover"},{value:!1,refs:"toolbarPopover",ref:"connectionPopover"}],helpModeActiveIndex:this.helpModeInitialIndex,yellowstar:gb,isFC:!1,inHelp:!1,currentBackground:"white",availableBackground:["white","lightskyblue","black"],loading:!1,flatmapMarker:lb,tooltipEntry:[],connectivityDataSource:"",connectivityTooltipVisible:!1,drawerOpen:!1,flightPath3DRadio:!1,displayFlightPathOption:!1,colourRadio:!0,outlinesRadio:!0,minimapResizeShow:!1,minimapSmall:!1,currentActive:"",selectedDrawnFeature:void 0,currentHover:"",viewingMode:"Exploration",viewingModes:{Exploration:"Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources","Neuron Connection":"Discover Neuron connections by selecting a neuron and viewing its associated network connections",Annotation:["View feature annotations","Add, comment on and view feature annotations"]},offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:"Anyone",annotatedSource:["Anyone","Me","Others"],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:["Edit","Delete","Point","LineString","Polygon","Connection"],annotator:void 0,authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:"Display Path With Alerts",key:"alert",enabled:!0},{label:"Display Path Without Alerts",key:"withoutAlert",enabled:!0}],mapFilters:n.markRaw({alert:{with:!0,without:!0}}),searchTerm:"",taxonLeaveDelay:void 0}},computed:{...ma.mapState(wb,["userToken"]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){var e,t,o;if(this.loading)return this.drawerOpen=!1,!1;if(this.isFC){if(((e=this.systems)==null?void 0:e.length)>0||this.containsAlert&&this.alertOptions||((t=this.pathways)==null?void 0:t.length)>0||((o=this.taxonConnectivity)==null?void 0:o.length)>0)return this.drawerOpen=!0,!0}else return this.drawerOpen=!0,!0;return this.drawerOpen=!1,!0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode==="Annotation"?this.authorisedUser?e[1]:e[0]:e}},watch:{entry:function(){this.state||this.createFlatmap()},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},state:{handler:function(e,t){e!==t&&(this.mapManagerRef?this.setState(e):this.setStateRequired=!0)},immediate:!0,deep:!0},viewingMode:function(e){this.clearAnnotationFeature(),e==="Annotation"&&(this.loading=!0,this.annotator.authenticate(this.userToken).then(t=>{t.name&&t.email&&t.canUpdate?(this.authorisedUser=t,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.setFeatureAnnotated(),this.addAnnotationFeature(),this.loading=!1}))},disableUI:function(e){e&&this.closeTooltip()},activeDrawTool:function(e){let t=[],o={x:null,y:null};const a=this.$el.querySelector(".maplibregl-canvas"),i=()=>{a.removeEventListener("keydown",r),a.removeEventListener("click",s)},r=l=>{if(!["Escape","Enter"].includes(l.key))return;const d=e==="Point"&&t.length===1||e==="LineString"&&t.length>=2||e==="Polygon"&&t.length>=3;(l.key==="Escape"||l.key==="Enter"&&!d)&&(this.activeDrawTool=void 0),i()},s=l=>{const d=a.getBoundingClientRect(),c=l.clientX-d.left,f=l.clientY-d.top;if(Math.sqrt((c-o.x)**2+(f-o.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}o={x:c,y:f},t.push(o)};e&&(i(),a.addEventListener("keydown",r),a.addEventListener("click",s))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ga.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef))},mounted:function(){this.openMapRef=n.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=n.shallowRef(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=n.markRaw(new cb),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),us()}},Eb={class:"flatmap-container",ref:"flatmapContainer","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},Ib={style:{height:"100%",width:"100%",position:"relative","overflow-y":"none"}},Tb={style:{height:"100%",width:"100%"},ref:"display"},Ab={class:"beta-popovers"},Ob={key:2,class:"warning-text"},Mb={class:"bottom-right-control"},xb=["innerHTML"],Bb=["innerHTML"],Nb={style:{"margin-bottom":"2px"}},_b={key:0,class:"viewing-mode-title"},Pb=["onClick"],Vb=["onClick"];function Rb(e,t,o,a,i,r){const s=n.resolveComponent("map-svg-sprite-color"),l=U.WarningFilled,d=ke,c=jn,f=U.ArrowDown,u=n.resolveComponent("DrawToolbar"),p=n.resolveComponent("map-svg-icon"),g=fs,h=n.resolveComponent("tree-controls"),m=ds,b=U.ArrowLeft,y=Lr,w=Qt,T=Xt,k=na,S=zn,E=Qr,I=Xr,M=n.resolveComponent("Tooltip"),x=ss,B=aa;return n.withDirectives((n.openBlock(),n.createElementBlock("div",Eb,[n.createVNode(s),n.createElementVNode("div",Ib,[n.createElementVNode("div",Tb,null,512),n.withDirectives(n.createElementVNode("div",Ab,[n.createElementVNode("div",null,[n.createVNode(c,{placement:"right","popper-class":"warning-popper flatmap-popper",teleported:!1,visible:e.hoverVisibilities[7].value,ref:"warningPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"warning-icon",onMouseover:t[7]||(t[7]=v=>r.showTooltip(7)),onMouseout:t[8]||(t[8]=v=>r.hideTooltip(7))},[o.displayWarning||o.isLegacy?(n.openBlock(),n.createBlock(d,{key:0},{default:n.withCtx(()=>[n.createVNode(l)]),_:1})):n.createCommentVNode("",!0),o.isLegacy?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t[33]||(t[33]=n.createElementVNode("span",{class:"warning-text"},"Legacy Map",-1)),n.createElementVNode("div",{class:"latest-map-text",onClick:t[6]||(t[6]=(...v)=>r.viewLatestMap&&r.viewLatestMap(...v))}," Click here for the latest map ")],64)):o.displayWarning?(n.openBlock(),n.createElementBlock("span",Ob,"Beta")):n.createCommentVNode("",!0)],32)]),default:n.withCtx(()=>[o.isLegacy?(n.openBlock(),n.createElementBlock("p",{key:0,onMouseover:t[0]||(t[0]=v=>r.showTooltip(7)),onMouseout:t[1]||(t[1]=v=>r.hideTooltip(7))}," This is a legacy map, you may view the latest map instead. ",32)):e.isFC?(n.openBlock(),n.createElementBlock("p",{key:1,onMouseover:t[2]||(t[2]=v=>r.showTooltip(7)),onMouseout:t[3]||(t[3]=v=>r.hideTooltip(7))},t[31]||(t[31]=[n.createTextVNode(" This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". ")]),32)):(n.openBlock(),n.createElementBlock("p",{key:2,onMouseover:t[4]||(t[4]=v=>r.showTooltip(7)),onMouseout:t[5]||(t[5]=v=>r.hideTooltip(7))},t[32]||(t[32]=[n.createTextVNode(" This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". New connectivity and species specificity will be added as the SPARC program progresses. ")]),32))]),_:1},8,["visible"])]),o.displayLatestChanges?(n.openBlock(),n.createBlock(c,{key:0,placement:"right",teleported:!1,trigger:"manual","popper-class":"warning-popper flatmap-popper",visible:e.hoverVisibilities[8].value,ref:"whatsNewPopover"},{reference:n.withCtx(()=>[o.displayLatestChanges?(n.openBlock(),n.createElementBlock("div",{key:0,class:"latest-changesicon",onMouseover:t[9]||(t[9]=v=>r.showTooltip(8)),onMouseout:t[10]||(t[10]=v=>r.hideTooltip(8))},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(l)]),_:1}),t[34]||(t[34]=n.createElementVNode("span",{class:"warning-text"},"What's new?",-1))],32)):n.createCommentVNode("",!0)]),default:n.withCtx(()=>t[35]||(t[35]=[n.createElementVNode("b",null,"Connectivity References",-1),n.createElementVNode("p",null," Connectivity references have been improved and available in various formats. ",-1),n.createElementVNode("b",null,"Improved state storing",-1),n.createElementVNode("p",null," Current selection and visibility filters are now stored when creating a permalink. ",-1)])),_:1},8,["visible"])):n.createCommentVNode("",!0)],512),[[n.vShow,!o.disableUI]]),n.withDirectives(n.createVNode(d,{class:n.normalizeClass(["minimap-resize",{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:"minimapResize",onClick:r.closeMinimap},{default:n.withCtx(()=>[n.createVNode(f)]),_:1},8,["class","onClick"]),[[n.vShow,e.minimapResizeShow]]),e.viewingMode==="Annotation"&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!o.disableUI?(n.openBlock(),n.createBlock(u,{key:0,mapCanvas:{containerHTML:this.$el,class:".maplibregl-canvas"},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,hoverVisibilities:e.hoverVisibilities,onClickToolbar:r.toolbarEvent,onFeatureTooltip:r.connectedFeatureTooltip,onConfirmDrawn:r.confirmDrawnFeature,onCancelDrawn:r.cancelDrawnFeature,onShowTooltip:r.showTooltip,onHideTooltip:r.hideTooltip,ref:"toolbarPopover"},null,8,["mapCanvas","toolbarOptions","activeDrawTool","activeDrawMode","newlyDrawnEntry","connectionEntry","hoverVisibilities","onClickToolbar","onFeatureTooltip","onConfirmDrawn","onCancelDrawn","onShowTooltip","onHideTooltip"])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",Mb,[n.createVNode(c,{content:"Zoom in",placement:"left",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[1].value,ref:"zoomInPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[11]||(t[11]=v=>r.zoomIn()),onMouseover:t[12]||(t[12]=v=>r.showTooltip(1)),onMouseout:t[13]||(t[13]=v=>r.hideTooltip(1))},[n.createVNode(p,{class:"icon-button zoomIn",icon:"zoomIn"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[2].value,ref:"zoomOutPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[14]||(t[14]=v=>r.zoomOut()),onMouseover:t[15]||(t[15]=v=>r.showTooltip(2)),onMouseout:t[16]||(t[16]=v=>r.hideTooltip(2))},[n.createVNode(p,{class:"icon-button zoomOut",icon:"zoomOut"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Reset",placement:"top",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[3].value,ref:"zoomFitPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[17]||(t[17]=v=>r.resetView()),onMouseover:t[18]||(t[18]=v=>r.showTooltip(3)),onMouseout:t[19]||(t[19]=v=>r.hideTooltip(3))},[n.createVNode(p,{class:"icon-button fitWindow",icon:"fitWindow"})],32)]),default:n.withCtx(()=>[t[36]||(t[36]=n.createElementVNode("div",null,[n.createTextVNode(" Fit to "),n.createElementVNode("br"),n.createTextVNode(" window ")],-1))]),_:1},8,["visible"])],512),[[n.vShow,!o.disableUI]]),n.createVNode(c,{content:"Change pathway visibility",placement:"right",teleported:!1,trigger:"manual",offset:-18,"popper-class":"flatmap-popper",visible:e.hoverVisibilities[6].value,ref:"checkBoxPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["pathway-location",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["pathway-container",{open:e.drawerOpen,close:!e.drawerOpen}]),style:n.normalizeStyle({"max-height":e.pathwaysMaxHeight+"px"})},[e.isFC?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(g,{key:0,class:"svg-legends-container"})),o.showStarInLegend?(n.openBlock(),n.createBlock(c,{key:1,content:"Location of the featured dataset",placement:"right",teleported:!0,trigger:"manual",width:"max-content",offset:-10,"popper-class":"flatmap-popper flatmap-teleport-popper",visible:e.hoverVisibilities[9].value,ref:"featuredMarkerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"yellow-star-legend",innerHTML:e.yellowstar,onMouseover:t[20]||(t[20]=v=>r.showTooltip(9)),onMouseout:t[21]||(t[21]=v=>r.hideTooltip(9))},null,40,xb),[[x,void 0,"featuredMarkerPopover"]])]),_:1},8,["visible"])):n.createCommentVNode("",!0),n.createVNode(c,{content:"Find these markers for data. The number inside the markers is the number of datasets available for each marker.",placement:"right",teleported:!1,width:"200",trigger:"manual","popper-class":"flatmap-popper flatmap-marker-popper",visible:e.hoverVisibilities[0].value,ref:"markerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"flatmap-marker-help",innerHTML:e.flatmapMarker},null,8,Bb),[[n.vShow,e.hoverVisibilities[0].value],[x,void 0,"markerPopover"]])]),_:1},8,["visible"]),e.isFC&&e.systems&&e.systems.length>0?(n.openBlock(),n.createBlock(h,{key:2,class:"treeControls",mapType:"flatmap",title:"Systems",treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:r.systemSelected,onCheckAll:r.checkAllSystems,onChangeActive:r.ftuSelected,ref:"treeControls"},null,8,["treeData","active","hover","onCheckChanged","onCheckAll","onChangeActive"])):n.createCommentVNode("",!0),e.containsAlert&&e.alertOptions&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Alert",labelKey:"label",identifierKey:"key",selections:e.alertOptions,onChanged:r.alertSelected,onCheckboxMouseEnter:r.alertMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllAlerts,ref:"alertSelection",key:"alertSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.pathways&&e.pathways.length>0&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Pathways",labelKey:"label",identifierKey:"type",colourStyle:"line",selections:e.pathways,onChanged:r.pathwaysSelected,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllPathways,ref:"pathwaysSelection",key:"pathwaysSelection"},null,8,["selections","onChanged","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Studied in",labelKey:"label",identifierKey:"taxon",helpMessage:"Evidence exists that this set of neuron populations have been studied in the given species.",selections:e.taxonConnectivity,onChanged:r.taxonsSelected,onCheckboxMouseEnter:r.taxonMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllTaxons,ref:"taxonSelection",key:"taxonSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0)],6)),[[x,void 0,"checkBoxPopover"]]),n.createElementVNode("div",{onClick:t[22]||(t[22]=(...v)=>r.toggleDrawer&&r.toggleDrawer(...v)),class:n.normalizeClass(["drawer-button",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(b)]),_:1})],2)],2),[[n.vShow,!o.disableUI&&r.requiresDrawer]])]),_:1},8,["visible"]),e.openMapRef?(n.openBlock(),n.createBlock(c,{key:1,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"136",teleported:!1,trigger:"click","popper-class":"open-map-popper non-selectable","virtual-triggering":""},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.openMapOptions,v=>(n.openBlock(),n.createBlock(w,{key:v.key},{default:n.withCtx(()=>[n.createVNode(y,{type:"primary",plain:"",onClick:_=>e.$emit("open-map",v.key)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(v.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):n.createCommentVNode("",!0),n.createVNode(c,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"320",teleported:!1,trigger:"click","popper-class":"background-popper h-auto","virtual-triggering":""},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[37]||(t[37]=[n.createTextVNode("Viewing Mode")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createElementVNode("div",Nb,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.viewingModes,(v,_,V)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:_},[_===e.viewingMode?(n.openBlock(),n.createElementBlock("span",_b,[n.createElementVNode("b",null,n.toDisplayString(_),1)])):(n.openBlock(),n.createElementBlock("span",{key:1,class:"viewing-mode-unselected",onClick:q=>r.changeViewingMode(_)},n.toDisplayString(_),9,Pb))],64))),128))]),n.createVNode(w,{class:"viewing-mode-description"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.modeDescription),1)]),_:1}),e.viewingMode==="Annotation"&&e.offlineAnnotationEnabled?(n.openBlock(),n.createBlock(w,{key:0,class:"viewing-mode-description"},{default:n.withCtx(()=>t[38]||(t[38]=[n.createTextVNode(" (Anonymous annotate) ")])),_:1})):n.createCommentVNode("",!0)]),_:1}),e.viewingMode==="Annotation"&&e.authorisedUser?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[39]||(t[39]=[n.createTextVNode("Annotations From")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(S,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":t[23]||(t[23]=v=>e.annotationFrom=v),placeholder:"Select",class:"select-box","popper-class":"flatmap_dropdown",onChange:r.setAnnotationFrom},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.annotatedSource,v=>(n.openBlock(),n.createBlock(k,{key:v,label:v,value:v},{default:n.withCtx(()=>[n.createVNode(w,null,{default:n.withCtx(()=>[n.createVNode(T,{span:12},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(v),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1})],64)):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:1,class:"backgroundSpacer"})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:2,class:"backgroundText"},{default:n.withCtx(()=>t[40]||(t[40]=[n.createTextVNode("Flight path display")])),_:1})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:3,class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":t[24]||(t[24]=v=>e.flightPath3DRadio=v),class:"flatmap-radio",onChange:r.setFlightPath3D},{default:n.withCtx(()=>[n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[41]||(t[41]=[n.createTextVNode("2D")])),_:1}),n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[42]||(t[42]=[n.createTextVNode("3D")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[43]||(t[43]=[n.createTextVNode("Organs display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.colourRadio,"onUpdate:modelValue":t[25]||(t[25]=v=>e.colourRadio=v),class:"flatmap-radio",onChange:r.setColour},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[44]||(t[44]=[n.createTextVNode("Colour")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[45]||(t[45]=[n.createTextVNode("Greyscale")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[46]||(t[46]=[n.createTextVNode("Outlines display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.outlinesRadio,"onUpdate:modelValue":t[26]||(t[26]=v=>e.outlinesRadio=v),class:"flatmap-radio",onChange:r.setOutlines},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[47]||(t[47]=[n.createTextVNode("Show")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[48]||(t[48]=[n.createTextVNode("Hide")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[49]||(t[49]=[n.createTextVNode("Change background")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.availableBackground,v=>(n.openBlock(),n.createElementBlock("div",{key:v,class:n.normalizeClass(["backgroundChoice",v,v==e.currentBackground?"active":""]),onClick:_=>r.backgroundChangeCallback(v)},null,10,Vb))),128))]),_:1})])]),_:1},8,["virtual-ref"]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[o.showOpenMapButton?(n.openBlock(),n.createBlock(w,{key:0},{default:n.withCtx(()=>[n.createVNode(c,{visible:e.hoverVisibilities[4].value,content:"Open new map",placement:"right",teleported:!1,"popper-class":"flatmap-popper",ref:"openMapPopover"},{reference:n.withCtx(()=>[o.enableOpenMapUI&&o.openMapOptions.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,ref:"openMapRef",class:"icon-button-container",onMouseover:t[27]||(t[27]=v=>r.showTooltip(4)),onMouseout:t[28]||(t[28]=v=>r.hideTooltip(4))},[n.createVNode(p,{icon:"openMap",class:"icon-button open-map-button"})],544)):n.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0),o.showLocalSettings?(n.openBlock(),n.createBlock(w,{key:1},{default:n.withCtx(()=>[n.createVNode(c,{content:"Change settings",placement:"right",visible:e.hoverVisibilities[5].value,teleported:!1,trigger:"manual","popper-class":"flatmap-popper",ref:"settingsPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{ref:"backgroundIconRef",class:"icon-button-container",onMouseover:t[29]||(t[29]=v=>r.showTooltip(5)),onMouseout:t[30]||(t[30]=v=>r.hideTooltip(5))},[n.createVNode(p,{icon:"changeBckgd",class:"icon-button"})],544)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0)],2),[[n.vShow,!o.disableUI]]),e.tooltipDisplay?(n.openBlock(),n.createBlock(M,{key:2,ref:"tooltip",class:"tooltip",annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode==="Annotation",onAnnotation:r.commitAnnotationEvent,onOnActionClick:r.onActionClick},null,8,["annotationEntry","tooltipEntry","annotationDisplay","onAnnotation","onOnActionClick"])):n.createCommentVNode("",!0)])])),[[B,e.loading]])}const ca=Kn(kb,[["render",Rb],["__scopeId","data-v-6b5fa883"]]),gs={"NCBITaxon:10114":"01fedbf9-d783-509c-a10c-827941ab13da","NCBITaxon:9823":"a336ac04-24db-561f-a25f-1c994fe17410","NCBITaxon:9606":"42ed6323-f645-5fbe-bada-9581819cf689","NCBITaxon:10090":"25285fab-48a0-5620-a6a0-f9a0374837d5","NCBITaxon:9685":"73060497-46a6-52bf-b975-cac511c127cb"},Lb={name:"MultiFlatmapVuer",components:{Col:Xt,Row:Qt,Option:na,Select:zn,Popover:jn,FlatmapVuer:ca},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),la.on("onActionClick",e=>{this.resourceSelected(e)}),la.on("open-pubmed-url",e=>{this.$emit("open-pubmed-url",e)})},methods:{initialise:function(){return new Promise(e=>{this.requireInitialisation?(this.requireInitialisation=!1,fetch(this.flatmapAPI).then(t=>t.json()).then(t=>{Object.keys(this.availableSpecies).forEach(a=>{const i=this.availableSpecies[a].uuid;if(i&&t.map(r=>r.uuid).indexOf(i)>0)this.speciesList[a]=this.availableSpecies[a];else for(let r=0;r<t.length;r++)if(this.availableSpecies[a].taxo===t[r].taxon)if(this.availableSpecies[a].biologicalSex){if(t[r].biologicalSex&&t[r].biologicalSex===this.availableSpecies[a].biologicalSex){this.speciesList[a]=this.availableSpecies[a];break}}else{this.speciesList[a]=this.availableSpecies[a];break}});let o=this.initial;if(this.state){const a=this.state.state;(!a||!a.uuid&&!a.entry)&&this.state.species?o=this.state.species:o=void 0}o&&(o&&this.speciesList[o]!==void 0?this.activeSpecies=o:this.activeSpecies=Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(a=>{a()})})):this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ga.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef)))},resourceSelected:function(e){this.$emit("resource-selected",e)},FlatmapReady:function(e){this.$emit("ready",e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},panZoomCallback:function(e){this.$emit("pan-zoom-callback",e)},onAnnotationClose:function(){this.$emit("annotation-close")},onAnnotationOpen:function(e){this.$emit("annotation-open",e)},updateOfflineAnnotationEnabled:function(e){this.$emit("update-offline-annotation-enabled",e)},onConnectivityInfoClose:function(){this.$emit("connectivity-info-close")},onConnectivityInfoOpen:function(e){this.$emit("connectivity-info-open",e)},onConnectivityError:function(e){this.$emit("connectivity-error",e)},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},showPopup:function(e,t,o){this.getCurrentFlatmap().showPopup(e,t,o)},showMarkerPopup:function(e,t,o){this.getCurrentFlatmap().showMarkerPopup(e,t,o)},setSpecies:function(e,t,o){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit("flatmapChanged",this.activeSpecies);else if(o){const a=o-1;a>=0&&this.$nextTick(()=>{this.setSpecies(e,t,a)})}},viewLatestMap:function(e){const t=Object.keys(this.speciesList);for(let o=0;o<t.length;o++){const a=this.speciesList[t[o]];if(!a.isLegacy&&a.taxo===e.entry&&a.biologicalSex===e.biologicalSex){this.setSpecies(t[o],e,0);return}}},createLegacyEntry:function(e,t,o){if(o&&t){let a="Legacy";return e.species&&(e.species.slice(0,6)==="Legacy"?a=e.species:a=a+` ${e.species}`),this.speciesList[a]={taxo:t,isLegacy:!0,displayWarning:!0},{species:a,state:{entry:t,uuid:o,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){const o=e.state;if(o.uuid){if(o.entry)return new Promise(()=>{const a={taxon:o.entry};o.biologicalSex&&(a.biologicalSex=o.biologicalSex),this.mapManagerRef.findMap(a).then(i=>{if(i.uuid!==o.uuid)return this.createLegacyEntry(e,o.entry,o.uuid)}).then(i=>{t(i||e)}).catch(()=>{t(e)})})}else if(o.entry){const a=o.entry in gs?gs[o.entry]:void 0,i=this.createLegacyEntry(e,o.entry,a);t(i||e)}}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0},t=this.getCurrentFlatmap();return e.state=t.getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(t=>{this.initialise().then(()=>{t.species&&t.species!==this.activeSpecies?this.setSpecies(t.species,t.state,5):t.state&&this.getCurrentFlatmap().setState(t.state)})}))},activateTooltipByIndex:function(e){return e===this.helpModeActiveItem&&this.helpMode},onHelpModeLastItem:function(e){e&&this.$emit("help-mode-last-item",!0)},onTooltipShown:function(){this.$emit("shown-tooltip")},onMapTooltipShown:function(){this.$emit("shown-map-tooltip")},changeViewingMode:function(e){this.getCurrentFlatmap().changeViewingMode(e)}},props:{initial:{type:String,default:""},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},displayMinimap:{type:Boolean,default:!1},showStarInLegend:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array},availableSpecies:{type:Object,default:function(){return{"Human Female":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000383",iconClass:"mapicon-icon_human",displayWarning:!0},"Human Male":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000384",iconClass:"mapicon-icon_human",displayWarning:!0},Rat:{taxo:"NCBITaxon:10114",iconClass:"mapicon-icon_rat",displayLatestChanges:!0},Mouse:{taxo:"NCBITaxon:10090",iconClass:"mapicon-icon_mouse",displayWarning:!0},Pig:{taxo:"NCBITaxon:9823",iconClass:"mapicon-icon_pig",displayWarning:!0},Cat:{taxo:"NCBITaxon:9685",iconClass:"mapicon-icon_cat",displayWarning:!0}}}},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:n.markRaw([]),initialised:!1,mapManagerRef:void 0}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0}}},Db={class:"multi-container",ref:"multiContainer"},Fb={key:0,style:{position:"absolute","z-index":"100"}},$b={class:"select-box-icon"};function zb(e,t,o,a,i,r){const s=na,l=zn,d=jn,c=ca;return n.openBlock(),n.createElementBlock("div",Db,[o.disableUI?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Fb,[t[2]||(t[2]=n.createElementVNode("div",{class:"species-display-text"},"Species",-1)),n.createVNode(d,{content:"Select a species",placement:"right",trigger:"manual","popper-class":"flatmap-popper flatmap-teleport-popper right-popper",width:"max-content",visible:r.activateTooltipByIndex(0),teleported:!1,ref:"selectPopover"},{reference:n.withCtx(()=>[n.createVNode(l,{id:"flatmap-select",teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":t[0]||(t[0]=f=>e.activeSpecies=f),placeholder:"Select",class:"select-box","popper-class":"flatmap-dropdown",onChange:r.setSpecies},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,u)=>(n.openBlock(),n.createBlock(s,{key:u,label:u,value:u},{default:n.withCtx(()=>[n.createElementVNode("span",$b,[n.createElementVNode("i",{class:n.normalizeClass(f.iconClass)},null,2)]),n.createTextVNode(" "+n.toDisplayString(u),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["visible"])])),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,u)=>n.withDirectives((n.openBlock(),n.createBlock(c,{key:u,entry:f.taxo,uuid:f.uuid,biologicalSex:f.biologicalSex,displayWarning:f.displayWarning,displayLatestChanges:f.displayLatestChanges,isLegacy:f.isLegacy,ref_for:!0,ref:u,enableOpenMapUI:o.enableOpenMapUI,openMapOptions:o.openMapOptions,disableUI:o.disableUI,onViewLatestMap:r.viewLatestMap,onResourceSelected:r.resourceSelected,onReady:r.FlatmapReady,onPanZoomCallback:r.panZoomCallback,annotationSidebar:o.annotationSidebar,onAnnotationOpen:r.onAnnotationOpen,onAnnotationClose:r.onAnnotationClose,onUpdateOfflineAnnotationEnabled:r.updateOfflineAnnotationEnabled,connectivityInfoSidebar:o.connectivityInfoSidebar,onConnectivityInfoOpen:r.onConnectivityInfoOpen,onConnectivityInfoClose:r.onConnectivityInfoClose,onConnectivityError:r.onConnectivityError,onOpenMap:t[1]||(t[1]=p=>e.$emit("open-map",p)),onPathwaySelectionChanged:r.onSelectionsDataChanged,minZoom:o.minZoom,helpMode:e.activeSpecies==u&&o.helpMode,helpModeActiveItem:o.helpModeActiveItem,helpModeDialog:o.helpModeDialog,helpModeInitialIndex:-2,onHelpModeLastItem:r.onHelpModeLastItem,onShownTooltip:r.onTooltipShown,onShownMapTooltip:r.onMapTooltipShown,renderAtMounted:o.renderAtMounted,displayMinimap:o.displayMinimap,showStarInLegend:o.showStarInLegend,style:{height:"100%"},mapManager:e.mapManagerRef,flatmapAPI:o.flatmapAPI,sparcAPI:o.sparcAPI,showLocalSettings:o.showLocalSettings,showOpenMapButton:o.showOpenMapButton,showPathwayFilter:o.showPathwayFilter},null,8,["entry","uuid","biologicalSex","displayWarning","displayLatestChanges","isLegacy","enableOpenMapUI","openMapOptions","disableUI","onViewLatestMap","onResourceSelected","onReady","onPanZoomCallback","annotationSidebar","onAnnotationOpen","onAnnotationClose","onUpdateOfflineAnnotationEnabled","connectivityInfoSidebar","onConnectivityInfoOpen","onConnectivityInfoClose","onConnectivityError","onPathwaySelectionChanged","minZoom","helpMode","helpModeActiveItem","helpModeDialog","onHelpModeLastItem","onShownTooltip","onShownMapTooltip","renderAtMounted","displayMinimap","showStarInLegend","mapManager","flatmapAPI","sparcAPI","showLocalSettings","showOpenMapButton","showPathwayFilter"])),[[n.vShow,e.activeSpecies==u]])),128))],512)}const jb=Kn(Lb,[["render",zb],["__scopeId","data-v-f9adfd5e"]]);H.FlatmapVuer=ca,H.MultiFlatmapVuer=jb,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});