"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5472],{85472:(e,a,t)=>{t.r(a),t.d(a,{default:()=>l});var n=t(75466),s=t(350),i=t(46377),r=t(99546),o=t(99834),c=t(66885),p=t(95600);class l extends i.BaseFeatureDataAdapter{async configurePre(e){const a=this.getConf("indexType"),t=this.getConf("vcfGzLocationMap")[e],i=this.getConf("indexLocationMap")[e]||{uri:`${t.uri}.${a.toLowerCase()}`},r=(0,o.openLocation)(t,this.pluginManager),c="CSI"===a,p=new n.wD({filehandle:r,csiFilehandle:c?(0,o.openLocation)(i,this.pluginManager):void 0,tbiFilehandle:c?void 0:(0,o.openLocation)(i,this.pluginManager),chunkCacheSize:52428800});return{vcf:p,parser:new s.A({header:await p.getHeader()})}}async configure(e,a){const{statusCallback:t=()=>{}}=a||{};return(0,r.updateStatus)("Downloading index",t,()=>this.configurePre(e))}async getRefNames(){return Object.keys(this.getConf("vcfGzLocationMap"))}getFeatures(e,a={}){return(0,c.ObservableCreate)(async t=>{const{refName:n,start:s,end:i}=e,{statusCallback:o=()=>{}}=a,{vcf:c,parser:l}=await this.configure(e.refName,a);await(0,r.updateStatus)("Downloading variants",o,()=>c.getLines(n,s,i,{lineCallback:(e,a)=>{t.next(new p.A({variant:l.parseLine(e),parser:l,id:`${this.id}-vcf-${a}`}))},...a})),t.complete()},a.stopToken)}async getSources(){const e=this.getConf("samplesTsvLocation"),a=Object.keys(this.getConf("vcfGzLocationMap"))[0];if(""===e.uri||"/path/to/samples.tsv"===e.uri){const{parser:e}=await this.configure(a);return e.samples.map(e=>({name:e}))}{const t=(await(0,r.fetchAndMaybeUnzipText)((0,o.openLocation)(e,this.pluginManager))).split(/\n|\r\n|\r/),n=t[0].split("\t"),{parser:s}=await this.configure(a),i=new Set(s.samples);return t.slice(1).map(e=>{const a=e.split("\t");return{name:a[0],...Object.fromEntries(a.slice(1).map((e,a)=>[n[a+1],e]))}}).filter(e=>i.has(e.name))}}}}}]);
//# sourceMappingURL=5472.ad396202.chunk.js.map