import{B as v}from"./index-6rN3ss-L.js";import{a7 as F,a8 as N,u as h,G as b}from"./index-Bm2SqMk3.js";import{r as q}from"./rxjs-DT7GVwt0.js";class y extends v.BaseFeatureDataAdapter{constructor(){super(...arguments),this.gcMode="content"}async configure(){var t;const a=await((t=this.getSubAdapter)===null||t===void 0?void 0:t.call(this,this.getConf("sequenceAdapter")));if(!a)throw new Error("Error getting subadapter");return a.dataAdapter}async getRefNames(t){return(await this.configure()).getRefNames(t)}getFeatures(t,a){const{statusCallback:C=()=>{},stopToken:x}=a||{};return q.ObservableCreate(async d=>{var l;const A=await this.configure(),p=this.getConf("windowSize"),g=this.getConf("windowDelta"),s=p===1?1:p/2,S=p===1;let{start:r,end:n}=t;if(r=Math.max(0,r-s),n+=s,n<0||r>n){d.complete();return}const u=((l=(await F(A.getFeatures({...t,start:r,end:n},a).pipe(N())))[0])===null||l===void 0?void 0:l.get("seq"))||"";let w=performance.now();await h.updateStatus("Calculating GC",C,()=>{for(let e=s;e<u.length-s;e+=g){performance.now()-w>400&&(b.checkStopToken(x),w=performance.now());const E=S?u[e]:u.slice(e-s,e+s);let i=0,c=0,m=0;for(const o of E)o==="c"||o==="C"?i++:(o==="g"||o==="G")&&c++,o!=="N"&&m++;const f=r,k=this.gcMode==="content"?(c+i)/(m||1):this.gcMode==="skew"?(c-i)/(c+i||1):0;d.next(new h.SimpleFeature({uniqueId:`${this.id}_${f+e}`,refName:t.refName,start:f+e,end:f+e+g,score:k}))}}),d.complete()})}freeResources(){}}y.capabilities=["hasLocalStats"];export{y as default};
