import{B as u}from"./index-P3rx-5SH.js";import{u as l}from"./rpcWorker-CVTx5FIM.js";import{r as d}from"./rxjs-Dgg09m9e.js";import{m as c,a as m}from"./merge-DrBsQLq1.js";import"./Observable-CILgZKT-.js";function g(o){const t=o.slice(o.lastIndexOf("/")+1);return t.slice(0,t.lastIndexOf("."))}class f extends u.BaseFeatureDataAdapter{async getAdapters(){const t=this.getSubAdapter;if(!t)throw new Error("no getSubAdapter available");let a=this.getConf("subadapters");return a!=null&&a.length||(a=this.getConf("bigWigs").map(s=>({type:"BigWigAdapter",source:g(s),bigWigLocation:{uri:s}}))),Promise.all(a.map(async r=>{const s=(await t(r)).dataAdapter;return{source:r.name||s.id,...r,dataAdapter:s}}))}async getRefNames(t){const a=await this.getAdapters(),r=await Promise.all(a.map(s=>s.dataAdapter.getRefNames(t)));return[...new Set(r.flat())]}async getGlobalStats(t){const a=await this.getAdapters(),r=(await Promise.all(a.map(e=>{var p,n;return(n=(p=e.dataAdapter).getGlobalStats)===null||n===void 0?void 0:n.call(p,t)}))).filter(e=>!!e),s=l.min(r.map(e=>e.scoreMin)),i=l.max(r.map(e=>e.scoreMax));return{scoreMin:s,scoreMax:i}}getFeatures(t,a={}){return d.ObservableCreate(async r=>{const s=await this.getAdapters();c(...s.map(i=>i.dataAdapter.getFeatures(t,a).pipe(m(e=>e.get("source")?e:new l.SimpleFeature({...e.toJSON(),uniqueId:`${i.source}-${e.id()}`,source:i.source}))))).subscribe(r)},a.stopToken)}async getMultiRegionFeatureDensityStats(t){return{featureDensity:0}}async getSources(t){return(await this.getAdapters()).map(({dataAdapter:r,source:s,name:i,...e})=>({name:s,__name:i,...e}))}freeResources(){}}f.capabilities=["hasResolution","hasLocalStats","hasGlobalStats"];export{f as default};
