(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[8537],{58354:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>l});var s=a(56798),r=a(59062),n=a(16979),i=a(48026),o=a(85291),c=a(71631),d=a(501);const l=class extends s.BaseFeatureDataAdapter{async loadDataP(){const e=this.pluginManager,t=await(0,r.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 s=new TextDecoder("utf8",{fatal:!0}).decode(a),n=s.split(/\n|\r\n|\r/),l=[];for(let e=0;e<n.length&&n[e].startsWith("#");e++)l.push(n[e]);const u=l.join("\n"),f=d.Z.parseStringSync(s,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1,disableDerivesFromReferences:!0}),h={};for(const e of f.flat().map(((e,t)=>new o.Z({data:this.featureData(e),id:`${this.id}-offset-${t}`})))){const t=e.get("refName");h[t]||(h[t]=new i.ZP),h[t].insert([e.get("start"),e.get("end")],e)}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(e={}){const{intervalTree:t}=await this.loadData();return Object.keys(t)}async getHeader(){const{header:e}=await this.loadData();return e}getFeatures(e,t={}){return(0,n.ObservableCreate)((async t=>{try{const{start:a,end:s,refName:r}=e,{intervalTree:n}=await this.loadData();n[r]?.search([a,s]).forEach((e=>t.next(e))),t.complete()}catch(e){t.error(e)}}),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"]),s=e.attributes||{};for(const e of Object.keys(s)){let r=e.toLowerCase();if(a.has(r)&&(r+="2"),null!==s[e]){let a=s[e];Array.isArray(a)&&1===a.length&&([a]=a),t[r]=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.6642655c.chunk.js.map