jbrowse-plugin-graphgenomeviewer 10.0.0 → 10.0.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.
- package/dist/chunks/{GraphGenomeView-YWPL7SG6.js → GraphGenomeView-2WSTZQNY.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-QXKYX5H2.js → LinearGraphDisplay-VYCJVUW4.js} +2 -2
- package/dist/chunks/{chunk-6HGDLU7H.js → chunk-EUXYBAW2.js} +5 -5
- package/dist/chunks/{chunk-6HGDLU7H.js.map → chunk-EUXYBAW2.js.map} +3 -3
- package/dist/chunks/{chunk-4HKASMM4.js → chunk-EVYIBH4N.js} +2 -2
- package/dist/chunks/{chunk-WBJPOKQT.js → chunk-ZKQLPKNN.js} +3 -3
- package/dist/chunks/{chunk-WBJPOKQT.js.map → chunk-ZKQLPKNN.js.map} +3 -3
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/GraphGenomeView/model.facetRebuild.test.ts +99 -0
- package/src/GraphGenomeView/model.ts +0 -6
- package/src/GraphGenomeView/pane/fitViews.ts +10 -5
- package/src/GraphGenomeView/pane/renderingActions.ts +24 -15
- package/src/RgfaTabixAdapter/test_data/walks8/build.sh +1 -0
- package/src/RgfaTabixAdapter/test_data/walks8/chain.GRCh38.gfa +500 -0
- package/src/RgfaTabixAdapter/test_data/walks8/chain.GRCh38.walks.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks8/chain.GRCh38.walks.gz.idx +3 -0
- package/src/version.ts +1 -1
- /package/dist/chunks/{GraphGenomeView-YWPL7SG6.js.map → GraphGenomeView-2WSTZQNY.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-QXKYX5H2.js.map → LinearGraphDisplay-VYCJVUW4.js.map} +0 -0
- /package/dist/chunks/{chunk-4HKASMM4.js.map → chunk-EVYIBH4N.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-NDWP2KNR.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-WBJPOKQT.js";import{q as O}from"./chunk-OP2PTYDR.js";import{$c as st,Ba as pe,Eb as Q,Ha as J,J as ce,La as Fe,Mb as Je,Na as Ve,Nb as Qe,S as We,Wb as _,Ya as Ye,Z as Be,a as F,b as ke,d as Pe,ea as De}from"./chunk-AVUNIRM5.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-CTQBRAQH.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[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 _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,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:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("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 Bt=P([n("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"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("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 zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.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(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("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 jt=P(n("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 Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,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:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{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:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("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=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("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 tn=P(n("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 Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={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},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},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:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("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"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={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},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={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},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-NDWP2KNR.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-ZKQLPKNN.js";import{q as O}from"./chunk-OP2PTYDR.js";import{$c as st,Ba as pe,Eb as Q,Ha as J,J as ce,La as Fe,Mb as Je,Na as Ve,Nb as Qe,S as We,Wb as _,Ya as Ye,Z as Be,a as F,b as ke,d as Pe,ea as De}from"./chunk-AVUNIRM5.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-CTQBRAQH.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[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 _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,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:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("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 Bt=P([n("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"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("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 zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.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(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("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 jt=P(n("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 Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,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:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{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:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("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=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("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 tn=P(n("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 Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={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},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},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:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("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"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={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},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={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},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EVYIBH4N.js.map
|