"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[7452],{77452:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var r=a(56798),s=a(59062),n=a(16979),i=a(65904),c=a(31238),o=a(98303),u=a(59131);class h extends r.BaseFeatureDataAdapter{constructor(){super(...arguments),this.vcfFeatures=void 0}async getHeader(){const{header:e}=await this.setup();return e}async getMetadata(){const{header:e}=await this.setup();return new o.Z({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:o}=(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),u={};for(const s of o.map(((e,t)=>{var a;const[r,s,,n,,,,i]=e.split("\t"),c=+s-1,o=c+n.length;return{line:e,refName:r,start:c,end:+((null===(a=i.match(/END=(\d+)/))||void 0===a?void 0:a[1].trim())||o),id:t}}))){const e=s.refName;u[e]||(u[e]=new i.ZP),u[e].insert([s.start,s.end],s)}return{header:n,intervalTree:u}}async setup(){return this.vcfFeatures||(this.vcfFeatures=this.setupP().catch((e=>{throw this.vcfFeatures=void 0,e}))),this.vcfFeatures}async getRefNames(){const{intervalTree:e}=await this.setup();return Object.keys(e)}getFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,n.ObservableCreate)((async t=>{try{var a;const{start:r,end:s,refName:n}=e,{header:i,intervalTree:c}=await this.setup(),h=new o.Z({header:i});null===(a=c[n])||void 0===a||a.search([r,s]).forEach((e=>t.next(new u.Z({variant:h.parseLine(e.line),parser:h,id:"".concat(this.id,"-").concat(e.id)})))),t.complete()}catch(r){t.error(r)}}),t.signal)}freeResources(){}}h.capabilities=["getFeatures","getRefNames"]}}]);
//# sourceMappingURL=7452.cf150940.chunk.js.map