jbrowse-plugin-graphgenomeviewer 8.7.1 → 8.7.2

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.
Files changed (32) hide show
  1. package/dist/chunks/AddTrackWorkflow-FANMD3WB.js +2 -0
  2. package/dist/chunks/{AddTrackWorkflow-IOPTETLH.js.map → AddTrackWorkflow-FANMD3WB.js.map} +2 -2
  3. package/dist/chunks/{GraphGenomeView-M4EGRLX4.js → GraphGenomeView-HCN57HV4.js} +2 -2
  4. package/dist/chunks/{LinearGraphDisplay-7ESV6SY2.js → LinearGraphDisplay-W5IT3HYI.js} +2 -2
  5. package/dist/chunks/chunk-7BKSSU2R.js +4 -0
  6. package/dist/chunks/chunk-7BKSSU2R.js.map +7 -0
  7. package/dist/chunks/{chunk-6V6OOEYK.js → chunk-OS52UJIX.js} +2 -2
  8. package/dist/chunks/chunk-T7LVVBTT.js +2 -0
  9. package/dist/chunks/chunk-T7LVVBTT.js.map +7 -0
  10. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +4 -4
  11. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
  12. package/package.json +1 -1
  13. package/src/GraphAddTrackWorkflow/AddTrackWorkflow.test.tsx +7 -5
  14. package/src/GraphAddTrackWorkflow/AddTrackWorkflow.tsx +2 -2
  15. package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +13 -6
  16. package/src/GraphTrack/GraphTrack.test.ts +68 -0
  17. package/src/GraphTrack/index.ts +8 -5
  18. package/src/RgfaTabixAdapter/index.ts +3 -2
  19. package/src/graphTrackDefaults/graphTrackDefaults.test.ts +80 -3
  20. package/src/graphTrackDefaults/guessAdapter.ts +62 -0
  21. package/src/graphTrackDefaults/index.ts +16 -51
  22. package/src/panSNAliases/panSNAliases.test.ts +40 -6
  23. package/src/panSNAliases/trackAdapterConfig.ts +49 -10
  24. package/src/version.ts +1 -1
  25. package/dist/chunks/AddTrackWorkflow-IOPTETLH.js +0 -2
  26. package/dist/chunks/chunk-CGPYVMGQ.js +0 -2
  27. package/dist/chunks/chunk-CGPYVMGQ.js.map +0 -7
  28. package/dist/chunks/chunk-MKW7A2MK.js +0 -4
  29. package/dist/chunks/chunk-MKW7A2MK.js.map +0 -7
  30. /package/dist/chunks/{GraphGenomeView-M4EGRLX4.js.map → GraphGenomeView-HCN57HV4.js.map} +0 -0
  31. /package/dist/chunks/{LinearGraphDisplay-7ESV6SY2.js.map → LinearGraphDisplay-W5IT3HYI.js.map} +0 -0
  32. /package/dist/chunks/{chunk-6V6OOEYK.js.map → chunk-OS52UJIX.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as z,b as gt}from"./chunk-HC2YPYTO.js";import{B as wt,C as St,a as et,b as tt,c as J,d as nt,e as ot,f as Q,h as rt,i as at,j as it,k as st,l as lt,m as ct,o as ee,p as pt,q as te,r as ut,t as ue,u as dt,v as ft,w as vt,x as yt,z as bt}from"./chunk-DQC5K7EW.js";import{N as Ue,O as Je,R as pe,T as Qe,U as ht,V as mt,a as P,c as ze,f as q,g as We,h as Ne,q as Oe,r as Be,t as Ze,u as $e,v as je,w as Ke}from"./chunk-MKW7A2MK.js";import{p as _}from"./chunk-64OSFJLE.js";import{Aa as Ye,D as Ae,Jb as H,K as _e,Nb as le,O as De,P as Xe,Pb as ce,Rb as B,a as D,b as ye,fa as se,ja as U,lc as qe,na as Fe,pa as Ve,v as He}from"./chunk-W4Y2JUP7.js";import{n as Te}from"./chunk-T3FHGWNW.js";import{e as G}from"./chunk-FLKXKTS2.js";import{j as $}from"./chunk-TC265JAP.js";import{a as Ee,e as T,f as Ie,g as Ge,h as k,i as C}from"./chunk-J2PN6CG3.js";import{D as Le,G as K,H as X,b as be,c as we,e as ie,k as Se,o as xe,p as Pe,s as Me,v as j,w as ke,y as Re,z as Ce}from"./chunk-WE7DQVXF.js";import{a as I,b as o,c as h,d}from"./chunk-DUU6T2I5.js";function xt(t){return Promise.resolve(new H(t))}var A=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>A!=null&&t in Object(A)?A[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Pt=hn("useRenderingBackend"),bo=A&&A.__esModule?A.default:A;var de=tt(1),Mt=d(function({model:e}){let[n,i]=C(null);return T(()=>{if(!n)return;let r=new H(n),c=D(()=>{Ye(qe()),r.resize(e.paneWidth,e.canvasHeight),e.paintHover(r,e.drawnBatch)});return()=>{c(),r.dispose()}},[n,e]),o("canvas",{ref:i,"data-testid":"graph-hover-layer",style:de})});var ne=d(function({row:e,at:n,hint:i,after:r,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[o("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:o(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?o("strong",{children:e.strong}):null,e.label]}),r]}),n?o("div",{style:l,"data-testid":"graph-walk-at",children:n}):e.under?o("div",{style:l,children:e.under}):null]}):o("div",{style:ut,children:e.label})}),mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=d(function({model:e}){let n=ct(e);if(n.length===0)return null;let i=n.flatMap(l=>l.rows),r=at(i),c=rt(i);return o("div",{style:{...pt,lineHeight:`${r}px`},children:n.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(Ee,{children:[s?o("div",{style:{...dt,paddingTop:m===0?0:ue},children:s}):null,o("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>o(ne,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?o("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:De,lineHeight:"normal"},vn={height:Xe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Je,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=d(function({model:e,lift:n,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),x=n.walks[0];T(()=>{if(!s||!m)return;let E=new H(s),N=new H(m),O=ye(()=>e.buildDrawing(n,!1)),V,Y=[D(()=>{let R=e.facetGrid;R&&E.resize(R.width,R.height);let L=O.get();L&&(L!==V&&(E.uploadGeometry(L.batch),V=L),e.applySelection(E),e.paint(E))}),D(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let L=O.get();L&&e.paintHover(N,L.batch)})];return()=>{for(let R of Y)R();E.dispose(),N.dispose()}},[s,m,e,n]);let W=e.walkLabel(x.name);return h("div",{style:c,children:[o("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([x.name]),e.setFacet("")},children:o(ne,{row:st(e,x),hint:`click to lift ${W} alone`,at:e.hoveredOn(x)})}),h("div",{style:yn,children:[o("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),o("canvas",{ref:w,style:de})]})]})}),Sn=d(function({model:e,handlers:n,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:U},children:[r.map((m,w)=>o(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:n,canvasStyle:i},m.walks[0].name)),o("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:lt(e).map(m=>o(ne,{row:m},m.key))})]})}),Rt=Sn;var Ct=P(o("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 Lt=P([o("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"),o("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=P(o("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 xn=d(function({model:e}){let n=e.colorSchemeLock;return o(z,{label:"Color",size:"small",sx:{minWidth:100},disabled:n!==void 0,title:n?.why,shown:n?.value,value:e.chosenColorScheme,options:Oe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=_()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function fe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=d(function({model:e}){let{classes:n}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?h(X,{variant:"caption",className:n.perf,"data-testid":"graph-perf-stats",children:["fetch ",fe(i)," \xB7 layout ",fe(r)," \xB7 geom"," ",fe(c)]}):null}),Mn=d(function({model:e}){let{classes:n}=Gt();return h("div",{className:n.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:[h(X,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",o(Pn,{model:e})]})}),Tt=Mn;var kn=d(function({model:e}){let{graph:n}=e;return o(z,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:ze.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:n?!l(n):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:o(z,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:n=>{e.setRepeatKey(n)}})}),At=Rn;var _t=P(o("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=P(o("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 Cn=d(function({model:e}){let n=e.highlightMenuItems({picks:!1});return o(be,{size:"small",tooltip:"Graph options",menuItems:[...n.length>0?[{label:"Haplotypes",icon:ht,subMenu:n}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Be,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:mt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{$(e).queueDialog(i=>[gt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:o(zt,{})})}),Wt=Cn;var Ln=_()({formControl:{minWidth:130,maxWidth:260}}),En=d(function({model:e}){let{classes:n}=Ln(),i=Ie(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Ve?o(xe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{$(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):h(Me,{size:"small",className:n.formControl,children:[o(ke,{id:i,children:"Highlight"}),o(Le,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>h(Ce,{value:s,dense:!0,children:[o(Pe,{size:"small",checked:p.includes(s)}),o(Re,{primary:u})]},s))})]})}),Nt=En;var In=_()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=d(function({model:e}){return o(X,{variant:"body2",children:e.zoomPercent})}),Tn=d(function({model:e}){let{classes:n}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:n.toolbar,children:[o(Ht,{model:e}),o(It,{model:e}),o(Nt,{model:e}),o(At,{model:e}),o(K,{title:"Zoom in",children:o(j,{size:"small",onClick:()=>{i(1.5)},children:o(Lt,{})})}),o(K,{title:"Zoom out",children:o(j,{size:"small",onClick:()=>{i(1/1.5)},children:o(Et,{})})}),o(K,{title:"Zoom to fit",children:o(j,{size:"small",onClick:()=>{e.refitView()},children:o(Ct,{})})}),o(Gn,{model:e}),o(Tt,{model:e}),o(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Ue,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function he({label:t,readout:e}){return h(I,{children:[o("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:he(e)};let n=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(n){let l=t.hoverDrawing?.members.get(n.id),p=Ne(n);return{body:h(I,{children:[o("strong",{children:n.name}),l?` and ${l.length-1} more`:""," \u2014"," ",n.length.toLocaleString()," bp, depth ",n.depth.toFixed(1),p?h(I,{children:[o("br",{}),p.sample," ",q(p)," (rank ",n.stable?.rank,")"]}):null,n.moved?h(I,{children:[o("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=We(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?h(I,{children:[o("strong",{children:"Deletion"})," ",l.deletion.bp,o("br",{}),l.deletion.where]}):h(I,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:he(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:he(c)}:void 0}var _n=d(function({model:e,chip:n}){let i=An(e,n);return i?o("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=P(o("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=P(o("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=P(o("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 zn={x:0,y:0};function Wn(t,e){let{own:n,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...Qe({own:n,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,n){let i=n??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!n&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${q(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var oe=d(function({model:e,at:n,onClose:i}){return o(we,{anchor:n,offset:zn,onClose:i,menuItems:()=>n===void 0?[]:"nodeId"in n?Wn(e,n.nodeId):On(e,n.row,n.bars)})});var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},Bn=d(function({bars:e,frame:n,ramp:i,rowGenes:r}){let c=ot(),l=Ge(()=>_e(e,n,{ramp:i,rowGenes:r,idPrefix:c}),[e,n,i,r,c]);return o(Q,{el:l})}),Fn=d(function({model:e}){let n=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=n?[n.reference,...n.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!n||!i||i.labelled||!r||!p)return null;let s=(n.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",He(p,l===0?void 0:n.reference)]})}),Vn=d(function({model:e,bars:n,frame:i}){return o(Q,{el:$e(n,i,e.walkStripMarks)})}),Yn=d(function({model:e}){let n=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!n||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return Ze(n,i,s.clientX-u.left,s.clientY-u.top)},p=Ae(n,{ramp:e.referenceRampDomain,rampCss:Te,genes:Ke(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{G(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[o(Bn,{bars:n,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),o(Vn,{model:e,bars:n,frame:i}),o(Q,{el:je(n,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),o(Fn,{model:e}),h("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[o(ee,{swatch:it(s.swatch)}),o("span",{children:s.label})]},s.label)),o("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),o(oe,{model:e,at:r&&{...r,bars:n},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=d(function({model:e}){let n=e.walkStripLocator;return n?h(J,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[o("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),o("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function me(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),n=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,n))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let n=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(n)<.001?t:t-n}function no(t,e){let n=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!n&&(!e||e.scrollZoom)?"zoom":n?"pan":"page"}function qt(t,e,n){T(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,G(n)&&n.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(n.hostPlacesX||n.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(n.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<n.referenceStripZonePx)return;let w=no(p,n.host);if(w!=="page"){if(n.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let x=p.deltaMode===1?Jn:1;n.setTransform(n.scale,n.translateX-p.deltaX*x,n.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(me(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,n])}var jt=3,ge="data-gesture-owner",F=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,n]=[...t.values()];return{spread:Math.hypot(e.x-n.x,e.y-n.y),mid:{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}}function Ut(t){let e=k({x:0,y:0}),n=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),x=k({frame:0,pan:null,hover:null,pinch:!1});T(()=>()=>{cancelAnimationFrame(x.current.frame)},[]);let[W,E]=C(),[N,O]=C(!1),[V,Y]=C(void 0);function R(a){let f=a.currentTarget.getBoundingClientRect();return{x:a.clientX-f.left,y:a.clientY-f.top}}function L(a,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,f);let g=t.referenceStripNodeAt(a,f);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,f,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,f){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,f,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let f=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&f.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),f.set(a.pointerId,F(a)),s.current=Kt(f),i.current=!0);return}i.current=!1,n.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ge);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,f.clear(),f.set(a.pointerId,F(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,M=t.layoutResult?.tubeMap||b?null:L(v,y);g&&M&&a.currentTarget.setAttribute(ge,""),w.current=g,u.current=b&&!g,M?t.setDraggingNode(M):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ve(){let a=s.current,f=p.current;if(!a||!f)return;let g=Kt(l.current),v=f.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=x.current,{pan:f,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ve(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!g)return;let{x:y,y:b}=g,M=t.facetPanels?void 0:vt(t.overlayLabels,y,b);if(Y(S=>S?.label===M?.label&&S?.readout===M?.readout?S:M),t.walkRowBars){let S=t.walkRowAt(y,b);t.setHoveredWalkRow(S===void 0?null:t.walkRowList[S].name)}if(t.nodePositions&&t.graph){let S=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(S,{x:y,y:b}),O(S!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(S===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(S||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function Z(){x.current.frame||(x.current.frame=requestAnimationFrame(on))}function rn(){let a=x.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let f=l.current;if(s.current&&f.has(a.pointerId)){f.set(a.pointerId,F(a)),x.current.pinch=!0,Z();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-n.current.x,a.clientY-n.current.y)>jt&&(i.current=!0);let y=x.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},Z();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},Z()}}function re(a){let f=l.current;if(s.current&&f.has(a.pointerId)){x.current.pinch&&(x.current.pinch=!1,ve()),f.delete(a.pointerId),s.current=null;let[[g,v]]=[...f];r.current=g,e.current=v;return}c(a)||(r.current=void 0,f.clear(),G(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),Y(void 0),O(!1),G(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:f,y:g}=R(a),v=L(f,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),E({clientX:y,clientY:b,nodeId:v});return}let M=t.walkRowAt(f,g);M!==void 0&&(a.preventDefault(),E({clientX:y,clientY:b,row:M}))}function cn(a){if(!i.current){let{x:f,y:g}=R(a),v=L(f,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}T(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${et}]`))return;m.current?.end(),u.current=!1,w.current=!1;let f=a.pointerId,g=F(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",M,!0),y.moved&&G(t)&&t.stopDragging()}};function b(S){if(S.pointerId!==f)return;if(!y.moved){if(Math.hypot(S.clientX-g.x,S.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let ae=x.current;ae.pan={dx:(ae.pan?.dx??0)+S.clientX-v.x,dy:(ae.pan?.dy??0)+S.clientY-v.y},v=F(S),Z()}function M(S){S.pointerId===f&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",M,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":N?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ge]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:re,onPointerCancel:re,onLostPointerCapture:re,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:W,hoveredChip:V,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{E(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={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},lo=d(function({model:e}){return o(I,{children:e.visibleRowLabels.map(({label:n,y:i,top:r})=>o("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:n},i))})}),co={position:"absolute",top:B,right:B,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={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},po={...Jt,color:"#18181c",fontWeight:600},uo=d(function({model:e}){let n=k(null),i=e.legendAtRest;return T(()=>{let r=n.current;if(!r||!i)return;let c=()=>{G(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),o("div",{ref:n,style:{...co,top:B+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*B-e.referenceStripZonePx},children:o(kt,{model:e})})}),fo=d(function({model:e}){let n=e.overlayLabels.sizes,i=n.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return h(I,{children:[i.length>0?o(J,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>o("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,n.map(({key:r,text:c,x:l,y:p,kind:s})=>o("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=d(function({model:e,handle:{canvasRef:n,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[x,W]=C(null);qt(x,i,e);let E=e.facetPanels!==void 0;return h("div",{style:oo,...p,children:[r?o(Ot,{model:e}):null,h("div",{ref:W,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{G(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?o("div",{style:{...ao,top:e.referenceStripZonePx,background:U}}):null,o("canvas",{ref:n,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),E?o(Rt,{model:e,handlers:c,canvasStyle:l}):h(I,{children:[o(wt,{model:e}),o(Mt,{model:e}),o(bt,{model:e}),o(lo,{model:e}),o(fo,{model:e}),o(nt,{model:e}),o(ft,{model:e}),o(yt,{model:e}),o(St,{model:e}),o(Yt,{model:e}),o(uo,{model:e})]}),r?o("div",{style:io,children:o(Se,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,o(Dt,{model:e,chip:w})]}),e.walkStripShown?o(Vt,{model:e}):null,o(oe,{model:e,at:u,onClose:m}),r?.renderError?o(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?o(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=d(function({model:e}){let{canvasRef:n,canvas:i,error:r,retry:c}=Pt(xt,e);return o(Qt,{model:e,handle:{canvasRef:n,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=d(function({model:e,handle:n}){return n?o(Qt,{model:e,handle:n}):o(ho,{model:e})}),Ki=mo;export{xt as a,Ki as b};
2
- //# sourceMappingURL=chunk-6V6OOEYK.js.map
1
+ import{a as z,b as gt}from"./chunk-HC2YPYTO.js";import{B as wt,C as St,a as et,b as tt,c as J,d as nt,e as ot,f as Q,h as rt,i as at,j as it,k as st,l as lt,m as ct,o as ee,p as pt,q as te,r as ut,t as ue,u as dt,v as ft,w as vt,x as yt,z as bt}from"./chunk-DQC5K7EW.js";import{N as Ue,O as Je,R as pe,T as Qe,U as ht,V as mt,a as P,c as ze,f as q,g as We,h as Ne,q as Oe,r as Be,t as Ze,u as $e,v as je,w as Ke}from"./chunk-7BKSSU2R.js";import{p as _}from"./chunk-64OSFJLE.js";import{Aa as Ye,D as Ae,Jb as H,K as _e,Nb as le,O as De,P as Xe,Pb as ce,Rb as B,a as D,b as ye,fa as se,ja as U,lc as qe,na as Fe,pa as Ve,v as He}from"./chunk-W4Y2JUP7.js";import{n as Te}from"./chunk-T3FHGWNW.js";import{e as G}from"./chunk-FLKXKTS2.js";import{j as $}from"./chunk-TC265JAP.js";import{a as Ee,e as T,f as Ie,g as Ge,h as k,i as C}from"./chunk-J2PN6CG3.js";import{D as Le,G as K,H as X,b as be,c as we,e as ie,k as Se,o as xe,p as Pe,s as Me,v as j,w as ke,y as Re,z as Ce}from"./chunk-WE7DQVXF.js";import{a as I,b as o,c as h,d}from"./chunk-DUU6T2I5.js";function xt(t){return Promise.resolve(new H(t))}var A=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>A!=null&&t in Object(A)?A[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Pt=hn("useRenderingBackend"),bo=A&&A.__esModule?A.default:A;var de=tt(1),Mt=d(function({model:e}){let[n,i]=C(null);return T(()=>{if(!n)return;let r=new H(n),c=D(()=>{Ye(qe()),r.resize(e.paneWidth,e.canvasHeight),e.paintHover(r,e.drawnBatch)});return()=>{c(),r.dispose()}},[n,e]),o("canvas",{ref:i,"data-testid":"graph-hover-layer",style:de})});var ne=d(function({row:e,at:n,hint:i,after:r,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[o("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:o(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?o("strong",{children:e.strong}):null,e.label]}),r]}),n?o("div",{style:l,"data-testid":"graph-walk-at",children:n}):e.under?o("div",{style:l,children:e.under}):null]}):o("div",{style:ut,children:e.label})}),mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=d(function({model:e}){let n=ct(e);if(n.length===0)return null;let i=n.flatMap(l=>l.rows),r=at(i),c=rt(i);return o("div",{style:{...pt,lineHeight:`${r}px`},children:n.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(Ee,{children:[s?o("div",{style:{...dt,paddingTop:m===0?0:ue},children:s}):null,o("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>o(ne,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?o("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:De,lineHeight:"normal"},vn={height:Xe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Je,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=d(function({model:e,lift:n,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),x=n.walks[0];T(()=>{if(!s||!m)return;let E=new H(s),N=new H(m),O=ye(()=>e.buildDrawing(n,!1)),V,Y=[D(()=>{let R=e.facetGrid;R&&E.resize(R.width,R.height);let L=O.get();L&&(L!==V&&(E.uploadGeometry(L.batch),V=L),e.applySelection(E),e.paint(E))}),D(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let L=O.get();L&&e.paintHover(N,L.batch)})];return()=>{for(let R of Y)R();E.dispose(),N.dispose()}},[s,m,e,n]);let W=e.walkLabel(x.name);return h("div",{style:c,children:[o("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([x.name]),e.setFacet("")},children:o(ne,{row:st(e,x),hint:`click to lift ${W} alone`,at:e.hoveredOn(x)})}),h("div",{style:yn,children:[o("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),o("canvas",{ref:w,style:de})]})]})}),Sn=d(function({model:e,handlers:n,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:U},children:[r.map((m,w)=>o(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:n,canvasStyle:i},m.walks[0].name)),o("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:lt(e).map(m=>o(ne,{row:m},m.key))})]})}),Rt=Sn;var Ct=P(o("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 Lt=P([o("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"),o("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=P(o("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 xn=d(function({model:e}){let n=e.colorSchemeLock;return o(z,{label:"Color",size:"small",sx:{minWidth:100},disabled:n!==void 0,title:n?.why,shown:n?.value,value:e.chosenColorScheme,options:Oe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=_()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function fe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=d(function({model:e}){let{classes:n}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?h(X,{variant:"caption",className:n.perf,"data-testid":"graph-perf-stats",children:["fetch ",fe(i)," \xB7 layout ",fe(r)," \xB7 geom"," ",fe(c)]}):null}),Mn=d(function({model:e}){let{classes:n}=Gt();return h("div",{className:n.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:[h(X,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",o(Pn,{model:e})]})}),Tt=Mn;var kn=d(function({model:e}){let{graph:n}=e;return o(z,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:ze.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:n?!l(n):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:o(z,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:n=>{e.setRepeatKey(n)}})}),At=Rn;var _t=P(o("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=P(o("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 Cn=d(function({model:e}){let n=e.highlightMenuItems({picks:!1});return o(be,{size:"small",tooltip:"Graph options",menuItems:[...n.length>0?[{label:"Haplotypes",icon:ht,subMenu:n}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Be,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:mt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{$(e).queueDialog(i=>[gt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:o(zt,{})})}),Wt=Cn;var Ln=_()({formControl:{minWidth:130,maxWidth:260}}),En=d(function({model:e}){let{classes:n}=Ln(),i=Ie(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Ve?o(xe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{$(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):h(Me,{size:"small",className:n.formControl,children:[o(ke,{id:i,children:"Highlight"}),o(Le,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>h(Ce,{value:s,dense:!0,children:[o(Pe,{size:"small",checked:p.includes(s)}),o(Re,{primary:u})]},s))})]})}),Nt=En;var In=_()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=d(function({model:e}){return o(X,{variant:"body2",children:e.zoomPercent})}),Tn=d(function({model:e}){let{classes:n}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:n.toolbar,children:[o(Ht,{model:e}),o(It,{model:e}),o(Nt,{model:e}),o(At,{model:e}),o(K,{title:"Zoom in",children:o(j,{size:"small",onClick:()=>{i(1.5)},children:o(Lt,{})})}),o(K,{title:"Zoom out",children:o(j,{size:"small",onClick:()=>{i(1/1.5)},children:o(Et,{})})}),o(K,{title:"Zoom to fit",children:o(j,{size:"small",onClick:()=>{e.refitView()},children:o(Ct,{})})}),o(Gn,{model:e}),o(Tt,{model:e}),o(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Ue,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function he({label:t,readout:e}){return h(I,{children:[o("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:he(e)};let n=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(n){let l=t.hoverDrawing?.members.get(n.id),p=Ne(n);return{body:h(I,{children:[o("strong",{children:n.name}),l?` and ${l.length-1} more`:""," \u2014"," ",n.length.toLocaleString()," bp, depth ",n.depth.toFixed(1),p?h(I,{children:[o("br",{}),p.sample," ",q(p)," (rank ",n.stable?.rank,")"]}):null,n.moved?h(I,{children:[o("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=We(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?h(I,{children:[o("strong",{children:"Deletion"})," ",l.deletion.bp,o("br",{}),l.deletion.where]}):h(I,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:he(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:he(c)}:void 0}var _n=d(function({model:e,chip:n}){let i=An(e,n);return i?o("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=P(o("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=P(o("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=P(o("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 zn={x:0,y:0};function Wn(t,e){let{own:n,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...Qe({own:n,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,n){let i=n??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!n&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${q(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var oe=d(function({model:e,at:n,onClose:i}){return o(we,{anchor:n,offset:zn,onClose:i,menuItems:()=>n===void 0?[]:"nodeId"in n?Wn(e,n.nodeId):On(e,n.row,n.bars)})});var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},Bn=d(function({bars:e,frame:n,ramp:i,rowGenes:r}){let c=ot(),l=Ge(()=>_e(e,n,{ramp:i,rowGenes:r,idPrefix:c}),[e,n,i,r,c]);return o(Q,{el:l})}),Fn=d(function({model:e}){let n=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=n?[n.reference,...n.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!n||!i||i.labelled||!r||!p)return null;let s=(n.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",He(p,l===0?void 0:n.reference)]})}),Vn=d(function({model:e,bars:n,frame:i}){return o(Q,{el:$e(n,i,e.walkStripMarks)})}),Yn=d(function({model:e}){let n=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!n||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return Ze(n,i,s.clientX-u.left,s.clientY-u.top)},p=Ae(n,{ramp:e.referenceRampDomain,rampCss:Te,genes:Ke(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{G(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[o(Bn,{bars:n,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),o(Vn,{model:e,bars:n,frame:i}),o(Q,{el:je(n,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),o(Fn,{model:e}),h("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[o(ee,{swatch:it(s.swatch)}),o("span",{children:s.label})]},s.label)),o("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),o(oe,{model:e,at:r&&{...r,bars:n},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=d(function({model:e}){let n=e.walkStripLocator;return n?h(J,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[o("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),o("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function me(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),n=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,n))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let n=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(n)<.001?t:t-n}function no(t,e){let n=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!n&&(!e||e.scrollZoom)?"zoom":n?"pan":"page"}function qt(t,e,n){T(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,G(n)&&n.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(n.hostPlacesX||n.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(n.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<n.referenceStripZonePx)return;let w=no(p,n.host);if(w!=="page"){if(n.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let x=p.deltaMode===1?Jn:1;n.setTransform(n.scale,n.translateX-p.deltaX*x,n.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(me(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,n])}var jt=3,ge="data-gesture-owner",F=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,n]=[...t.values()];return{spread:Math.hypot(e.x-n.x,e.y-n.y),mid:{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}}function Ut(t){let e=k({x:0,y:0}),n=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),x=k({frame:0,pan:null,hover:null,pinch:!1});T(()=>()=>{cancelAnimationFrame(x.current.frame)},[]);let[W,E]=C(),[N,O]=C(!1),[V,Y]=C(void 0);function R(a){let f=a.currentTarget.getBoundingClientRect();return{x:a.clientX-f.left,y:a.clientY-f.top}}function L(a,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,f);let g=t.referenceStripNodeAt(a,f);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,f,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,f){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,f,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let f=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&f.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),f.set(a.pointerId,F(a)),s.current=Kt(f),i.current=!0);return}i.current=!1,n.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ge);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,f.clear(),f.set(a.pointerId,F(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,M=t.layoutResult?.tubeMap||b?null:L(v,y);g&&M&&a.currentTarget.setAttribute(ge,""),w.current=g,u.current=b&&!g,M?t.setDraggingNode(M):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ve(){let a=s.current,f=p.current;if(!a||!f)return;let g=Kt(l.current),v=f.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=x.current,{pan:f,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ve(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!g)return;let{x:y,y:b}=g,M=t.facetPanels?void 0:vt(t.overlayLabels,y,b);if(Y(S=>S?.label===M?.label&&S?.readout===M?.readout?S:M),t.walkRowBars){let S=t.walkRowAt(y,b);t.setHoveredWalkRow(S===void 0?null:t.walkRowList[S].name)}if(t.nodePositions&&t.graph){let S=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(S,{x:y,y:b}),O(S!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(S===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(S||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function Z(){x.current.frame||(x.current.frame=requestAnimationFrame(on))}function rn(){let a=x.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let f=l.current;if(s.current&&f.has(a.pointerId)){f.set(a.pointerId,F(a)),x.current.pinch=!0,Z();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-n.current.x,a.clientY-n.current.y)>jt&&(i.current=!0);let y=x.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},Z();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},Z()}}function re(a){let f=l.current;if(s.current&&f.has(a.pointerId)){x.current.pinch&&(x.current.pinch=!1,ve()),f.delete(a.pointerId),s.current=null;let[[g,v]]=[...f];r.current=g,e.current=v;return}c(a)||(r.current=void 0,f.clear(),G(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),Y(void 0),O(!1),G(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:f,y:g}=R(a),v=L(f,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),E({clientX:y,clientY:b,nodeId:v});return}let M=t.walkRowAt(f,g);M!==void 0&&(a.preventDefault(),E({clientX:y,clientY:b,row:M}))}function cn(a){if(!i.current){let{x:f,y:g}=R(a),v=L(f,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}T(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${et}]`))return;m.current?.end(),u.current=!1,w.current=!1;let f=a.pointerId,g=F(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",M,!0),y.moved&&G(t)&&t.stopDragging()}};function b(S){if(S.pointerId!==f)return;if(!y.moved){if(Math.hypot(S.clientX-g.x,S.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let ae=x.current;ae.pan={dx:(ae.pan?.dx??0)+S.clientX-v.x,dy:(ae.pan?.dy??0)+S.clientY-v.y},v=F(S),Z()}function M(S){S.pointerId===f&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",M,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":N?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ge]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:re,onPointerCancel:re,onLostPointerCapture:re,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:W,hoveredChip:V,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{E(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={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},lo=d(function({model:e}){return o(I,{children:e.visibleRowLabels.map(({label:n,y:i,top:r})=>o("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:n},i))})}),co={position:"absolute",top:B,right:B,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={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},po={...Jt,color:"#18181c",fontWeight:600},uo=d(function({model:e}){let n=k(null),i=e.legendAtRest;return T(()=>{let r=n.current;if(!r||!i)return;let c=()=>{G(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),o("div",{ref:n,style:{...co,top:B+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*B-e.referenceStripZonePx},children:o(kt,{model:e})})}),fo=d(function({model:e}){let n=e.overlayLabels.sizes,i=n.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return h(I,{children:[i.length>0?o(J,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>o("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,n.map(({key:r,text:c,x:l,y:p,kind:s})=>o("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=d(function({model:e,handle:{canvasRef:n,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[x,W]=C(null);qt(x,i,e);let E=e.facetPanels!==void 0;return h("div",{style:oo,...p,children:[r?o(Ot,{model:e}):null,h("div",{ref:W,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{G(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?o("div",{style:{...ao,top:e.referenceStripZonePx,background:U}}):null,o("canvas",{ref:n,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),E?o(Rt,{model:e,handlers:c,canvasStyle:l}):h(I,{children:[o(wt,{model:e}),o(Mt,{model:e}),o(bt,{model:e}),o(lo,{model:e}),o(fo,{model:e}),o(nt,{model:e}),o(ft,{model:e}),o(yt,{model:e}),o(St,{model:e}),o(Yt,{model:e}),o(uo,{model:e})]}),r?o("div",{style:io,children:o(Se,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,o(Dt,{model:e,chip:w})]}),e.walkStripShown?o(Vt,{model:e}):null,o(oe,{model:e,at:u,onClose:m}),r?.renderError?o(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?o(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=d(function({model:e}){let{canvasRef:n,canvas:i,error:r,retry:c}=Pt(xt,e);return o(Qt,{model:e,handle:{canvasRef:n,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=d(function({model:e,handle:n}){return n?o(Qt,{model:e,handle:n}):o(ho,{model:e})}),Ki=mo;export{xt as a,Ki as b};
2
+ //# sourceMappingURL=chunk-OS52UJIX.js.map
@@ -0,0 +1,2 @@
1
+ import{c as F}from"./chunk-TMM73K4C.js";import{a as p,b as d,c as y,d as T,h as r,i as g,j as f}from"./chunk-6VNDP3UB.js";import{a as I}from"./chunk-D6TY2QEG.js";var W=5e3;function G(e){return typeof e=="string"&&/^[\w+-][\w.+-]*$/.test(e)}function k(e){return e==null}function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L(e){return M(e)&&G(e.prefix)&&typeof e.foldBelowBp=="number"&&Number.isFinite(e.foldBelowBp)&&e.foldBelowBp>0}function P(e){let n;try{n=JSON.parse(e)}catch{return}if(!M(n)||n.schema!==1)return;let{reference:t,tier:i,index:a,contig:o,bubbles:s,alleles:l}=n;if((k(t)||typeof t=="string"&&t.trim()!=="")&&(k(i)||L(i))&&[a,o,s,l].every(A=>k(A)||G(A)))return{...typeof t=="string"?{reference:t.trim()}:{},...L(i)?{tier:{prefix:i.prefix,foldBelowBp:i.foldBelowBp,...i.format===2?{format:2}:{}}}:{}}}function b(e,n){return f(e,t=>t.replace(/[^/\\]*$/,n))}function R(e){let n=r(e);return[p,d].find(t=>n.endsWith(t))}function N(e){return g(e)&&R(e)!==void 0}function B(e,n){let t=R(e)??p;return f(e,i=>`${i.slice(0,-t.length)}${n}`)}function _(e){return N(e)?B(e,".graph.json"):void 0}async function j(e,n){let t=_(e);if(t)try{let i=await I(t,n).readFile({encoding:"utf8",signal:AbortSignal.timeout(W)});return P(i)}catch{return}}var J={RgfaTabixAdapter:"Indexed GFA (gfa-to-tabix .segs.bed.gz or .graph.bed.gz)",RgfaTabixWalks:"Haplotype walks without lanes (.walks.bed.gz)",WalkTabixSyntenyAdapter:"Haplotype walks (.walks.bed.gz)",GbzBaseSyntenyAdapter:"GBZ database (.gbz.db)",MinigraphBubbleAdapter:"Minigraph bubbles (tabix BED)"},E="Path to a walk file (<prefix>.<sample>.walks.bed.gz from gfa-to-tabix --walks, for the sample this assembly is)",Z={RgfaTabixAdapter:"Path to segments BED (.segs.bed.gz from gfa-to-tabix; the .links.bed.gz, its index and any .graph.json are read beside it), or format 2's .graph.bed.gz",RgfaTabixWalks:E,WalkTabixSyntenyAdapter:E,GbzBaseSyntenyAdapter:"Path to the .gbz.db written by gbz-base construct",MinigraphBubbleAdapter:"Path to bubbles BED (.bed.gz from gfatools bubble)"},u="Path to tabix index (optional; the sibling .tbi is assumed, a .csi is recognised by name)",q={RgfaTabixAdapter:u,RgfaTabixWalks:u,WalkTabixSyntenyAdapter:u,GbzBaseSyntenyAdapter:"Path to the haplotype index (optional; graph.haplotype-index.db beside the database is assumed)",MinigraphBubbleAdapter:u};function x(e,n){return f(e,t=>t+n)}function C(e){if(!r(e).endsWith(p))throw new Error(`Expected a segments BED ending in ${p}, got ${r(e)}`);return B(e,".links.bed.gz")}function c(e,n){return n?{location:n,indexType:F(r(n),"CSI","TBI")}:{location:x(e,".tbi"),indexType:"TBI"}}function h(e,n){return n!==void 0&&F(r(n),"CSI","TBI")==="CSI"?{location:x(e,".csi"),indexType:"CSI"}:{location:x(e,".tbi"),indexType:"TBI"}}function w(e,n){let t=n.trim();return t&&e?{assemblyNameToPanSN:{[e]:t}}:{}}function z(e,n,t){if(!t)return{};if(t.format===2){let o=b(e,`${t.prefix}${d}`);return{coarse:{foldBelowBp:t.foldBelowBp,graphLocation:o,graphIndex:h(o,n)}}}let i=b(e,`${t.prefix}${p}`),a=b(e,`${t.prefix}.links.bed.gz`);return{coarse:{foldBelowBp:t.foldBelowBp,segmentsLocation:i,segmentsIndex:h(i,n),linksLocation:a,linksIndex:h(a,n)}}}function S(e,n,t){let i=t===e?void 0:t;return w(e,n.trim()||i||"")}function $(e){return e?{readsLocation:e,...r(e).endsWith(".gz")&&g(e)?{readsIndex:{location:x(e,".tbi")}}:{}}:{}}function Q(e){return e.split(/[\s,]+/).filter(n=>n!=="")}function D({choice:e,loc:n,indexLoc:t,readsLoc:i,manifest:a,assembly:o,sample:s,haplotypes:l=[]}){if(e==="RgfaTabixWalks"||e==="WalkTabixSyntenyAdapter"){if(!r(n).endsWith(y))throw new Error(`Expected a walk file ending in ${y}, got ${r(n)}`);return{type:e==="RgfaTabixWalks"?"RgfaTabixAdapter":e,walksLocation:n,walksIndex:c(n,t),...S(o,s,T(n)),...l.length>0?{defaultHaplotypes:l}:{}}}if(e==="GbzBaseSyntenyAdapter")return{type:"GbzBaseSyntenyAdapter",gbzDbLocation:n,...t?{haplotypeIndexLocation:t}:{},...$(i),...w(o,s)};if(e==="MinigraphBubbleAdapter")return{type:"MinigraphBubbleAdapter",bubblesLocation:n,index:c(n,t),...w(o,s)};if(r(n).endsWith(d))return{type:"RgfaTabixAdapter",graphLocation:n,graphIndex:c(n,t),...S(o,s,a?.reference),...z(n,t,a?.tier)};let m=C(n);return{type:"RgfaTabixAdapter",segmentsLocation:n,segmentsIndex:c(n,t),linksLocation:m,linksIndex:h(m,t),...S(o,s,a?.reference),...z(n,t,a?.tier)}}function V(e){let{choice:n,assembly:t,trackId:i,name:a}=e;return{type:n==="MinigraphBubbleAdapter"?"FeatureTrack":"GraphTrack",trackId:i,name:a,assemblyNames:[t],adapter:D(e),...n==="RgfaTabixAdapter"||n==="RgfaTabixWalks"?{displayDefaults:{labels:{name:{show:!1},description:{show:!1}}}}:{}}}export{N as a,j as b,J as c,Z as d,q as e,Q as f,D as g,V as h};
2
+ //# sourceMappingURL=chunk-T7LVVBTT.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/GraphAddTrackWorkflow/graphManifest.ts", "../../src/GraphAddTrackWorkflow/buildTrackConfig.ts"],
4
+ "sourcesContent": ["import { openLocation } from '@jbrowse/core/util/io'\n\nimport {\n GRAPH_SUFFIX,\n SEGMENTS_SUFFIX,\n locationName,\n readsSiblings,\n renamed,\n} from '../locationName'\n\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { FileLocation } from '@jbrowse/core/util'\n\n// The part of `<prefix>.graph.json`, written by `gfa-to-tabix build`, that\n// Open track reads\nexport interface GraphManifest {\n reference?: string\n // `format: 2` when the tier is one `<prefix>.graph.bed.gz`, as gfa-to-tabix\n // 2 writes it, rather than a segments and links pair\n tier?: { prefix: string; foldBelowBp: number; format?: 2 }\n}\n\nconst FETCH_TIMEOUT_MS = 5000\n\n// A bare file name beside the manifest: no directory, scheme or leading dot\nfunction isSiblingName(name: unknown): name is string {\n return typeof name === 'string' && /^[\\w+-][\\w.+-]*$/.test(name)\n}\n\nfunction isAbsent(value: unknown) {\n return value === undefined || value === null\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isTier(tier: unknown): tier is NonNullable<GraphManifest['tier']> {\n return (\n isPlainRecord(tier) &&\n isSiblingName(tier.prefix) &&\n typeof tier.foldBelowBp === 'number' &&\n Number.isFinite(tier.foldBelowBp) &&\n tier.foldBelowBp > 0\n )\n}\n\nexport function parseGraphManifest(text: string): GraphManifest | undefined {\n let json: unknown\n try {\n json = JSON.parse(text)\n } catch {\n return undefined\n }\n if (!isPlainRecord(json) || json.schema !== 1) {\n return undefined\n }\n const { reference, tier, index, contig, bubbles, alleles } = json\n const valid =\n (isAbsent(reference) ||\n (typeof reference === 'string' && reference.trim() !== '')) &&\n (isAbsent(tier) || isTier(tier)) &&\n [index, contig, bubbles, alleles].every(\n f => isAbsent(f) || isSiblingName(f),\n )\n if (!valid) {\n return undefined\n }\n return {\n ...(typeof reference === 'string' ? { reference: reference.trim() } : {}),\n ...(isTier(tier)\n ? {\n tier: {\n prefix: tier.prefix,\n foldBelowBp: tier.foldBelowBp,\n ...(tier.format === 2 ? { format: 2 as const } : {}),\n },\n }\n : {}),\n }\n}\n\n// A file the manifest names, in the directory of the segments file opened\nexport function besideSegments(segs: FileLocation, fileName: string) {\n return renamed(segs, name => name.replace(/[^/\\\\]*$/, fileName))\n}\n\n// The suffix of a gfa-to-tabix index file: format 1's segments BED or format\n// 2's graph BED\nfunction indexSuffix(loc: FileLocation) {\n const name = locationName(loc)\n return [SEGMENTS_SUFFIX, GRAPH_SUFFIX].find(suffix => name.endsWith(suffix))\n}\n\n// A segments BED, or format 2's graph BED, the rest of the index and the\n// manifest can be found beside\nexport function isGraphIndexLocation(loc: FileLocation) {\n return readsSiblings(loc) && indexSuffix(loc) !== undefined\n}\n\n// `<prefix><suffix>` beside `<prefix>.segs.bed.gz` or `<prefix>.graph.bed.gz`\nexport function segmentsSibling(segs: FileLocation, suffix: string) {\n const own = indexSuffix(segs) ?? SEGMENTS_SUFFIX\n return renamed(segs, name => `${name.slice(0, -own.length)}${suffix}`)\n}\n\nexport function manifestLocation(segs: FileLocation) {\n return isGraphIndexLocation(segs)\n ? segmentsSibling(segs, '.graph.json')\n : undefined\n}\n\n// Undefined for a manifest that is missing, unreadable or not schema 1, so\n// Open track falls back to the files beside the segments alone\nexport async function readGraphManifest(\n segs: FileLocation,\n pluginManager?: PluginManager,\n) {\n const loc = manifestLocation(segs)\n if (!loc) {\n return undefined\n }\n try {\n const text = await openLocation(loc, pluginManager).readFile({\n encoding: 'utf8',\n signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n })\n return parseGraphManifest(text)\n } catch {\n return undefined\n }\n}\n", "import { makeIndexType } from '@jbrowse/core/util/tracks'\n\nimport { besideSegments, segmentsSibling } from './graphManifest'\nimport {\n GRAPH_SUFFIX,\n SEGMENTS_SUFFIX,\n WALKS_SUFFIX,\n locationName,\n readsSiblings,\n renamed,\n walkFileSample,\n} from '../locationName'\n\nimport type { GraphManifest } from './graphManifest'\nimport type { FileLocation } from '@jbrowse/core/util'\n\n// 'RgfaTabixWalks' is an RgfaTabixAdapter read from a walk file, which draws\n// the graph without haplotype lanes\nexport type GraphFileChoice =\n | 'RgfaTabixAdapter'\n | 'RgfaTabixWalks'\n | 'WalkTabixSyntenyAdapter'\n | 'GbzBaseSyntenyAdapter'\n | 'MinigraphBubbleAdapter'\n\nexport const GRAPH_FILE_LABELS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter: 'Indexed GFA (gfa-to-tabix .segs.bed.gz or .graph.bed.gz)',\n RgfaTabixWalks: 'Haplotype walks without lanes (.walks.bed.gz)',\n WalkTabixSyntenyAdapter: 'Haplotype walks (.walks.bed.gz)',\n GbzBaseSyntenyAdapter: 'GBZ database (.gbz.db)',\n MinigraphBubbleAdapter: 'Minigraph bubbles (tabix BED)',\n}\n\nconst WALKS_FIELD =\n 'Path to a walk file (<prefix>.<sample>.walks.bed.gz from gfa-to-tabix --walks, for the sample this assembly is)'\n\nexport const GRAPH_FILE_FIELDS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter:\n \"Path to segments BED (.segs.bed.gz from gfa-to-tabix; the .links.bed.gz, its index and any .graph.json are read beside it), or format 2's .graph.bed.gz\",\n RgfaTabixWalks: WALKS_FIELD,\n WalkTabixSyntenyAdapter: WALKS_FIELD,\n GbzBaseSyntenyAdapter: 'Path to the .gbz.db written by gbz-base construct',\n MinigraphBubbleAdapter: 'Path to bubbles BED (.bed.gz from gfatools bubble)',\n}\n\nconst TABIX_INDEX_FIELD =\n 'Path to tabix index (optional; the sibling .tbi is assumed, a .csi is recognised by name)'\n\nexport const GRAPH_INDEX_FIELDS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter: TABIX_INDEX_FIELD,\n RgfaTabixWalks: TABIX_INDEX_FIELD,\n WalkTabixSyntenyAdapter: TABIX_INDEX_FIELD,\n GbzBaseSyntenyAdapter:\n 'Path to the haplotype index (optional; graph.haplotype-index.db beside the database is assumed)',\n MinigraphBubbleAdapter: TABIX_INDEX_FIELD,\n}\n\nfunction sibling(loc: FileLocation, suffix: string) {\n return renamed(loc, name => name + suffix)\n}\n\nfunction linksLocation(loc: FileLocation) {\n if (!locationName(loc).endsWith(SEGMENTS_SUFFIX)) {\n throw new Error(\n `Expected a segments BED ending in ${SEGMENTS_SUFFIX}, got ${locationName(loc)}`,\n )\n }\n return segmentsSibling(loc, '.links.bed.gz')\n}\n\nfunction tabixIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n return indexLoc\n ? {\n location: indexLoc,\n indexType: makeIndexType(locationName(indexLoc), 'CSI', 'TBI'),\n }\n : { location: sibling(loc, '.tbi'), indexType: 'TBI' }\n}\n\n// The links file's index is assumed beside it, of the kind the segments' is.\nfunction siblingIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n const csi =\n indexLoc !== undefined &&\n makeIndexType(locationName(indexLoc), 'CSI', 'TBI') === 'CSI'\n return csi\n ? { location: sibling(loc, '.csi'), indexType: 'CSI' }\n : { location: sibling(loc, '.tbi'), indexType: 'TBI' }\n}\n\n// none for a guessed config, which knows no assembly yet; see withWalkReference\nfunction panSN(assembly: string, sample: string) {\n const name = sample.trim()\n return name && assembly ? { assemblyNameToPanSN: { [assembly]: name } } : {}\n}\n\nfunction coarseTier(\n loc: FileLocation,\n indexLoc: FileLocation | undefined,\n tier: GraphManifest['tier'],\n) {\n if (!tier) {\n return {}\n }\n if (tier.format === 2) {\n const graph = besideSegments(loc, `${tier.prefix}${GRAPH_SUFFIX}`)\n return {\n coarse: {\n foldBelowBp: tier.foldBelowBp,\n graphLocation: graph,\n graphIndex: siblingIndex(graph, indexLoc),\n },\n }\n }\n const segs = besideSegments(loc, `${tier.prefix}${SEGMENTS_SUFFIX}`)\n const links = besideSegments(loc, `${tier.prefix}.links.bed.gz`)\n return {\n coarse: {\n foldBelowBp: tier.foldBelowBp,\n segmentsLocation: segs,\n segmentsIndex: siblingIndex(segs, indexLoc),\n linksLocation: links,\n linksIndex: siblingIndex(links, indexLoc),\n },\n }\n}\n\n// The user's sample wins; the reference the graph's files name (a manifest's,\n// or a walk file's own) stands in when blank\nfunction referencePanSN(\n assembly: string,\n sample: string,\n reference: string | undefined,\n) {\n const fromManifest = reference === assembly ? undefined : reference\n return panSN(assembly, sample.trim() || fromManifest || '')\n}\n\n// a bgzipped GAF is read by its tabix index, a plain one whole\nfunction readsConfig(readsLoc: FileLocation | undefined) {\n return readsLoc\n ? {\n readsLocation: readsLoc,\n ...(locationName(readsLoc).endsWith('.gz') && readsSiblings(readsLoc)\n ? { readsIndex: { location: sibling(readsLoc, '.tbi') } }\n : {}),\n }\n : {}\n}\n\n// Names typed as a list, by comma or space\nexport function parseHaplotypes(text: string) {\n return text.split(/[\\s,]+/).filter(name => name !== '')\n}\n\nexport function buildAdapterConfig({\n choice,\n loc,\n indexLoc,\n readsLoc,\n manifest,\n assembly,\n sample,\n haplotypes = [],\n}: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n // a GBZ track's GAF reads, which no other choice takes\n readsLoc?: FileLocation\n // the `.graph.json` beside an rGFA segments file\n manifest?: GraphManifest\n assembly: string\n sample: string\n // a walk file's haplotypes to cut for until the user picks others\n haplotypes?: string[]\n}) {\n if (choice === 'RgfaTabixWalks' || choice === 'WalkTabixSyntenyAdapter') {\n if (!locationName(loc).endsWith(WALKS_SUFFIX)) {\n throw new Error(\n `Expected a walk file ending in ${WALKS_SUFFIX}, got ${locationName(loc)}`,\n )\n }\n return {\n type: choice === 'RgfaTabixWalks' ? 'RgfaTabixAdapter' : choice,\n walksLocation: loc,\n walksIndex: tabixIndex(loc, indexLoc),\n ...referencePanSN(assembly, sample, walkFileSample(loc)),\n ...(haplotypes.length > 0 ? { defaultHaplotypes: haplotypes } : {}),\n }\n }\n if (choice === 'GbzBaseSyntenyAdapter') {\n return {\n type: 'GbzBaseSyntenyAdapter',\n gbzDbLocation: loc,\n ...(indexLoc ? { haplotypeIndexLocation: indexLoc } : {}),\n ...readsConfig(readsLoc),\n ...panSN(assembly, sample),\n }\n }\n if (choice === 'MinigraphBubbleAdapter') {\n return {\n type: 'MinigraphBubbleAdapter',\n bubblesLocation: loc,\n index: tabixIndex(loc, indexLoc),\n ...panSN(assembly, sample),\n }\n }\n if (locationName(loc).endsWith(GRAPH_SUFFIX)) {\n return {\n type: 'RgfaTabixAdapter',\n graphLocation: loc,\n graphIndex: tabixIndex(loc, indexLoc),\n ...referencePanSN(assembly, sample, manifest?.reference),\n ...coarseTier(loc, indexLoc, manifest?.tier),\n }\n }\n const links = linksLocation(loc)\n return {\n type: 'RgfaTabixAdapter',\n segmentsLocation: loc,\n segmentsIndex: tabixIndex(loc, indexLoc),\n linksLocation: links,\n linksIndex: siblingIndex(links, indexLoc),\n ...referencePanSN(assembly, sample, manifest?.reference),\n ...coarseTier(loc, indexLoc, manifest?.tier),\n }\n}\n\nexport function buildTrackConfig(args: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n readsLoc?: FileLocation\n manifest?: GraphManifest\n assembly: string\n sample: string\n haplotypes?: string[]\n trackId: string\n name: string\n}) {\n const { choice, assembly, trackId, name } = args\n return {\n type: choice === 'MinigraphBubbleAdapter' ? 'FeatureTrack' : 'GraphTrack',\n trackId,\n name,\n assemblyNames: [assembly],\n adapter: buildAdapterConfig(args),\n ...(choice === 'RgfaTabixAdapter' || choice === 'RgfaTabixWalks'\n ? {\n displayDefaults: {\n labels: { name: { show: false }, description: { show: false } },\n },\n }\n : {}),\n }\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["FETCH_TIMEOUT_MS", "isSiblingName", "name", "isAbsent", "value", "isPlainRecord", "isTier", "tier", "parseGraphManifest", "text", "json", "reference", "index", "contig", "bubbles", "alleles", "f", "besideSegments", "segs", "fileName", "renamed", "indexSuffix", "loc", "locationName", "SEGMENTS_SUFFIX", "GRAPH_SUFFIX", "suffix", "isGraphIndexLocation", "readsSiblings", "segmentsSibling", "own", "manifestLocation", "readGraphManifest", "pluginManager", "openLocation", "GRAPH_FILE_LABELS", "WALKS_FIELD", "GRAPH_FILE_FIELDS", "TABIX_INDEX_FIELD", "GRAPH_INDEX_FIELDS", "sibling", "loc", "suffix", "renamed", "name", "linksLocation", "locationName", "SEGMENTS_SUFFIX", "segmentsSibling", "tabixIndex", "indexLoc", "makeIndexType", "siblingIndex", "panSN", "assembly", "sample", "coarseTier", "tier", "graph", "besideSegments", "GRAPH_SUFFIX", "segs", "links", "referencePanSN", "reference", "fromManifest", "readsConfig", "readsLoc", "readsSiblings", "parseHaplotypes", "text", "buildAdapterConfig", "choice", "manifest", "haplotypes", "WALKS_SUFFIX", "walkFileSample", "buildTrackConfig", "args", "trackId"]
7
+ }