"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7722],{47722:(t,e,a)=>{a.r(e),a.d(e,{getQuantitativeStatsAutorun:()=>c});var s=a(42489),r=a(36422),i=a(99546),n=a(91468),o=a(68584);function c(t){(0,r.addDisposer)(t,(0,s.autorun)((async()=>{try{const e=(0,i.getContainingView)(t),a=new AbortController;if(t.setStatsLoading(a),!t.quantitativeStatsReady)return;const s=JSON.stringify(e.dynamicBlocks),c=await async function(t,e){const{rpcManager:a}=(0,i.getSession)(t),s=(0,o.getConf)(t,"numStdDev")||3,{adapterConfig:c,autoscaleType:l}=t,u=(0,n.getRpcSessionId)(t),{currStatsBpPerPx:g}=e,p={sessionId:u,adapterConfig:c,statusCallback:e=>{(0,r.isAlive)(t)&&t.setMessage(e)},...e};if("global"===l||"globalsd"===l){const t=await a.call(u,"WiggleGetGlobalQuantitativeStats",p),{scoreMin:e,scoreMean:r,scoreStdDev:i}=t;return"globalsd"===l?{...t,scoreMin:e>=0?0:r-s*i,scoreMax:r+s*i,currStatsBpPerPx:g}:{...t,currStatsBpPerPx:g}}if("local"===l||"localsd"===l){const{dynamicBlocks:e,bpPerPx:r}=(0,i.getContainingView)(t),n=await a.call(u,"WiggleGetMultiRegionQuantitativeStats",{...p,regions:e.contentBlocks.map((t=>{const{start:e,end:a}=t;return{...JSON.parse(JSON.stringify(t)),start:Math.floor(e),end:Math.ceil(a)}})),bpPerPx:r}),{scoreMin:o,scoreMean:c,scoreStdDev:d}=n;return"localsd"===l?{...n,scoreMin:o>=0?0:c-s*d,scoreMax:c+s*d,currStatsBpPerPx:g}:{...n,currStatsBpPerPx:g}}if("zscale"===l)return a.call(u,"WiggleGetGlobalQuantitativeStats",p);throw new Error(`invalid autoscaleType '${l}'`)}(t,{signal:a.signal,filters:[],currStatsBpPerPx:e.bpPerPx,...t.adapterProps()});(0,r.isAlive)(t)&&t.updateQuantitativeStats(c,s)}catch(e){console.error(e),!(0,i.isAbortException)(e)&&(0,r.isAlive)(t)&&t.setError(e)}}),{delay:1e3}))}}}]);
//# sourceMappingURL=7722.1734de0e.chunk.js.map