"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7489],{69870:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var s=a(71616),n=a(46377),i=a(99834),r=a(66885),c=a(99546),o=a(47046),u=a(43334);class h extends n.BaseSequenceAdapter{seqCache=new o.A({cache:new u.A({maxSize:200}),fill:async(e,t)=>{const{refName:a,start:s,end:n,fasta:i}=e;return i.getSequence(a,s,n,{...e,signal:t})}});async getRefNames(e){const{fasta:t}=await this.setup();return t.getSequenceNames(e)}async getRegions(e){const{fasta:t}=await this.setup(),a=await t.getSequenceSizes(e);return Object.keys(a).map((e=>({refName:e,start:0,end:a[e]})))}async setupPre(){const e=this.getConf("fastaLocation"),t=this.getConf("faiLocation");return{fasta:new s.BL({fasta:(0,i.openLocation)(e,this.pluginManager),fai:(0,i.openLocation)(t,this.pluginManager)})}}async getHeader(){const e=this.getConf("metadataLocation");return""===e.uri||"/path/to/fa.metadata.yaml"===e.uri?null:(0,i.openLocation)(e,this.pluginManager).readFile("utf8")}async setup(){return this.setupP||(this.setupP=this.setupPre().catch((e=>{throw this.setupP=void 0,e}))),this.setupP}getFeatures(e,t){const{refName:a,start:s,end:n}=e;return(0,r.ObservableCreate)((async e=>{const{fasta:i}=await this.setup(),r=await i.getSequenceSize(a,t),o=Math.min(r,n),u=[],h=128e3,f=s-s%h,l=n+(h-n%h);for(let e=f;e<l;e+=h){const s={refName:a,start:e,end:e+h};u.push(this.seqCache.get(JSON.stringify(s),{...s,fasta:i},t?.signal))}const p=(await Promise.all(u)).join("").slice(s-f).slice(0,n-s);p&&e.next(new c.SimpleFeature({id:`${a} ${s}-${o}`,data:{refName:a,start:s,end:o,seq:p}})),e.complete()}))}freeResources(){}}}}]);
//# sourceMappingURL=7489.b8a76d29.chunk.js.map