@abi-software/flatmapvuer 1.21.1-demo.0 → 1.21.1-demo.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/flatmapvuer.umd.cjs
CHANGED
|
@@ -25,13 +25,13 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:i,curr
|
|
|
25
25
|
style="fill:${Lg};stroke:${Rg};stroke-width:1.1"/>
|
|
26
26
|
<circle cx="12.5" cy="12.5" r="8" fill="${Rg}"/>
|
|
27
27
|
<text x="12.5" y="16.1" text-anchor="middle" style="font-size:7.5px;font-weight:700;fill:${zg};font-family:Arial, sans-serif">${Hg(e.count)}</text>
|
|
28
|
-
</svg>`,t},Wg=function(e,t){let n=Array.isArray(e?.modelFeatureIds?.(t))?e.modelFeatureIds(t):[],r=[],i=new Set;for(let t of n){let n=e.annotation(t),a=String(n?.uri||``).trim();a&&!i.has(a)&&(i.add(a),r.push({type:`feature-uri`,value:a}))}return!r.length&&n.length&&r.push({type:`model`,value:t}),r},Gg=function(e){if(!e||e.addSomaLocationMarkers)return e;let t=[];return e.clearSomaLocationMarkers=function(){t.forEach(t=>{e.removeMarker(t)}),t=[]},e.addSomaLocationMarkers=function(n){let r=Vg(n),i=[];return e.clearSomaLocationMarkers(),r.forEach(n=>{let r=Wg(e,n.curie);if(!r.length)return;let a=!1;r.forEach(r=>{let i=Ug(n),o=[];if(r.type===`feature-uri`)o=e.addMarkerByFeatureUri(r.value,{element:i});else if(r.type===`model`){let t=e.addMarker(r.value,{element:i});o=t>-1?[t]:[]}o.length&&(t.push(...o),a=!0)}),a&&i.push(n)}),i},e},Kg=(0,c.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function qg(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var Jg=new qg,Yg=`cannot be found on the map.`,Xg=500,Zg=e=>{let t={lng:0,lat:0},n;return e.type===`Polygon`?e.coordinates.length&&(n=e.coordinates[0]):n=e.coordinates,n&&(e.type===`Point`?(t.lng+=parseFloat(n[0]),t.lat+=parseFloat(n[1])):(n.map(e=>{t.lng+=parseFloat(e[0]),t.lat+=parseFloat(e[1])}),t.lng/=n.length,t.lat/=n.length)),t},Qg=(e,t)=>{let n=[],r=e.organs?e.organs:e.ftus,i=r?r.filter((e,t)=>r.findIndex(t=>t.label===e.label)===t):void 0;return i&&i.forEach(e=>{let r={label:e.label,models:e.models,key:`${t}.${e.label}`},i=Qg(e,r.key);i.length>0&&(r.children=i),n.push(r)}),n},$g={name:`FlatmapVuer`,components:{MapSvgIcon:i.MapSvgIcon,MapSvgSpriteColor:i.MapSvgSpriteColor,Tooltip:r.Tooltip,TreeControls:r.TreeControls,SelectionsGroup:Uh,ElIconWarningFilled:n.WarningFilled,ElIconArrowDown:n.ArrowDown,ElIconArrowLeft:n.ArrowLeft,DrawToolbar:r.DrawToolbar,FlatmapError:lg},directives:{helpMode:r.helpModeDirective},beforeCreate:function(){this.setStateRequired=!1},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new s.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(this.mapImp.contextLost?this.filterToRestore=e?(0,t.markRaw)(JSON.parse(JSON.stringify(e))):void 0:(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter(),this.filterToRestore=void 0))},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){let t=Number(e),n={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(t=>t.id===e.trim())}};this.checkAndCreatePopups([n],!1)}else this.closeTooltip()}},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent],!1),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){let e=t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${e}`})}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()),!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){let e=Object.values(this.connectionEntry),t={type:`connectivity`,source:e[0],target:e[e.length-1],intermediates:e.filter((t,n)=>n!==0&&n!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},forceContextLoss:function(){this.mapImp&&!this.mapImp.contextLost&&!this.loading&&this.mapImp.forceContextLoss()},forceContextRestore:function(){this.mapImp&&(this.flatmapError=null,this.mapImp.forceContextRestore())},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 n;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.resource===this.serverURL).map(e=>e.item.id)):(n=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),`resource`in n&&(n=n.itemIds)),n},setFeatureAnnotated:async function(){if(this.mapImp){let e=await this.fetchAnnotatedItemIds();for(let t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let n;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.feature&&e.resource===this.serverURL).map(e=>e.feature);else{let r=await this.fetchAnnotatedItemIds(e,t);n=await this.annotator.drawnFeatures(this.userToken,this.serverURL,r),`resource`in n&&(n=n.features)}return n},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);let 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`,n=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=n,this.loading=!1,!this.featureAnnotationSubmitted)for(let e of n)this.mapImp.addAnnotationFeature(e)}},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`);let 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){let t={label:`All`,key:`All`,children:[]};e.forEach(e=>{let n={colour:e.colour,enabled:e.enabled,label:e.id,key:e.id},r=Qg(e,n.key);r.length>0&&(n.children=r),t.children.push(n)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,yg(this.mapImp,e).then(e=>{e.length&&e.forEach(e=>{let n=!0;t&&(n=t.checkAll?!0:t.checked.includes(e.taxon)),this.taxonConnectivity.push({...e,enabled:n}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.taxon,n)})})},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){let e=this.mapImp.map,n=this.mapImp.options.bounds,r=[[n[0],n[1]],[n[2],n[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=(0,t.markRaw)({initBounds:r})}},resetView:function(){if(this.mapImp){let 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={}){if(this.mapImp){let n=[],r=t.target?.length?t.target:[],i=[...this.mapImp.pathModelNodes(e)],a=await this.mapImp.queryPathsForFeatures(e);if(i.length){if(!r.length){let n=t.type?.length?t.type:[`all`],i=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),a=i?.ids?.dendrites.flat(1/0),o=i?.ids?.components.flat(1/0),s=i?.ids?.axons.flat(1/0),c=[];n.includes(`origins`)&&c.push(...a),n.includes(`components`)&&c.push(...o),n.includes(`destinations`)&&c.push(...s),n.includes(`all`)&&c.push(...a,...o,...s),r=[...new Set(c)]}i.forEach(e=>{this.mapImp.nodePathModels(e).forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)})})}else a.length&&(r.length?a.forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)}):n=a);return n=[...new Set([...n,...e])],n}},resetMapFilter:function(){let e=this.mapFilters.alert,t,n={"tile-layer":`pathways`},r={NOT:n};e.with&&!e.without?t={OR:[r,{AND:[n,{HAS:`alert`}]}]}:!e.with&&e.without?t={OR:[r,{AND:[n,{NOT:{HAS:`alert`}}]}]}:!e.with&&!e.without&&(t=r),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp){if(e.value){let t,n={"tile-layer":`pathways`},r={NOT:n};(e.key===`alert`||e.key===`withoutAlert`)&&(t={OR:[r,{AND:[n,e.key===`alert`?{HAS:`alert`}:{NOT:{HAS:`alert`}}]}]}),this.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,!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 n=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,n)})},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){let t=this.existDrawnFeatures.find(e=>e.id===this.selectedDrawnFeature.id);t&&t.connection&&(this.connectionEntry=t.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`);let n=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=n}t.type===`created`?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type===`updated`&&(this.previousEditEvent=t),this.previousDeletedEvent=t.type===`deleted`?t:{}},getTaxons:function(e){let t;return e.taxons&&(t=typeof e.taxons==`object`?e.taxons:JSON.parse(e.taxons)),t},eventCallback:function(){return(e,t,...n)=>{if(e===`annotation`){let r={feature:t,userData:n,eventType:e};this.annotationEventCallback(r,t)}else if(e===`context-lost`)this.onContextLost();else if(e===`context-restored`)this.onContextRestored();else if(e===`pan-zoom`)this.$emit(`pan-zoom-callback`,t);else{let r=t.label,i=[t.models],a=this.entry,o=this.biologicalSex,s=Ng(t.alert),c=this.getTaxons(t),l=[{dataset:t.dataset,biologicalSex:o,taxonomy:a,resource:i,label:r,feature:t,userData:n,eventType:e,provenanceTaxonomy:c,alert:s}];if(e===`mouseenter`&&(this.lastHoveredFeature=t),e===`click`){let r=!t[0];if(!r){l=[];let r=t.mapUUID,i=new Set;for(let[s,c]of Object.entries(t))if(s!==`mapUUID`){let t=c.featureId,s=c.label,u=[c.models],d=this.getTaxons(c);if(i.has(t))continue;i.add(t),l.push({dataset:c.dataset,biologicalSex:o,taxonomy:a,resource:u,label:s,feature:c,userData:n,eventType:e,provenanceTaxonomy:d,alert:Ng(c.alert),mapUUID:r})}}let i=r?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,i),this.viewingMode!==`Neuron Connection`&&(this.currentActive=i.models?i.models:``,this.activeDrawTool&&!this.isValidDrawnCreated)){let e=i.featureId||this.existDrawnFeatures.find(e=>e.id===i.id);if(this.activeDrawTool===`LineString`&&e){let e=i.featureId?i.featureId:i.id,t=i.label?i.label:`Feature ${i.id}`;this.connectionEntry[` ${e}`]=Object.assign({label:t},Object.fromEntries(Object.entries(i).filter(([e])=>[`featureId`,`models`].includes(e)).map(([e,t])=>[e===`featureId`?`id`:e,t])))}}t&&t.type!==`marker`&&!this.activeDrawTool&&this.checkAndCreatePopups(l)}else e===`mouseenter`&&this.viewingMode!==`Neuron Connection`&&(this.currentHover=t.models?t.models:``);this.$emit(`resource-selected`,l)}}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=e===`Exploration`?t.models?.startsWith(`ilxtr:`)?t.models:``:t.featureId||t.id},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(`.flatmap-tooltip-popup`).forEach(e=>e.remove()),this.lastHoveredFeature=null},createTooltipForConnectivity:function(e,t){let n=document.createElement(`div`);n.classList.add(`flatmap-feature-label`),e.forEach((t,r)=>{let{label:i}=t;if(n.append(Mg(i)),r+1<e.length){let e=document.createElement(`hr`);n.appendChild(e)}}),this.mapImp.showPopup(t,n,{className:`custom-popup flatmap-tooltip-popup`,positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){let{connectivityInfo:t,data:n}=e,r=[],i=[],a=[],o=[];if(this.lastHoveredFeature=null,t&&t.featureId&&r.push(...t.featureId),this.mapImp){if(n.forEach(e=>{let t=this.mapImp.search(e.id);if(t?.results.length){let n=t?.results[0].featureId;a.push({featureId:n,...e})}else o.push(e)}),a.length){let e=a[0].featureId;this.mapImp.annotations.forEach(t=>{let n=t[`anatomical-nodes`];if(n){let r=n.join(``);a.every(e=>r.indexOf(e.id)!==-1)&&(e=t.featureId,i.push(e))}}),this.createTooltipForConnectivity(a,e)}else this.removeActiveTooltips();o.length&&this.emitConnectivityError(o);let e=r.reduce((e,t)=>{let n=this.mapImp.pathways.paths[t],r=n?n.connectivity:null;if(r){let t=r.flat(1/0);e.push(...t)}return e},[]),t=[...new Set(e)],s=[...r,...t],c=[...this.mapImp.modelFeatureIdList(s),...i];this.mapImp.selectGeoJSONFeatures(c)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(e=>{this.mapImp.selectFeatures(e)})},searchConnectivitiesByReference:async function(e){let t=sessionStorage.getItem(`flatmap-knowledge`),n;return n=t?await wg(e):await Tg(this.mapImp,e,this.flatmapQueries),n},getFlatmapKnowledge:function(){let e=[],t=sessionStorage.getItem(`flatmap-knowledge`);return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit(`connectivity-error`,{data:{errorData:e,errorMessage:Yg}})},checkConnectivityTooltipEntry:function(e){return e?.length?e.find(e=>e?.destinations?.length||e?.components?.length)!==void 0:!1},changeConnectivitySource:async function(e){let{entry:t,connectivitySource:n}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],n),this.tooltipEntry=this.tooltipEntry.map(e=>e.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(e):e),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit(`connectivity-info-open`,this.tooltipEntry))},checkAndCreatePopups:async function(e,t=!0){if(this.viewingMode===`Annotation`){let t=e.filter(e=>e.feature).map(e=>e.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(e=>{this.annotationEntry.push({...e,resourceId:this.serverURL,featureId:e.featureId?e.featureId:e.feature?.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,Zg(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{let e=this.annotationEntry.filter(e=>e.featureId&&e.models).map(e=>e.models);e.length>0&&this.displayTooltip(e)}}else this.annotation={}}else if(this.viewingMode===`Neuron Connection`&&t){let t=e.map(e=>e.resource[0]);if(t.find(e=>!e.startsWith(`ilxtr:`))){let n=Array.isArray(t)?[...t]:[t];n.length===1&&n.push([]);let i=e[0].feature?.featureId,a=this.mapImp.annotations.get(i),o=a?.[`anatomical-nodes`],s=a?.models,c,l=n,u=a?.models;o?.length&&(c=o.find(e=>JSON.parse(e)[0]===s)),c?l=JSON.parse(c):u&&(l=[u,[]]);let d=this.mapImp.knowledgeSource,f=l.flat(1/0),p=[...new Set(f)],m=(await(0,r.fetchLabels)(this.flatmapAPI,p)).reduce((e,t)=>{let n=t[0],r=JSON.parse(t[1]);return e.push({id:n,label:r.label,source:r.source}),e},[]);m.sort((e,t)=>e.id===t.id?e.source===d&&t.source!==d?-1:+(e.source!==d&&t.source===d):e.id.localeCompare(t.id));let h=[];for(let e=0;e<p.length;e++){let t=m.find(t=>t.id===p[e]);t&&h.push(t.label)}let g=Mg(h.join(`, `)),_={facet:JSON.stringify(l),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:g,term:this.connectionType};this.connectivityFilters.some(e=>e.facet===_.facet&&e.facetPropPath===_.facetPropPath)||this.connectivityFilters.push(_),this.$emit(`neuron-connection-feature-click`,{filters:this.connectivityFilters,search:``})}else await this.openConnectivityInfo(e)}else await this.openConnectivityInfo(e)},openConnectivityInfo:async function(e){Og(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(e=>e.resource[0]in this.mapImp.pathways.paths).map(e=>({title:e.label,featureId:e.resource,ready:!1})),this.tooltipEntry.length){this.$emit(`connectivity-info-open`,this.tooltipEntry);for(let n=0;n<e.length;n++)t.push(await this.getKnowledgeTooltip(e[n]));this.tooltipEntry=await Promise.all(t);let n=this.tooltipEntry.map(e=>e.featureId[0]);n.length>0&&this.displayTooltip(n)}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(e=>e.facet.toLowerCase()!==`show all`))},resetConnectivityfilters:function(e){this.connectivityFilters=e.length?this.connectivityFilters.filter(t=>e.some(e=>e.facetPropPath===t.facetPropPath&&e.facet!==t.facet)):[]},getKnowledgeTooltip:async function(e){let t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e),n=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(n.featuresAlert=Ng(e.alert),n.knowledgeSource=Eg(this.mapImp),n.mapId=this.mapImp.mapMetadata.id,n.mapuuid=this.mapImp.mapMetadata.uuid),n.ready=!0,n},popUpCssHacks:function(){let 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`}),this.lastHoveredFeature=null},showPopup:function(e,t,n){let r=n;this.mapImp&&(r?r.className||(r.className=`custom-popup`):r={className:`custom-popup`,positionAtLastClick:!0},this.mapImp.showPopup(e,t,r))},showMarkerPopup:function(e,t,n){this.mapImp&&this.mapImp.showMarkerPopup(e,t,n)},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)},getHelpModeSteps:function(){return(0,r.collectHelpModeSteps)(this.$el)},openHelpModeDrawer:function(){clearTimeout(this.helpModeDrawerTimeout),this.requiresDrawer&&(this.drawerOpen||(this.helpModeDrawerOpened=!0),this.drawerOpen=!0)},restoreHelpModeDrawer:function(){clearTimeout(this.helpModeDrawerTimeout),this.helpModeDrawerTimeout=setTimeout(()=>{this.helpModeDrawerOpened&&(this.drawerOpen=!1),this.helpModeDrawerOpened=!1},Xg)},setHelpModeMarker:function(e){e?this.openHelpModeDrawer():this.restoreHelpModeDrawer(),this.helpModeMarkerVisible=e},displayTooltip:function(e,t=void 0){let n,r={className:`flatmapvuer-popover`};if(t)n=e,r.annotationFeatureGeometry=t,this.annotationEntry.length&&(r.annotationEvent={type:this.annotationEntry[0].type,feature:this.annotationEntry[0].feature});else{let t=Array.isArray(e)?e[0]:e;t&&(n=this.mapImp.modelFeatureIds(t)[0]),this.activeDrawTool||(r.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}),n&&!this.disableUI&&(this.viewingMode===`Annotation`&&!this.annotationSidebar||this.viewingMode===`Exploration`&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(n,this.$refs.tooltip.$el,r),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){let{offsetX:n=0,offsetY:r=0,zoom:i=4}=t,a=this.mapImp.map,o=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),o?.length&&setTimeout(()=>{a.fitBounds(o,{offset:[n,r],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`})}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(`.flatmap-popup-popper .maplibregl-popup-close-button`).forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let n of t.values())n.label&&e.push(n.label);return Array.from(new Set(e))}},getVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=this.$refs[t];n&&(e[t]=n.getState())}),this.$refs.treeControls&&(e.systemsSelection=this.$refs.treeControls.$refs.regionTree.getCheckedKeys().filter(e=>!e.includes(`.`)))},setVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=e[t];if(n){let e=this.$refs[t];e&&e.setState(n)}}),`systemsSelection`in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(t=>{this.mapImp.enableSystem(t.key,e.systemsSelection.includes(t.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()},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){let t=e.searchTerm;this.searchAndShowResult(t,!0,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){let t=1.6;(e===t||e>t)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0,this.flatmapError=null;let t={taxon:this.entry};this.uuid&&(t.uuid=this.uuid),e?(e.uuid?t={uuid:e.uuid}:e.entry&&(t.taxon=e.entry),e.biologicalSex?t.biologicalSex=e.biologicalSex:t.taxon===`NCBITaxon:9606`&&(t.biologicalSex=`PATO:0000384`)):this.biologicalSex&&(t.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(t,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:!1,container:this.$refs.display,tooltipDelay:15}).then(t=>{this.mapImp=Gg(t),this.serverURL=this.mapImp.makeServerUrl(``).slice(0,-1);let n=this.mapImp.details.version;this.setFlightPathInfo(n);let r=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(r),this.$nextTick(()=>this.restoreMapState(r))}).catch(e=>{if(console.error(`Flatmap loading error:`,e),this.flatmapError={},e.message&&e.message.indexOf(`Unknown map`)!==-1?(this.flatmapError.title=`Unknown Map!`,this.flatmapError.messages=Object.keys(t).map(e=>`${e===`uuid`?`UUID`:Mg(e)}: ${t[e]}`)):(this.flatmapError.title=`Error Loading Map!`,this.flatmapError.messages=[e.message?e.message:e.toString(),`Please try again later or contact support if the problem persists.`]),this.$parent?.$refs?.multiContainer){let e=this.$parent;this.flatmapError.button={text:`Load Default Map`,callback:()=>{let t=e.initial;e.setSpecies(t,void 0,3)}}}this.loading=!1})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){let e=this.$refs.display;if(e){let t=getComputedStyle(e),n=parseInt(t.paddingTop)+parseInt(t.paddingBottom),r=e.clientHeight-n;this.pathwaysMaxHeight=r-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&this.mapImp.resize()}catch{console.error(`Map resize error`)}},getFilterSources:function(){let e=[`kind`,`taxons`],t=new Set,n=new Set,r=new Map;for(let i of this.mapImp.annotations.values())if(i.source){`alert`in i?t.add(i.source):n.add(i.source);for(let[t,n]of Object.entries(i))if(e.includes(t)){r.has(t)||r.set(t,new Map);let e=r.get(t),a=t=>{let n=t;e.has(n)||e.set(n,new Set),e.get(n).add(`${i.source}`)};Array.isArray(n)?n.forEach(a):a(n)}}let i={alert:{with:[...t],without:[...n]}};for(let[e,t]of r.entries()){i[e]={};for(let[n,r]of t.entries())i[e][n]=[...r.values()]}return i},getFilterOptions:async function(e,t){let n=t||this.getFlatmapKnowledge(),i=this.pathways;return await(0,r.getFlatmapFilterOptions)(this.flatmapAPI,e,n,i)},onFlatmapReady:function(e){this.sensor=(0,t.markRaw)(new Fg.default(this.$refs.display,this.mapResize)),this.mapImp.options?.style===`functional`&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(e=>e.enabled&&e.type!==`other`),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert=`alert`in this.mapImp.featureFilterRanges(),this.flatmapLegends=this.mapImp.flatmapLegend,this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.$emit(`ready`,this)},handleMapClick:function(){let e=this.mapImp.map;e&&e.on(`click`,()=>{this.connectivityDataSource||this.$emit(`connectivity-info-close`),this.connectivityDataSource=``})},onContextLost:function(){this.lastViewport=(0,t.markRaw)(this.mapImp.getState()),this.flatmapError={},this.flatmapError.title=`GL context lost!`,this.flatmapError.messages=[`A display issue has occurred due
|
|
28
|
+
</svg>`,t},Wg=function(e,t){let n=Array.isArray(e?.modelFeatureIds?.(t))?e.modelFeatureIds(t):[],r=[],i=new Set;for(let t of n){let n=e.annotation(t),a=String(n?.uri||``).trim();a&&!i.has(a)&&(i.add(a),r.push({type:`feature-uri`,value:a}))}return!r.length&&n.length&&r.push({type:`model`,value:t}),r},Gg=function(e){if(!e||e.addSomaLocationMarkers)return e;let t=[];return e.clearSomaLocationMarkers=function(){t.forEach(t=>{e.removeMarker(t)}),t=[]},e.addSomaLocationMarkers=function(n){let r=Vg(n),i=[];return e.clearSomaLocationMarkers(),r.forEach(n=>{let r=Wg(e,n.curie);if(!r.length)return;let a=!1;r.forEach(r=>{let i=Ug(n),o=[];if(r.type===`feature-uri`)o=e.addMarkerByFeatureUri(r.value,{element:i});else if(r.type===`model`){let t=e.addMarker(r.value,{element:i});o=t>-1?[t]:[]}o.length&&(t.push(...o),a=!0)}),a&&i.push(n)}),i},e},Kg=(0,c.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function qg(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var Jg=new qg,Yg=`cannot be found on the map.`,Xg=500,Zg=e=>{let t={lng:0,lat:0},n;return e.type===`Polygon`?e.coordinates.length&&(n=e.coordinates[0]):n=e.coordinates,n&&(e.type===`Point`?(t.lng+=parseFloat(n[0]),t.lat+=parseFloat(n[1])):(n.map(e=>{t.lng+=parseFloat(e[0]),t.lat+=parseFloat(e[1])}),t.lng/=n.length,t.lat/=n.length)),t},Qg=(e,t)=>{let n=[],r=e.organs?e.organs:e.ftus,i=r?r.filter((e,t)=>r.findIndex(t=>t.label===e.label)===t):void 0;return i&&i.forEach(e=>{let r={label:e.label,models:e.models,key:`${t}.${e.label}`},i=Qg(e,r.key);i.length>0&&(r.children=i),n.push(r)}),n},$g={name:`FlatmapVuer`,components:{MapSvgIcon:i.MapSvgIcon,MapSvgSpriteColor:i.MapSvgSpriteColor,Tooltip:r.Tooltip,TreeControls:r.TreeControls,SelectionsGroup:Uh,ElIconWarningFilled:n.WarningFilled,ElIconArrowDown:n.ArrowDown,ElIconArrowLeft:n.ArrowLeft,DrawToolbar:r.DrawToolbar,FlatmapError:lg},directives:{helpMode:r.helpModeDirective},beforeCreate:function(){this.setStateRequired=!1},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new s.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(this.mapImp.contextLost?this.filterToRestore=e?(0,t.markRaw)(JSON.parse(JSON.stringify(e))):void 0:(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter(),this.filterToRestore=void 0))},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){let t=Number(e),n={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(t=>t.id===e.trim())}};this.checkAndCreatePopups([n],!1)}else this.closeTooltip()}},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent],!1),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){let e=t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${e}`})}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()),!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){let e=Object.values(this.connectionEntry),t={type:`connectivity`,source:e[0],target:e[e.length-1],intermediates:e.filter((t,n)=>n!==0&&n!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},forceContextLoss:function(){this.mapImp&&!this.mapImp.contextLost&&!this.loading&&this.mapImp.forceContextLoss()},forceContextRestore:function(){this.mapImp&&(this.flatmapError=null,this.mapImp.forceContextRestore())},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 n;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.resource===this.serverURL).map(e=>e.item.id)):(n=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),`resource`in n&&(n=n.itemIds)),n},setFeatureAnnotated:async function(){if(this.mapImp){let e=await this.fetchAnnotatedItemIds();for(let t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let n;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.feature&&e.resource===this.serverURL).map(e=>e.feature);else{let r=await this.fetchAnnotatedItemIds(e,t);n=await this.annotator.drawnFeatures(this.userToken,this.serverURL,r),`resource`in n&&(n=n.features)}return n},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);let 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`,n=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=n,this.loading=!1,!this.featureAnnotationSubmitted)for(let e of n)this.mapImp.addAnnotationFeature(e)}},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`);let 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){let t={label:`All`,key:`All`,children:[]};e.forEach(e=>{let n={colour:e.colour,enabled:e.enabled,label:e.id,key:e.id},r=Qg(e,n.key);r.length>0&&(n.children=r),t.children.push(n)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,yg(this.mapImp,e).then(e=>{e.length&&e.forEach(e=>{let n=!0;t&&(n=t.checkAll?!0:t.checked.includes(e.taxon)),this.taxonConnectivity.push({...e,enabled:n}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.taxon,n)})})},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){let e=this.mapImp.map,n=this.mapImp.options.bounds,r=[[n[0],n[1]],[n[2],n[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=(0,t.markRaw)({initBounds:r})}},resetView:function(){if(this.mapImp){let 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={}){if(this.mapImp){let n=[],r=t.target?.length?t.target:[],i=[...this.mapImp.pathModelNodes(e)],a=await this.mapImp.queryPathsForFeatures(e);if(i.length){if(!r.length){let n=t.type?.length?t.type:[`all`],i=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),a=i?.ids?.dendrites.flat(1/0),o=i?.ids?.components.flat(1/0),s=i?.ids?.axons.flat(1/0),c=[];n.includes(`origins`)&&c.push(...a),n.includes(`components`)&&c.push(...o),n.includes(`destinations`)&&c.push(...s),n.includes(`all`)&&c.push(...a,...o,...s),r=[...new Set(c)]}i.forEach(e=>{this.mapImp.nodePathModels(e).forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)})})}else a.length&&(r.length?a.forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)}):n=a);return n=[...new Set([...n,...e])],n}},resetMapFilter:function(){let e=this.mapFilters.alert,t,n={"tile-layer":`pathways`},r={NOT:n};e.with&&!e.without?t={OR:[r,{AND:[n,{HAS:`alert`}]}]}:!e.with&&e.without?t={OR:[r,{AND:[n,{NOT:{HAS:`alert`}}]}]}:!e.with&&!e.without&&(t=r),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp){if(e.value){let t,n={"tile-layer":`pathways`},r={NOT:n};(e.key===`alert`||e.key===`withoutAlert`)&&(t={OR:[r,{AND:[n,e.key===`alert`?{HAS:`alert`}:{NOT:{HAS:`alert`}}]}]}),this.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,!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 n=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,n)})},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){let t=this.existDrawnFeatures.find(e=>e.id===this.selectedDrawnFeature.id);t&&t.connection&&(this.connectionEntry=t.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`);let n=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=n}t.type===`created`?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type===`updated`&&(this.previousEditEvent=t),this.previousDeletedEvent=t.type===`deleted`?t:{}},getTaxons:function(e){let t;return e.taxons&&(t=typeof e.taxons==`object`?e.taxons:JSON.parse(e.taxons)),t},eventCallback:function(){return(e,t,...n)=>{if(e===`annotation`){let r={feature:t,userData:n,eventType:e};this.annotationEventCallback(r,t)}else if(e===`context-lost`)this.onContextLost();else if(e===`context-restored`)this.onContextRestored();else if(e===`pan-zoom`)this.$emit(`pan-zoom-callback`,t);else{let r=t.label,i=[t.models],a=this.entry,o=this.biologicalSex,s=Ng(t.alert),c=this.getTaxons(t),l=[{dataset:t.dataset,biologicalSex:o,taxonomy:a,resource:i,label:r,feature:t,userData:n,eventType:e,provenanceTaxonomy:c,alert:s}];if(e===`mouseenter`&&(this.lastHoveredFeature=t),e===`click`){let r=!t[0];if(!r){l=[];let r=t.mapUUID,i=new Set;for(let[s,c]of Object.entries(t))if(s!==`mapUUID`){let t=c.featureId,s=c.label,u=[c.models],d=this.getTaxons(c);if(i.has(t))continue;i.add(t),l.push({dataset:c.dataset,biologicalSex:o,taxonomy:a,resource:u,label:s,feature:c,userData:n,eventType:e,provenanceTaxonomy:d,alert:Ng(c.alert),mapUUID:r})}}let i=r?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,i),this.viewingMode!==`Neuron Connection`&&(this.currentActive=i.models?i.models:``,this.activeDrawTool&&!this.isValidDrawnCreated)){let e=i.featureId||this.existDrawnFeatures.find(e=>e.id===i.id);if(this.activeDrawTool===`LineString`&&e){let e=i.featureId?i.featureId:i.id,t=i.label?i.label:`Feature ${i.id}`;this.connectionEntry[` ${e}`]=Object.assign({label:t},Object.fromEntries(Object.entries(i).filter(([e])=>[`featureId`,`models`].includes(e)).map(([e,t])=>[e===`featureId`?`id`:e,t])))}}t&&t.type!==`marker`&&!this.activeDrawTool&&this.checkAndCreatePopups(l)}else e===`mouseenter`&&this.viewingMode!==`Neuron Connection`&&(this.currentHover=t.models?t.models:``);this.$emit(`resource-selected`,l)}}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=e===`Exploration`?t.models?.startsWith(`ilxtr:`)?t.models:``:t.featureId||t.id},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(`.flatmap-tooltip-popup`).forEach(e=>e.remove()),this.lastHoveredFeature=null},createTooltipForConnectivity:function(e,t){let n=document.createElement(`div`);n.classList.add(`flatmap-feature-label`),e.forEach((t,r)=>{let{label:i}=t;if(n.append(Mg(i)),r+1<e.length){let e=document.createElement(`hr`);n.appendChild(e)}}),this.mapImp.showPopup(t,n,{className:`custom-popup flatmap-tooltip-popup`,positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){let{connectivityInfo:t,data:n}=e,r=[],i=[],a=[],o=[];if(this.lastHoveredFeature=null,t&&t.featureId&&r.push(...t.featureId),this.mapImp){if(n.forEach(e=>{let t=this.mapImp.search(e.id);if(t?.results.length){let n=t?.results[0].featureId;a.push({featureId:n,...e})}else o.push(e)}),a.length){let e=a[0].featureId;this.mapImp.annotations.forEach(t=>{let n=t[`anatomical-nodes`];if(n){let r=n.join(``);a.every(e=>r.indexOf(e.id)!==-1)&&(e=t.featureId,i.push(e))}}),this.createTooltipForConnectivity(a,e)}else this.removeActiveTooltips();o.length&&this.emitConnectivityError(o);let e=r.reduce((e,t)=>{let n=this.mapImp.pathways.paths[t],r=n?n.connectivity:null;if(r){let t=r.flat(1/0);e.push(...t)}return e},[]),t=[...new Set(e)],s=[...r,...t],c=[...this.mapImp.modelFeatureIdList(s),...i];return this.mapImp.selectGeoJSONFeatures(c),c}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(e=>{this.mapImp.selectFeatures(e)})},searchConnectivitiesByReference:async function(e){let t=sessionStorage.getItem(`flatmap-knowledge`),n;return n=t?await wg(e):await Tg(this.mapImp,e,this.flatmapQueries),n},getFlatmapKnowledge:function(){let e=[],t=sessionStorage.getItem(`flatmap-knowledge`);return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit(`connectivity-error`,{data:{errorData:e,errorMessage:Yg}})},checkConnectivityTooltipEntry:function(e){return e?.length?e.find(e=>e?.destinations?.length||e?.components?.length)!==void 0:!1},changeConnectivitySource:async function(e){let{entry:t,connectivitySource:n}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],n),this.tooltipEntry=this.tooltipEntry.map(e=>e.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(e):e),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit(`connectivity-info-open`,this.tooltipEntry))},checkAndCreatePopups:async function(e,t=!0){if(this.viewingMode===`Annotation`){let t=e.filter(e=>e.feature).map(e=>e.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(e=>{this.annotationEntry.push({...e,resourceId:this.serverURL,featureId:e.featureId?e.featureId:e.feature?.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,Zg(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{let e=this.annotationEntry.filter(e=>e.featureId&&e.models).map(e=>e.models);e.length>0&&this.displayTooltip(e)}}else this.annotation={}}else if(this.viewingMode===`Neuron Connection`&&t){let t=e.map(e=>e.resource[0]);if(t.find(e=>!e.startsWith(`ilxtr:`))){let n=Array.isArray(t)?[...t]:[t];n.length===1&&n.push([]);let i=e[0].feature?.featureId,a=this.mapImp.annotations.get(i),o=a?.[`anatomical-nodes`],s=a?.models,c,l=n,u=a?.models;o?.length&&(c=o.find(e=>JSON.parse(e)[0]===s)),c?l=JSON.parse(c):u&&(l=[u,[]]);let d=this.mapImp.knowledgeSource,f=l.flat(1/0),p=[...new Set(f)],m=(await(0,r.fetchLabels)(this.flatmapAPI,p)).reduce((e,t)=>{let n=t[0],r=JSON.parse(t[1]);return e.push({id:n,label:r.label,source:r.source}),e},[]);m.sort((e,t)=>e.id===t.id?e.source===d&&t.source!==d?-1:+(e.source!==d&&t.source===d):e.id.localeCompare(t.id));let h=[];for(let e=0;e<p.length;e++){let t=m.find(t=>t.id===p[e]);t&&h.push(t.label)}let g=Mg(h.join(`, `)),_={facet:JSON.stringify(l),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:g,term:this.connectionType};this.connectivityFilters.some(e=>e.facet===_.facet&&e.facetPropPath===_.facetPropPath)||this.connectivityFilters.push(_),this.$emit(`neuron-connection-feature-click`,{filters:this.connectivityFilters,search:``})}else await this.openConnectivityInfo(e)}else await this.openConnectivityInfo(e)},openConnectivityInfo:async function(e){Og(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(e=>e.resource[0]in this.mapImp.pathways.paths).map(e=>({title:e.label,featureId:e.resource,ready:!1})),this.tooltipEntry.length){this.$emit(`connectivity-info-open`,this.tooltipEntry);for(let n=0;n<e.length;n++)t.push(await this.getKnowledgeTooltip(e[n]));this.tooltipEntry=await Promise.all(t);let n=this.tooltipEntry.map(e=>e.featureId[0]);n.length>0&&this.displayTooltip(n)}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(e=>e.facet.toLowerCase()!==`show all`))},resetConnectivityfilters:function(e){this.connectivityFilters=e.length?this.connectivityFilters.filter(t=>e.some(e=>e.facetPropPath===t.facetPropPath&&e.facet!==t.facet)):[]},getKnowledgeTooltip:async function(e){let t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e),n=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(n.featuresAlert=Ng(e.alert),n.knowledgeSource=Eg(this.mapImp),n.mapId=this.mapImp.mapMetadata.id,n.mapuuid=this.mapImp.mapMetadata.uuid),n.ready=!0,n},popUpCssHacks:function(){let 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`}),this.lastHoveredFeature=null},showPopup:function(e,t,n){let r=n;this.mapImp&&(r?r.className||(r.className=`custom-popup`):r={className:`custom-popup`,positionAtLastClick:!0},this.mapImp.showPopup(e,t,r))},showMarkerPopup:function(e,t,n){this.mapImp&&this.mapImp.showMarkerPopup(e,t,n)},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)},getHelpModeSteps:function(){return(0,r.collectHelpModeSteps)(this.$el)},openHelpModeDrawer:function(){clearTimeout(this.helpModeDrawerTimeout),this.requiresDrawer&&(this.drawerOpen||(this.helpModeDrawerOpened=!0),this.drawerOpen=!0)},restoreHelpModeDrawer:function(){clearTimeout(this.helpModeDrawerTimeout),this.helpModeDrawerTimeout=setTimeout(()=>{this.helpModeDrawerOpened&&(this.drawerOpen=!1),this.helpModeDrawerOpened=!1},Xg)},setHelpModeMarker:function(e){e?this.openHelpModeDrawer():this.restoreHelpModeDrawer(),this.helpModeMarkerVisible=e},displayTooltip:function(e,t=void 0){let n,r={className:`flatmapvuer-popover`};if(t)n=e,r.annotationFeatureGeometry=t,this.annotationEntry.length&&(r.annotationEvent={type:this.annotationEntry[0].type,feature:this.annotationEntry[0].feature});else{let t=Array.isArray(e)?e[0]:e;t&&(n=this.mapImp.modelFeatureIds(t)[0]),this.activeDrawTool||(r.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}),n&&!this.disableUI&&(this.viewingMode===`Annotation`&&!this.annotationSidebar||this.viewingMode===`Exploration`&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(n,this.$refs.tooltip.$el,r),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){let{offsetX:n=0,offsetY:r=0,zoom:i=4}=t,a=this.mapImp.map,o=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),o?.length&&setTimeout(()=>{a.fitBounds(o,{offset:[n,r],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`})}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(`.flatmap-popup-popper .maplibregl-popup-close-button`).forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let n of t.values())n.label&&e.push(n.label);return Array.from(new Set(e))}},getVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=this.$refs[t];n&&(e[t]=n.getState())}),this.$refs.treeControls&&(e.systemsSelection=this.$refs.treeControls.$refs.regionTree.getCheckedKeys().filter(e=>!e.includes(`.`)))},setVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=e[t];if(n){let e=this.$refs[t];e&&e.setState(n)}}),`systemsSelection`in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(t=>{this.mapImp.enableSystem(t.key,e.systemsSelection.includes(t.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()},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){let t=e.searchTerm;this.searchAndShowResult(t,!0,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){let t=1.6;(e===t||e>t)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0,this.flatmapError=null;let t={taxon:this.entry};this.uuid&&(t.uuid=this.uuid),e?(e.uuid?t={uuid:e.uuid}:e.entry&&(t.taxon=e.entry),e.biologicalSex?t.biologicalSex=e.biologicalSex:t.taxon===`NCBITaxon:9606`&&(t.biologicalSex=`PATO:0000384`)):this.biologicalSex&&(t.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(t,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:!1,container:this.$refs.display,tooltipDelay:15}).then(t=>{this.mapImp=Gg(t),this.serverURL=this.mapImp.makeServerUrl(``).slice(0,-1);let n=this.mapImp.details.version;this.setFlightPathInfo(n);let r=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(r),this.$nextTick(()=>this.restoreMapState(r))}).catch(e=>{if(console.error(`Flatmap loading error:`,e),this.flatmapError={},e.message&&e.message.indexOf(`Unknown map`)!==-1?(this.flatmapError.title=`Unknown Map!`,this.flatmapError.messages=Object.keys(t).map(e=>`${e===`uuid`?`UUID`:Mg(e)}: ${t[e]}`)):(this.flatmapError.title=`Error Loading Map!`,this.flatmapError.messages=[e.message?e.message:e.toString(),`Please try again later or contact support if the problem persists.`]),this.$parent?.$refs?.multiContainer){let e=this.$parent;this.flatmapError.button={text:`Load Default Map`,callback:()=>{let t=e.initial;e.setSpecies(t,void 0,3)}}}this.loading=!1})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){let e=this.$refs.display;if(e){let t=getComputedStyle(e),n=parseInt(t.paddingTop)+parseInt(t.paddingBottom),r=e.clientHeight-n;this.pathwaysMaxHeight=r-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&this.mapImp.resize()}catch{console.error(`Map resize error`)}},getFilterSources:function(){let e=[`kind`,`taxons`],t=new Set,n=new Set,r=new Map;for(let i of this.mapImp.annotations.values())if(i.source){`alert`in i?t.add(i.source):n.add(i.source);for(let[t,n]of Object.entries(i))if(e.includes(t)){r.has(t)||r.set(t,new Map);let e=r.get(t),a=t=>{let n=t;e.has(n)||e.set(n,new Set),e.get(n).add(`${i.source}`)};Array.isArray(n)?n.forEach(a):a(n)}}let i={alert:{with:[...t],without:[...n]}};for(let[e,t]of r.entries()){i[e]={};for(let[n,r]of t.entries())i[e][n]=[...r.values()]}return i},getFilterOptions:async function(e,t){let n=t||this.getFlatmapKnowledge(),i=this.pathways;return await(0,r.getFlatmapFilterOptions)(this.flatmapAPI,e,n,i)},onFlatmapReady:function(e){this.sensor=(0,t.markRaw)(new Fg.default(this.$refs.display,this.mapResize)),this.mapImp.options?.style===`functional`&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(e=>e.enabled&&e.type!==`other`),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert=`alert`in this.mapImp.featureFilterRanges(),this.flatmapLegends=this.mapImp.flatmapLegend,this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.$emit(`ready`,this)},handleMapClick:function(){let e=this.mapImp.map;e&&e.on(`click`,()=>{this.connectivityDataSource||this.$emit(`connectivity-info-close`),this.connectivityDataSource=``})},onContextLost:function(){this.lastViewport=(0,t.markRaw)(this.mapImp.getState()),this.flatmapError={},this.flatmapError.title=`GL context lost!`,this.flatmapError.messages=[`A display issue has occurred due
|
|
29
29
|
to a limit on available WebGL contexts. You can restore the display
|
|
30
30
|
using the Restore Context button. Please see the
|
|
31
31
|
<a href="https://docs.sparc.science/docs/integrated-maps-viewer-overview#limit-on-available-webgl-contexts" target='_blank'>documentation</a>
|
|
32
|
-
for more details.`],this.flatmapError.button={text:`Restore Context`,callback:()=>{this.forceContextRestore()}}},onContextRestored:function(){if(this.mapImp){this.handleMapClick(),this.setInitMapState();let e=this.getState();e&&(e.viewport=this.lastViewport),this.restoreMapState(e),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.filterToRestore&&=(this.mapImp.setVisibilityFilter(this.filterToRestore),void 0),this.$emit(`context-restored`,this)}},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,n=!0){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;{let r=this.mapImp.search(e);if(r?.results?.length){if(this.mapImp.showSearchResults(r),t){let e;for(let t=0;t<r.results.length;t++){e=r.results[t].featureId;let n=this.mapImp.annotation(e);if(e&&n?.label)break}if(e){let t=this.mapImp.featureProperties(e),r={resource:[t.models],feature:t,label:t.label,provenanceTaxonomy:t.taxons,alert:Ng(t.alert)};this.checkAndCreatePopups([r],n);let i=t.id.startsWith(`ilxtr:`)||t.id.startsWith(`ilx:`);i?(this.lastHoveredFeature=t,this.lastHoveredFeature.mapUUID=this.mapImp.uuid):this.lastHoveredFeature=null,this.mapImp.showPopup(e,Mg(t.label),{className:i?`flatmap-tooltip-popup`:`custom-popup`,positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){let t=e.filter(e=>e in this.mapImp.pathways.paths),n=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(n)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){Jg.emit(`onActionClick`,e)},setConnectionType:function(e){this.connectionType=e},_handleTooltipMutation:function(e){for(let t of e)for(let e of t.addedNodes)if(e.nodeType===1){if(e.matches&&e.matches(`.flatmap-tooltip-popup`))this._applyCustomTooltipContent(e);else if(e.querySelector){let t=e.querySelector(`.flatmap-tooltip-popup`);t&&this._applyCustomTooltipContent(t)}}},_applyCustomTooltipContent:function(e){if(!(!this.tooltipContentProvider||!this.lastHoveredFeature))try{let t=this.lastHoveredFeature,n=t[0]&&typeof t[0]==`object`,r;if(n){let e=[],n=t.mapUUID;for(let[r,i]of Object.entries(t))r!==`mapUUID`&&i&&typeof i==`object`&&e.push({...i,mapUUID:n});r=this.tooltipContentProvider(e.length>1?e:e[0])}else r=this.tooltipContentProvider(t);if(r){let t=e.querySelector(`.maplibregl-popup-content`);t&&(t.innerHTML=r)}}catch(e){console.warn(`[flatmapvuer] Error in tooltipContentProvider:`,e)}}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:``},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},render:{type:Boolean,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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken,openHelpModeDrawer:this.openHelpModeDrawer,restoreHelpModeDrawer:this.restoreHelpModeDrawer}},data:function(){return{filterToRestore:void 0,flatmapError:null,sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:(0,t.markRaw)({}),sckanDisplay:[{label:`Display Path with SCKAN`,key:`VALID`}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipDelay:500,helpModeMarkerVisible:!1,yellowstar:Pg,isFC:!1,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],loading:!1,flatmapMarker:ug,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`]},connectionType:`All`,offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:`Anyone`,annotatedSource:[`Anyone`,`Me`,`Others`],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:[`Edit`,`Delete`,`Point`,`LineString`,`Polygon`,`Connection`],authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},lastHoveredFeature:null,tooltipObserver:null,connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:`Display Path With Notes`,key:`alert`,enabled:!0},{label:`Display Path Without Notes`,key:`withoutAlert`,enabled:!0}],mapFilters:(0,t.markRaw)({alert:{with:!0,without:!0}}),searchTerm:``,taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[],lastViewport:void 0}},computed:{warningHelpDescription:function(){return this.isLegacy?`This is a legacy map. Click the link below the icon to view the latest map instead.`:this.isFC?`This map displays the connectivity of individual neurons which align with the neuron populations from the ApiNATOMY models available in SCKAN.`:`This map displays the connectivity of neuron populations from the primarily rat-based ApiNATOMY models available in SCKAN. New connectivity and species specificity will be added as the SPARC program progresses.`},...(0,c.mapState)(Kg,[`userToken`]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){return this.loading?!1:this.systems?.length>0||this.containsAlert&&this.alertOptions||this.pathways?.length>0||this.taxonConnectivity?.length>0||this.legendEntry?.length>0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e},legendEntry:function(){return[...this.flatmapLegends,...this.externalLegends]}},watch:{entry:function(){this.state||this.createFlatmap()},requiresDrawer:{handler:function(e){this.drawerOpen=e},immediate:!0},render:function(e){e&&this.mapImp&&this.mapImp.contextLost&&!this.loading&&this.$nextTick(()=>{this.forceContextRestore()})},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(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,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=[],n={x:null,y:null},r=this.$el.querySelector(`.maplibregl-canvas`),i=()=>{r.removeEventListener(`keydown`,a),r.removeEventListener(`click`,o)},a=n=>{if(![`Escape`,`Enter`].includes(n.key))return;let r=e===`Point`&&t.length===1||e===`LineString`&&t.length>=2||e===`Polygon`&&t.length>=3;(n.key===`Escape`||n.key===`Enter`&&!r)&&(this.activeDrawTool=void 0),i()},o=e=>{let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top;if(Math.sqrt((o-n.x)**2+(s-n.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}n={x:o,y:s},t.push(n)};e&&(i(),r.addEventListener(`keydown`,a),r.addEventListener(`click`,o))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new Ig.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef))},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.flatmapQueries=(0,t.markRaw)(new Cg),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),jg(),this.tooltipContentProvider&&this.$nextTick(()=>{let e=this.$refs.flatmapContainer||this.$el;e&&(this.tooltipObserver=new MutationObserver(this._handleTooltipMutation.bind(this)),this.tooltipObserver.observe(e,{childList:!0,subtree:!0}))})},beforeUnmount:function(){this.tooltipObserver&&=(this.tooltipObserver.disconnect(),null)}},e_={class:`flatmap-container`,ref:`flatmapContainer`,"data-help-scope":``,"element-loading-text":`Loading...`,"element-loading-background":`rgba(0, 0, 0, 0.3)`},t_={style:{height:`100%`,width:`100%`,position:`relative`,"overflow-y":`none`}},n_={style:{height:`100%`,width:`100%`},ref:`display`,class:`flatmap-display`},r_={class:`beta-popovers`},i_={key:0},a_={key:1},o_={key:2},s_={class:`warning-icon`},c_={key:2,class:`warning-text`},l_={key:0,class:`latest-changesicon`},u_={class:`bottom-right-control`},d_={class:`flatmap-marker-help`},f_=[`innerHTML`],p_={style:{"margin-bottom":`2px`}},m_={key:0,class:`viewing-mode-title`},h_=[`onClick`],g_=[`onClick`],__={key:0,ref:`openMapRef`,class:`icon-button-container`},v_={ref:`backgroundIconRef`,class:`icon-button-container`};function y_(e,r,i,a,o,s){let c=(0,t.resolveComponent)(`map-svg-sprite-color`),l=lg,u=n.WarningFilled,d=md,f=Ch,p=n.ArrowDown,m=(0,t.resolveComponent)(`DrawToolbar`),h=(0,t.resolveComponent)(`map-svg-icon`),g=eg,_=(0,t.resolveComponent)(`tree-controls`),v=Uh,y=n.ArrowLeft,b=Gp,x=ph,S=mh,C=Om,w=Dm,T=ch,E=lh,D=(0,t.resolveComponent)(`Tooltip`),O=(0,t.resolveDirective)(`help-mode`),k=Ph;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,e_,[(0,t.createVNode)(c),(0,t.createElementVNode)(`div`,t_,[(0,t.withDirectives)((0,t.createElementVNode)(`div`,n_,null,512),[[O,{id:`flatmap-map-popup`,area:`map-info`,order:1,title:`Explore the map`,description:`<b>Hover</b> over a feature on the map to see its name, <b>click</b> on it to see more information such as its connectivity.`,placement:`bottom`,target:()=>e.$el.querySelector(`.flatmap-popup-popper`),onEnter:s.openFlatmapHelpPopup,onLeave:s.closeFlatmapHelpPopup}]]),e.flatmapError?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,flatmapError:e.flatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,r_,[(0,t.createElementVNode)(`div`,null,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,"popper-class":`warning-popper flatmap-popper`,teleported:!1,trigger:`hover`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`warningPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,s_,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(d,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1})):(0,t.createCommentVNode)(``,!0),i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[r[11]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`Legacy Map`,-1),(0,t.createElementVNode)(`div`,{class:`latest-map-text`,onClick:r[0]||=(...e)=>s.viewLatestMap&&s.viewLatestMap(...e)},` Click here for the latest map `)],64)):i.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,c_,`Beta`)):(0,t.createCommentVNode)(``,!0)])),[[O,{id:`flatmap-warning`,area:`map-info`,title:`About this map`,description:s.warningHelpDescription,placement:`right`}]])]),default:(0,t.withCtx)(()=>[i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,i_,`This is a legacy map, you may view the latest map instead.`)):e.isFC?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,a_,[...r[9]||=[(0,t.createTextVNode)(` This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(` . `,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,o_,[...r[10]||=[(0,t.createTextVNode)(` This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(` . New connectivity and species specificity will be added as the SPARC program progresses. `,-1)]]))]),_:1},8,[`show-after`,`hide-after`])):(0,t.createCommentVNode)(``,!0)]),i.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,teleported:!1,trigger:`hover`,"popper-class":`warning-popper flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[i.displayLatestChanges?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,l_,[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),r[12]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`What's new?`,-1)])),[[O,{id:`flatmap-whats-new`,area:`map-info`,title:`What's new?`,description:`See the latest changes and improvements made to this map.`,placement:`right`}]]):(0,t.createCommentVNode)(``,!0)]),default:(0,t.withCtx)(()=>[...r[13]||=[(0,t.createElementVNode)(`b`,null,`Connectivity References`,-1),(0,t.createElementVNode)(`p`,null,`Connectivity references have been improved and available in various formats.`,-1),(0,t.createElementVNode)(`b`,null,`Improved state storing`,-1),(0,t.createElementVNode)(`p`,null,` Current selection and visibility filters are now stored when creating a permalink. `,-1)]]),_:1},8,[`show-after`,`hide-after`])):(0,t.createCommentVNode)(``,!0)],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createVNode)(d,{class:(0,t.normalizeClass)([`minimap-resize`,{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:`minimapResize`,onClick:s.closeMinimap},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p)]),_:1},8,[`class`,`onClick`]),[[t.vShow,e.minimapResizeShow]]),e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!i.disableUI?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,mapCanvas:{containerHTML:this.$el,class:`.maplibregl-canvas`},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,onClickToolbar:s.toolbarEvent,onFeatureTooltip:s.connectedFeatureTooltip,onConfirmDrawn:s.confirmDrawnFeature,onCancelDrawn:s.cancelDrawnFeature,ref:`toolbarPopover`},null,8,[`mapCanvas`,`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`newlyDrawnEntry`,`connectionEntry`,`onClickToolbar`,`onFeatureTooltip`,`onConfirmDrawn`,`onCancelDrawn`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,u_,[(0,t.createVNode)(f,{content:`Zoom in`,placement:`left`,teleported:!1,trigger:`hover`,width:`70`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[1]||=e=>s.zoomIn()},[(0,t.createVNode)(h,{class:`icon-button zoomIn`,icon:`zoomIn`})])),[[O,{id:`flatmap-zoom-in`,area:`zoom`,title:`Zoom in`,description:`Zoom in to see more detail. You can also scroll or pinch on the map.`,placement:`left`}]])]),_:1},8,[`show-after`,`hide-after`]),(0,t.createVNode)(f,{content:`Zoom out`,placement:`top-end`,teleported:!1,trigger:`hover`,width:`70`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[2]||=e=>s.zoomOut()},[(0,t.createVNode)(h,{class:`icon-button zoomOut`,icon:`zoomOut`})])),[[O,{id:`flatmap-zoom-out`,area:`zoom`,title:`Zoom out`,description:`Zoom out to see more of the map.`,placement:`top`}]])]),_:1},8,[`show-after`,`hide-after`]),(0,t.createVNode)(f,{content:`Reset`,placement:`top`,teleported:!1,trigger:`hover`,width:`70`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomFitPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[3]||=e=>s.resetView()},[(0,t.createVNode)(h,{class:`icon-button fitWindow`,icon:`fitWindow`})])),[[O,{id:`flatmap-zoom-fit`,area:`zoom`,title:`Fit to window`,description:`Reset the view so the whole map fits in the window.`,placement:`top`}]])]),default:(0,t.withCtx)(()=>[r[14]||=(0,t.createElementVNode)(`div`,null,[(0,t.createTextVNode)(` Fit to `),(0,t.createElementVNode)(`br`),(0,t.createTextVNode)(` window `)],-1)]),_:1},8,[`show-after`,`hide-after`])],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pathway-location`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`pathway-container`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({"max-height":e.pathwaysMaxHeight+`px`})},[s.legendEntry.length?((0,t.openBlock)(),(0,t.createBlock)(g,{key:0,identifierKey:`prompt`,colourKey:`colour`,styleKey:`style`,legends:s.legendEntry,showStarInLegend:!0,ref:`featuredMarkerPopover`,class:`svg-legends-container`},null,8,[`legends`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,d_,[(0,t.createElementVNode)(`div`,{class:`flatmap-marker-help-icon`,innerHTML:e.flatmapMarker},null,8,f_),r[15]||=(0,t.createElementVNode)(`span`,{class:`flatmap-marker-help-label`},`Dataset markers`,-1)])),[[t.vShow,e.helpModeMarkerVisible],[O,{id:`flatmap-marker`,area:`legends`,title:`Dataset markers`,description:`Find these markers on the map for data. The number inside a marker is the number of datasets available at that location.`,placement:`right`,onEnter:()=>s.setHelpModeMarker(!0),onLeave:()=>s.setHelpModeMarker(!1)}]]),e.isFC&&e.systems&&e.systems.length>0?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1,class:`treeControls`,mapType:`flatmap`,title:`Systems`,treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:s.systemSelected,onCheckAll:s.checkAllSystems,onChangeActive:s.ftuSelected,ref:`treeControls`},null,8,[`treeData`,`active`,`hover`,`onCheckChanged`,`onCheckAll`,`onChangeActive`])):(0,t.createCommentVNode)(``,!0),e.containsAlert&&e.alertOptions&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Notes`,labelKey:`label`,identifierKey:`key`,selections:e.alertOptions,onChanged:s.alertSelected,onCheckboxMouseEnter:s.alertMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllAlerts,ref:`alertSelection`,key:`alertSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.pathways&&e.pathways.length>0?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Pathways`,labelKey:`label`,identifierKey:`type`,colourStyle:`line`,selections:e.pathways,showAsLegend:!i.showPathwayFilter,onChanged:s.pathwaysSelected,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllPathways,ref:`pathwaysSelection`,key:`pathwaysSelection`},null,8,[`selections`,`showAsLegend`,`onChanged`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{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:s.taxonsSelected,onCheckboxMouseEnter:s.taxonMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllTaxons,ref:`taxonSelection`,key:`taxonSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0)],6)),[[O,{id:`flatmap-pathways`,area:`legends`,title:i.showPathwayFilter?`Pathways and legends`:`Legends`,description:i.showPathwayFilter?`Show or hide pathways, systems and other map layers using the checkboxes in this panel.`:`The legends explain the symbols and colours used on this map.`,placement:`right`,onEnter:s.openHelpModeDrawer,onLeave:s.restoreHelpModeDrawer}]]),(0,t.createElementVNode)(`div`,{onClick:r[4]||=(...e)=>s.toggleDrawer&&s.toggleDrawer(...e),class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(y)]),_:1})],2)],2),[[t.vShow,!i.disableUI&&s.requiresDrawer]]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,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:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(x,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(b,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,null,[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[16]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,p_,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,m_,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>s.changeViewingMode(r)},(0,t.toDisplayString)(r),9,h_))],64))),128))]),(0,t.createVNode)(x,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...r[17]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1}),e.viewingMode===`Annotation`&&e.authorisedUser?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[18]||=[(0,t.createTextVNode)(`Annotations From`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":r[5]||=t=>e.annotationFrom=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap_dropdown`,onChange:s.setAnnotationFrom},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.annotatedSource,e=>((0,t.openBlock)(),(0,t.createBlock)(C,{key:e,label:e,value:e},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(x,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{span:12},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1})],64)):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1,class:`backgroundSpacer`})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:2,class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[19]||=[(0,t.createTextVNode)(`Flight path display`,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:3,class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":r[6]||=t=>e.flightPath3DRadio=t,class:`flatmap-radio`,onChange:s.setFlightPath3D},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[20]||=[(0,t.createTextVNode)(`2D`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[21]||=[(0,t.createTextVNode)(`3D`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[22]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.colourRadio,"onUpdate:modelValue":r[7]||=t=>e.colourRadio=t,class:`flatmap-radio`,onChange:s.setColour},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[23]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[24]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[25]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.outlinesRadio,"onUpdate:modelValue":r[8]||=t=>e.outlinesRadio=t,class:`flatmap-radio`,onChange:s.setOutlines},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[26]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[27]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[28]||=[(0,t.createTextVNode)(`Change background`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>s.backgroundChangeCallback(n)},null,10,g_))),128))]),_:1})])]),_:1},8,[`virtual-ref`]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group`,{open:e.drawerOpen,close:!e.drawerOpen}])},[i.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{trigger:`hover`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,content:`Open new map`,placement:`right`,teleported:!1,"popper-class":`flatmap-popper`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[i.enableOpenMapUI&&i.openMapOptions.length>0?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,__,[(0,t.createVNode)(h,{icon:`openMap`,class:`icon-button open-map-button`})])),[[O,{id:`flatmap-open-map`,area:`map-settings`,title:`Open new map`,description:`Open another map, such as a different species or a connectivity map.`,placement:`right`}]]):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`show-after`,`hide-after`])]),_:1})):(0,t.createCommentVNode)(``,!0),i.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{content:`Change settings`,placement:`right`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,teleported:!1,trigger:`hover`,"popper-class":`flatmap-popper`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,v_,[(0,t.createVNode)(h,{icon:`changeBckgd`,class:`icon-button`})])),[[O,{id:`flatmap-settings`,area:`map-settings`,title:`Settings`,description:`Change the map settings, such as the background colour and the viewing mode.`,placement:`right`}]])]),_:1},8,[`show-after`,`hide-after`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2),[[t.vShow,!i.disableUI]]),e.tooltipDisplay?((0,t.openBlock)(),(0,t.createBlock)(D,{key:3,ref:`tooltip`,class:`tooltip`,annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode===`Annotation`,onAnnotation:s.commitAnnotationEvent,onOnActionClick:s.onActionClick},null,8,[`annotationEntry`,`tooltipEntry`,`annotationDisplay`,`onAnnotation`,`onOnActionClick`])):(0,t.createCommentVNode)(``,!0)])])),[[k,e.loading]])}var b_=Fh($g,[[`render`,y_],[`__scopeId`,`data-v-4eee1dfc`]]),x_={"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`},S_={name:`MultiFlatmapVuer`,components:{FlatmapVuer:b_},directives:{helpMode:r.helpModeDirective},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),Jg.on(`onActionClick`,e=>{this.resourceSelected(e)}),Jg.on(`open-pubmed-url`,e=>{this.$emit(`open-pubmed-url`,e)})},methods:{initialise:function(){return this.multiflatmapError=null,new Promise(e=>{if(this.requireInitialisation){this.requireInitialisation=!1;let t=new AbortController,n=t.signal,r=setTimeout(()=>t.abort(),5e3);fetch(this.flatmapAPI,{signal:n}).then(t=>{if(!t.ok){if(t.status===404)return this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
32
|
+
for more details.`],this.flatmapError.button={text:`Restore Context`,callback:()=>{this.forceContextRestore()}}},onContextRestored:function(){if(this.mapImp){this.handleMapClick(),this.setInitMapState();let e=this.getState();e&&(e.viewport=this.lastViewport),this.restoreMapState(e),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.filterToRestore&&=(this.mapImp.setVisibilityFilter(this.filterToRestore),void 0),this.$emit(`context-restored`,this)}},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,n=!0){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;{let r=this.mapImp.search(e);if(r?.results?.length){if(this.mapImp.showSearchResults(r),t){let e;for(let t=0;t<r.results.length;t++){e=r.results[t].featureId;let n=this.mapImp.annotation(e);if(e&&n?.label)break}if(e){let t=this.mapImp.featureProperties(e),r={resource:[t.models],feature:t,label:t.label,provenanceTaxonomy:t.taxons,alert:Ng(t.alert)};this.checkAndCreatePopups([r],n);let i=t.id.startsWith(`ilxtr:`)||t.id.startsWith(`ilx:`);i?(this.lastHoveredFeature=t,this.lastHoveredFeature.mapUUID=this.mapImp.uuid):this.lastHoveredFeature=null,this.mapImp.showPopup(e,Mg(t.label),{className:i?`flatmap-tooltip-popup`:`custom-popup`,positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){let t=e.filter(e=>e in this.mapImp.pathways.paths),n=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(n)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){Jg.emit(`onActionClick`,e)},setConnectionType:function(e){this.connectionType=e},_handleTooltipMutation:function(e){for(let t of e)for(let e of t.addedNodes)if(e.nodeType===1){if(e.matches&&e.matches(`.flatmap-tooltip-popup`))this._applyCustomTooltipContent(e);else if(e.querySelector){let t=e.querySelector(`.flatmap-tooltip-popup`);t&&this._applyCustomTooltipContent(t)}}},_applyCustomTooltipContent:function(e){if(!(!this.tooltipContentProvider||!this.lastHoveredFeature))try{let t=this.lastHoveredFeature,n=t[0]&&typeof t[0]==`object`,r;if(n){let e=[],n=t.mapUUID;for(let[r,i]of Object.entries(t))r!==`mapUUID`&&i&&typeof i==`object`&&e.push({...i,mapUUID:n});r=this.tooltipContentProvider(e.length>1?e:e[0])}else r=this.tooltipContentProvider(t);if(r){let t=e.querySelector(`.maplibregl-popup-content`);t&&(t.innerHTML=r)}}catch(e){console.warn(`[flatmapvuer] Error in tooltipContentProvider:`,e)}}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:``},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},render:{type:Boolean,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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken,openHelpModeDrawer:this.openHelpModeDrawer,restoreHelpModeDrawer:this.restoreHelpModeDrawer}},data:function(){return{filterToRestore:void 0,flatmapError:null,sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:(0,t.markRaw)({}),sckanDisplay:[{label:`Display Path with SCKAN`,key:`VALID`}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipDelay:500,helpModeMarkerVisible:!1,yellowstar:Pg,isFC:!1,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],loading:!1,flatmapMarker:ug,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`]},connectionType:`All`,offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:`Anyone`,annotatedSource:[`Anyone`,`Me`,`Others`],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:[`Edit`,`Delete`,`Point`,`LineString`,`Polygon`,`Connection`],authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},lastHoveredFeature:null,tooltipObserver:null,connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:`Display Path With Notes`,key:`alert`,enabled:!0},{label:`Display Path Without Notes`,key:`withoutAlert`,enabled:!0}],mapFilters:(0,t.markRaw)({alert:{with:!0,without:!0}}),searchTerm:``,taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[],lastViewport:void 0}},computed:{warningHelpDescription:function(){return this.isLegacy?`This is a legacy map. Click the link below the icon to view the latest map instead.`:this.isFC?`This map displays the connectivity of individual neurons which align with the neuron populations from the ApiNATOMY models available in SCKAN.`:`This map displays the connectivity of neuron populations from the primarily rat-based ApiNATOMY models available in SCKAN. New connectivity and species specificity will be added as the SPARC program progresses.`},...(0,c.mapState)(Kg,[`userToken`]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){return this.loading?!1:this.systems?.length>0||this.containsAlert&&this.alertOptions||this.pathways?.length>0||this.taxonConnectivity?.length>0||this.legendEntry?.length>0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e},legendEntry:function(){return[...this.flatmapLegends,...this.externalLegends]}},watch:{entry:function(){this.state||this.createFlatmap()},requiresDrawer:{handler:function(e){this.drawerOpen=e},immediate:!0},render:function(e){e&&this.mapImp&&this.mapImp.contextLost&&!this.loading&&this.$nextTick(()=>{this.forceContextRestore()})},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(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,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=[],n={x:null,y:null},r=this.$el.querySelector(`.maplibregl-canvas`),i=()=>{r.removeEventListener(`keydown`,a),r.removeEventListener(`click`,o)},a=n=>{if(![`Escape`,`Enter`].includes(n.key))return;let r=e===`Point`&&t.length===1||e===`LineString`&&t.length>=2||e===`Polygon`&&t.length>=3;(n.key===`Escape`||n.key===`Enter`&&!r)&&(this.activeDrawTool=void 0),i()},o=e=>{let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top;if(Math.sqrt((o-n.x)**2+(s-n.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}n={x:o,y:s},t.push(n)};e&&(i(),r.addEventListener(`keydown`,a),r.addEventListener(`click`,o))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new Ig.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef))},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.flatmapQueries=(0,t.markRaw)(new Cg),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),jg(),this.tooltipContentProvider&&this.$nextTick(()=>{let e=this.$refs.flatmapContainer||this.$el;e&&(this.tooltipObserver=new MutationObserver(this._handleTooltipMutation.bind(this)),this.tooltipObserver.observe(e,{childList:!0,subtree:!0}))})},beforeUnmount:function(){this.tooltipObserver&&=(this.tooltipObserver.disconnect(),null)}},e_={class:`flatmap-container`,ref:`flatmapContainer`,"data-help-scope":``,"element-loading-text":`Loading...`,"element-loading-background":`rgba(0, 0, 0, 0.3)`},t_={style:{height:`100%`,width:`100%`,position:`relative`,"overflow-y":`none`}},n_={style:{height:`100%`,width:`100%`},ref:`display`,class:`flatmap-display`},r_={class:`beta-popovers`},i_={key:0},a_={key:1},o_={key:2},s_={class:`warning-icon`},c_={key:2,class:`warning-text`},l_={key:0,class:`latest-changesicon`},u_={class:`bottom-right-control`},d_={class:`flatmap-marker-help`},f_=[`innerHTML`],p_={style:{"margin-bottom":`2px`}},m_={key:0,class:`viewing-mode-title`},h_=[`onClick`],g_=[`onClick`],__={key:0,ref:`openMapRef`,class:`icon-button-container`},v_={ref:`backgroundIconRef`,class:`icon-button-container`};function y_(e,r,i,a,o,s){let c=(0,t.resolveComponent)(`map-svg-sprite-color`),l=lg,u=n.WarningFilled,d=md,f=Ch,p=n.ArrowDown,m=(0,t.resolveComponent)(`DrawToolbar`),h=(0,t.resolveComponent)(`map-svg-icon`),g=eg,_=(0,t.resolveComponent)(`tree-controls`),v=Uh,y=n.ArrowLeft,b=Gp,x=ph,S=mh,C=Om,w=Dm,T=ch,E=lh,D=(0,t.resolveComponent)(`Tooltip`),O=(0,t.resolveDirective)(`help-mode`),k=Ph;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,e_,[(0,t.createVNode)(c),(0,t.createElementVNode)(`div`,t_,[(0,t.withDirectives)((0,t.createElementVNode)(`div`,n_,null,512),[[O,{id:`flatmap-map-popup`,area:`map-info`,order:1,title:`Explore the map`,description:`<b>Hover</b> over a feature on the map to see its name, <b>click</b> on it to see more information (depending on the viewing mode).`,placement:`bottom`,target:()=>e.$el.querySelector(`.flatmap-popup-popper`),onEnter:s.openFlatmapHelpPopup,onLeave:s.closeFlatmapHelpPopup}]]),e.flatmapError?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,flatmapError:e.flatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,r_,[(0,t.createElementVNode)(`div`,null,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,"popper-class":`warning-popper flatmap-popper`,teleported:!1,trigger:`hover`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`warningPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,s_,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(d,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1})):(0,t.createCommentVNode)(``,!0),i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[r[11]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`Legacy Map`,-1),(0,t.createElementVNode)(`div`,{class:`latest-map-text`,onClick:r[0]||=(...e)=>s.viewLatestMap&&s.viewLatestMap(...e)},` Click here for the latest map `)],64)):i.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,c_,`Beta`)):(0,t.createCommentVNode)(``,!0)])),[[O,{id:`flatmap-warning`,area:`map-info`,title:`About this map`,description:s.warningHelpDescription,placement:`right`}]])]),default:(0,t.withCtx)(()=>[i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,i_,`This is a legacy map, you may view the latest map instead.`)):e.isFC?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,a_,[...r[9]||=[(0,t.createTextVNode)(` This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(` . `,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,o_,[...r[10]||=[(0,t.createTextVNode)(` This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(` . New connectivity and species specificity will be added as the SPARC program progresses. `,-1)]]))]),_:1},8,[`show-after`,`hide-after`])):(0,t.createCommentVNode)(``,!0)]),i.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,teleported:!1,trigger:`hover`,"popper-class":`warning-popper flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[i.displayLatestChanges?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,l_,[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),r[12]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`What's new?`,-1)])),[[O,{id:`flatmap-whats-new`,area:`map-info`,title:`What's new?`,description:`See the latest changes and improvements made to this viewer.`,placement:`right`}]]):(0,t.createCommentVNode)(``,!0)]),default:(0,t.withCtx)(()=>[...r[13]||=[(0,t.createElementVNode)(`b`,null,`Connectivity References`,-1),(0,t.createElementVNode)(`p`,null,`Connectivity references have been improved and available in various formats.`,-1),(0,t.createElementVNode)(`b`,null,`Improved state storing`,-1),(0,t.createElementVNode)(`p`,null,` Current selection and visibility filters are now stored when creating a permalink. `,-1)]]),_:1},8,[`show-after`,`hide-after`])):(0,t.createCommentVNode)(``,!0)],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createVNode)(d,{class:(0,t.normalizeClass)([`minimap-resize`,{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:`minimapResize`,onClick:s.closeMinimap},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p)]),_:1},8,[`class`,`onClick`]),[[t.vShow,e.minimapResizeShow]]),e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!i.disableUI?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,mapCanvas:{containerHTML:this.$el,class:`.maplibregl-canvas`},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,onClickToolbar:s.toolbarEvent,onFeatureTooltip:s.connectedFeatureTooltip,onConfirmDrawn:s.confirmDrawnFeature,onCancelDrawn:s.cancelDrawnFeature,ref:`toolbarPopover`},null,8,[`mapCanvas`,`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`newlyDrawnEntry`,`connectionEntry`,`onClickToolbar`,`onFeatureTooltip`,`onConfirmDrawn`,`onCancelDrawn`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,u_,[(0,t.createVNode)(f,{content:`Zoom in`,placement:`left`,teleported:!1,trigger:`hover`,width:`max-content`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[1]||=e=>s.zoomIn()},[(0,t.createVNode)(h,{class:`icon-button zoomIn`,icon:`zoomIn`})])),[[O,{id:`flatmap-zoom-in`,area:`zoom`,title:`Zoom in`,description:`Zoom in to see more detail. You can also scroll, or pinch open on a touch screen.`,placement:`left`}]])]),_:1},8,[`show-after`,`hide-after`]),(0,t.createVNode)(f,{content:`Zoom out`,placement:`top-end`,teleported:!1,trigger:`hover`,width:`max-content`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[2]||=e=>s.zoomOut()},[(0,t.createVNode)(h,{class:`icon-button zoomOut`,icon:`zoomOut`})])),[[O,{id:`flatmap-zoom-out`,area:`zoom`,title:`Zoom out`,description:`Zoom out to see more. You can also scroll, or pinch closed on a touch screen.`,placement:`top`}]])]),_:1},8,[`show-after`,`hide-after`]),(0,t.createVNode)(f,{placement:`top`,teleported:!1,trigger:`hover`,width:`max-content`,"popper-class":`flatmap-popper`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,ref:`zoomFitPopover`,content:`Fit to view`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`icon-button-container`,onClick:r[3]||=e=>s.resetView()},[(0,t.createVNode)(h,{class:`icon-button fitWindow`,icon:`fitWindow`})])),[[O,{id:`flatmap-zoom-fit`,area:`zoom`,title:`Fit to view`,description:`Reset the zoom and position so everything fits in this view.`,placement:`top`}]])]),_:1},8,[`show-after`,`hide-after`])],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pathway-location`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`pathway-container`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({"max-height":e.pathwaysMaxHeight+`px`})},[s.legendEntry.length?((0,t.openBlock)(),(0,t.createBlock)(g,{key:0,identifierKey:`prompt`,colourKey:`colour`,styleKey:`style`,legends:s.legendEntry,showStarInLegend:!0,ref:`featuredMarkerPopover`,class:`svg-legends-container`},null,8,[`legends`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,d_,[(0,t.createElementVNode)(`div`,{class:`flatmap-marker-help-icon`,innerHTML:e.flatmapMarker},null,8,f_),r[14]||=(0,t.createElementVNode)(`span`,{class:`flatmap-marker-help-label`},`Dataset markers`,-1)])),[[t.vShow,e.helpModeMarkerVisible],[O,{id:`flatmap-marker`,area:`legends`,title:`Dataset markers`,description:`Find these markers on the map for data. The number inside a marker is the number of datasets available at that location.`,placement:`right`,onEnter:()=>s.setHelpModeMarker(!0),onLeave:()=>s.setHelpModeMarker(!1)}]]),e.isFC&&e.systems&&e.systems.length>0?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1,class:`treeControls`,mapType:`flatmap`,title:`Systems`,treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:s.systemSelected,onCheckAll:s.checkAllSystems,onChangeActive:s.ftuSelected,ref:`treeControls`},null,8,[`treeData`,`active`,`hover`,`onCheckChanged`,`onCheckAll`,`onChangeActive`])):(0,t.createCommentVNode)(``,!0),e.containsAlert&&e.alertOptions&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Notes`,labelKey:`label`,identifierKey:`key`,selections:e.alertOptions,onChanged:s.alertSelected,onCheckboxMouseEnter:s.alertMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllAlerts,ref:`alertSelection`,key:`alertSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.pathways&&e.pathways.length>0?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Pathways`,labelKey:`label`,identifierKey:`type`,colourStyle:`line`,selections:e.pathways,showAsLegend:!i.showPathwayFilter,onChanged:s.pathwaysSelected,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllPathways,ref:`pathwaysSelection`,key:`pathwaysSelection`},null,8,[`selections`,`showAsLegend`,`onChanged`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{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:s.taxonsSelected,onCheckboxMouseEnter:s.taxonMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllTaxons,ref:`taxonSelection`,key:`taxonSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0)],6)),[[O,{id:`flatmap-pathways`,area:`legends`,title:i.showPathwayFilter?`Pathways and legends`:`Legends`,description:i.showPathwayFilter?`Show or hide pathways, systems and other map layers using the checkboxes in this panel.`:`The legends explain the symbols and colors used on this map.`,placement:`right`,onEnter:s.openHelpModeDrawer,onLeave:s.restoreHelpModeDrawer}]]),(0,t.createElementVNode)(`div`,{onClick:r[4]||=(...e)=>s.toggleDrawer&&s.toggleDrawer(...e),class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(y)]),_:1})],2)],2),[[t.vShow,!i.disableUI&&s.requiresDrawer]]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,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:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(x,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(b,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,null,[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[15]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,p_,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,m_,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>s.changeViewingMode(r)},(0,t.toDisplayString)(r),9,h_))],64))),128))]),(0,t.createVNode)(x,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...r[16]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1}),e.viewingMode===`Annotation`&&e.authorisedUser?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[17]||=[(0,t.createTextVNode)(`Annotations From`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":r[5]||=t=>e.annotationFrom=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap_dropdown`,onChange:s.setAnnotationFrom},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.annotatedSource,e=>((0,t.openBlock)(),(0,t.createBlock)(C,{key:e,label:e,value:e},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(x,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{span:12},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1})],64)):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1,class:`backgroundSpacer`})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:2,class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[18]||=[(0,t.createTextVNode)(`Flight path display`,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:3,class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":r[6]||=t=>e.flightPath3DRadio=t,class:`flatmap-radio`,onChange:s.setFlightPath3D},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[19]||=[(0,t.createTextVNode)(`2D`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[20]||=[(0,t.createTextVNode)(`3D`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[21]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.colourRadio,"onUpdate:modelValue":r[7]||=t=>e.colourRadio=t,class:`flatmap-radio`,onChange:s.setColour},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[22]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[23]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[24]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.outlinesRadio,"onUpdate:modelValue":r[8]||=t=>e.outlinesRadio=t,class:`flatmap-radio`,onChange:s.setOutlines},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[25]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[26]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[27]||=[(0,t.createTextVNode)(`Change background`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>s.backgroundChangeCallback(n)},null,10,g_))),128))]),_:1})])]),_:1},8,[`virtual-ref`]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group`,{open:e.drawerOpen,close:!e.drawerOpen}])},[i.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{trigger:`hover`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,content:`Open new map`,placement:`right`,teleported:!1,"popper-class":`flatmap-popper`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[i.enableOpenMapUI&&i.openMapOptions.length>0?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,__,[(0,t.createVNode)(h,{icon:`openMap`,class:`icon-button open-map-button`})])),[[O,{id:`flatmap-open-map`,area:`map-settings`,title:`Open new map`,description:`Open another map viewer, such as a different species or a connectivity map.`,placement:`right`}]]):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`show-after`,`hide-after`])]),_:1})):(0,t.createCommentVNode)(``,!0),i.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{content:`Change settings`,placement:`right`,"show-after":e.tooltipDelay,"hide-after":e.tooltipDelay,teleported:!1,trigger:`hover`,"popper-class":`flatmap-popper`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,v_,[(0,t.createVNode)(h,{icon:`changeBckgd`,class:`icon-button`})])),[[O,{id:`flatmap-settings`,area:`map-settings`,title:`Settings`,description:`Change the map settings, such as the background colour and the viewing mode.`,placement:`right`}]])]),_:1},8,[`show-after`,`hide-after`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2),[[t.vShow,!i.disableUI]]),e.tooltipDisplay?((0,t.openBlock)(),(0,t.createBlock)(D,{key:3,ref:`tooltip`,class:`tooltip`,annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode===`Annotation`,onAnnotation:s.commitAnnotationEvent,onOnActionClick:s.onActionClick},null,8,[`annotationEntry`,`tooltipEntry`,`annotationDisplay`,`onAnnotation`,`onOnActionClick`])):(0,t.createCommentVNode)(``,!0)])])),[[k,e.loading]])}var b_=Fh($g,[[`render`,y_],[`__scopeId`,`data-v-f52dd5ae`]]),x_={"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`},S_={name:`MultiFlatmapVuer`,components:{FlatmapVuer:b_},directives:{helpMode:r.helpModeDirective},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),Jg.on(`onActionClick`,e=>{this.resourceSelected(e)}),Jg.on(`open-pubmed-url`,e=>{this.$emit(`open-pubmed-url`,e)})},methods:{initialise:function(){return this.multiflatmapError=null,new Promise(e=>{if(this.requireInitialisation){this.requireInitialisation=!1;let t=new AbortController,n=t.signal,r=setTimeout(()=>t.abort(),5e3);fetch(this.flatmapAPI,{signal:n}).then(t=>{if(!t.ok){if(t.status===404)return this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
33
33
|
flatmap API endpoint is incorrect. Please check the endpoint URL
|
|
34
34
|
or contact support if the problem persists.`],this.initialised=!0,e(),this.resolveList.forEach(e=>e()),Promise.reject({handled:!0});throw Error(`HTTP ${t.status}: ${t.statusText}`)}return t.json()}).then(t=>{if(t&&t.status_code===404){console.error(`Flatmap API endpoint is incorrect`,t),this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
35
35
|
flatmap API endpoint is incorrect. Please check the endpoint URL
|
|
36
36
|
or contact support if the problem persists.`],this.initialised=!0,e(),this.resolveList.forEach(e=>e());return}Object.keys(this.availableSpecies).forEach(e=>{let n=this.availableSpecies[e].uuid;if(n&&t.length&&t.map(e=>e.uuid).indexOf(n)>0)this.speciesList[e]=this.availableSpecies[e];else for(let n=0;n<t.length;n++)if(this.availableSpecies[e].taxo===t[n].taxon){if(this.availableSpecies[e].biologicalSex){if(t[n].biologicalSex&&t[n].biologicalSex===this.availableSpecies[e].biologicalSex){this.speciesList[e]=this.availableSpecies[e];break}}else{this.speciesList[e]=this.availableSpecies[e];break}}});let n=this.initial;if(this.state){let e=this.state.state;n=(!e||!e.uuid&&!e.entry)&&this.state.species?this.state.species:void 0}n&&(this.activeSpecies=n&&this.speciesList[n]!==void 0?n:Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(e=>{e()})}).catch(t=>{t&&t.handled||(console.error(`Error fetching flatmap:`,t),this.initialised=!0,this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded due to an unexpected error.
|
|
37
|
-
Please try again later or contact support if the problem persists.`],e(),this.resolveList.forEach(e=>{e()}))}).finally(()=>{clearTimeout(r)})}else this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new Ig.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef)))},resourceSelected:function(e){this.$emit(`resource-selected`,e)},onContextRestored:function(e){this.$emit(`context-restored`,e)},FlatmapReady:function(e){this.$emit(`ready`,e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},getHelpModeSteps:function(){return(0,r.collectHelpModeSteps)(this.$el)},openSpeciesInNewView:function(e){this.$refs.speciesSelect?.blur(),this.$emit(`open-map-species`,e)},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)},onNeuronConnectionFeatureClick:function(e){this.$emit(`neuron-connection-feature-click`,e)},onSelectionsDataChanged:function(e){this.$emit(`pathway-selection-changed`,e)},showPopup:function(e,t,n){this.getCurrentFlatmap().showPopup(e,t,n)},showMarkerPopup:function(e,t,n){this.getCurrentFlatmap().showMarkerPopup(e,t,n)},setSpecies:function(e,t,n){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit(`flatmapChanged`,this.activeSpecies);else if(n){let r=n-1;r>=0&&this.$nextTick(()=>{this.setSpecies(e,t,r)})}},viewLatestMap:function(e){let t=Object.keys(this.speciesList);for(let n=0;n<t.length;n++){let r=this.speciesList[t[n]];if(!r.isLegacy&&r.taxo===e.entry&&r.biologicalSex===e.biologicalSex){this.setSpecies(t[n],e,0);return}}},createLegacyEntry:function(e,t,n){if(n&&t){let r=`Legacy`;return e.species&&(e.species.slice(0,6)===`Legacy`?r=e.species:r+=` ${e.species}`),this.speciesList[r]={taxo:t,isLegacy:!0,displayWarning:!0},{species:r,state:{entry:t,uuid:n,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){let n=e.state;if(!n.uuid){if(n.entry){let r=n.entry in x_?x_[n.entry]:void 0;t(this.createLegacyEntry(e,n.entry,r)||e)}}else if(n.entry)return new Promise(()=>{let r={taxon:n.entry};n.biologicalSex&&(r.biologicalSex=n.biologicalSex),this.mapManagerRef.findMap(r).then(t=>{if(t.uuid!==n.uuid)return this.createLegacyEntry(e,n.entry,n.uuid)}).then(n=>{t(n||e)}).catch(()=>{t(e)})})}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0};return e.state=this.getCurrentFlatmap().getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(e=>{this.initialise().then(()=>{e.species&&e.species!==this.activeSpecies?this.setSpecies(e.species,e.state,5):e.state&&this.getCurrentFlatmap().setState(e.state)})}))},changeViewingMode:function(e){let t=this.getCurrentFlatmap();t&&t.changeViewingMode(e)},setConnectionType:function(e){this.getCurrentFlatmap().setConnectionType(e)}},props:{initial:{type:String,default:``},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},render:{type:Boolean,default:!0},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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:(0,t.markRaw)([]),initialised:!1,mapManagerRef:void 0,multiflatmapError:null}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},activeSpecies:{handler:function(e,t){t&&this.$refs[t][0].forceContextLoss()}}}},C_={class:`multi-container`,ref:`multiContainer`},w_={key:0,style:{position:`absolute`,"z-index":`100`}},T_={class:`option-label`},E_={class:`option-title`},D_={class:`select-box-icon`},O_={key:1,class:`option-title active-species`},k_={class:`select-box-icon`},A_=[`aria-label`,`onClick`];function j_(e,n,r,i,a,o){let s=Hf,c=Om,l=Dm,u=b_,d=lg,f=(0,t.resolveDirective)(`help-mode`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,C_,[r.disableUI?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,w_,[n[3]||=(0,t.createElementVNode)(`div`,{class:`species-display-text`},`Species`,-1),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(l,{id:`flatmap-select`,ref:`speciesSelect`,teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":n[0]||=t=>e.activeSpecies=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap-dropdown`,onChange:o.setSpecies},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(i,a)=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:a,label:a,value:a},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,T_,[e.activeSpecies===a?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,O_,[(0,t.createElementVNode)(`span`,k_,[(0,t.createElementVNode)(`i`,{class:(0,t.normalizeClass)(i.iconClass)},null,2)]),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(a),1)])):((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,content:`Change species to ${a}`,placement:`top`,effect:`light`,"show-after":200,"popper-class":`flatmap-species-option-tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,E_,[(0,t.createElementVNode)(`span`,D_,[(0,t.createElementVNode)(`i`,{class:(0,t.normalizeClass)(i.iconClass)},null,2)]),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(a),1)])]),_:2},1032,[`content`])),r.enableOpenMapUI?((0,t.openBlock)(),(0,t.createBlock)(s,{key:2,content:`Open ${a} in a new view`,placement:`top`,effect:`light`,"show-after":200,"popper-class":`flatmap-open-new-view-tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`open-new-view-button`,"aria-label":`Open ${a} in a new view`,onClick:(0,t.withModifiers)(e=>o.openSpeciesInNewView(a),[`stop`])},[...n[2]||=[(0,t.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[(0,t.createElementVNode)(`rect`,{x:`8`,y:`8`,width:`13`,height:`13`,rx:`2`}),(0,t.createElementVNode)(`path`,{d:`M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3`}),(0,t.createElementVNode)(`path`,{d:`M14.5 11.5v6M11.5 14.5h6`})],-1)]],8,A_)]),_:2},1032,[`content`])):(0,t.createCommentVNode)(``,!0)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])),[[f,{id:`multiflatmap-species-select`,area:`map-info`,title:`Select a species`,description:`Switch between the maps of the available species.`,placement:`right`}]])])),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(i,a)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(u,{key:a,entry:i.taxo,uuid:i.uuid,biologicalSex:i.biologicalSex,displayWarning:i.displayWarning,displayLatestChanges:i.displayLatestChanges,isLegacy:i.isLegacy,ref_for:!0,ref:a,enableOpenMapUI:r.enableOpenMapUI,openMapOptions:r.openMapOptions,disableUI:r.disableUI,onContextRestored:o.onContextRestored,onViewLatestMap:o.viewLatestMap,onResourceSelected:o.resourceSelected,onReady:o.FlatmapReady,onPanZoomCallback:o.panZoomCallback,annotationSidebar:r.annotationSidebar,onAnnotationOpen:o.onAnnotationOpen,onAnnotationClose:o.onAnnotationClose,onUpdateOfflineAnnotationEnabled:o.updateOfflineAnnotationEnabled,connectivityInfoSidebar:r.connectivityInfoSidebar,onConnectivityInfoOpen:o.onConnectivityInfoOpen,onConnectivityInfoClose:o.onConnectivityInfoClose,onConnectivityError:o.onConnectivityError,onNeuronConnectionFeatureClick:o.onNeuronConnectionFeatureClick,onOpenMap:n[1]||=t=>e.$emit(`open-map`,t),onPathwaySelectionChanged:o.onSelectionsDataChanged,minZoom:r.minZoom,renderAtMounted:r.renderAtMounted,render:r.render&&e.activeSpecies==a,displayMinimap:r.displayMinimap,showStarInLegend:r.showStarInLegend,style:{height:`100%`},mapManager:e.mapManagerRef,flatmapAPI:r.flatmapAPI,sparcAPI:r.sparcAPI,showLocalSettings:r.showLocalSettings,showOpenMapButton:r.showOpenMapButton,showPathwayFilter:r.showPathwayFilter,externalLegends:r.externalLegends,tooltipContentProvider:r.tooltipContentProvider},null,8,`entry.uuid.biologicalSex.displayWarning.displayLatestChanges.isLegacy.enableOpenMapUI.openMapOptions.disableUI.onContextRestored.onViewLatestMap.onResourceSelected.onReady.onPanZoomCallback.annotationSidebar.onAnnotationOpen.onAnnotationClose.onUpdateOfflineAnnotationEnabled.connectivityInfoSidebar.onConnectivityInfoOpen.onConnectivityInfoClose.onConnectivityError.onNeuronConnectionFeatureClick.onPathwaySelectionChanged.minZoom.renderAtMounted.render.displayMinimap.showStarInLegend.mapManager.flatmapAPI.sparcAPI.showLocalSettings.showOpenMapButton.showPathwayFilter.externalLegends.tooltipContentProvider`.split(`.`))),[[t.vShow,e.activeSpecies==a]])),128)),e.multiflatmapError?((0,t.openBlock)(),(0,t.createBlock)(d,{key:1,flatmapError:e.multiflatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0)],512)}var M_=Fh(S_,[[`render`,j_],[`__scopeId`,`data-v-7bcc9c0b`]]);e.FlatmapVuer=b_,e.MultiFlatmapVuer=M_});
|
|
37
|
+
Please try again later or contact support if the problem persists.`],e(),this.resolveList.forEach(e=>{e()}))}).finally(()=>{clearTimeout(r)})}else this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new Ig.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef)))},resourceSelected:function(e){this.$emit(`resource-selected`,e)},onContextRestored:function(e){this.$emit(`context-restored`,e)},FlatmapReady:function(e){this.$emit(`ready`,e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},getHelpModeSteps:function(){return(0,r.collectHelpModeSteps)(this.$el)},openSpeciesInNewView:function(e){this.$refs.speciesSelect?.blur(),this.$emit(`open-map-species`,e)},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)},onNeuronConnectionFeatureClick:function(e){this.$emit(`neuron-connection-feature-click`,e)},onSelectionsDataChanged:function(e){this.$emit(`pathway-selection-changed`,e)},showPopup:function(e,t,n){this.getCurrentFlatmap().showPopup(e,t,n)},showMarkerPopup:function(e,t,n){this.getCurrentFlatmap().showMarkerPopup(e,t,n)},setSpecies:function(e,t,n){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit(`flatmapChanged`,this.activeSpecies);else if(n){let r=n-1;r>=0&&this.$nextTick(()=>{this.setSpecies(e,t,r)})}},viewLatestMap:function(e){let t=Object.keys(this.speciesList);for(let n=0;n<t.length;n++){let r=this.speciesList[t[n]];if(!r.isLegacy&&r.taxo===e.entry&&r.biologicalSex===e.biologicalSex){this.setSpecies(t[n],e,0);return}}},createLegacyEntry:function(e,t,n){if(n&&t){let r=`Legacy`;return e.species&&(e.species.slice(0,6)===`Legacy`?r=e.species:r+=` ${e.species}`),this.speciesList[r]={taxo:t,isLegacy:!0,displayWarning:!0},{species:r,state:{entry:t,uuid:n,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){let n=e.state;if(!n.uuid){if(n.entry){let r=n.entry in x_?x_[n.entry]:void 0;t(this.createLegacyEntry(e,n.entry,r)||e)}}else if(n.entry)return new Promise(()=>{let r={taxon:n.entry};n.biologicalSex&&(r.biologicalSex=n.biologicalSex),this.mapManagerRef.findMap(r).then(t=>{if(t.uuid!==n.uuid)return this.createLegacyEntry(e,n.entry,n.uuid)}).then(n=>{t(n||e)}).catch(()=>{t(e)})})}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0};return e.state=this.getCurrentFlatmap().getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(e=>{this.initialise().then(()=>{e.species&&e.species!==this.activeSpecies?this.setSpecies(e.species,e.state,5):e.state&&this.getCurrentFlatmap().setState(e.state)})}))},changeViewingMode:function(e){let t=this.getCurrentFlatmap();t&&t.changeViewingMode(e)},setConnectionType:function(e){this.getCurrentFlatmap().setConnectionType(e)}},props:{initial:{type:String,default:``},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},render:{type:Boolean,default:!0},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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:(0,t.markRaw)([]),initialised:!1,mapManagerRef:void 0,multiflatmapError:null}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},activeSpecies:{handler:function(e,t){t&&this.$refs[t][0].forceContextLoss()}}}},C_={class:`multi-container`,ref:`multiContainer`},w_={key:0,style:{position:`absolute`,"z-index":`100`}},T_={class:`option-label`},E_={class:`option-title`},D_={class:`select-box-icon`},O_={key:1,class:`option-title active-species`},k_={class:`select-box-icon`},A_=[`aria-label`,`onClick`];function j_(e,n,r,i,a,o){let s=Hf,c=Om,l=Dm,u=b_,d=lg,f=(0,t.resolveDirective)(`help-mode`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,C_,[r.disableUI?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,w_,[n[3]||=(0,t.createElementVNode)(`div`,{class:`species-display-text`},`Species`,-1),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(l,{id:`flatmap-select`,ref:`speciesSelect`,teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":n[0]||=t=>e.activeSpecies=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap-dropdown`,onChange:o.setSpecies},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(i,a)=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:a,label:a,value:a},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,T_,[e.activeSpecies===a?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,O_,[(0,t.createElementVNode)(`span`,k_,[(0,t.createElementVNode)(`i`,{class:(0,t.normalizeClass)(i.iconClass)},null,2)]),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(a),1)])):((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,content:`Change species to ${a}`,placement:`top`,effect:`light`,"show-after":200,"popper-class":`flatmap-species-option-tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,E_,[(0,t.createElementVNode)(`span`,D_,[(0,t.createElementVNode)(`i`,{class:(0,t.normalizeClass)(i.iconClass)},null,2)]),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(a),1)])]),_:2},1032,[`content`])),r.enableOpenMapUI?((0,t.openBlock)(),(0,t.createBlock)(s,{key:2,content:`Open ${a} in a new view`,placement:`top`,effect:`light`,"show-after":200,"popper-class":`flatmap-open-new-view-tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`open-new-view-button`,"aria-label":`Open ${a} in a new view`,onClick:(0,t.withModifiers)(e=>o.openSpeciesInNewView(a),[`stop`])},[...n[2]||=[(0,t.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[(0,t.createElementVNode)(`rect`,{x:`8`,y:`8`,width:`13`,height:`13`,rx:`2`}),(0,t.createElementVNode)(`path`,{d:`M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3`}),(0,t.createElementVNode)(`path`,{d:`M14.5 11.5v6M11.5 14.5h6`})],-1)]],8,A_)]),_:2},1032,[`content`])):(0,t.createCommentVNode)(``,!0)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])),[[f,{id:`multiflatmap-species-select`,area:`map-info`,title:`Select a species`,description:`Set the species for this viewer or open the map in new viewer.`,placement:`right`}]])])),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(i,a)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(u,{key:a,entry:i.taxo,uuid:i.uuid,biologicalSex:i.biologicalSex,displayWarning:i.displayWarning,displayLatestChanges:i.displayLatestChanges,isLegacy:i.isLegacy,ref_for:!0,ref:a,enableOpenMapUI:r.enableOpenMapUI,openMapOptions:r.openMapOptions,disableUI:r.disableUI,onContextRestored:o.onContextRestored,onViewLatestMap:o.viewLatestMap,onResourceSelected:o.resourceSelected,onReady:o.FlatmapReady,onPanZoomCallback:o.panZoomCallback,annotationSidebar:r.annotationSidebar,onAnnotationOpen:o.onAnnotationOpen,onAnnotationClose:o.onAnnotationClose,onUpdateOfflineAnnotationEnabled:o.updateOfflineAnnotationEnabled,connectivityInfoSidebar:r.connectivityInfoSidebar,onConnectivityInfoOpen:o.onConnectivityInfoOpen,onConnectivityInfoClose:o.onConnectivityInfoClose,onConnectivityError:o.onConnectivityError,onNeuronConnectionFeatureClick:o.onNeuronConnectionFeatureClick,onOpenMap:n[1]||=t=>e.$emit(`open-map`,t),onPathwaySelectionChanged:o.onSelectionsDataChanged,minZoom:r.minZoom,renderAtMounted:r.renderAtMounted,render:r.render&&e.activeSpecies==a,displayMinimap:r.displayMinimap,showStarInLegend:r.showStarInLegend,style:{height:`100%`},mapManager:e.mapManagerRef,flatmapAPI:r.flatmapAPI,sparcAPI:r.sparcAPI,showLocalSettings:r.showLocalSettings,showOpenMapButton:r.showOpenMapButton,showPathwayFilter:r.showPathwayFilter,externalLegends:r.externalLegends,tooltipContentProvider:r.tooltipContentProvider},null,8,`entry.uuid.biologicalSex.displayWarning.displayLatestChanges.isLegacy.enableOpenMapUI.openMapOptions.disableUI.onContextRestored.onViewLatestMap.onResourceSelected.onReady.onPanZoomCallback.annotationSidebar.onAnnotationOpen.onAnnotationClose.onUpdateOfflineAnnotationEnabled.connectivityInfoSidebar.onConnectivityInfoOpen.onConnectivityInfoClose.onConnectivityError.onNeuronConnectionFeatureClick.onPathwaySelectionChanged.minZoom.renderAtMounted.render.displayMinimap.showStarInLegend.mapManager.flatmapAPI.sparcAPI.showLocalSettings.showOpenMapButton.showPathwayFilter.externalLegends.tooltipContentProvider`.split(`.`))),[[t.vShow,e.activeSpecies==a]])),128)),e.multiflatmapError?((0,t.openBlock)(),(0,t.createBlock)(d,{key:1,flatmapError:e.multiflatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0)],512)}var M_=Fh(S_,[[`render`,j_],[`__scopeId`,`data-v-69d7dfea`]]);e.FlatmapVuer=b_,e.MultiFlatmapVuer=M_});
|