"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[8343],{98343:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var r=a(46377),s=a(99834),n=a(66885),i=a(32598),c=a(7706),h=a(9502),o=a(54702);class u extends r.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];async getHeader(){const{header:e}=await this.setup();return e}async getMetadata(){const{header:e}=await this.setup();return new h.A({header:e}).getMetadata()}async setupP(){const e=this.pluginManager,t=await(0,s.openLocation)(this.getConf("vcfLocation"),e).readFile(),a=function(e){return 31===e[0]&&139===e[1]&&8===e[2]}(t)?await(0,c.unzip)(t):t;if(a.length>536870888)throw new Error("Data exceeds maximum string length (512MB)");const r=(new TextDecoder).decode(a),{header:n,lines:u}=(e=>{const t=[],a=[];return e.split(/\n|\r\n|\r/).map((e=>e.trim())).filter((e=>!!e)).forEach((e=>{e.startsWith("#")?t.push(e):e&&a.push(e)})),{header:t.join("\n"),lines:a}})(r),d={},l=new h.A({header:n});let p=0;for(const e of u){const t=new o.A({variant:l.parseLine(e),parser:l,id:`${this.id}-${p++}`}),a=t.get("refName");d[a]||(d[a]=new i.Ay),d[a].insert([t.get("start"),t.get("end")],t)}return{header:n,intervalTree:d}}async setup(){return this.vcfFeatures||(this.vcfFeatures=this.setupP().catch((e=>{throw this.vcfFeatures=void 0,e}))),this.vcfFeatures}async getRefNames(e={}){const{intervalTree:t}=await this.setup();return Object.keys(t)}getFeatures(e,t={}){return(0,n.ObservableCreate)((async t=>{try{const{start:a,end:r,refName:s}=e,{intervalTree:n}=await this.setup();n[s]?.search([a,r]).forEach((e=>{t.next(e)})),t.complete()}catch(e){t.error(e)}}),t.signal)}freeResources(){}}}}]);
//# sourceMappingURL=8343.2d0aa189.chunk.js.map