"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5524],{15524:(e,o,t)=>{t.d(o,{drawXY:()=>u});var r=t(68584),n=t(99546),a=t(87485),c=t(37347),s=t(75429);function l(e,o){const t=e.toHsl(),r=t.l*(1+o);return(0,a.M)({...t,l:(0,n.clamp)(r,0,100)})}function f(e,o){const t=e.toHsl(),r=t.l*(1-o);return(0,a.M)({...t,l:(0,n.clamp)(r,0,100)})}const i=.3,m=2;function u(e,o){const{features:t,bpPerPx:u,regions:p,scaleOpts:g,height:x,config:h,ticks:w,displayCrossHatches:S,offset:d=0,colorCallback:b}=o,C=p[0],M=(C.end-C.start)/u,v=x-2*d,y=(0,r.readConfObject)(h,"filled"),k=(0,r.readConfObject)(h,"clipColor"),P=(0,r.readConfObject)(h,"summaryScoreMode"),R=(0,r.readConfObject)(h,"bicolorPivotValue"),T=(0,r.readConfObject)(h,"minSize"),j=(0,s.getScale)({...g,range:[0,v]}),O=(0,s.getOrigin)(g.scaleType),W=j.domain(),H=W[0],_=W[1],I=e=>(0,n.clamp)(v-(j(e)||0),0,v)+d,N=e=>y?(e=>I(O)-I(e))(e):Math.max(T,1);let E=!1,F=Number.NEGATIVE_INFINITY;const V=[],Y=H<R&&_>R;let z=performance.now();if("whiskers"===P){let o,r;z=performance.now();for(const f of t.values()){performance.now()-z>400&&((0,c.SW)(),z=performance.now());const[t,m]=(0,n.featureSpanPx)(f,C,u);if(f.get("summary")){const n=Math.max(m-t+i,T),c=f.get("maxScore"),u=b(f,c),p=Y?u:u===o?r:r=l((0,a.M)(u),.4).toHex();(0,s.fillRectCtx)(t,I(c),n,N(c),e,p),o=u}}r=void 0,o=void 0,z=performance.now();for(const l of t.values()){performance.now()-z>400&&((0,c.SW)(),z=performance.now());const[t,f]=(0,n.featureSpanPx)(l,C,u),m=l.get("score"),p=l.get("maxScore"),g=l.get("minScore"),x=l.get("summary"),h=b(l,m),w=Y&&x?h===o?r:r=(0,a.M)(b(l,p)).mix((0,a.M)(b(l,g))).toString():h,S=Math.max(f-t+i,T);Math.floor(t)!==Math.floor(F)&&(V.push(l),F=t),E=E||m<H||m>_,(0,s.fillRectCtx)(t,I(m),S,N(m),e,w),o=h}r=void 0,o=void 0,z=performance.now();for(const l of t.values()){performance.now()-z>400&&((0,c.SW)(),z=performance.now());const[t,m]=(0,n.featureSpanPx)(l,C,u);if(l.get("summary")){const n=l.get("minScore"),c=b(l,n),u=Math.max(m-t+i,T),p=Y?c:c===o?r:r=f((0,a.M)(c),.4).toHex();(0,s.fillRectCtx)(t,I(n),u,N(n),e,p),o=c}}}else{z=performance.now();for(const o of t.values()){performance.now()-z>400&&((0,c.SW)(),z=performance.now());const[t,r]=(0,n.featureSpanPx)(o,C,u);Math.floor(t)!==Math.floor(F)&&(V.push(o),F=t);const a=o.get("score"),l=b(o,a);E=E||a<H||a>_;const f=Math.max(r-t+i,T);if("max"===P){const r=o.get("summary")?o.get("maxScore"):a;(0,s.fillRectCtx)(t,I(r),f,N(r),e,l)}else if("min"===P){const r=o.get("summary")?o.get("minScore"):a;(0,s.fillRectCtx)(t,I(r),f,N(r),e,l)}else(0,s.fillRectCtx)(t,I(a),f,N(a),e,l)}}if(e.save(),E){e.fillStyle=k,z=performance.now();for(const o of t.values()){performance.now()-z>400&&((0,c.SW)(),z=performance.now());const[t,r]=(0,n.featureSpanPx)(o,C,u),a=r-t+i,l=o.get("score");l>_?(0,s.fillRectCtx)(t,d,a,m,e):l<H&&"log"!==g.scaleType&&(0,s.fillRectCtx)(t,x,a,m,e)}}return e.restore(),S&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.5)",w.values.forEach((o=>{e.beginPath(),e.moveTo(0,Math.round(I(o))),e.lineTo(M,Math.round(I(o))),e.stroke()}))),{reducedFeatures:V}}}}]);
//# sourceMappingURL=5524.afcd1a5c.chunk.js.map