import{T as u}from"./tabixIndexedFile-B_BgWenS.js";import{i as c}from"./rpcWorker-CVTx5FIM.js";import{V as p,a as g}from"./index-Cv8sKuNF.js";import{B as h}from"./index-P3rx-5SH.js";import{r as l}from"./rxjs-Dgg09m9e.js";import"./AbortablePromiseCache-xs5eyOH3.js";class L extends h.BaseFeatureDataAdapter{async configurePre(){const e=this.pluginManager,t=this.getConf("vcfGzLocation"),a=this.getConf(["index","location"]),s=this.getConf(["index","indexType"]),o=c.openLocation(t,e),n=s==="CSI",r=new u({filehandle:o,csiFilehandle:n?c.openLocation(a,e):void 0,tbiFilehandle:n?void 0:c.openLocation(a,e),chunkCacheSize:50*2**20}),i=await r.getHeader();return{vcf:r,parser:new p({header:i})}}async configure(){return this.configured||(this.configured=this.configurePre().catch(e=>{throw this.configured=void 0,e})),this.configured}async getRefNames(e={}){const{vcf:t}=await this.configure();return t.getReferenceSequenceNames(e)}async getHeader(){const{vcf:e}=await this.configure();return e.getHeader()}async getMetadata(){const{parser:e}=await this.configure();return e.getMetadata()}getFeatures(e,t={}){return l.ObservableCreate(async a=>{const{refName:s,start:o,end:n}=e,{vcf:r,parser:i}=await this.configure();await r.getLines(s,o,n,{lineCallback:(f,d)=>{a.next(new g({variant:i.parseLine(f),parser:i,id:`${this.id}-vcf-${d}`}))},...t}),a.complete()},t.stopToken)}async getSources(){const{parser:e}=await this.configure();return e.samples.map(t=>({name:t}))}freeResources(){}}export{L as default};
