"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4345],{53740:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(7552),o=n(68446),a=n(99546),i=n(68584),s=n(72241),l=n(9502);function c(e,t){const n=t?(0,l.h)(t):void 0,r=e.get("start");let o=e.get("end");const a=e.get("strand"),i=e.get("mate"),s=e.get("refName");let c,m=0,u=0,f=0,g=0;if(["<TRA","<DEL","<INV","<INS","<DUP","<CNV"].some((e=>t?.startsWith(e)))){const t=e.get("INFO"),n=t?.END?.[0]??o;c=t?.CHR2?.[0]??s,m=n,u=n-1,o=r+1}else if(n?.MatePosition){const e=n.MatePosition.split(":");g="left"===n.MateDirection?1:-1,f="left"===n.Join?-1:1,m=+e[1],u=+e[1]-1,c=e[0]}return{k1:{refName:s,start:r,end:o,strand:a,mateDirection:g},k2:i??{refName:c||"unknown",end:m,start:u,mateDirection:f}}}function m(e,t){const{k1:n,k2:r}=c(e,t);return[e.get("name"),e.get("id"),(0,a.assembleLocString)(n),(0,a.assembleLocString)(r),e.get("INFO")?.SVTYPE,t].filter((e=>!!e)).join(" - ")}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(null,arguments)}const f=(0,o.observer)((function({model:e,feature:t,alt:n,assembly:o,view:l}){const[f,g]=(0,r.useState)(!1),{height:d}=e,{k1:h,k2:k}=c(t,n),b=(0,r.useRef)(null),p=(0,i.getConf)(e,"color",{feature:t,alt:n}),v=o.getCanonicalRefName(h.refName)||h.refName,E=o.getCanonicalRefName(k.refName)||k.refName,w=h.start,N=k.start,P=l.bpToPx({refName:v,coord:w})?.offsetPx,x=l.bpToPx({refName:E,coord:N})?.offsetPx;if(void 0!==P&&void 0!==x){const o=(x-P)/2,i=Math.abs(o),c=Math.min(d,i),v=P-l.offsetPx,E=x-l.offsetPx,w=f?"black":p,N=3;return i>1?r.createElement(r.Fragment,null,r.createElement("path",u({d:`M ${v} 0 C ${v} ${c}, ${E} ${c}, ${E} 0`,ref:b},(0,a.getStrokeProps)(w),{strokeWidth:N,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},fill:"none",pointerEvents:"stroke"})),h.mateDirection?r.createElement("line",u({},(0,a.getStrokeProps)(w),{strokeWidth:N,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},x1:v,x2:v+20*h.mateDirection,y1:1.5,y2:1.5})):null,k.mateDirection?r.createElement("line",u({},(0,a.getStrokeProps)(w),{strokeWidth:N,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},x1:E,x2:E+20*k.mateDirection,y1:1.5,y2:1.5})):null,f?r.createElement(s.A,{contents:m(t,n)}):null):null}return null})),g=(0,o.observer)((function({model:e,exportSVG:t,children:n}){const{height:o}=e,i=(0,a.getContainingView)(e),s=Math.round(i.dynamicBlocks.totalWidthPx);return t?n:r.createElement("svg",{width:s,height:o},n)})),d=(0,o.observer)((function({model:e,exportSVG:t}){const n=(0,a.getContainingView)(e),o=(0,a.getSession)(e),{assemblyManager:i}=o,{features:s}=e,l=i.get(n.assemblyNames[0]);return l?r.createElement(g,{model:e,exportSVG:t},s?.map((t=>{const a=t.get("ALT");return a?.map((a=>r.createElement(f,{key:`${t.id()}-${a}`,session:o,feature:t,alt:a,view:n,model:e,assembly:l})))??r.createElement(f,{key:t.id(),session:o,feature:t,view:n,model:e,assembly:l})}))):null}))},44345:(e,t,n)=>{n.d(t,{renderArcSvg:()=>i});var r=n(7552),o=n(99546),a=n(53740);async function i(e,t){await(0,o.when)((()=>!e.loading));const n=(0,o.getContainingView)(e).dynamicBlocks.totalWidthPx,i=e.height,s=`arc-${e.id}`;return r.createElement(r.Fragment,null,r.createElement("defs",null,r.createElement("clipPath",{id:s},r.createElement("rect",{x:0,y:0,width:n,height:i}))),r.createElement("g",{clipPath:`url(#${s})`},r.createElement(a.A,{model:e,exportSVG:!0})))}}}]);
//# sourceMappingURL=4345.383a71d1.chunk.js.map