"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[6390],{26390:(e,t,n)=>{n.d(t,{drawFeats:()=>f});var o=n(90872),r=n(69349),s=n(41814),i=n(89327);function a(e){return 2*Math.random()*e-e}function l(e,t,n,o){e.strokeStyle=o,e.beginPath(),e.moveTo(t,0),e.lineTo(t,n),e.stroke()}function f(e,t,n,f){const{chainData:d,colorBy:c,drawInter:g,drawLongRange:h,lineWidthSetting:u,jitterVal:v}=e;if(!d)return;const m=(0,o.getContainingView)(e),{assemblyManager:k}=(0,o.getSession)(e),{chains:b,stats:S}=d,y=(0,i.F)(d),P=k.get(m.assemblyNames[0]),p=(null===c||void 0===c?void 0:c.type)||"insertSizeAndOrientation";if(P){t.lineWidth=u;for(const e of b)if(1===e.length&&h){const t=e[0];if(!y||8&t.flags){const e=[t,...(0,s.featurizeSA)(t.SA,t.id,t.strand,t.name)].sort(((e,t)=>e.clipPos-t.clipPos));for(let t=0;t<e.length-1;t++){w(e[t],e[t+1],P,!0)}}else{w(t,{refName:t.next_ref||"",start:t.next_pos||0,end:t.next_pos||0,strand:t.strand},P,!0)}}else{const t=y?e.filter((e=>!(2048&e.flags)&&!(8&e.flags))):e.sort(((e,t)=>e.clipPos-t.clipPos)).filter((e=>!(256&e.flags)));for(let e=0;e<t.length-1;e++)w(t[e],t[e+1],P,!1)}}function w(e,n,o,s){var i,d;const c=e.strand,h=n.strand,u=-1===h,k=-1===c?e.start:e.end,b=y?u?n.start:n.end:u?n.end:n.start,P=o.getCanonicalRefName(e.refName)||e.refName,w=o.getCanonicalRefName(n.refName)||n.refName,x=null===(i=m.bpToPx({refName:P,coord:k}))||void 0===i?void 0:i.offsetPx,N=null===(d=m.bpToPx({refName:w,coord:b}))||void 0===d?void 0:d.offsetPx;if(void 0!==x&&void 0!==N){const o=(N-x)/2,i=Math.abs(o),d=x-m.offsetPx,g=N-m.offsetPx,u=i>1e4;if(s&&u?(t.moveTo(d,0),t.beginPath()):(t.beginPath(),t.moveTo(d,0)),s&&u)t.strokeStyle="red";else if(y)if("insertSizeAndOrientation"===p)t.strokeStyle=(0,r.k5)(e,n,S)[0];else if("orientation"===p)t.strokeStyle=(0,r.uE)(e)[0];else if("insertSize"===p){var T;t.strokeStyle=(null===(T=(0,r.Wh)(e,n,S))||void 0===T?void 0:T[0])||"grey"}else"gradient"===p&&(t.strokeStyle="hsl(".concat(10*Math.log10(i),",50%,50%)"));else"orientation"===p||"insertSizeAndOrientation"===p?t.strokeStyle=-1===c&&1===h?"navy":1===c&&-1===h?"green":"grey":"gradient"===p&&(t.strokeStyle="hsl(".concat(10*Math.log10(i),",50%,50%)"));const k=d+2*o,b=Math.min(f+a(v),i);s?i>1e5?(l(t,d+a(v),f,"red"),l(t,g+a(v),f,"red")):u?(t.arc(d+o+a(v),0,i,0,Math.PI),t.stroke()):(t.bezierCurveTo(d+a(v),b,k,b,k+a(v),0),t.stroke()):(t.bezierCurveTo(d+a(v),b,k,b,k+a(v),0),t.stroke())}else x&&g&&l(t,x-m.offsetPx,f,"purple")}}},89327:(e,t,n)=>{function o(e){for(const t of e.chains.values())if(1&t[0].flags)return!0;return!1}n.d(t,{F:()=>o})}}]);
//# sourceMappingURL=6390.4723db34.chunk.js.map