@abi-software/map-utilities 1.7.3 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35712,20 +35712,21 @@ async function J7(t, e, r, n) {
35712
35712
  g.children = y.sort((m, b) => m.label.localeCompare(b.label)), g.label && g.children.length && a.push(g);
35713
35713
  }
35714
35714
  }
35715
- const o = e.pathways.paths, s = r.reduce((h, v) => {
35716
- const p = v.id;
35717
- if (p) {
35718
- const g = o[p];
35719
- if (g && g.connectivity && g["node-phenotypes"]) {
35720
- const y = g.connectivity, m = g["node-phenotypes"];
35721
- v.connectivity = [...y];
35722
- for (let b in v["node-phenotypes"])
35723
- m[b] && (v["node-phenotypes"][b] = [...m[b]]);
35724
- h.push(JSON.parse(JSON.stringify(v)));
35715
+ const o = e.pathways.paths, s = [];
35716
+ for (const h of s) {
35717
+ const v = h.id;
35718
+ if (v) {
35719
+ const p = o[v];
35720
+ if (p && p.connectivity && p["node-phenotypes"]) {
35721
+ const g = p.connectivity, y = p["node-phenotypes"];
35722
+ h.connectivity = [...g];
35723
+ for (let m in h["node-phenotypes"])
35724
+ y[m] && (h["node-phenotypes"][m] = [...y[m]]);
35725
+ s.push(JSON.parse(JSON.stringify(h)));
35725
35726
  }
35726
35727
  }
35727
- return h;
35728
- }, []), u = e.knowledgeSource, l = await T7(t, u, s), c = await O7(t, u, s), d = await I7(t, u, s), f = (h, v) => {
35728
+ }
35729
+ const u = e.knowledgeSource, l = await T7(t, u, s), c = await O7(t, u, s), d = await I7(t, u, s), f = (h, v) => {
35729
35730
  const p = JSON.stringify(v.key);
35730
35731
  return {
35731
35732
  key: `flatmap.connectivity.source.${h}.${p}`,
@@ -467,4 +467,4 @@ Licensed under The MIT License (http://opensource.org/licenses/MIT)
467
467
  `)}</ul>`,i="<div><strong>References</strong></div>";this.referecesListContent=i+`
468
468
  `+a}this.$emit("references-loaded",{style:e,list:r})},replaceLinkInText:function(t){const e="https://";let r=t.split(e)[1];if(r){r=r.split(" ")[0],r=r.trim(),r.endsWith(".")&&(r=r.substring(0,r.length-1));const n=e+r,a=`<a href="${n}" target="_blank">${n}</a>`;return t.replace(n,a)}return t},searchPMID:async function(t){const e=`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=${t}&format=json`;return await this.fetchData(e)},getCitationTextByDOI:async function(t){const e=`${this.crosscite_host}/format?doi=${t}&style=${this.citationType}&lang=en-US`;return await this.fetchData(e,"text")},getDOIFromPubMedID:async function(t){const e=`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=${t}&format=json`;return await this.fetchData(e)},formatOpenLibReferences:function(){this.openLibReferences.forEach(t=>{const{bookId:e}=t;this.getBookData(e).then(r=>{const{title:n,authors:a,publish_date:i}=r;n&&(t.title=n),i&&(t.date=i),a&&(t.authors=[],a.forEach(o=>{this.getBookAuthor(o.key).then(l=>{const{name:c}=l;c&&(t.authors.push(c),this.updateCopyContents())})})),this.updateCopyContents()})})},getBookData:async function(t){const e=`https://openlibrary.org/books/${t}.json`;return await this.fetchData(e)},getBookAuthor:async function(t){const e=`https://openlibrary.org${t}.json`;return await this.fetchData(e)},formatCopyReference:function(t){const e=[],{title:r,date:n,authors:a,url:i}=t;return r&&e.push(r),n&&e.push(`(${n})`),a&&e.push(`- ${a.join(", ")}`),e.push(`<div><a href="${i}" target="_blank">${i}</a></div>`),e.join(" ")},fetchData:async function(t,e){try{const r=await fetch(t);if(!r.ok)throw new Error(`Response status: ${r.status}`);return e==="text"?await r.text():await r.json()}catch(r){throw new Error(r)}},onCopied:function(t,e){let r="Reference List",n="",a=this.citationType;e?(r=e.resource,n=e.type==="doi"?e.id:""):r=[...this.pubMedReferences,...this.openLibReferences,...this.isbnDBReferences].map(c=>c.type==="doi"?c.id:c.resource).join(", ");const i={event:"interaction_event",event_name:"portal_maps_copy_citation",category:r,doi:n,citation_type:a,location:"map_connectivity_references"};this.$emit("trackEvent",i)}}},va=t=>(s.pushScopeId("data-v-e4259096"),t=t(),s.popScopeId(),t),WH={class:"resource-container"},YH={class:"attribute-title-container"},ZH=va(()=>s.createElementVNode("div",{class:"attribute-title"},"References",-1)),XH={class:"copy-button"},JH={key:0,class:"citation-tabs"},QH={class:"citation-list"},eK=va(()=>s.createElementVNode("span",null,"Internal Server Error",-1)),tK=va(()=>s.createElementVNode("br",null,null,-1)),rK=va(()=>s.createElementVNode("br",null,null,-1)),nK=["href"],aK=va(()=>s.createElementVNode("br",null,null,-1)),iK=va(()=>s.createElementVNode("span",null,"Sorry, something went wrong.",-1)),oK=va(()=>s.createElementVNode("br",null,null,-1)),sK=["onClick"],lK=["innerHTML"],uK=["innerHTML"],cK=["href"];function dK(t,e,r,n,a,i){const o=us,l=Ht,c=E_;return s.openBlock(),s.createElementBlock("div",WH,[s.createElementVNode("div",YH,[ZH,s.createElementVNode("div",XH,[s.createVNode(o,{onCopied:e[0]||(e[0]=u=>i.onCopied(u,"")),label:"Copy list to clipboard",content:t.referecesListContent},null,8,["content"])])]),i.referencesWithDOI?(s.openBlock(),s.createElementBlock("div",JH,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.citationOptions,u=>(s.openBlock(),s.createBlock(l,{link:"",key:u.value,type:t.citationType===u.value?"primary":"",onClick:d=>i.onCitationFormatChange(u.value)},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(u.label),1)]),_:2},1032,["type","onClick"]))),128))])):s.createCommentVNode("",!0),s.createElementVNode("ul",QH,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.pubMedReferences,u=>{var d,f,h,v;return s.openBlock(),s.createElementBlock("li",{key:u.id,class:s.normalizeClass({loading:i.isCitationLoading(u.citation),error:i.isCitationError(u.citation)})},[u.citation?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[((d=u.citation.error)==null?void 0:d.ref)==="doi"&&((f=u.citation.error)==null?void 0:f.type)===t.citationType?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[eK,tK,s.createTextVNode(" Sorry, something went wrong."),rK,s.createTextVNode(" The dataset citation generator ("),s.createElementVNode("a",{href:t.crosscite_host,target:"_blank"},s.toDisplayString(t.crosscite_host),9,nK),s.createTextVNode(") encountered an internal error and was unable to complete your request."),aK,s.createTextVNode(" Please come back later. ")],64)):((h=u.citation.error)==null?void 0:h.ref)==="pubmed"&&((v=u.citation.error)==null?void 0:v.type)===t.citationType?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[iK,oK,s.createTextVNode(" Please try again. "),s.createElementVNode("span",{class:"reload-button",onClick:p=>i.reloadCitation(u)},"Reload",8,sK)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createElementVNode("span",{innerHTML:u.citation[t.citationType]},null,8,lK),s.createVNode(c,{resource:u.resource,onShowRelatedConnectivities:i.showRelatedConnectivities},null,8,["resource","onShowRelatedConnectivities"]),s.createVNode(o,{onCopied:p=>i.onCopied(p,u),content:u.citation[t.citationType]},null,8,["onCopied","content"])],64))],64)):s.createCommentVNode("",!0)],2)}),128)),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.openLibReferences,u=>(s.openBlock(),s.createElementBlock("li",{key:u.id},[s.createElementVNode("div",{innerHTML:i.formatCopyReference(u)},null,8,uK),s.createVNode(c,{resource:u.resource,onShowRelatedConnectivities:i.showRelatedConnectivities},null,8,["resource","onShowRelatedConnectivities"]),s.createVNode(o,{onCopied:d=>i.onCopied(d,u),content:i.formatCopyReference(u)},null,8,["onCopied","content"])]))),128)),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.isbnDBReferences,u=>(s.openBlock(),s.createElementBlock("li",{key:u.id},[s.createElementVNode("a",{href:u.url,target:"_blank"},s.toDisplayString(u.url),9,cK),s.createVNode(c,{resource:u.resource,onShowRelatedConnectivities:i.showRelatedConnectivities},null,8,["resource","onShowRelatedConnectivities"]),s.createVNode(o,{onCopied:d=>i.onCopied(d,u),content:u.url},null,8,["onCopied","content"])]))),128))])])}const bg=Yt(jH,[["render",dK],["__scopeId","data-v-e4259096"]]);function fK(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(a){a(r)}),(n=t.get("*"))&&n.slice().map(function(a){a(e,r)})}}}const x_=new fK,hK={name:"ProvenancePopup",components:{ElIconArrowUp:Ne.ArrowUp,ElIconArrowDown:Ne.ArrowDown,ElIconWarning:Ne.Warning,ConnectivityList:hg,ExternalResourceCard:bg},props:{tooltipEntry:{type:Array,default:[]}},data:function(){return{loading:!1,showDetails:!1,originDescriptions:{motor:"is the location of the initial cell body of the circuit",sensory:"is the location of the initial cell body in the PNS circuit"},entryIndex:0,availableAnatomyFacets:[],connectivityError:{}}},computed:{entry:function(){return this.tooltipEntry[this.entryIndex]},previousLabel:function(){var t;return this.entryIndex===0?"This is the first item. Click 'Next' to see more information.":(t=this.tooltipEntry[this.entryIndex-1])==null?void 0:t.title},nextLabel:function(){var t;return this.entryIndex===this.tooltipEntry.length-1?"This is the last item. Click 'Previous' to see more information.":(t=this.tooltipEntry[this.entryIndex+1])==null?void 0:t.title},provSpeciesDescription:function(){let t="Studied in";return this.entry.provenanceTaxonomyLabel.forEach(e=>{t+=` ${e},`}),t=t.slice(0,-1),t+=" species",t},origins:function(){return this.entry.origins},components:function(){return this.entry.components},destinations:function(){return this.entry.destinations},originsWithDatasets:function(){return this.entry.originsWithDatasets},componentsWithDatasets:function(){return this.entry.componentsWithDatasets},destinationsWithDatasets:function(){return this.entry.destinationsWithDatasets},resources:function(){return this.entry.hyperlinks||[]}},watch:{tooltipEntry:{deep:!0,immediate:!0,handler:function(t,e){t!==e&&(this.entryIndex=0)}}},mounted:function(){this.loadAvailableAnatomyFacets()},methods:{previous:function(){this.entryIndex!==0&&(this.entryIndex=this.entryIndex-1)},next:function(){this.entryIndex!==this.tooltipEntry.length-1&&(this.entryIndex=this.entryIndex+1)},titleCase:function(t){return V9(t)},capitalise:function(t){return $S(t)},onConnectivityActionClick:function(t){x_.emit("onActionClick",t)},loadAvailableAnatomyFacets:function(){const t=localStorage.getItem("available-anatomy-facets");t&&(this.availableAnatomyFacets=JSON.parse(t))}}},pK=t=>(s.pushScopeId("data-v-dc8d1ad3"),t=t(),s.popScopeId(),t),vK={key:0,class:"main"},gK={key:0,class:"toggle-button"},mK={key:1,class:"block"},yK={class:"title"},bK={key:0,class:"subtitle"},wK={key:2,class:"block"},CK={class:"title"},EK={key:3,class:"attribute-title-container"},xK=pK(()=>s.createElementVNode("span",{class:"attribute-title"},"Alert",-1)),kK={style:{"word-break":"keep-all"}},SK={class:"content-container scrollbar"};function _K(t,e,r,n,a,i){const o=Ht,l=Oa,c=Ne.Warning,u=ut,d=Ne.ArrowUp,f=Ne.ArrowDown,h=hg,v=bg,p=Bu;return i.entry?s.withDirectives((s.openBlock(),s.createElementBlock("div",vK,[r.tooltipEntry.length>1?(s.openBlock(),s.createElementBlock("div",gK,[s.createVNode(l,{width:"auto",trigger:"hover",teleported:!1},{reference:s.withCtx(()=>[s.createVNode(o,{class:"button",onClick:i.previous,disabled:this.entryIndex===0},{default:s.withCtx(()=>[s.createTextVNode(" Previous ")]),_:1},8,["onClick","disabled"])]),default:s.withCtx(()=>[s.createElementVNode("span",null,s.toDisplayString(i.previousLabel),1)]),_:1}),s.createVNode(l,{width:"auto",trigger:"hover",teleported:!1},{reference:s.withCtx(()=>[s.createVNode(o,{class:"button",onClick:i.next,disabled:this.entryIndex===this.tooltipEntry.length-1},{default:s.withCtx(()=>[s.createTextVNode(" Next ")]),_:1},8,["onClick","disabled"])]),default:s.withCtx(()=>[s.createElementVNode("span",null,s.toDisplayString(i.nextLabel),1)]),_:1})])):s.createCommentVNode("",!0),i.entry.title?(s.openBlock(),s.createElementBlock("div",mK,[s.createElementVNode("div",yK,s.toDisplayString(i.capitalise(i.entry.title)),1),i.entry.provenanceTaxonomyLabel&&i.entry.provenanceTaxonomyLabel.length>0?(s.openBlock(),s.createElementBlock("div",bK,s.toDisplayString(i.provSpeciesDescription),1)):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",wK,[s.createElementVNode("div",CK,s.toDisplayString(i.entry.featureId),1)])),i.entry.featuresAlert?(s.openBlock(),s.createElementBlock("div",EK,[xK,s.createVNode(l,{width:"250",trigger:"hover",teleported:!1,"popper-class":"popover-origin-help"},{reference:s.withCtx(()=>[s.createVNode(u,{class:"info"},{default:s.withCtx(()=>[s.createVNode(c)]),_:1})]),default:s.withCtx(()=>[s.createElementVNode("span",kK,s.toDisplayString(i.entry.featuresAlert),1)]),_:1})])):s.createCommentVNode("",!0),s.withDirectives(s.createElementVNode("div",{class:"hide",id:"hide-path-info",onClick:e[0]||(e[0]=g=>t.showDetails=!1)},[s.createTextVNode(" Hide path information "),s.createVNode(u,null,{default:s.withCtx(()=>[s.createVNode(d)]),_:1})],512),[[s.vShow,t.showDetails]]),s.withDirectives(s.createElementVNode("div",{class:"hide",id:"show-path-info",onClick:e[1]||(e[1]=g=>t.showDetails=!0)},[s.createTextVNode(" Show path information "),s.createVNode(u,null,{default:s.withCtx(()=>[s.createVNode(f)]),_:1})],512),[[s.vShow,!t.showDetails]]),s.createVNode(s.Transition,{name:"slide-fade"},{default:s.withCtx(()=>[s.withDirectives(s.createElementVNode("div",SK,[(s.openBlock(),s.createBlock(h,{key:i.entry.featureId[0],entry:i.entry,origins:i.origins,components:i.components,destinations:i.destinations,originsWithDatasets:i.originsWithDatasets,componentsWithDatasets:i.componentsWithDatasets,destinationsWithDatasets:i.destinationsWithDatasets,availableAnatomyFacets:t.availableAnatomyFacets,connectivityError:t.connectivityError,onConnectivityActionClick:i.onConnectivityActionClick},null,8,["entry","origins","components","destinations","originsWithDatasets","componentsWithDatasets","destinationsWithDatasets","availableAnatomyFacets","connectivityError","onConnectivityActionClick"])),i.resources.length?(s.openBlock(),s.createBlock(v,{key:0,resources:i.resources},null,8,["resources"])):s.createCommentVNode("",!0)],512),[[s.vShow,t.showDetails]])]),_:1})])),[[p,t.loading]]):s.createCommentVNode("",!0)}const TK=Yt(hK,[["render",_K],["__scopeId","data-v-dc8d1ad3"]]),NK={name:"Tooltip",props:{tooltipEntry:{type:Array},annotationDisplay:{type:Boolean,default:!1},annotationEntry:{type:Array}},mounted:function(){x_.on("onActionClick",t=>{this.$emit("onActionClick",t)})}},IK={class:"tooltip-container",id:"tooltip-container"};function BK(t,e,r,n,a,i){const o=g0,l=TK;return s.openBlock(),s.createElementBlock("div",IK,[r.annotationDisplay?(s.openBlock(),s.createBlock(o,{key:0,annotationEntry:r.annotationEntry,onAnnotation:e[0]||(e[0]=c=>t.$emit("annotation",c))},null,8,["annotationEntry"])):(s.openBlock(),s.createBlock(l,{key:1,tooltipEntry:r.tooltipEntry},null,8,["tooltipEntry"]))])}const DK=Yt(NK,[["render",BK],["__scopeId","data-v-d1e37cc2"]]),OK={name:"TreeControls",props:{mapType:{type:String,required:!0},isReady:{type:Boolean,default:!0},title:{type:String},treeData:{type:Array,default:function(){return[]}},showColourPicker:{type:Boolean,default:!1},active:{type:[String,Array],required:!0},hover:{type:[String,Array],required:!0},enableFilter:{type:Boolean,default:!0}},data:function(){return{defaultExpandedKeys:["All"],filterText:"",tooltipVisible:!1,tooltipLabel:"",tooltipAtBottom:!1}},computed:{isFlatmap:function(){return this.mapType==="flatmap"},isScaffold:function(){return this.mapType==="scaffold"},nodeKey:function(){if(this.isFlatmap)return"key";if(this.isScaffold)return"id"},expandedKeys:function(){if(this.isFlatmap)return this.defaultExpandedKeys;if(this.isScaffold)return[]}},watch:{filterText:{handler:function(t){this.$refs.regionTree&&this.$refs.regionTree.filter(t)}}},methods:{filterNode:function(t,e){return t?e.label?e.label.toLowerCase().includes(t.toLowerCase()):!1:!0},setColour:function(t,e){this.$emit("setColour",t,e)},getBackgroundStyles:function(t){return"colour"in t?{background:t.colour}:{}},nodeIsActive:function(t){return this.active===t.models},nodeIsHover:function(t){return this.hover===t.models},changeActiveByNode:function(t,e=!1){this.isFlatmap?t.models&&this.$emit("changeActive",t.models):this.isScaffold&&(t.isPrimitives||t.isRegion)&&this.$emit("changeActive",t,e)},changeHoverByNode:function(t,e=!1){this.isFlatmap?t.models&&this.$emit("changeHover",t.models):this.isScaffold&&t.isPrimitives&&this.$emit("changeHover",t,e)},checkChanged:function(t,e){if(this.isFlatmap){const r=e.checkedKeys.includes(t.key);t.key==="All"?this.$emit("checkAll",r):this.$emit("checkChanged",{key:t.key,value:r})}else this.isScaffold&&this.$emit("checkChanged",t,e)},displayTooltip:function(t,e,r){const a=r.target.closest(".el-tree-node__content"),i=a.clientWidth,o=a.getBoundingClientRect().x,l=a.querySelector(".lastChildInItem");let c=0;if(l){const d=l.getBoundingClientRect();c=d.x+d.width-o}const u=c>i;this.tooltipVisible=u&&e,this.tooltipLabel=t,this.tooltipAtBottom=.5>r.layerY/this.$refs.treeContainer.clientHeight}},unmounted:function(){this.sortedPrimitiveGroups=void 0},mounted:function(){this.$refs.regionTree&&this.$refs.regionTree.filter(this.filterText)}},PK={class:"selections-container"},AK={class:"title-text"},RK={class:"tree-container",ref:"treeContainer"},LK={class:"tooltip-text"},MK=["onClick","onMouseover","onMouseenter"],FK=["onClick","onMouseover","onMouseenter"],$K={class:"lastChildInItem"},VK={key:0,class:"node-options"};function qK(t,e,r,n,a,i){const o=Ri,l=Di,c=as,u=Oa,d=RR,f=FL,h=Bu;return s.openBlock(),s.createElementBlock("div",PK,[r.title?(s.openBlock(),s.createBlock(c,{key:0},{default:s.withCtx(()=>[s.createVNode(o,{span:12},{default:s.withCtx(()=>[s.createElementVNode("div",AK,s.toDisplayString(r.title),1)]),_:1}),r.enableFilter?(s.openBlock(),s.createBlock(o,{key:0,span:12},{default:s.withCtx(()=>[s.createElementVNode("div",null,[s.createVNode(l,{class:"tree-filter-input",modelValue:t.filterText,"onUpdate:modelValue":e[0]||(e[0]=v=>t.filterText=v),placeholder:"Filter "+r.title},null,8,["modelValue","placeholder"])])]),_:1})):s.createCommentVNode("",!0)]),_:1})):s.createCommentVNode("",!0),s.createElementVNode("div",RK,[s.createElementVNode("div",{class:s.normalizeClass(["tree-tooltip",t.tooltipAtBottom?"bottom":""])},[s.createVNode(u,{ref:"tooltip",visible:t.tooltipVisible&&t.tooltipLabel!=="",placement:"top","show-arrow":!1,teleported:!1,trigger:"manual","popper-class":"tree-tooltip-popper","virtual-triggering":"",width:260},{default:s.withCtx(()=>[s.createElementVNode("div",LK,s.toDisplayString(t.tooltipLabel),1)]),_:1},8,["visible"])],2),s.withDirectives((s.openBlock(),s.createBlock(f,{ref:"regionTree","element-loading-background":"rgba(0, 0, 0, 0.3)","show-checkbox":"","node-key":i.nodeKey,data:r.treeData,"check-strictly":!1,"expand-on-click-node":!1,"render-after-expand":!1,"default-expanded-keys":i.expandedKeys,onCheck:i.checkChanged,indent:8,"filter-node-method":i.filterNode,class:s.normalizeClass([r.mapType==="flatmap"?"hide_grandchildren_checkbox":""])},{default:s.withCtx(({node:v,data:p})=>[r.mapType==="flatmap"?(s.openBlock(),s.createElementBlock("span",{key:0,class:s.normalizeClass(["region-tree-node",{activeItem:i.nodeIsActive(p),hoverItem:i.nodeIsHover(p)}]),onClick:g=>i.changeActiveByNode(p),onMouseover:g=>i.changeHoverByNode(p,!1),onMouseenter:g=>i.displayTooltip(v.label,!0,g),onMouseleave:e[1]||(e[1]=g=>i.displayTooltip("",!1,g))},[s.createElementVNode("div",{style:s.normalizeStyle(i.getBackgroundStyles(p)),class:"lastChildInItem"},s.toDisplayString(v.label),5)],42,MK)):r.mapType==="scaffold"?(s.openBlock(),s.createElementBlock("span",{key:1,class:s.normalizeClass(["region-tree-node",{activeItem:r.active.includes(p.id),hoverItem:r.hover.includes(p.id)}]),onClick:g=>i.changeActiveByNode(p,!0),onMouseover:g=>i.changeHoverByNode(p,!0,g),onMouseenter:g=>i.displayTooltip(v.label,!0,g),onMouseleave:e[2]||(e[2]=g=>i.displayTooltip("",!1,g))},[p.isPrimitives?(s.openBlock(),s.createBlock(d,{key:0,class:s.normalizeClass({"show-picker":r.showColourPicker}),modelValue:p.activeColour,"onUpdate:modelValue":g=>p.activeColour=g,size:"small",onChange:g=>i.setColour(p,g)},null,8,["class","modelValue","onUpdate:modelValue","onChange"])):s.createCommentVNode("",!0),s.createElementVNode("div",$K,[s.createElementVNode("span",null,s.toDisplayString(v.label),1),p.isTextureSlides?(s.openBlock(),s.createElementBlock("span",VK," (Texture) ")):s.createCommentVNode("",!0)])],42,FK)):s.createCommentVNode("",!0)]),_:1},8,["node-key","data","default-expanded-keys","onCheck","filter-node-method","class"])),[[h,!r.isReady]])],512)])}const zK=Yt(OK,[["render",qK],["__scopeId","data-v-e1dbd1e9"]]);async function HK(t,e){try{const r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`API Error: ${r.status} ${r.statusText}`);return await r.json()}catch(r){throw console.error("Request failed:",r),r}}async function On(t){const{flatmapAPI:e,knowledgeSource:r,queryId:n,parameters:a,orderId:i}=t,o=`${e}competency/query`,l=Array.isArray(a)?[...a]:[];l.push({column:"source_id",value:r});let c;if(typeof n=="number")c=n.toString();else if(typeof n=="string")c=n;else throw new TypeError("queryId must be a string or a number convertible to string.");const u={query_id:c,parameters:l};return i&&(u.order=[i]),HK(o,u)}async function KK(t,e,r){var v,p;const n=Array.isArray(r)?r:[r],a=n[0].startsWith("ilxtr:"),i=a?23:1,o=a?"path_id":"feature_id",l=a?n:[],c=await On({flatmapAPI:t,knowledgeSource:e,queryId:i,parameters:[{column:o,value:n}]}),u=((p=(v=c==null?void 0:c.results)==null?void 0:v.values)==null?void 0:p.map(g=>g[1]))||[],d=[...new Set([...l,...u])];let f=[];return d.length&&(f=await Cg(t,e,d)),[...new Set([...d,...f])]}async function GK(t,e,r){var a;const n=await On({flatmapAPI:t,knowledgeSource:e,queryId:1,parameters:[{column:"feature_id",value:r}]});if((a=n==null?void 0:n.results)!=null&&a.values){const i=n.results.values.map(o=>o[1]);return[...new Set(i)]}return[]}async function UK(t,e,r){var a;const n=await On({flatmapAPI:t,knowledgeSource:e,queryId:1,parameters:[{column:"feature_id",value:r}]});if((a=n==null?void 0:n.results)!=null&&a.values){const i=n.results.values.map(o=>o[1]);return[...new Set(i)]}return[]}async function jK(t,e,r){var a;const n=await On({flatmapAPI:t,knowledgeSource:e,queryId:2,parameters:[{column:"feature_id",value:r}]});if((a=n==null?void 0:n.results)!=null&&a.values){const i=n.results.values.map(o=>o[1]);return[...new Set(i)]}return[]}function wg(t){const e=[];for(const r of t){const n=JSON.parse(r);Array.isArray(n)&&n.length>=2&&Array.isArray(n[1])&&n[1].length===0&&e.push(n[0])}return e}async function Cg(t,e,r){var a;const n=await On({flatmapAPI:t,knowledgeSource:e,queryId:26,parameters:[{column:"path_id",value:r}]});if((a=n==null?void 0:n.results)!=null&&a.values){const i=n.results.values.map(o=>o[2]);return[...new Set(i)]}return[]}async function WK({flatmapAPI:t,knowledgeSource:e,origins:r,destinations:n,vias:a}){var w,C,x,k;const i=wg(r),o=wg(n),l=wg(a),c=[{column:"source_feature_id",value:i},{column:"via_feature_id",value:l},{column:"dest_feature_id",value:o}],u=[{column:"source_node_id",value:r},{column:"via_node_id",value:a},{column:"dest_node_id",value:n}],d=c.some(E=>Array.isArray(E.value)&&E.value.length>0),f=[On({flatmapAPI:t,knowledgeSource:e,queryId:24,parameters:u})];d&&f.push(On({flatmapAPI:t,knowledgeSource:e,queryId:25,parameters:c}));const h=await Promise.all(f);let v=[],p;if(d){const E=h[0];p=h[1],v=((C=(w=E==null?void 0:E.results)==null?void 0:w.values)==null?void 0:C.map(_=>_[1]))||[]}else p=h[0];const g=((k=(x=p==null?void 0:p.results)==null?void 0:x.values)==null?void 0:k.map(E=>E[1]))||[],m=[...new Set([...v,...g])];let y=[];return m.length&&(y=await Cg(t,e,m)),[...new Set([...m,...y])]}const Eg=[];async function YK(t,e){const r=e.filter(i=>Eg.some(o=>o.taxon===i)),n=Eg.filter(i=>r.includes(i.taxon)),a=e.filter(i=>!r.includes(i));if(a.length){const i=await t.queryLabels(a);if(i.length)return i.forEach(o=>{let{entity:l,label:c}=o;c==="Mammalia"&&(c="Mammalia not otherwise specified");const u={taxon:l,label:c};n.push(u),Eg.push(u)}),n}else return n}async function ZK(t,e,r){const n=`${t}knowledge/query/`,a={sql:e,params:r};try{const i=await fetch(n,{method:"POST",headers:{Accept:"application/json; charset=utf-8","Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Error(`Cannot access ${n}`);return await i.json()}catch{return{values:[]}}}async function k_(t,e){return e.length?await(await ZK(t,`select entity, knowledge from knowledge
469
469
  where entity in (?${", ?".repeat(e.length-1)})
470
- order by source desc`,[...e])).values:[]}function XK(t){var r;const e=(r=t["node-phenotypes"])==null?void 0:r["ilxtr:hasSomaLocatedIn"];return Array.isArray(t.connectivity)&&t.connectivity.length>0&&Array.isArray(e)&&e.length>0}function JK(t){var a,i;const e=(a=t["node-phenotypes"])==null?void 0:a["ilxtr:hasAxonPresynapticElementIn"],r=(i=t["node-phenotypes"])==null?void 0:i["ilxtr:hasAxonSensorySubcellularElementIn"],n=Array.isArray(e)&&e.length>0||Array.isArray(r)&&r.length>0;return Array.isArray(t.connectivity)&&t.connectivity.length>0&&n}function QK(t){var n,a,i;if(!Array.isArray(t.connectivity)||t.connectivity.length===0)return!1;const e=new Set((((n=t["node-phenotypes"])==null?void 0:n["ilxtr:hasSomaLocatedIn"])||[]).map(o=>o[0])),r=new Set([...(((a=t["node-phenotypes"])==null?void 0:a["ilxtr:hasAxonPresynapticElementIn"])||[]).map(o=>o[0]),...(((i=t["node-phenotypes"])==null?void 0:i["ilxtr:hasAxonSensorySubcellularElementIn"])||[]).map(o=>o[0])]);return t.connectivity.some(o=>{const[l,c]=o,u=l[0],d=c[0];return!e.has(u)&&!r.has(d)})}function xg(t){if(!Array.isArray(t.connectivity))return[];const e=new Set;return t.connectivity.forEach(r=>{Array.isArray(r)&&r.length&&r.forEach(n=>{if(Array.isArray(n)&&typeof n[0]=="string"){const a=JSON.stringify(n);e.add(a)}})}),Array.from(e)}function Lr(t,e){var n;const r=(n=t["node-phenotypes"])==null?void 0:n[e];return Array.isArray(r)?r:[]}async function kg(t,e,r){const n=Array.from(new Map(r.map(f=>[JSON.stringify(f),f])).values()),a=n.flat(1/0),i=[...new Set(a)],l=(await k_(t,i)).reduce((f,h)=>{const v=h[0],p=JSON.parse(h[1]);return f.push({id:v,label:p.label,source:p.source}),f},[]);l.sort((f,h)=>f.id===h.id?f.source===e&&h.source!==e?-1:f.source!==e&&h.source===e?1:0:f.id.localeCompare(h.id));const c=[];return[...n.map(f=>{const h=f.flat(),v=[];for(let p=0;p<h.length;p++){const g=l.find(m=>m.id===h[p]);g&&(v.push(g.label),p>0&&c.push({key:[h[p],[]],label:g.label}))}return{key:f,label:v.join(", ")}}),...c].filter((f,h,v)=>h===v.findIndex(p=>p.label===f.label))}async function S_(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));Lr(a,"ilxtr:hasSomaLocatedIn").forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}async function __(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));[...Lr(a,"ilxtr:hasAxonPresynapticElementIn"),...Lr(a,"ilxtr:hasAxonSensorySubcellularElementIn")].forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}async function T_(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));[...Lr(a,"ilxtr:hasAxonLeadingToSensorySubcellularElementIn"),...Lr(a,"ilxtr:hasAxonLocatedIn")].forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}function N_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:Lr(r,"ilxtr:hasSomaLocatedIn").some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}function I_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:[...Lr(r,"ilxtr:hasAxonPresynapticElementIn"),...Lr(r,"ilxtr:hasAxonSensorySubcellularElementIn")].some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}function B_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:[...Lr(r,"ilxtr:hasAxonLeadingToSensorySubcellularElementIn"),...Lr(r,"ilxtr:hasAxonLocatedIn")].some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}async function eG({knowledge:t,origins:e,destinations:r,vias:n}){let a=t;return e.length&&(a=N_(a,e)),r.length&&(a=I_(a,r)),n.length&&(a=B_(a,n)),a}async function tG(t,e,r,n){let a=[];const i=[];if(e){if(e&&typeof e.featureFilterRanges=="function"){const v=e.featureFilterRanges();for(const[p,g]of Object.entries(v)){let m={key:`flatmap.connectivity.${p}`,label:"",children:[]},y=[];if(p==="kind"){m.label="Pathways";for(const b of g){const w=n.find(C=>C.type===b);w&&y.push({key:`${m.key}.${b}`,label:w.label,colour:w.colour,colourStyle:"line",dashed:w.dashed})}}else if(p==="taxons"){m.label="Studied in";const b=await YK(e,e.taxonIdentifiers);if(b.length)for(const w of g){const C=b.find(x=>x.taxon===w);C&&y.push({key:`${m.key}.${w}`,label:`${C.label} `})}}else if(p==="alert"){m.label="Alert";for(const b of["with","without"])y.push({key:`${m.key}.${b}`,label:`${b} alerts`})}m.children=y.sort((b,w)=>b.label.localeCompare(w.label)),m.label&&m.children.length&&a.push(m)}}const o=e.pathways.paths,l=r.reduce((v,p)=>{const g=p.id;if(g){const m=o[g];if(m&&m.connectivity&&m["node-phenotypes"]){const y=m.connectivity,b=m["node-phenotypes"];p.connectivity=[...y];for(let w in p["node-phenotypes"])b[w]&&(p["node-phenotypes"][w]=[...b[w]]);v.push(JSON.parse(JSON.stringify(p)))}}return v},[]),c=e.knowledgeSource,u=await S_(t,c,l),d=await T_(t,c,l),f=await __(t,c,l),h=(v,p)=>{const g=JSON.stringify(p.key);return{key:`flatmap.connectivity.source.${v}.${g}`,label:p.label||g}};for(const v of["origin","via","destination","all"]){let p=[];if(v==="origin")p=u.map(g=>h(v,g));else if(v==="via")p=d.map(g=>h(v,g));else if(v==="destination")p=f.map(g=>h(v,g));else{const g=[...u.map(y=>h(v,y)),...d.map(y=>h(v,y)),...f.map(y=>h(v,y))],m=new Set;p=g.filter(y=>m.has(y.key)?!1:(m.add(y.key),!0))}p=p.sort((g,m)=>{const y=C=>/^[a-zA-Z]/.test(C),b=y(g.label),w=y(m.label);return b&&!w?-1:!b&&w?1:g.label.localeCompare(m.label)}),p.length&&i.push({key:`flatmap.connectivity.source.${v}`,label:v,children:p})}i.length&&a.push(...i)}return a}Te.AnnotationPopup=g0,Te.ConnectivityGraph=$9,Te.ConnectivityList=hg,Te.CopyToClipboard=us,Te.CreateTooltipContent=gM,Te.DrawToolbar=AH,Te.ExternalResourceCard=bg,Te.HelpModeDialog=VH,Te.Tooltip=DK,Te.TreeControls=zK,Te.competencyQuery=On,Te.extractDestinationItems=__,Te.extractOriginItems=S_,Te.extractViaItems=T_,Te.fetchLabels=k_,Te.filterDestinations=JK,Te.filterOrigins=XK,Te.filterViaLocations=QK,Te.findPathsByDestinationItem=I_,Te.findPathsByOriginItem=N_,Te.findPathsByViaItem=B_,Te.getFlatmapFilterOptions=tG,Te.queryAllConnectedPaths=KK,Te.queryForwardBackwardConnections=Cg,Te.queryPathsByDestination=jK,Te.queryPathsByOrigin=GK,Te.queryPathsByRoute=WK,Te.queryPathsByRouteFromKnowledge=eG,Te.queryPathsByViaLocation=UK,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
470
+ order by source desc`,[...e])).values:[]}function XK(t){var r;const e=(r=t["node-phenotypes"])==null?void 0:r["ilxtr:hasSomaLocatedIn"];return Array.isArray(t.connectivity)&&t.connectivity.length>0&&Array.isArray(e)&&e.length>0}function JK(t){var a,i;const e=(a=t["node-phenotypes"])==null?void 0:a["ilxtr:hasAxonPresynapticElementIn"],r=(i=t["node-phenotypes"])==null?void 0:i["ilxtr:hasAxonSensorySubcellularElementIn"],n=Array.isArray(e)&&e.length>0||Array.isArray(r)&&r.length>0;return Array.isArray(t.connectivity)&&t.connectivity.length>0&&n}function QK(t){var n,a,i;if(!Array.isArray(t.connectivity)||t.connectivity.length===0)return!1;const e=new Set((((n=t["node-phenotypes"])==null?void 0:n["ilxtr:hasSomaLocatedIn"])||[]).map(o=>o[0])),r=new Set([...(((a=t["node-phenotypes"])==null?void 0:a["ilxtr:hasAxonPresynapticElementIn"])||[]).map(o=>o[0]),...(((i=t["node-phenotypes"])==null?void 0:i["ilxtr:hasAxonSensorySubcellularElementIn"])||[]).map(o=>o[0])]);return t.connectivity.some(o=>{const[l,c]=o,u=l[0],d=c[0];return!e.has(u)&&!r.has(d)})}function xg(t){if(!Array.isArray(t.connectivity))return[];const e=new Set;return t.connectivity.forEach(r=>{Array.isArray(r)&&r.length&&r.forEach(n=>{if(Array.isArray(n)&&typeof n[0]=="string"){const a=JSON.stringify(n);e.add(a)}})}),Array.from(e)}function Lr(t,e){var n;const r=(n=t["node-phenotypes"])==null?void 0:n[e];return Array.isArray(r)?r:[]}async function kg(t,e,r){const n=Array.from(new Map(r.map(f=>[JSON.stringify(f),f])).values()),a=n.flat(1/0),i=[...new Set(a)],l=(await k_(t,i)).reduce((f,h)=>{const v=h[0],p=JSON.parse(h[1]);return f.push({id:v,label:p.label,source:p.source}),f},[]);l.sort((f,h)=>f.id===h.id?f.source===e&&h.source!==e?-1:f.source!==e&&h.source===e?1:0:f.id.localeCompare(h.id));const c=[];return[...n.map(f=>{const h=f.flat(),v=[];for(let p=0;p<h.length;p++){const g=l.find(m=>m.id===h[p]);g&&(v.push(g.label),p>0&&c.push({key:[h[p],[]],label:g.label}))}return{key:f,label:v.join(", ")}}),...c].filter((f,h,v)=>h===v.findIndex(p=>p.label===f.label))}async function S_(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));Lr(a,"ilxtr:hasSomaLocatedIn").forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}async function __(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));[...Lr(a,"ilxtr:hasAxonPresynapticElementIn"),...Lr(a,"ilxtr:hasAxonSensorySubcellularElementIn")].forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}async function T_(t,e,r){const n=[];return r.forEach(a=>{if(!Array.isArray(a.connectivity)||a.connectivity.length===0)return;const i=new Set(xg(a));[...Lr(a,"ilxtr:hasAxonLeadingToSensorySubcellularElementIn"),...Lr(a,"ilxtr:hasAxonLocatedIn")].forEach(o=>{const l=JSON.stringify(o);i.has(l)&&n.push(o)})}),await kg(t,e,n)}function N_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:Lr(r,"ilxtr:hasSomaLocatedIn").some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}function I_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:[...Lr(r,"ilxtr:hasAxonPresynapticElementIn"),...Lr(r,"ilxtr:hasAxonSensorySubcellularElementIn")].some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}function B_(t,e){return t.filter(r=>!Array.isArray(r.connectivity)||r.connectivity.length===0?!1:[...Lr(r,"ilxtr:hasAxonLeadingToSensorySubcellularElementIn"),...Lr(r,"ilxtr:hasAxonLocatedIn")].some(a=>e.map(i=>JSON.stringify(i)).includes(JSON.stringify(a))))}async function eG({knowledge:t,origins:e,destinations:r,vias:n}){let a=t;return e.length&&(a=N_(a,e)),r.length&&(a=I_(a,r)),n.length&&(a=B_(a,n)),a}async function tG(t,e,r,n){let a=[];const i=[];if(e){if(e&&typeof e.featureFilterRanges=="function"){const v=e.featureFilterRanges();for(const[p,g]of Object.entries(v)){let m={key:`flatmap.connectivity.${p}`,label:"",children:[]},y=[];if(p==="kind"){m.label="Pathways";for(const b of g){const w=n.find(C=>C.type===b);w&&y.push({key:`${m.key}.${b}`,label:w.label,colour:w.colour,colourStyle:"line",dashed:w.dashed})}}else if(p==="taxons"){m.label="Studied in";const b=await YK(e,e.taxonIdentifiers);if(b.length)for(const w of g){const C=b.find(x=>x.taxon===w);C&&y.push({key:`${m.key}.${w}`,label:`${C.label} `})}}else if(p==="alert"){m.label="Alert";for(const b of["with","without"])y.push({key:`${m.key}.${b}`,label:`${b} alerts`})}m.children=y.sort((b,w)=>b.label.localeCompare(w.label)),m.label&&m.children.length&&a.push(m)}}const o=e.pathways.paths,l=[];for(const v of l){const p=v.id;if(p){const g=o[p];if(g&&g.connectivity&&g["node-phenotypes"]){const m=g.connectivity,y=g["node-phenotypes"];v.connectivity=[...m];for(let b in v["node-phenotypes"])y[b]&&(v["node-phenotypes"][b]=[...y[b]]);l.push(JSON.parse(JSON.stringify(v)))}}}const c=e.knowledgeSource,u=await S_(t,c,l),d=await T_(t,c,l),f=await __(t,c,l),h=(v,p)=>{const g=JSON.stringify(p.key);return{key:`flatmap.connectivity.source.${v}.${g}`,label:p.label||g}};for(const v of["origin","via","destination","all"]){let p=[];if(v==="origin")p=u.map(g=>h(v,g));else if(v==="via")p=d.map(g=>h(v,g));else if(v==="destination")p=f.map(g=>h(v,g));else{const g=[...u.map(y=>h(v,y)),...d.map(y=>h(v,y)),...f.map(y=>h(v,y))],m=new Set;p=g.filter(y=>m.has(y.key)?!1:(m.add(y.key),!0))}p=p.sort((g,m)=>{const y=C=>/^[a-zA-Z]/.test(C),b=y(g.label),w=y(m.label);return b&&!w?-1:!b&&w?1:g.label.localeCompare(m.label)}),p.length&&i.push({key:`flatmap.connectivity.source.${v}`,label:v,children:p})}i.length&&a.push(...i)}return a}Te.AnnotationPopup=g0,Te.ConnectivityGraph=$9,Te.ConnectivityList=hg,Te.CopyToClipboard=us,Te.CreateTooltipContent=gM,Te.DrawToolbar=AH,Te.ExternalResourceCard=bg,Te.HelpModeDialog=VH,Te.Tooltip=DK,Te.TreeControls=zK,Te.competencyQuery=On,Te.extractDestinationItems=__,Te.extractOriginItems=S_,Te.extractViaItems=T_,Te.fetchLabels=k_,Te.filterDestinations=JK,Te.filterOrigins=XK,Te.filterViaLocations=QK,Te.findPathsByDestinationItem=I_,Te.findPathsByOriginItem=N_,Te.findPathsByViaItem=B_,Te.getFlatmapFilterOptions=tG,Te.queryAllConnectedPaths=KK,Te.queryForwardBackwardConnections=Cg,Te.queryPathsByDestination=jK,Te.queryPathsByOrigin=GK,Te.queryPathsByRoute=WK,Te.queryPathsByRouteFromKnowledge=eG,Te.queryPathsByViaLocation=UK,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ABI-Software/map-utilities.git"
8
+ },
4
9
  "files": [
5
10
  "dist/*",
6
11
  "src/*",
@@ -315,7 +315,8 @@ async function getFlatmapFilterOptions (flatmapAPI, mapImp, providedKnowledge, p
315
315
  }
316
316
 
317
317
  const mapKnowledge = mapImp.pathways.paths;
318
- const flatmapKnowledge = providedKnowledge.reduce((arr, knowledge) => {
318
+ const flatmapKnowledge = [];
319
+ for (const knowledge of flatmapKnowledge) {
319
320
  const id = knowledge.id;
320
321
  if (id) {
321
322
  const mapKnowledgeObj = mapKnowledge[id];
@@ -331,11 +332,11 @@ async function getFlatmapFilterOptions (flatmapAPI, mapImp, providedKnowledge, p
331
332
  }
332
333
  }
333
334
  // to avoid mutation
334
- arr.push(JSON.parse(JSON.stringify(knowledge)));
335
+ flatmapKnowledge.push(JSON.parse(JSON.stringify(knowledge)));
335
336
  }
336
337
  }
337
- return arr;
338
- }, []);
338
+ }
339
+
339
340
  const knowledgeSource = mapImp.knowledgeSource;
340
341
  const originItems = await extractOriginItems(flatmapAPI, knowledgeSource, flatmapKnowledge);
341
342
  const viaItems = await extractViaItems(flatmapAPI, knowledgeSource, flatmapKnowledge);