"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7809],{37809:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var s=a(32598),r=a(46377),n=a(99546),i=a(99834),o=a(66885),c=a(6434),l=a(52645),d=a(77744);class u extends r.BaseFeatureDataAdapter{calculatedIntervalTreeMap={};async loadDataP(e){const{statusCallback:t=()=>{}}=e||{},a=await(0,n.fetchAndMaybeUnzip)((0,i.openLocation)(this.getConf("gffLocation"),this.pluginManager),e),r=[],o={},u=new TextDecoder("utf8");let f=0,h=0;for(;f<a.length;){const e=a.indexOf(10,f),s=-1===e?a.subarray(f):a.subarray(f,e),i=u.decode(s).trim();if(i)if(i.startsWith("#"))r.push(i);else{if(i.startsWith(">"))break;{const e=i.indexOf("\t"),t=i.slice(0,e);o[t]||(o[t]=""),o[t]+=`${i}\n`}}h++%1e4==0&&t(`Loading ${(0,n.getProgressDisplayStr)(f,a.length)}`),f=e+1}const p=Object.fromEntries(Object.entries(o).map((([e,t])=>[e,a=>{if(!this.calculatedIntervalTreeMap[e]){a?.("Parsing GFF data");const r=new s.Ay;for(const a of(0,l.g)(t).flat().map(((t,a)=>new c.A({data:(0,d.d)(t),id:`${this.id}-${e}-${a}`}))))r.insert([a.get("start"),a.get("end")],a);this.calculatedIntervalTreeMap[e]=r}return this.calculatedIntervalTreeMap[e]}])));return{header:r.join("\n"),intervalTreeMap:p}}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,o.ObservableCreate)((async a=>{try{const{start:s,end:r,refName:n}=e,{intervalTreeMap:i}=await this.loadData(t);for(const e of i[n]?.(t.statusCallback).search([s,r])||[])a.next(e);a.complete()}catch(e){a.error(e)}}),t.stopToken)}}},77744:(e,t,a)=>{function s(e){const{end:t,start:a,child_features:r,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"]),b=i||{},g={};for(const e of Object.keys(b)){let t=e.toLowerCase();if(p.has(t)&&(t+="2"),b[e]&&"_lineHash"!==e){let a=b[e];Array.isArray(a)&&1===a.length&&([a]=a),g[t]=a}}return{...g,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:r.flatMap((e=>e.map((e=>s(e)))))}}a.d(t,{d:()=>s})}}]);
//# sourceMappingURL=7809.c435ca8e.chunk.js.map