"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6621],{66621:(e,t,a)=>{a.r(t),a.d(t,{default:()=>g});var n=a(35505),i=a(6854),s=a(46377),r=a(99546),c=a(99834),o=a(66885),u=a(54702);class g extends s.BaseFeatureDataAdapter{async configurePre(e){const{statusCallback:t=()=>{}}=e||{},a=this.getConf("vcfGzLocation"),s=this.getConf(["index","location"]),o=this.getConf(["index","indexType"]),u=(0,c.openLocation)(a,this.pluginManager),g="CSI"===o,l=new n.wD({filehandle:u,csiFilehandle:g?(0,c.openLocation)(s,this.pluginManager):void 0,tbiFilehandle:g?void 0:(0,c.openLocation)(s,this.pluginManager),chunkCacheSize:52428800}),h=await(0,r.updateStatus)("Downloading index",t,(()=>l.getHeader()));return{vcf:l,parser:new i.A({header:h})}}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(0,o.ObservableCreate)((async a=>{const{refName:n,start:i,end:s}=e,{statusCallback:c=()=>{}}=t,{vcf:o,parser:g}=await this.configure();await(0,r.updateStatus)("Downloading variants",c,(()=>o.getLines(n,i,s,{lineCallback:(e,t)=>{a.next(new u.A({variant:g.parseLine(e),parser:g,id:`${this.id}-vcf-${t}`}))},...t}))),a.complete()}),t.stopToken)}async getSources(){const e=this.getConf("samplesTsvLocation");if(""===e.uri||"/path/to/samples.tsv"===e.uri){const{parser:e}=await this.configure();return e.samples.map((e=>({name:e})))}{const t=(await(0,r.fetchAndMaybeUnzipText)((0,c.openLocation)(e,this.pluginManager))).split(/\n|\r\n|\r/),a=t[0].split("\t"),{parser:n}=await this.configure(),i=new Set(n.samples);return t.slice(1).map((e=>{const t=e.split("\t");return{name:t[0],...Object.fromEntries(t.slice(1).map(((e,t)=>[a[t+1],e])))}})).filter((e=>i.has(e.name)))}}freeResources(){}}}}]);
//# sourceMappingURL=6621.900c18c5.chunk.js.map