(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[305],{37809:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>h});var r=a(46377),s=a(99834),n=a(66885),i=a(32598),o=a(6434),c=a(7706),d=a(92202),l=a(99546),u=a(77744);class h 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,l.isGzip)(a)?await(0,l.updateStatus)("Unzipping",t,(()=>(0,c.unzip)(a))):a,n=[],h={};let f=0;const p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;let g=0;for(;f<r.length;){const e=r.indexOf("\n",f),a=-1===e?r.subarray(f):r.subarray(f,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);h[t]||(h[t]=""),h[t]+=`${s}\n`}}g++%1e4==0&&t(`Loading ${Math.floor(f/1e6).toLocaleString("en-US")}/${Math.floor(r.length/1e6).toLocaleString("en-US")} MB`),f=e+1}const b=Object.fromEntries(Object.entries(h).map((([e,t])=>[e,a=>{if(!this.calculatedIntervalTreeMap[e]){a?.("Parsing GFF data");const r=new i.Ay;d.A.parseStringSync(t,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1,disableDerivesFromReferences:!0}).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)=>{"use strict";function r(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=null===e.phase?void 0:Number(e.phase),t.refName=e.seq_id,null===e.score&&(t.score=void 0);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"),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=>r(e)))))),t.child_features=void 0,t.data=void 0,t.attributes=void 0,t.seq_id=void 0,t}a.d(t,{d:()=>r})},85392:()=>{},43951:()=>{}}]);
//# sourceMappingURL=305.ca994aa3.chunk.js.map