(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[9342],{59894:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return y}});var n=r(96234),a=r(33028),s=r(34795),u=r(9249),i=r(87371),c=r(45754),o=r(86906),f=r(77162),l=r.n(f),d=r(29598),h=r(9077),p=r(33528),v=r(26131),g=r(16362),w=r(14956),b=r(42098),k=r(64526);function m(e){return 31===e[0]&&139===e[1]&&8===e[2]}var y=function(e){(0,c.Z)(r,e);var t=(0,o.Z)(r);function r(){var e;(0,u.Z)(this,r);for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return(e=t.call.apply(t,[this].concat(a))).gffFeatures=void 0,e}return(0,i.Z)(r,[{key:"loadDataP",value:function(){var e=(0,s.Z)(l().mark((function e(){var t,r,n,a,s,u,i,c,o,f=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,p.openLocation)((0,h.readConfObject)(this.config,"gffLocation"),this.pluginManager).readFile();case 2:if(!m(t=e.sent)){e.next=9;break}return e.next=6,(0,b.unzip)(t);case 6:e.t0=e.sent,e.next=10;break;case 9:e.t0=t;case 10:if(!((r=e.t0).length>536870888)){e.next=13;break}throw new Error("Data exceeds maximum string length (512MB)");case 13:for(n=new TextDecoder("utf8",{fatal:!0}).decode(r),a=n.split("\n"),s=[],u=0;u<a.length&&a[u].startsWith("#");u++)s.push(a[u]);return i=s.join("\n"),c=k.Z.parseStringSync(n,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1}),o=c.flat().map((function(e,t){return new w.Z({data:f.featureData(e),id:"".concat(f.id,"-offset-").concat(t)})})).reduce((function(e,t){var r=t.get("refName");return e[r]||(e[r]=new g.ZP),e[r].insert([t.get("start"),t.get("end")],t),e}),{}),e.abrupt("return",{header:i,intervalTree:o});case 21:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"loadData",value:function(){var e=(0,s.Z)(l().mark((function e(){var t=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.gffFeatures||(this.gffFeatures=this.loadDataP().catch((function(e){throw t.gffFeatures=void 0,e}))),e.abrupt("return",this.gffFeatures);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)(l().mark((function e(){var t,r,n=arguments;return l().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.loadData();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:"getHeader",value:function(){var e=(0,s.Z)(l().mark((function e(){var t,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadData();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:"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)(l().mark((function r(n){var a,s,u,i,c,o;return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,s=e.start,u=e.end,i=e.refName,r.next=4,t.loadData();case 4:c=r.sent,o=c.intervalTree,null===(a=o[i])||void 0===a||a.search([s,u]).forEach((function(e){return n.next(e)})),n.complete(),r.next=13;break;case 10:r.prev=10,r.t0=r.catch(0),n.error(r.t0);case 13:case"end":return r.stop()}}),r,null,[[0,10]])})));return function(e){return r.apply(this,arguments)}}(),r.signal)}},{key:"featureData",value:function(e){var t=this,r=(0,a.Z)({},e);r.start-=1,"+"===e.strand?r.strand=1:"-"===e.strand?r.strand=-1:"."===e.strand?r.strand=0:r.strand=void 0,r.phase=Number(e.phase),r.refName=e.seq_id,null===e.score&&delete r.score,null===e.phase&&delete r.score;var s=["start","end","seq_id","score","type","source","phase","strand"],u=e.attributes||{};return Object.keys(u).forEach((function(e){var t=e.toLowerCase();if(s.includes(t)&&(t+="2"),null!==u[e]){var a=u[e];if(Array.isArray(a)&&1===a.length){var i=a;a=(0,n.Z)(i,1)[0]}r[t]=a}})),r.refName=r.seq_id,e.child_features&&e.child_features.length&&(r.subfeatures=e.child_features.map((function(e){return e.map((function(e){return t.featureData(e)}))})).flat()),delete r.child_features,delete r.data,delete r.derived_features,delete r.attributes,delete r.seq_id,r}},{key:"freeResources",value:function(){}}]),r}(d.BaseFeatureDataAdapter)},57267:function(){},48732:function(){}}]);
//# sourceMappingURL=9342.860c76ee.chunk.js.map