jbrowse-plugin-graphgenomeviewer 4.0.14 → 4.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-YWJ3RWYB.js";import"./chunk-JXAJ7YLT.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-FCWXYIFC.js";import"./chunk-5E7TVPCI.js";import{B as L}from"./chunk-IUIIYSGF.js";import"./chunk-EFVAQ2KM.js";import"./chunk-KULNKXPT.js";import{a as s,b as g,c as v,d as G,e as B}from"./chunk-XEJ47DLD.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(G(),1),n=a(v(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(G(),1),i=a(v(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
1
+ import{a as x}from"./chunk-UQN2NWT5.js";import"./chunk-JXAJ7YLT.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-FCWXYIFC.js";import"./chunk-5E7TVPCI.js";import{B as L}from"./chunk-IUIIYSGF.js";import"./chunk-EFVAQ2KM.js";import"./chunk-KULNKXPT.js";import{a as s,b as g,c as v,d as G,e as B}from"./chunk-XEJ47DLD.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(G(),1),n=a(v(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(G(),1),i=a(v(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
2
2
  S 1 ACGT
3
3
  S 2 GGCC
4
4
  S 3 TTAA
@@ -7,4 +7,4 @@ L 1 + 2 + 0M
7
7
  L 1 + 3 + 0M
8
8
  L 2 + 4 + 0M
9
9
  L 3 + 4 + 0M`,z=(0,E.makeStyles)()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),R=(0,w.observer)(function({model:e}){let{classes:r}=z(),[d,T]=(0,M.useState)("");function y(){d.trim()&&e.loadGFAFromLocation({uri:d,locationType:"UriLocation"})}function A(p){let c=p.target.files?.[0];c&&c.text().then(f=>e.loadGFA(f,c.name)).catch(f=>{e.setError(f)})}return(0,t.jsxs)(i.Paper,{className:r.paper,children:[(0,t.jsx)("div",{className:r.header,children:(0,t.jsx)(i.Typography,{variant:"h6",children:"Load a GFA graph"})}),(0,t.jsxs)("div",{className:r.column,children:[(0,t.jsxs)("div",{className:r.rowCenter,children:[(0,t.jsxs)(i.Button,{variant:"outlined",component:"label",size:"small",children:["Choose file",(0,t.jsx)("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:p=>{A(p)}})]}),(0,t.jsx)(i.Typography,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),(0,t.jsxs)("div",{className:r.rowEnd,children:[(0,t.jsx)(i.TextField,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:d,onChange:p=>{T(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&y()},className:r.flex1}),(0,t.jsx)(i.Button,{variant:"contained",onClick:()=>{y()},disabled:!d.trim(),children:"Open"})]})]}),(0,t.jsx)("div",{className:r.footer,children:(0,t.jsx)(i.Button,{size:"small",onClick:()=>{e.loadGFA(k,"Example graph")},children:"Load 4-node example"})}),e.error?(0,t.jsx)(N.ErrorBanner,{error:e.error}):null]})}),F=R;var l=a(s(),1),U=(0,S.observer)(function({model:e}){return e.hasGraph?(0,l.jsx)(x,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?(0,l.jsx)(h,{model:e}):(0,l.jsxs)(l.Fragment,{children:[e.isLoading?(0,l.jsx)(h,{model:e}):null,(0,l.jsx)("div",{hidden:e.isLoading,children:(0,l.jsx)(F,{model:e})})]})}),O=U;export{O as default};
10
- //# sourceMappingURL=GraphGenomeView-35HMVXRP.js.map
10
+ //# sourceMappingURL=GraphGenomeView-5SMMNFD4.js.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-YWJ3RWYB.js";import"./chunk-JXAJ7YLT.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-FCWXYIFC.js";import"./chunk-5E7TVPCI.js";import"./chunk-IUIIYSGF.js";import"./chunk-EFVAQ2KM.js";import"./chunk-KULNKXPT.js";import{a as e,b as d}from"./chunk-XEJ47DLD.js";import{a as h,b as t}from"./chunk-FY3BTKY4.js";var p=h((l,o)=>{o.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var s=t(p(),1),n=t(d(),1);var r=t(e(),1),y=(0,n.observer)(function({model:a}){return(0,r.jsx)(s.DisplayStatusChrome,{model:a,phase:a.displayPhase,drawn:a.painted&&a.geometryPainted,testid:"linear-graph-display","data-layout":a.chosenLayoutMode,"data-cut-tier":a.cutTier,"data-recuts":a.recuts,"data-node-count":a.hasGraph?a.nodeCount:void 0,"data-loading":a.isLoading?"":void 0,style:{width:a.paneWidth,height:a.height,overflow:"hidden"},children:(0,r.jsx)(i,{model:a,ownChrome:!1})})}),c=y;export{c as default};
2
- //# sourceMappingURL=LinearGraphDisplay-3M3LNC5H.js.map
1
+ import{a as i}from"./chunk-UQN2NWT5.js";import"./chunk-JXAJ7YLT.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-FCWXYIFC.js";import"./chunk-5E7TVPCI.js";import"./chunk-IUIIYSGF.js";import"./chunk-EFVAQ2KM.js";import"./chunk-KULNKXPT.js";import{a as e,b as d}from"./chunk-XEJ47DLD.js";import{a as h,b as t}from"./chunk-FY3BTKY4.js";var p=h((l,o)=>{o.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var s=t(p(),1),n=t(d(),1);var r=t(e(),1),y=(0,n.observer)(function({model:a}){return(0,r.jsx)(s.DisplayStatusChrome,{model:a,phase:a.displayPhase,drawn:a.painted&&a.geometryPainted,testid:"linear-graph-display","data-layout":a.chosenLayoutMode,"data-cut-tier":a.cutTier,"data-recuts":a.recuts,"data-node-count":a.hasGraph?a.nodeCount:void 0,"data-loading":a.isLoading?"":void 0,style:{width:a.paneWidth,height:a.height,overflow:"hidden"},children:(0,r.jsx)(i,{model:a,ownChrome:!1})})}),c=y;export{c as default};
2
+ //# sourceMappingURL=LinearGraphDisplay-BEOEIUGA.js.map
@@ -0,0 +1,4 @@
1
+ import{C as at,D as it,F as lt,J as be,K as ct,L as Ne,M as Ge,U as ut,X as dt,Y as pt,a as A,aa as ht,b as Je,c as lo,ca as ft,da as mt,f as V,fa as gt,g as tt,j as nt,k as ot,l as Be,la as bt,m as fe,ma as _e,oa as yt,t as me,ta as vt,u as st,v as ge,va as xt,wa as St}from"./chunk-JXAJ7YLT.js";import{b as et}from"./chunk-UQEPPJEO.js";import{a as He}from"./chunk-FCWXYIFC.js";import{a as Mt}from"./chunk-5E7TVPCI.js";import{B as se,f as rt}from"./chunk-IUIIYSGF.js";import{a as k,b as $,c as te,d as Qe,e as pe}from"./chunk-XEJ47DLD.js";import{a as je,b as p}from"./chunk-FY3BTKY4.js";var Gt=je((qr,Nt)=>{Nt.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var eo=je((ca,Qn)=>{Qn.exports=JBrowseExports["@jbrowse/render-core/renderingBackendBase"]});var Y=p(pe(),1);var co=50;function wt(r,e){return e>0?Math.max(1,r/e):co}function uo(r){let e=new Set,t=1/0,n=-1/0;for(let o of r)e.add(o.minY),t=Math.min(t,o.minY),n=Math.max(n,o.minY);return e.size>1?(n-t)/(e.size-1):void 0}function po(r,e,t){let n=wt(e,r.length);return{x:n,y:t>0?wt(t,r.length):uo(r)??n}}function kt(r,e,t,n){return r===void 0?po(e,t,n):typeof r=="number"?{x:r,y:r}:r}function ho(r,e,t){let n=r.get(e);n||(n=new Map,r.set(e,n));let o=n.get(t);return o||(o=[],n.set(t,o)),o}function Ct(r,e,t,n,o,s,a){let i=Math.floor(t/e.x),l=Math.floor(o/e.x),c=Math.floor(n/e.y),d=Math.floor(s/e.y);for(let u=i;u<=l;u++)for(let g=c;g<=d;g++)ho(r,u,g).push(a)}function Rt(r,e,t,n,o,s){let a=Math.floor((t-o)/e.x),i=Math.floor((t+o)/e.x),l=Math.floor((n-s)/e.y),c=Math.floor((n+s)/e.y),d=[],u=new Set;for(let g=a;g<=i;g++){let b=r.get(g);if(b)for(let x=l;x<=c;x++){let v=b.get(x);if(v)for(let m of v)u.has(m)||(u.add(m),d.push(m))}}return d}var ye=class{constructor(e,t){this.cells=new Map;let n=[],o=0,s=0;for(let[a,i]of Object.entries(e))for(let l=0;l<i.length-1;l++){let c=i[l],d=i[l+1],u=Math.min(c.x,d.x),g=Math.min(c.y,d.y),b=Math.max(c.x,d.x),x=Math.max(c.y,d.y);o+=b-u,s+=x-g,n.push({entry:{nodeId:a,segmentIdx:l},minX:u,minY:g,maxX:b,maxY:x})}this.cellSize=kt(t,n,o,s);for(let a of n)Ct(this.cells,this.cellSize,a.minX,a.minY,a.maxX,a.maxY,a.entry)}query(e,t,n,o=n){return Rt(this.cells,this.cellSize,e,t,n,o)}},ve=class{constructor(e,t,n,o,s,a,i=0){this.cells=new Map;this.edgeCurves=ct(e,t,o,a,i);let l=[],c=0,d=0;for(let u=0;u<t.edges.length;u++){let g=t.edges[u],b=e[g.from],x=e[g.to],v=this.edgeCurves.get(u);if(b?.length&&x?.length&&v){let{minX:m,minY:R,maxX:T,maxY:N}=nt(v),H=g.pathIds?.length??0;if(n&&H>0){let L=0,E=0;for(let _ of fe(b,x,H,o))L=Math.max(L,Math.abs(_.x)),E=Math.max(E,Math.abs(_.y));m-=L,R-=E,T+=L,N+=E}c+=T-m,d+=N-R,l.push({ei:u,minX:m,minY:R,maxX:T,maxY:N})}}this.cellSize=kt(s,l,c,d);for(let u of l)Ct(this.cells,this.cellSize,u.minX,u.minY,u.maxX,u.maxY,u.ei)}getCurves(e){return this.edgeCurves.get(e)}query(e,t,n,o=n){return Rt(this.cells,this.cellSize,e,t,n,o)}};function Pt(r,e,t,n,o,s){let a=o-t,i=s-n,l=a*a+i*i;if(l===0)return Math.hypot(r-t,e-n);let c=Math.max(0,Math.min(1,((r-t)*a+(e-n)*i)/l));return Math.hypot(r-(t+c*a),e-(n+c*i))}function fo(r,e,t,n,o,s,a,i,l,c){let d=1/0,u=20,g=t,b=n;for(let x=1;x<=u;x++){let v=x/u,m=1-v,R=m*m*m*t+3*m*m*v*o+3*m*v*v*a+v*v*v*l,T=m*m*m*n+3*m*m*v*s+3*m*v*v*i+v*v*v*c;d=Math.min(d,Pt(r,e,g,b,R,T)),g=R,b=T}return d}function mo(r,e,t){return fo(r,e,t.x0,t.y0,t.cx0,t.cy0,t.cx1,t.cy1,t.x1,t.y1)}function Lt(r,e,t,n=1){let o=1/0;for(let s of t){let a=mo(r,e,n===1?s:{x0:s.x0,y0:s.y0*n,cx0:s.cx0,cy0:s.cy0*n,cx1:s.cx1,cy1:s.cy1*n,x1:s.x1,y1:s.y1*n});a<o&&(o=a)}return o}var Et=new WeakMap;function go(r,e){let t=Et.get(r);if(t?.version===e)return t.index;let n=new ye(r);return Et.set(r,{version:e,index:n}),n}var It=new WeakMap;function bo(r,e,t,n,o,s){let a=It.get(r);if(a?.graph===e&&a.drawPaths===t&&a.scaleX===n.scaleX&&a.scaleY===n.scaleY&&a.version===o&&a.deletions===s)return a.index;let i=new ve(r,e,t,n,void 0,s,o);return It.set(r,{graph:e,drawPaths:t,scaleX:n.scaleX,scaleY:n.scaleY,version:o,index:i,deletions:s}),i}var yo=5;function Tt(r,e,t,n,o=0,s){let a=Be(n),i=go(r,o),l=b=>Math.max(yo,b)/n.scaleX,c=l(s?.maxHalfWidthPx??0),d=i.query(e,t,c,c/a),u=null,g=1/0;for(let{nodeId:b,segmentIdx:x}of d){let v=r[b],m=Pt(e,t*a,v[x].x,v[x].y*a,v[x+1].x,v[x+1].y*a);m<g&&m<l(s?.halfWidthPx(b)??0)&&(g=m,u=b)}return u}function Ht(r,e,t,n,o,s,a=0,i,l){let c=Be(o),d=10/o.scaleX,u=bo(r,e,s,o,a,i),g=u.query(t,n,d,d/c),b=null,x=d;for(let v of g){let m=e.edges[v],R=r[m.from],T=r[m.to];if(!R?.length||!T?.length||l?.has(v))continue;let N=m.pathIds?.length??0,H=u.getCurves(v);if(!H)continue;let L;if(!s||N===0)L=Lt(t,n*c,H,c);else{let E=1/0;for(let _ of fe(R,T,N,o)){let h=_.x===0&&_.y===0?H:ot(H,_.x,_.y),M=Lt(t,n*c,h,c);M<E&&(E=M)}L=E}L<x&&(x=L,b=v)}return b}function Bt(r){let e=r.deltaY*(r.deltaMode===1?40:r.deltaMode===2?800:1),t=(r.ctrlKey?10:1)*e/100;return 1.1**-Math.max(-2,Math.min(2,t))}var re=p(Qe(),1),Te=p(He(),1),so=p(Gt(),1);var _t=p(k(),1),$t=(0,A.createSvgIcon)((0,_t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var F=p($(),1);var $e=p($(),1),X=p(k(),1),vo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},xo=(0,$e.observer)(function({model:e}){let{bubbleHalos:t,walkHighlight:n,hoveredBubble:o}=e;if(t.length===0)return null;let{scaleX:s,scaleY:a,translateX:i,translateY:l,paneWidth:c,canvasHeight:d}=e,u=e.contigThickness*st,g=b=>n!==void 0&&!b.nodeIds.some(x=>n.nodeIds.has(x));return(0,X.jsx)("svg",{style:vo,width:c,height:d,"data-testid":"graph-bubble-halos",children:(0,X.jsx)("g",{transform:`translate(${i} ${l}) scale(${s} ${a})`,children:t.filter(b=>!b.whole).map(b=>(0,X.jsx)("path",{d:b.path,fill:"none",stroke:V[b.kind],strokeOpacity:o&&et(b.bubble,o)?.45:g(b)?.06:.22,strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${b.bubble.start}-${b.bubble.end}`))})})}),zt=xo,So={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Mo={display:"flex",alignItems:"center",gap:5};function wo({color:r}){return(0,X.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,X.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:r,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var Ot=(0,$e.observer)(function({model:e}){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=V[n.kind],s=t.get(o)??new Set;s.add(tt[n.kind]),t.set(o,s)}return t.size>0?(0,X.jsx)("div",{style:So,"data-testid":"graph-halo-legend",children:[...t].map(([n,o])=>(0,X.jsxs)("div",{style:Mo,children:[(0,X.jsx)(wo,{color:n}),(0,X.jsxs)("span",{children:["bubble: ",[...o].join(", ")]})]},n))}):null});var Xt=p(He(),1),Yt=p(te(),1),Wt=p($(),1),z=p(k(),1),ko={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Co={position:"absolute",left:8,top:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},Ro=10;function At(r,e){let t=12+26*Math.log10(1+r);return Math.min(t,e)}var Lo=(0,Wt.observer)(function({model:e}){let{bubbleGlyphs:t,poppedFrom:n}=e,o=n?(0,z.jsxs)(Yt.Button,{size:"small",variant:"outlined",style:Co,"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null;if(t.length===0)return o;let{scaleX:s,translateX:a,translateY:i,paneWidth:l,canvasHeight:c}=e,d=i,u=m=>m*s+a,g=e.overlayLabels.glyphs,b=Math.max(0,...g.map(m=>m.y+4)),x=Math.max(24,d-b-14),v=[...t].sort((m,R)=>R.bubble.end-R.bubble.start-(m.bubble.end-m.bubble.start));return(0,z.jsxs)(z.Fragment,{children:[o,(0,z.jsxs)("svg",{style:ko,width:l,height:c,"data-testid":"graph-bubble-overlay",children:[v.map(({bubble:m,kind:R,label:T})=>{let N=u(m.start),H=u(m.end),L=Math.max(H-N,Ro),E=(N+H)/2,_=At(m.longestAlleleLength,x),h=V[R],w=m.end-m.start-m.shortestAlleleLength,y=w>0?6+10*Math.log10(1+w):0,I=`${m.start}-${m.end}`;return(0,z.jsxs)("g",{children:[(0,z.jsx)("path",{d:`M${E-L/2},${d} C${E-L/2},${d-_} ${E+L/2},${d-_} ${E+L/2},${d} Z`,fill:h,fillOpacity:.18,stroke:h,strokeWidth:2,style:{pointerEvents:"auto",cursor:"pointer"},onClick:()=>{e.popBubble(m)},onMouseEnter:()=>{e.setHoveredBubble(m)},onMouseLeave:()=>{(0,Xt.isAlive)(e)&&e.setHoveredBubble(null)},children:(0,z.jsx)("title",{children:`${T}
2
+ ${m.segmentCount} segments \xB7 click to open`})}),y>0?(0,z.jsx)("path",{d:`M${E-L/2},${d} C${E-L/2},${d+y} ${E+L/2},${d+y} ${E+L/2},${d}`,fill:"none",stroke:h,strokeWidth:2,strokeDasharray:"4 3"}):null]},I)}),g.map(({item:{glyph:m,glyphX:R},x:T,y:N})=>{let H=V[m.kind],L=d-At(m.bubble.longestAlleleLength,x);return(0,z.jsxs)("g",{children:[(0,z.jsx)("line",{x1:R,x2:R,y1:N+4,y2:L-2,stroke:H,strokeWidth:.7,strokeOpacity:.5}),(0,z.jsx)("text",{x:T,y:N,fontSize:11,fontFamily:"sans-serif",fill:H,textAnchor:"middle",children:m.label})]},`${m.bubble.start}-${m.bubble.end}-label`)})]})]})}),Dt=Lo;var Ft=p($(),1),Se=p(k(),1),Eo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Me="#1c1c22",Io=(0,Ft.observer)(function({model:e}){let{genePins:t}=e;if(t.length===0)return null;let{scaleX:n,scaleY:o,translateX:s,translateY:a,paneWidth:i,canvasHeight:l,contigThickness:c}=e;return(0,Se.jsx)("svg",{style:Eo,width:i,height:l,"data-testid":"graph-gene-pins",children:(0,Se.jsx)("g",{transform:`translate(${s} ${a}) scale(${n} ${o})`,children:t.map(d=>d.exons?(0,Se.jsx)("path",{d:d.exons,fill:"none",stroke:Me,strokeOpacity:.9,strokeWidth:c*.55,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},`${d.gene.name}-${d.gene.start}`):null)})})}),Vt=Io;var Ut=p(k(),1),Zt=(0,A.createSvgIcon)((0,Ut.jsx)("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var ze=p(k(),1),qt=(0,A.createSvgIcon)([(0,ze.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),(0,ze.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Kt=p(k(),1),jt=(0,A.createSvgIcon)((0,Kt.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var D=p(te(),1),Ye=p($(),1),Mn=p(se(),1);var q=p(te(),1),Jt=p($(),1),Qt=p(se(),1),ae=p(k(),1),Po=(0,Qt.makeStyles)()({formControl:{minWidth:100}}),To=(0,Jt.observer)(function({model:e}){let{classes:t}=Po();return(0,ae.jsxs)(q.FormControl,{size:"small",className:t.formControl,children:[(0,ae.jsx)(q.InputLabel,{children:"Color"}),(0,ae.jsx)(q.Select,{value:e.chosenColorScheme,label:"Color",onChange:n=>{e.setColorScheme(n.target.value)},children:rt.map(({value:n,label:o})=>(0,ae.jsx)(q.MenuItem,{value:n,children:o},n))})]})}),en=To;var Ae=p(te(),1),Xe=p($(),1),tn=p(se(),1),ie=p(k(),1),nn=(0,tn.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Oe(r){return r===void 0?"\u2013":`${Math.round(r)}ms`}var Ho=(0,Xe.observer)(function({model:e}){let{classes:t}=nn(),{lastFetchMs:n,lastLayoutMs:o,lastGeometryMs:s}=e,a=n!==void 0||o!==void 0||s!==void 0;return e.showPerf&&a?(0,ie.jsxs)(Ae.Typography,{variant:"caption",className:t.perf,"data-testid":"graph-perf-stats",children:["fetch ",Oe(n)," \xB7 layout ",Oe(o)," \xB7 geom"," ",Oe(s)]}):null}),Bo=(0,Xe.observer)(function({model:e}){let{classes:t}=nn();return(0,ie.jsxs)("div",{className:t.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[(0,ie.jsxs)(Ae.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ie.jsx)(Ho,{model:e})]})}),on=Bo;var W=p(te(),1),rn=p($(),1),sn=p(se(),1),K=p(k(),1),No=(0,sn.makeStyles)()({formControl:{minWidth:150}}),Go=(0,rn.observer)(function({model:e}){let{classes:t}=No(),{graph:n}=e;return(0,K.jsxs)(W.FormControl,{size:"small",className:t.formControl,children:[(0,K.jsx)(W.InputLabel,{children:"Layout"}),(0,K.jsx)(W.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:o=>{e.switchLayout(o.target.value)},children:lt.map(({value:o,label:s,description:a,available:i})=>(0,K.jsx)(W.MenuItem,{value:o,disabled:n?!i(n):!1,children:(0,K.jsx)(W.Tooltip,{title:a,placement:"right",children:(0,K.jsx)("span",{children:s})})},o))})]})}),an=Go;var U=p(te(),1),ln=p($(),1),cn=p(se(),1),j=p(k(),1),_o=(0,cn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),$o=(0,ln.observer)(function({model:e}){let{classes:t}=_o(),{repeatChoices:n}=e;if(e.chosenLayoutMode!=="walkrows"||n.length===0)return null;let o=new Set(n.map(s=>s.key));return(0,j.jsxs)(U.FormControl,{size:"small",className:t.formControl,children:[(0,j.jsx)(U.InputLabel,{children:"Repeat"}),(0,j.jsxs)(U.Select,{value:o.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:s=>{e.setRepeatKey(s.target.value)},children:[(0,j.jsx)(U.MenuItem,{value:"",children:(0,j.jsx)("em",{children:"Whole window"})}),n.map(({key:s,name:a,unit:i})=>(0,j.jsxs)(U.MenuItem,{value:s,children:[a," \xB7 ",i.toLocaleString()," bp unit"]},s))]})]})}),un=$o;var mn=p(pe(),1),gn=p(Qe(),1);var dn=p(k(),1),pn=(0,A.createSvgIcon)((0,dn.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var hn=p(k(),1),fn=(0,A.createSvgIcon)((0,hn.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var bn=p($(),1);var J=p(k(),1),zo=(0,bn.observer)(function({model:e}){let[t,n]=(0,mn.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(gn.CascadingMenuButton,{size:"small",menuItems:[{type:"checkbox",label:"Linear layout",checked:e.linearLayout,onClick:()=>{e.setLinearLayout(!e.linearLayout),e.recomputeLayout()}},{type:"checkbox",label:"Show deletion edges",checked:e.showDeletionEdges,onClick:()=>{e.setShowDeletionEdges(!e.showDeletionEdges)}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:St,onClick:()=>{n(!0)}},{type:"divider"},{label:"Return to import form",icon:pn,onClick:()=>{e.clearGraph()}}],children:(0,J.jsx)(fn,{})}),(0,J.jsx)(Mt,{model:e,open:t,onClose:()=>{n(!1)}})]})}),yn=zo;var Z=p(te(),1),vn=p($(),1),xn=p(se(),1),Q=p(k(),1),Oo=(0,xn.makeStyles)()({formControl:{minWidth:130,maxWidth:220}}),Ao=(0,vn.observer)(function({model:e}){let{classes:t}=Oo(),{walkChoices:n}=e;if(n.length===0)return null;let o=new Set(n.map(s=>s.name));return(0,Q.jsxs)(Z.FormControl,{size:"small",className:t.formControl,children:[(0,Q.jsx)(Z.InputLabel,{children:"Walk"}),(0,Q.jsxs)(Z.Select,{value:o.has(e.highlightedPath)?e.highlightedPath:"",label:"Walk","data-testid":"graph-walk-select",onChange:s=>{e.setHighlightedPath(s.target.value)},children:[(0,Q.jsx)(Z.MenuItem,{value:"",children:(0,Q.jsx)("em",{children:"None"})}),n.map(({name:s,label:a})=>(0,Q.jsx)(Z.MenuItem,{value:s,children:a},s))]})]})}),Sn=Ao;var P=p(k(),1),Xo=(0,Mn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Yo=(0,Ye.observer)(function({model:e}){return(0,P.jsx)(D.Typography,{variant:"body2",children:e.zoomPercent})}),Wo=(0,Ye.observer)(function({model:e}){let{classes:t}=Xo();return(0,P.jsxs)("div",{className:t.toolbar,children:[(0,P.jsx)(an,{model:e}),(0,P.jsx)(en,{model:e}),(0,P.jsx)(Sn,{model:e}),(0,P.jsx)(un,{model:e}),(0,P.jsx)(D.Tooltip,{title:"Zoom in",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,P.jsx)(qt,{})})}),(0,P.jsx)(D.Tooltip,{title:"Zoom out",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,P.jsx)(jt,{})})}),(0,P.jsx)(D.Tooltip,{title:"Zoom to fit",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,P.jsx)(Zt,{})})}),(0,P.jsx)(Yo,{model:e}),(0,P.jsx)(on,{model:e}),(0,P.jsx)(yn,{model:e})]})}),wn=Wo;var kn=p(He(),1),Cn=p($(),1);var ce=p(k(),1);function he({x:r,y:e,w:t,text:n,color:o,italic:s,small:a,dimmed:i,title:l,testId:c,onClick:d,onHover:u}){return(0,ce.jsxs)("g",{style:{pointerEvents:d||u?"auto":"none",cursor:d?"pointer":void 0,opacity:i?.35:1},"data-testid":c,onClick:d,onMouseEnter:()=>{u?.(!0)},onMouseLeave:()=>{u?.(!1)},children:[l?(0,ce.jsx)("title",{children:l}):null,(0,ce.jsx)("rect",{x:r-t/2,y:e-11-4+2,width:t,height:17,rx:3,fill:"rgba(255,255,255,0.85)",stroke:o,strokeWidth:a?.6:1}),(0,ce.jsx)("text",{x:r,y:e,fontSize:a?10:11,fontFamily:"sans-serif",fontStyle:s?"italic":void 0,fontWeight:s?600:void 0,fill:o,textAnchor:"middle",children:n})]})}var ee=p(k(),1),Do={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Fo=(0,Cn.observer)(function({model:e}){let{bubbles:t,genes:n,routes:o}=e.overlayLabels;if(t.length+n.length+o.length===0)return null;let{walkHighlight:s,scaleY:a,translateY:i,contigThickness:l}=e,c=u=>s!==void 0&&!u.nodeIds.some(g=>s.nodeIds.has(g)),d=u=>s!==void 0&&!u.route.walks.includes(s.name);return(0,ee.jsxs)("svg",{style:Do,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[n.map(({item:u,x:g,y:b,w:x,text:v})=>(0,ee.jsxs)("g",{children:[(0,ee.jsx)("line",{x1:g,x2:g,y1:b-11-2,y2:u.at.y*a+i+l/2,stroke:Me,strokeWidth:.8,strokeOpacity:.6}),(0,ee.jsx)(he,{x:g,y:b,w:x,text:v,color:Me,italic:!0,title:`${u.gene.name} ${u.gene.refName}:${u.gene.start.toLocaleString()}-${u.gene.end.toLocaleString()}${u.covered<.98?", runs past the cut":""}`,testId:"graph-gene-pin-label"})]},`${u.gene.name}-${u.gene.start}`)),o.map(({item:{halo:u,route:g},x:b,y:x,w:v,text:m})=>(0,ee.jsx)(he,{x:b,y:x,w:v,text:m,color:V[u.kind],small:!0,dimmed:d(g),title:`${g.route.walks.length} walk(s): ${g.route.walks.join(", ")}`,testId:"graph-route-label"},`${u.bubble.start}-${u.bubble.end}-${g.route.steps.join(",")}`)),t.map(({item:u,x:g,y:b,w:x,text:v})=>(0,ee.jsx)(he,{x:g,y:b,w:x,text:v,color:V[u.kind],dimmed:c(u),title:`${u.label}
3
+ ${u.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(u.bubble)},onHover:m=>{(0,kn.isAlive)(e)&&e.setHoveredBubble(m?u.bubble:null)}},`${u.bubble.start}-${u.bubble.end}`))]})}),Rn=Fo;var we=p(pe(),1);var En=p(_e(),1),In=p(Je(),1),We=p($(),1),G=p(k(),1),Vo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},Uo=(0,We.observer)(function({model:e}){let t=(0,we.useRef)(null),{referenceStripShown:n,paneWidth:o,canvasHeight:s}=e;return(0,we.useEffect)(()=>(0,In.autorun)(()=>{let a=t.current,i=e.referenceStripFrame,l=a?.getContext("2d");if(a&&l&&i&&e.referenceStripShown){let c=(0,En.getDpr)(),d=e.paneWidth,u=e.canvasHeight;a.width=Math.round(d*c),a.height=Math.round(u*c),l.setTransform(c,0,0,c,0,0),l.clearRect(0,0,d,u),ut(l,e.referenceStripBlocks,i,{width:d,lit:e.referenceStripLit,darkMode:e.darkMode})}}),[e]),(0,G.jsx)("canvas",{ref:t,"data-testid":n?"graph-reference-strip":void 0,style:{...Vo,width:o,height:s,display:n?"block":"none"}})}),Pn=Uo,Zo={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Ln={display:"flex",alignItems:"center",gap:5},Tn=18;function qo(){return(0,G.jsxs)("svg",{width:Tn,height:4,style:{flex:"none"},children:[(0,G.jsx)("rect",{x:0,y:0,width:6,height:4,fill:"hsl(0, 70%, 50%)"}),(0,G.jsx)("rect",{x:6,y:0,width:5,height:4,fill:"hsl(120, 70%, 50%)"}),(0,G.jsx)("rect",{x:11,y:0,width:7,height:4,fill:"hsl(240, 70%, 50%)"})]})}function Ko(){return(0,G.jsx)("svg",{width:Tn,height:8,style:{flex:"none"},children:(0,G.jsx)("path",{d:"M0,4 L5,0.5 L5,7.5 Z M18,4 L13,0.5 L13,7.5 Z",fill:"#18181c"})})}var Hn=(0,We.observer)(function({model:e}){return e.referenceStripShown?(0,G.jsxs)("div",{style:Zo,"data-testid":"graph-reference-strip-legend",children:[(0,G.jsxs)("div",{style:Ln,children:[(0,G.jsx)(qo,{}),(0,G.jsx)("span",{children:"top strip: reference segments at their bp"})]}),e.referenceStripOverhangs?(0,G.jsxs)("div",{style:Ln,children:[(0,G.jsx)(Ko,{}),(0,G.jsx)("span",{children:"the graph runs past this edge"})]}):null]}):null});var Ce=p(pe(),1);var Gn=p(_e(),1),_n=p(Je(),1),De=p($(),1),C=p(k(),1),jo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},Jo=(0,De.observer)(function({model:e}){let t=(0,Ce.useRef)(null),{tubeMapPicture:n,paneWidth:o,canvasHeight:s}=e;return(0,Ce.useEffect)(()=>(0,_n.autorun)(()=>{let a=t.current,i=e.tubeMapPicture,l=e.tubeMapFrame,c=a?.getContext("2d");if(a&&c&&i&&l){let d=(0,Gn.getDpr)(),u=e.paneWidth,g=e.canvasHeight;a.width=Math.round(u*d),a.height=Math.round(g*d),c.setTransform(d,0,0,d,0,0),c.clearRect(0,0,u,g);let b={...l,width:u,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode};gt(c,i,b),mt(c,e.tubeMapDeviations,b),ht(c,e.tubeMapConnectors,e.connectorZoneBottom,b);let{bounds:x}=i;bt(c,e.tubeMapGenes,b,l.y(x.minY)-2);let v=e.tubeMapRulerBoxes;v&&pt(c,v,b,l.y(x.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,C.jsx)("canvas",{ref:t,"data-testid":n?"graph-tube-map":void 0,style:{...jo,width:o,height:s,display:n?"block":"none"}})}),$n=Jo,Qo={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},er={display:"flex",alignItems:"center",gap:5},ke=18;function tr(){let r=[[.5,5.5],[8.5,ke-.5]];return(0,C.jsx)("svg",{width:ke,height:7,style:{flex:"none"},children:(0,C.jsx)("path",{d:r.map(([e,t])=>`M${e},6 V1.5 H${t} V6`).join(" "),fill:"none",stroke:dt(),strokeWidth:1})})}var Fe={width:ke,height:7,flex:"none"},nr={...Fe,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function or(){return(0,C.jsx)("div",{style:nr,children:(0,C.jsx)("div",{style:{width:2,backgroundColor:ft()}})})}function Bn({colors:r}){let e=100/r.length,t=r.map((n,o)=>`${n} ${o*e}% ${(o+1)*e}%`);return(0,C.jsx)("div",{style:{...Fe,background:`linear-gradient(to right, ${t.join(", ")})`}})}var Nn={width:ke,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function rr(){return(0,C.jsx)("div",{style:{...Fe,backgroundColor:"grey"}})}function ne({swatch:r,children:e}){return(0,C.jsxs)("div",{style:er,children:[r,(0,C.jsx)("span",{children:e})]})}var zn=(0,De.observer)(function({model:e}){let{logWidths:t,foldBp:n,forwardReads:o,reverseReads:s,mismatches:a}=e.tubeMapKeys,i=[o&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(Bn,{colors:at}),children:"read on the forward strand"},"fwd"),s&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(Bn,{colors:it}),children:"read on the reverse strand"},"rev"),a.has("substitution")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)("span",{style:Nn,children:"A"}),children:"a read's base unlike the node's"},"sub"),a.has("insertion")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)("span",{style:Nn,children:"*"}),children:"bases a read inserts"},"ins"),a.has("deletion")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(rr,{}),children:"bases a read skips"},"del"),n!==void 0&&(0,C.jsxs)(ne,{swatch:(0,C.jsx)(or,{}),children:["a haplotype's variant under ",me(n)]},"fold"),t&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(tr,{}),children:"width grows with log of length"},"log")].filter(Boolean);return i.length>0?(0,C.jsx)("div",{style:Qo,"data-testid":"graph-tube-map-legend",children:i}):null});var Yn=p(pe(),1);var Ue=p($(),1);function Re(r){return`hsl(${r}, 70%, 50%)`}function Ve(r,e){let t=(r-e.start)/(e.end-e.start);return Math.max(0,Math.min(1,t))*Ne}var sr=30;function On({start:r,bp:e,reversed:t},n){let o=Ve(r,n),s=Ve(r+e,n);if(s-o<1)return[(o+s)/2];let a=Math.ceil((s-o)/sr);return Array.from({length:a+1},(i,l)=>Ve(r+e*(t?a-l:l)/a,n))}var Le=`linear-gradient(to right, ${Array.from({length:7},(r,e)=>`${Re(e/6*Ne)} ${e/6*100}%`).join(", ")})`;var S=p(k(),1),cr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Wn="#2f8fd6",Dn="#111",Fn="#9e9e9e",Vn="#c62828",Un="#8e3fbf",O=12,An=["#4e79a7","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ze="#d0d0d0",ur="rgb(160, 160, 160)";function Zn(r,e){let t=r.findIndex(n=>n.unit===e);return t<0?Ze:An[t%An.length]}var dr={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},oe={display:"flex",alignItems:"center",gap:5},ue={width:18,height:O-4,borderRadius:2},pr={...ue,display:"flex",justifyContent:"center"};function Xn({color:r}){return(0,S.jsx)("div",{style:pr,children:(0,S.jsx)("div",{style:{width:2,backgroundColor:r}})})}var qn=(0,Ue.observer)(function({model:e}){let t=e.walkRowBars;if(!t)return null;let n=e.referenceRampDomain,o=e.walkRowUnits,s=[t.reference,...t.rows],a=s.flatMap(i=>i.call&&!i.call.sequences?i.call:[]);return(0,S.jsxs)("div",{style:dr,"data-testid":"graph-walk-rows-legend",children:[o?(0,S.jsxs)(S.Fragment,{children:[o.map((i,l)=>(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:Zn(o,i.unit)}}),(0,S.jsxs)("span",{children:["unit ",l+1," \xB7 ",i.unitLength.toLocaleString()," bp"]})]},i.unit)),s.some(i=>!i.call?.sequences)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:Ze}}),(0,S.jsx)("span",{children:"no allele in the repeat track"})]}):null]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,background:n?Le:Wn}}),(0,S.jsxs)("span",{children:["shared with ",t.reference.label]})]}),(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:n?Ge:Un}}),(0,S.jsx)("span",{children:"carried by haplotypes only"})]})]}),a.some(i=>i.spanningReads!==0)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)(Xn,{color:Dn}),(0,S.jsx)("span",{children:"allele length called for this walk"})]}):null,a.some(i=>i.spanningReads===0)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)(Xn,{color:Fn}),(0,S.jsx)("span",{children:"called with no read spanning it"})]}):null,a.some(i=>i.agrees===!1)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:ue}),(0,S.jsxs)("span",{style:{color:Vn},children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})});function Ee(r){return`${(r/1e3).toFixed(r<1e4?1:0)} kb`}function hr(r,e){return e?` \u2248 ${Math.round(r/e)} units`:""}function Kn(r,e,t){if(!t?.sequences)return hr(r,e);let n=t.sequences.reduce((o,s)=>o+s.count,0);return` \xB7 ${Number.isInteger(n)?n:n.toFixed(1)} copies`}function fr(r,e,t){let{bp:n,complete:o,call:s}=r,a=n-e,i=a===0?"":` (${a>0?"+":"\u2212"}${Ee(Math.abs(a))})`,l=s&&!s.sequences?mr(s):"";return`${Ee(n)}${Kn(n,t,s)}${i}${o?"":" \xB7 partial walk"}${l}`}function mr(r){let e=r.spanningReads===0?" \xB7 no spanning read":"";return` \xB7 called ${Ee(r.bp)}${e}`}function gr(r){let e=0;return r.map(t=>{let n=e,o=t.copyBp??Array.from({length:Math.ceil(t.count)},()=>t.unitLength),s=[],a=n;for(let i of o)s.push(a),a+=i;return e+=t.bp,{start:n,bp:t.bp,unit:t.unit,copyStarts:s}})}var jn=3;function br(r,e,t){if(t(e)-t(0)<jn)return[];let n=[];for(let o=e;o<r;o+=e)n.push(o);return n}function yr(r,e,t){if(!e)return{fill:r.onReference?Wn:Un};if(r.referenceStart===void 0)return{fill:Ge};let n=On({...r,start:r.referenceStart},e);return n.length===1?{fill:Re(n[0])}:{fill:`url(#${t})`,gradient:(0,S.jsx)("linearGradient",{id:t,children:n.map((o,s)=>(0,S.jsx)("stop",{offset:s/(n.length-1),stopColor:Re(o)},s))})}}var vr=(0,Ue.observer)(function({model:e}){let t=(0,Yn.useId)().replace(/[^\w-]/g,""),{walkRowBars:n,referenceRampDomain:o}=e;if(!n)return null;let{scaleX:s,scaleY:a,translateX:i,translateY:l,paneWidth:c,canvasHeight:d}=e,u=h=>h*s+i,g=h=>h*20*a+l,{origin:b,unit:x,reference:v,rows:m}=n,R=e.walkRowUnits,T=Math.min(b,e.graphRegion?.start??b),N=Math.max(b+v.bp,e.graphRegion?.end??0),H=(h,M,w,y="#333")=>{let I=u(M)+6,B=I+h.length*6.2<c;return(0,S.jsx)("text",{x:B?I:u(M)-6,y:w+4,fontSize:11,fontFamily:"sans-serif",fill:y,stroke:B?void 0:"white",strokeWidth:B?void 0:3,paintOrder:"stroke",textAnchor:B?"start":"end",children:h})},L=(h,M,w)=>h.filter(y=>y>0&&y<M).map(y=>(0,S.jsx)("line",{x1:u(b+y),x2:u(b+y),y1:w-O/2,y2:w+O/2,stroke:"white",strokeWidth:1},y)),E=(h,M,w,y)=>(0,S.jsx)("rect",{x:u(b+h),y:w-O/2,width:Math.max(1,M*s),height:O,fill:y},h),_=(h,M,w)=>{let y=h.call?.sequences?gr(h.call.sequences):[],I=x!==void 0&&x*s>=jn;return(0,S.jsxs)(S.Fragment,{children:[E(0,h.bp,M,Ze),y.filter(B=>B.start<h.bp).map(B=>E(B.start,Math.min(B.bp,h.bp-B.start),M,Zn(w,B.unit))),I?L(y.flatMap(B=>B.copyStarts),h.bp,M):null]})};return(0,S.jsxs)("svg",{style:cr,width:c,height:d,"data-testid":"graph-walk-rows",children:[R?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("rect",{x:u(T)-O/2,y:g(0)-O/2,width:(N-T)*s+O,height:O,rx:O/2,fill:ur}),_(v,g(0),R)]}):null,H(`${Ee(v.bp)}${Kn(v.bp,x,v.call)}`,N,g(0)),m.map((h,M)=>{let w=g(M+1);if(w<-O||w>d+O)return null;let{call:y}=h;return(0,S.jsxs)("g",{"data-testid":"graph-walk-row",children:[R?_(h,w,R):(0,S.jsxs)(S.Fragment,{children:[h.runs.map(I=>{let{fill:B,gradient:io}=yr(I,o,`${t}-${M}-${I.start}`);return(0,S.jsxs)("g",{children:[io,E(I.start,I.bp,w,B)]},I.start)}),x?L(br(h.bp,x,I=>I*s),h.bp,w):null]}),y&&!y.sequences?(0,S.jsx)("rect",{"data-testid":"graph-walk-call",x:u(b+y.bp)-1,y:w-O/2-3,width:2,height:O+6,fill:y.spanningReads===0?Fn:Dn}):null,H(fr(h,v.bp,x),b+h.bp,w,y?.agrees===!1?Vn:void 0)]},h.name)})]})}),Jn=vr;var de=p(lo(),1),to=p(_e(),1),no=p(eo(),1);var Pe=class extends no.Canvas2DRenderingBackendBase{constructor(){super(...arguments);this.transform=null;this.batch=null;this.nodeHighlights=new Map;this.highlightedEdge=null;this.highlightFactor=1}resize(t,n){(0,to.syncCanvasSize)(this.ctx.canvas,t,n)}uploadGeometry(t){this.batch=t,this.highlightedEdge=null}setNodeHighlights(t){this.nodeHighlights=t}setEdgeHighlight(t,n){this.highlightedEdge=t,this.highlightFactor=n}updateTransform(t){this.transform=t}render(t){if(!this.transform)return;let o=this.ctx,{width:s,height:a}=o.canvas;o.fillStyle=(0,de.normalizedRgbToCssRgba)([t[0],t[1],t[2]],t[3]),o.fillRect(0,0,s,a);let i=this.batch;i&&(o.lineCap="round",o.lineJoin="round",this.renderEdges(i),this.renderNodes(i),this.renderArrows(i))}renderEdges(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.edgeCurveRuns.get(this.highlightedEdge);for(let{color:a,items:i}of qe(t.edgeCurves,(l,c)=>({color:Ie(s,c)?be(l.color,this.highlightFactor):l.color,weight:l.thickness,last:Ie(s,c)}))){o.strokeStyle=(0,de.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.curves[0];o.moveTo(c.x0*n.scaleX+n.translateX,c.y0*n.scaleY+n.translateY);for(let d of l.curves)o.bezierCurveTo(d.cx0*n.scaleX+n.translateX,d.cy0*n.scaleY+n.translateY,d.cx1*n.scaleX+n.translateX,d.cy1*n.scaleY+n.translateY,d.x1*n.scaleX+n.translateX,d.y1*n.scaleY+n.translateY)}o.stroke()}}renderNodes(t){let n=this.transform,o=this.ctx,s=new Map;for(let[a,i]of this.nodeHighlights){let l=t.nodeStrokeRuns.get(a);if(l)for(let c=l.start;c<l.start+l.count;c++)s.set(c,i)}for(let{color:a,items:i}of qe(t.nodeStrokes,(l,c)=>{let d=s.get(c);return{color:d===void 0?l.color:be(l.color,d),weight:l.thickness,last:d!==void 0}})){o.strokeStyle=(0,de.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.points[0];o.moveTo(c.x*n.scaleX+n.translateX,c.y*n.scaleY+n.translateY);for(let d=1,u=l.points.length;d<u;d++){let g=l.points[d];o.lineTo(g.x*n.scaleX+n.translateX,g.y*n.scaleY+n.translateY)}}o.stroke()}}renderArrows(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.arrowRuns.get(this.highlightedEdge);for(let{color:a,items:i}of qe(t.arrows,(l,c)=>({color:Ie(s,c)?be(l.color,this.highlightFactor):l.color,weight:0,last:Ie(s,c)}))){o.fillStyle=(0,de.abgrToCssRgba)(a),o.beginPath();for(let l of i){let[c,d,u,g]=Sr(l,n);o.moveTo(c.x,c.y),o.lineTo(d.x,d.y),o.lineTo(u.x,u.y),o.lineTo(g.x,g.y),o.closePath()}o.fill()}}dispose(){super.dispose(),this.batch=null,this.nodeHighlights=new Map,this.highlightedEdge=null}},xr=.25;function Sr(r,e){let t=Math.cos(r.angle),n=Math.sin(r.angle),o=r.x*e.scaleX+e.translateX,s=r.y*e.scaleY+e.translateY,a=r.length*e.dpr,i=r.halfWidth*e.dpr,l=o-t*a,c=s-n*a,d=a*(1-xr);return[{x:o,y:s},{x:l-n*i,y:c+t*i},{x:o-t*d,y:s-n*d},{x:l+n*i,y:c-t*i}]}function Ie(r,e){return r!==void 0&&e>=r.start&&e<r.start+r.count}function qe(r,e){let t=new Map,n=new Map;for(let o=0,s=r.length;o<s;o++){let a=r[o],{color:i,weight:l,last:c}=e(a,o),d=c?n:t,u=`${i}:${l}`,g=d.get(u);g?g.items.push(a):d.set(u,{color:i,items:[a]})}return[...t.values(),...n.values()]}function oo(r){return Promise.resolve(new Pe(r))}var f=p(k(),1),ro={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none"},Mr={position:"relative"},wr={position:"relative",lineHeight:0},kr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Cr={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Rr=(0,F.observer)(function({model:e}){let t=e.drawnRowLabels;return(0,f.jsx)(f.Fragment,{children:t.map(({label:n,y:o})=>{let s=o*e.scaleY+e.translateY;return s>=0&&s<=e.canvasHeight?(0,f.jsx)("div",{"data-testid":"graph-row-label",style:{...Cr,top:s},children:n},o):null})})}),Lr={position:"absolute",top:ge,right:ge,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Ke={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Er={display:"flex",alignItems:"center",gap:5},Ir={width:18,height:3,borderRadius:2},Pr=(0,F.observer)(function({model:e}){let{pathLegend:t}=e;return t.length>0?(0,f.jsx)("div",{style:Ke,"data-testid":"graph-path-legend",children:t.map(({name:n,label:o,color:s})=>(0,f.jsxs)("div",{style:Er,children:[(0,f.jsx)("div",{style:{...Ir,backgroundColor:s}}),(0,f.jsx)("span",{children:o})]},n))}):null}),Tr=(0,F.observer)(function({model:e}){let t=e.walkHighlight;if(!t)return null;let n=e.walkChoices.find(s=>s.name===t.name)?.label??t.name,o=t.referenceBp===void 0?"":t.bp===t.referenceBp?", the reference length":`, ${t.bp>t.referenceBp?"+":"\u2212"}${Math.abs(t.bp-t.referenceBp).toLocaleString()} bp against the reference`;return(0,f.jsxs)("div",{style:Ke,"data-testid":"graph-walk-readout",children:[(0,f.jsx)("strong",{children:n}),": ",t.steps.toLocaleString()," steps,"," ",t.bp.toLocaleString()," bp",o,(0,f.jsx)("br",{}),"paler: what ",n," does not carry"]})}),Hr={minWidth:90,height:8,borderRadius:2,background:Le},Br={display:"flex",justifyContent:"space-between",gap:8},Nr=(0,F.observer)(function({model:e}){let t=e.referenceRampDomain;return t?(0,f.jsxs)("div",{style:Ke,"data-testid":"graph-ramp-legend",children:[(0,f.jsx)("div",{style:Hr}),(0,f.jsxs)("div",{style:Br,children:[(0,f.jsx)("span",{children:t.start.toLocaleString()}),(0,f.jsxs)("span",{children:["(",me(t.end-t.start),")"]}),(0,f.jsx)("span",{children:t.end.toLocaleString()})]})]}):null}),ao={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Gr={...ao,color:"#18181c",fontWeight:600},_r={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},$r=(0,F.observer)(function({model:e}){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let n=t.current;if(!n)return;let o=new ResizeObserver(()=>{(0,Te.isAlive)(e)&&e.setLegendSize({width:n.offsetWidth,height:n.offsetHeight})});return o.observe(n),()=>{o.disconnect()}},[e]),(0,f.jsxs)("div",{ref:t,style:{...Lr,top:ge+e.referenceStripZonePx},children:[(0,f.jsx)(Nr,{model:e}),(0,f.jsx)(Hn,{model:e}),(0,f.jsx)(Ot,{model:e}),(0,f.jsx)(Pr,{model:e}),(0,f.jsx)(zn,{model:e}),(0,f.jsx)(qn,{model:e}),(0,f.jsx)(Tr,{model:e})]})}),zr=(0,F.observer)(function({model:e}){let t=e.overlayLabels.sizes,n=t.flatMap(({key:o,leader:s})=>s?[{key:o,...s}]:[]);return(0,f.jsxs)(f.Fragment,{children:[n.length>0?(0,f.jsx)("svg",{style:_r,width:e.paneWidth,height:e.canvasHeight,children:n.map(({key:o,arcX:s,arcY:a,labelX:i,labelY:l})=>(0,f.jsx)("line",{"data-testid":"graph-label-leader",x1:s,y1:a,x2:i,y2:l,stroke:"#18181c",strokeWidth:1},o))}):null,t.map(({key:o,text:s,x:a,y:i,kind:l})=>(0,f.jsx)("div",{"data-testid":"graph-size-label",style:{...l==="deletion"?Gr:ao,left:a,top:i},children:s},o))]})}),Or=(0,F.observer)(function({model:e}){let t=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,n=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,o=t?yt(t):void 0,s=e.hoveredEdge===null?void 0:e.deletions.find(a=>a.edgeIndex===e.hoveredEdge);return(0,f.jsxs)(f.Fragment,{children:[t?(0,f.jsxs)("div",{style:ro,children:[(0,f.jsx)("strong",{children:t.name})," \u2014 length:"," ",t.length.toLocaleString(),", depth:"," ",t.depth.toFixed(1),o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("br",{}),o.sample," ",vt(o)," (rank"," ",t.stable?.rank,")"]}):null]}):null,n?(0,f.jsx)("div",{style:ro,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("strong",{children:"Deletion"})," ",s.bp.toLocaleString()," bp",(0,f.jsx)("br",{}),s.refName,":",s.start.toLocaleString(),"-",s.end.toLocaleString()]}):(0,f.jsxs)(f.Fragment,{children:["Edge: ",n.from," \u2192 ",n.to]})}):null]})}),Ar=(0,F.observer)(function({model:e,nodeId:t,top:n,left:o,onClose:s}){let{own:a,reference:i,highlight:l}=e.nodeLaunchTargets(t);return(0,f.jsx)(re.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:n,left:o},onClose:()=>{s()},onMenuItemClick:c=>{c()},menuItems:[{label:"Node details",icon:$t,onClick:()=>{e.showNodeDetails(t)}},...xt({own:a,reference:i,highlight:l,onShowLinear:c=>{e.showInLinearView(c)},onHighlight:e.canHighlightInLinearView?c=>{e.highlightInLinearView(c)}:void 0})]})}),Xr=(0,F.observer)(function({model:e,ownChrome:t=!0}){let{canvasRef:n,canvas:o,error:s,retry:a}=(0,so.useRenderingBackend)(oo,e),i=(0,Y.useRef)({x:0,y:0}),l=(0,Y.useRef)(!1),c=(0,Y.useRef)({frame:0,pan:null,hover:null});(0,Y.useEffect)(()=>()=>{cancelAnimationFrame(c.current.frame)},[]);let[d,u]=(0,Y.useState)(void 0);(0,Y.useEffect)(()=>{if(o){let w=function(y){if(e.hostPlacesX)return;e.host&&y.stopPropagation(),y.preventDefault();let I=M.getBoundingClientRect();e.zoom(Bt(y),y.clientX-I.left,y.clientY-I.top)};var h=w;let M=o;return M.addEventListener("wheel",w,{passive:!1}),()=>{M.removeEventListener("wheel",w)}}},[o,e]);function g(h,M){return{x:(h-e.translateX)/e.scaleX,y:(M-e.translateY)/e.scaleY}}function b(h){let M=h.currentTarget.getBoundingClientRect();return g(h.clientX-M.left,h.clientY-M.top)}function x(h,M){let{nodePositions:w}=e,y=h*e.scaleX+e.translateX,I=M*e.scaleY+e.translateY;if(e.layoutResult?.tubeMap)return e.tubeMapNodeAt(y,I);let B=e.referenceStripNodeAt(y,I);return B||(w?Tt(w,h,M,e.axisScale,e.positionsVersion,e.nodeInk):null)}function v(h){if(h.button===0){if(l.current=!1,e.hostPlacesX)return;e.host&&h.stopPropagation();let{x:M,y:w}=b(h),y=e.layoutResult?.tubeMap||h.nativeEvent.offsetY<e.referenceStripZonePx?null:x(M,w);y?e.setDraggingNode(y):e.setPanning(!0),i.current={x:h.clientX,y:h.clientY}}}function m(){let h=c.current;if(h.frame=0,h.pan&&(e.setTransform(e.scale,e.translateX+h.pan.dx,e.translateY+h.pan.dy),h.pan=null),h.hover&&e.nodePositions&&e.graph){let{x:M,y:w}=g(h.hover.x,h.hover.y);h.hover=null;let y=x(M,w);e.setHoveredNode(y),e.setHoveredEdge(y||e.layoutResult?.tubeMap?null:Ht(e.nodePositions,e.graph,M,w,e.axisScale,e.effectiveDrawPaths,e.positionsVersion,e.deletionEdgeIndexes,e.hiddenEdgeIndexes))}}function R(){c.current.frame||(c.current.frame=requestAnimationFrame(m))}function T(){let h=c.current;cancelAnimationFrame(h.frame),h.frame=0,h.pan=null,h.hover=null}function N(h){let M=h.clientX-i.current.x,w=h.clientY-i.current.y;i.current={x:h.clientX,y:h.clientY},(Math.abs(M)>1||Math.abs(w)>1)&&(l.current=!0);let y=c.current;if(e.draggingNode)e.moveNode(e.draggingNode,M/e.scaleX,w/e.scaleY);else if(e.isPanning)y.pan={dx:(y.pan?.dx??0)+M,dy:(y.pan?.dy??0)+w},R();else{let I=h.currentTarget.getBoundingClientRect();y.hover={x:h.clientX-I.left,y:h.clientY-I.top},R()}}function H(){e.stopDragging()}function L(){T(),(0,Te.isAlive)(e)&&(e.stopDragging(),e.setHoveredNode(null),e.setHoveredEdge(null))}function E(h){let{x:M,y:w}=b(h),y=x(M,w);y&&(h.preventDefault(),u({nodeId:y,top:h.clientY,left:h.clientX}))}function _(h){if(!l.current){let{x:M,y:w}=b(h),y=x(M,w);e.setSelectedNode(y),y&&e.showNodeDetails(y)}}return(0,f.jsxs)("div",{style:Mr,children:[t?(0,f.jsx)(wn,{model:e}):null,(0,f.jsxs)("div",{style:wr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,Te.isAlive)(e)&&e.setPointerInPane(!1)},children:[(0,f.jsx)("canvas",{ref:n,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block"},onMouseDown:v,onMouseMove:N,onMouseUp:H,onMouseLeave:L,onClick:_,onContextMenu:E}),(0,f.jsx)($n,{model:e}),(0,f.jsx)(Pn,{model:e}),(0,f.jsx)(Rr,{model:e}),(0,f.jsx)(zr,{model:e}),(0,f.jsx)(zt,{model:e}),(0,f.jsx)(Vt,{model:e}),(0,f.jsx)(Rn,{model:e}),(0,f.jsx)(Dt,{model:e}),(0,f.jsx)(Jn,{model:e}),(0,f.jsx)($r,{model:e}),t?(0,f.jsx)("div",{style:kr,children:(0,f.jsx)(re.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),(0,f.jsx)(Or,{model:e}),d?(0,f.jsx)(Ar,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:()=>{u(void 0)}}):null,s?(0,f.jsx)(re.ErrorBanner,{error:s,onReset:a}):null,t&&e.error?(0,f.jsx)(re.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Ta=Xr;export{Ta as a};
4
+ //# sourceMappingURL=chunk-UQN2NWT5.js.map