(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[8537],{58354:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>l});var r=a(56798),s=a(59062),n=a(16979),i=a(65904),o=a(85291),c=a(31238),d=a(46922);const l=class extends r.BaseFeatureDataAdapter{constructor(){super(...arguments),this.gffFeatures=void 0}async loadDataP(){const e=this.pluginManager,t=await(0,s.openLocation)(this.getConf("gffLocation"),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("utf8",{fatal:!0}).decode(a),n=r.split(/\n|\r\n|\r/),l=[];for(let s=0;s<n.length&&n[s].startsWith("#");s++)l.push(n[s]);const u=l.join("\n"),f=d.Z.parseStringSync(r,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1,disableDerivesFromReferences:!0}),h={};for(const s of f.flat().map(((e,t)=>new o.Z({data:this.featureData(e),id:"".concat(this.id,"-offset-").concat(t)})))){const e=s.get("refName");h[e]||(h[e]=new i.ZP),h[e].insert([s.get("start"),s.get("end")],s)}return{header:u,intervalTree:h}}async loadData(){return this.gffFeatures||(this.gffFeatures=this.loadDataP().catch((e=>{throw this.gffFeatures=void 0,e}))),this.gffFeatures}async getRefNames(){const{intervalTree:e}=await this.loadData();return Object.keys(e)}async getHeader(){const{header:e}=await this.loadData();return 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,{intervalTree:i}=await this.loadData();null===(a=i[n])||void 0===a||a.search([r,s]).forEach((e=>t.next(e))),t.complete()}catch(r){t.error(r)}}),t.signal)}featureData(e){const t={...e};t.start-=1,"+"===e.strand?t.strand=1:"-"===e.strand?t.strand=-1:"."===e.strand?t.strand=0:t.strand=void 0,t.phase=Number(e.phase),t.refName=e.seq_id,null===e.score&&delete t.score,null===e.phase&&delete t.score;const a=new Set(["start","end","seq_id","score","type","source","phase","strand"]),r=e.attributes||{};for(const s of Object.keys(r)){let e=s.toLowerCase();if(a.has(e)&&(e+="2"),null!==r[s]){let a=r[s];Array.isArray(a)&&1===a.length&&([a]=a),t[e]=a}}return t.refName=t.seq_id,e.child_features&&e.child_features.length>0&&(t.subfeatures=e.child_features.flatMap((e=>e.map((e=>this.featureData(e)))))),delete t.child_features,delete t.data,delete t.attributes,delete t.seq_id,t}freeResources(){}}},74854:()=>{},66602:()=>{}}]);
//# sourceMappingURL=8537.74789031.chunk.js.map