"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[8930],{38930:function(e,t,r){r.r(t),r.d(t,{default:function(){return x}});var n=r(96234),a=r(41361),u=r(32723),s=r(34795),i=r(9249),c=r(87371),o=r(45754),f=r(13820),p=r(20783),h=r(33528),v=r(26131),l=r(16362),d=r(42098),Z=r(6556),w=r(78867),k=function(e){var t=[],r=[];return e.split(/\n|\r\n|\r/).map((function(e){return e.trim()})).filter((function(e){return!!e})).forEach((function(e){e.startsWith("#")?t.push(e):e&&r.push(e)})),{header:t.join("\n"),lines:r}};function m(e){return 31===e[0]&&139===e[1]&&8===e[2]}var x=function(e){(0,o.Z)(r,e);var t=(0,f.Z)(r);function r(){var e;(0,i.Z)(this,r);for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return(e=t.call.apply(t,[this].concat(a))).vcfFeatures=void 0,e}return(0,c.Z)(r,[{key:"getHeader",value:function(){var e=(0,s.Z)((0,u.Z)().mark((function e(){var t,r;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setup();case 2:return t=e.sent,r=t.header,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getMetadata",value:function(){var e=(0,s.Z)((0,u.Z)().mark((function e(){var t,r,n;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setup();case 2:return t=e.sent,r=t.header,n=new Z.Z({header:r}),e.abrupt("return",n.getMetadata());case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setupP",value:function(){var e=(0,s.Z)((0,u.Z)().mark((function e(){var t,r,s,i,c,o,f,p,v,Z,w,x;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.pluginManager,e.next=3,(0,h.openLocation)(this.getConf("vcfLocation"),t).readFile();case 3:if(!m(r=e.sent)){e.next=10;break}return e.next=7,(0,d.unzip)(r);case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=r;case 11:if(!((s=e.t0).length>536870888)){e.next=14;break}throw new Error("Data exceeds maximum string length (512MB)");case 14:i=(new TextDecoder).decode(s),c=k(i),o=c.header,f=c.lines,p={},v=(0,a.Z)(f.map((function(e,t){var r,a=e.split("\t"),u=(0,n.Z)(a,8),s=u[0],i=u[1],c=u[3],o=u[7],f=+i-1,p=f+c.length;return{line:e,refName:s,start:f,end:+((null===(r=o.match(/END=(\d+)/))||void 0===r?void 0:r[1].trim())||p),id:t}})));try{for(v.s();!(Z=v.n()).done;)w=Z.value,x=w.refName,p[x]||(p[x]=new l.ZP),p[x].insert([w.start,w.end],w)}catch(u){v.e(u)}finally{v.f()}return e.abrupt("return",{header:o,intervalTree:p});case 20:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setup",value:function(){var e=(0,s.Z)((0,u.Z)().mark((function e(){var t=this;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.vcfFeatures||(this.vcfFeatures=this.setupP().catch((function(e){throw t.vcfFeatures=void 0,e}))),e.abrupt("return",this.vcfFeatures);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getRefNames",value:function(){var e=(0,s.Z)((0,u.Z)().mark((function e(){var t,r,n=arguments;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.length>0&&void 0!==n[0]?n[0]:{},e.next=3,this.setup();case 3:return t=e.sent,r=t.intervalTree,e.abrupt("return",Object.keys(r));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getFeatures",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,v.ObservableCreate)(function(){var r=(0,s.Z)((0,u.Z)().mark((function r(n){var a,s,i,c,o,f,p,h;return(0,u.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,s=e.start,i=e.end,c=e.refName,r.next=4,t.setup();case 4:o=r.sent,f=o.header,p=o.intervalTree,h=new Z.Z({header:f}),null===(a=p[c])||void 0===a||a.search([s,i]).forEach((function(e){return n.next(new w.Z({variant:h.parseLine(e.line),parser:h,id:"".concat(t.id,"-").concat(e.id)}))})),n.complete(),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(0),n.error(r.t0);case 15:case"end":return r.stop()}}),r,null,[[0,12]])})));return function(e){return r.apply(this,arguments)}}(),r.signal)}},{key:"freeResources",value:function(){}}]),r}(p.BaseFeatureDataAdapter);x.capabilities=["getFeatures","getRefNames"]}}]);
//# sourceMappingURL=8930.49275ba6.chunk.js.map