"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7809],{37809:(e,t,a)=>{a.r(t),a.d(t,{default:()=>f});var r=a(46377),s=a(99834),n=a(66885),i=a(32598),o=a(6434),c=a(7706),l=a(52645),d=a(99546),u=a(77744);class f extends r.BaseFeatureDataAdapter{calculatedIntervalTreeMap={};async loadDataP(e){const{statusCallback:t=()=>{}}=e||{},a=await(0,s.openLocation)(this.getConf("gffLocation"),this.pluginManager).readFile(e),r=(0,d.isGzip)(a)?await(0,d.updateStatus)("Unzipping",t,(()=>(0,c.unzip)(a))):a,n=[],f={};let h=0;const p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;let g=0;for(;h<r.length;){const e=r.indexOf("\n",h),a=-1===e?r.subarray(h):r.subarray(h,e),s=(p?.decode(a)||a.toString()).trim();if(s)if(s.startsWith("#"))n.push(s);else{if(s.startsWith(">"))break;{const e=s.indexOf("\t"),t=s.slice(0,e);f[t]||(f[t]=""),f[t]+=`${s}\n`}}g++%1e4==0&&t(`Loading ${Math.floor(h/1e6).toLocaleString("en-US")}/${Math.floor(r.length/1e6).toLocaleString("en-US")} MB`),h=e+1}const b=Object.fromEntries(Object.entries(f).map((([e,t])=>[e,a=>{if(!this.calculatedIntervalTreeMap[e]){a?.("Parsing GFF data");const r=new i.Ay;(0,l.g)(t).flat().map(((t,a)=>new o.A({data:(0,u.d)(t),id:`${this.id}-${e}-${a}`}))).forEach((e=>r.insert([e.get("start"),e.get("end")],e))),this.calculatedIntervalTreeMap[e]=r}return this.calculatedIntervalTreeMap[e]}])));return{header:n.join("\n"),intervalTreeMap:b}}async loadData(e){return this.gffFeatures||(this.gffFeatures=this.loadDataP(e).catch((e=>{throw this.gffFeatures=void 0,e}))),this.gffFeatures}async getRefNames(e={}){const{intervalTreeMap:t}=await this.loadData(e);return Object.keys(t)}async getHeader(e={}){const{header:t}=await this.loadData(e);return t}getFeatures(e,t={}){return(0,n.ObservableCreate)((async a=>{try{const{start:r,end:s,refName:n}=e,{intervalTreeMap:i}=await this.loadData(t);i[n]?.(t.statusCallback).search([r,s]).forEach((e=>{a.next(e)})),a.complete()}catch(e){a.error(e)}}),t.signal)}freeResources(){}}},77744:(e,t,a)=>{function r(e){const{end:t,start:a,child_features:s,derived_features:n,attributes:i,type:o,source:c,phase:l,seq_id:d,score:u,strand:f}=e;let h;"+"===f?h=1:"-"===f?h=-1:"."===f&&(h=0);const p=new Set(["start","end","seq_id","score","type","source","phase","strand"]),g=i||{},b={};for(const e of Object.keys(g)){let t=e.toLowerCase();if(p.has(t)&&(t+="2"),g[e]&&"_lineHash"!==e){let a=g[e];Array.isArray(a)&&1===a.length&&([a]=a),b[t]=a}}return{...b,start:a-1,end:t,strand:h,type:o,source:c,refName:d,derived_features:n,phase:null===l?void 0:Number(l),score:null===u?void 0:u,subfeatures:s.flatMap((e=>e.map((e=>r(e)))))}}a.d(t,{d:()=>r})}}]);
//# sourceMappingURL=7809.eb2c5f08.chunk.js.map