jbrowse-plugin-graphgenomeviewer 4.2.0 → 4.4.0
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-QOBHGMLE.js → GraphGenomeView-NHYVE7GZ.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-RTSJTM6A.js → GraphTrackSettingsDialog-LXYUYPZS.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-TPXW6POY.js → LinearGraphDisplay-742CW5KL.js} +2 -2
- package/dist/chunks/chunk-5GUQPO7Y.js +3 -0
- package/dist/chunks/chunk-5GUQPO7Y.js.map +7 -0
- package/dist/chunks/{chunk-4C4CMI6K.js → chunk-CNFN6EVE.js} +2 -2
- package/dist/chunks/chunk-QHMGWDDH.js +2 -0
- package/dist/chunks/chunk-QHMGWDDH.js.map +7 -0
- package/dist/chunks/chunk-UTWFU4X6.js +2 -0
- package/dist/chunks/chunk-UTWFU4X6.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +5 -5
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +2 -2
- package/src/GraphGenomeView/components/GraphCanvas.tsx +6 -53
- package/src/GraphGenomeView/components/WalkRowContextMenu.tsx +63 -0
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +1 -1
- package/src/GraphGenomeView/components/WalkStrip.tsx +210 -0
- package/src/GraphGenomeView/components/WalkStripLocator.tsx +49 -0
- package/src/GraphGenomeView/components/usePaneGestures.ts +1 -0
- package/src/GraphGenomeView/model.test.ts +42 -3
- package/src/GraphGenomeView/model.ts +226 -105
- package/src/GraphGenomeView/viewModel.ts +23 -7
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-ECKLYJWP.js +0 -2
- package/dist/chunks/chunk-ECKLYJWP.js.map +0 -7
- package/dist/chunks/chunk-HW55QCJG.js +0 -3
- package/dist/chunks/chunk-HW55QCJG.js.map +0 -7
- package/dist/chunks/chunk-SIP5IHWK.js +0 -2
- package/dist/chunks/chunk-SIP5IHWK.js.map +0 -7
- /package/dist/chunks/{GraphGenomeView-QOBHGMLE.js.map → GraphGenomeView-NHYVE7GZ.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-RTSJTM6A.js.map → GraphTrackSettingsDialog-LXYUYPZS.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-TPXW6POY.js.map → LinearGraphDisplay-742CW5KL.js.map} +0 -0
- /package/dist/chunks/{chunk-4C4CMI6K.js.map → chunk-CNFN6EVE.js.map} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as vn}from"./chunk-UQEPPJEO.js";import{c as bn}from"./chunk-SCMIJAAX.js";import{A as At,B as Cn,C as An,D as _t,E as It,H as _n,I as In,U as Pn,V as dt,a as ve,i as xn,j as Ct,k as yn,l as Mn,m as wn,n as Rn,o as En,t as Sn,u as ut,v as Nn,w as Ue,x as be,y as Ln,z as Tn}from"./chunk-ECKLYJWP.js";import{a as je,b as P,c as lt,d as _e,e as gn,f as Ie,i as ct}from"./chunk-7BKUWQE5.js";import{a as at,c as mn,d as it}from"./chunk-KULNKXPT.js";import{a as st}from"./chunk-XEJ47DLD.js";import{a as Ke,b as H}from"./chunk-FY3BTKY4.js";var $n=Ke((pl,On)=>{On.exports=JBrowseExports["@mui/material/SvgIcon"]});var Pe=Ke((yl,Gn)=>{Gn.exports=JBrowseExports["@jbrowse/core/util/colorBits"]});var ks=Ke((rc,so)=>{so.exports=JBrowseExports.mobx});var ar=Ke((Eu,sr)=>{sr.exports=JBrowseExports["@jbrowse/render-core/canvas2dUtils"]});var lr=Ke((Su,ir)=>{ir.exports=JBrowseExports["@jbrowse/render-core/renderingBackendBase"]});var ne=H($n(),1);var Kr=3.4,Bn=6,jr=8,Ur=18,Vr=2,Qr=15;function Zr(e){let t=e.gene.end-e.gene.start;if(e.covered>=.98)return;let[n,r]=t>=1e6?[1e6,"Mb"]:t>=1e3?[1e3,"kb"]:[1,"bp"],o=s=>+(s/n).toFixed(n===1?0:1);return`${o(e.covered*t)} of ${o(t)} ${r}`}function Jr(e,t,n){return kn(e,r=>r.gene.end-r.gene.start).map(r=>{let{x:o,y:s}=t(r.at),a=Zr(r);return{item:r,x:o,y:s+n+Ur,text:a?`${r.gene.name} \xB7 ${a}`:r.gene.name,fallback:a?`${r.gene.name} \u2026`:void 0,stack:Vr}})}function kn(e,t){return[...e].sort((n,r)=>t(r)-t(n))}function bl(e){let{paneWidth:t,canvasHeight:n,translateX:r,translateY:o}=e,{scaleX:s,scaleY:a}=e.axisScale,i={width:t,height:n},l=R=>({x:R.x*s+r,y:R.y*a+o}),c=e.drawnRowLabels.map(({label:R,y:T})=>Nn(R,T*a+o)),d=e.referenceStripZonePx??0;d>0&&c.push({x0:0,x1:t,y0:0,y1:d}),e.legendSize.width>0&&c.push({x0:t-Bn-e.legendSize.width,x1:t,y0:0,y1:d+Bn+e.legendSize.height}),e.poppedFrom&&c.push({x0:0,x1:60+e.poppedFrom.label.length*6.2*1.2,y0:0,y1:44});let u=Sn(i,c),f=e.drawnRowLabels.length>0,h=f?Math.min(...e.drawnRowLabels.map(R=>R.y)):1/0,p=e.contigThickness*Kr,m=kn(e.bubbleHalos,R=>R.members),g=ut(m.map(R=>{let{x:T,y:O}=l({x:R.labelAt.x,y:Math.min(R.labelAt.y,h)}),k=O-p/2-6;return{item:R,x:T,y:f?Math.max(k,Qr):k,text:R.label}}),i,u),b=ut(Jr(e.genePins,l,e.contigThickness),i,u),M=e.nodePositions&&e.labelsNodeSizes?Ln({nodePositions:e.nodePositions,nodeLengths:e.nodeLengths,deletions:e.showDeletionEdges?e.deletions:[],alleleDeletions:e.alleleDeletions,axis:e.axisScale,translateX:r,translateY:o,width:t,height:n,version:e.positionsVersion}):{deletions:[],nodes:[]},N=At(M.deletions,u),E=ut(m.flatMap(R=>R.routes.map(T=>{let{x:O,y:k}=l(T.at);return{item:{halo:R,route:T},x:O,y:k+4,text:T.text,stack:jr}})),i,u),S=At(M.nodes,u,Tn(t,n));return{bubbles:g,genes:b,routes:E,sizes:[...N,...S]}}var F=H(Pe(),1);var G=H(Pe(),1);function Oe(e,t){return(0,G.packAbgr)((0,G.abgrRed)(e),(0,G.abgrGreen)(e),(0,G.abgrBlue)(e),Math.round((0,G.abgrAlpha)(e)*t))}function pt(e,t){return(0,G.packAbgr)(Math.min(255,Math.round((0,G.abgrRed)(e)*t)),Math.min(255,Math.round((0,G.abgrGreen)(e)*t)),Math.min(255,Math.round((0,G.abgrBlue)(e)*t)),(0,G.abgrAlpha)(e))}var es=4;function Ve(e){let t=new Map;function n(r,o){let s=t.get(r);s?s.push(o):t.set(r,[o])}for(let r of e.edges)n(r.from,r.to),n(r.to,r.from);return t}function ts({nodeId:e,nodeById:t,neighbors:n}){let r=new Set([e]),o=[e],s=1/0,a=-1/0;for(let i=0;i<es&&o.length>0;i++){let l=[];for(let c of o){let d=n.get(c);if(d){for(let u of d)if(!r.has(u)){r.add(u);let f=t.get(u);f&&P(f)?(s=Math.min(s,f.stable.start+f.length),a=Math.max(a,f.stable.start)):l.push(u)}}}o=l}return s===1/0?void 0:{start:Math.min(s,a),end:Math.max(s,a)}}function ns({nodeId:e,nodeById:t,neighbors:n}){let r=t.get(e);return r===void 0?void 0:P(r)?{start:r.stable.start,end:r.stable.start+r.length}:ts({nodeId:e,nodeById:t,neighbors:n})}function Fn(e){let t=new Map(e.nodes.map(o=>[o.id,o])),n=Ve(e),r=new Map;for(let o of e.nodes){let s=ns({nodeId:o.id,nodeById:t,neighbors:n});s&&r.set(o.id,(s.start+s.end)/2)}return r}var Wn=new WeakMap;function Dn(e,t,n,r,o){let{scaleX:s,scaleY:a}=n,i=Wn.get(e);if(i?.graph===t&&i.scaleX===s&&i.scaleY===a&&i.deletions===r&&i.version===o)return i.curves;let l=new Map;for(let c=0;c<t.edges.length;c++){let d=t.edges[c],u=e[d.from],f=e[d.to];if(u?.length&&f?.length){let h=r?.get(c);l.set(c,Rn(u,f,wn(d),0,0,n,h?En(e,h):[]))}}return Wn.set(e,{graph:t,scaleX:s,scaleY:a,deletions:r,version:o,curves:l}),l}var os=(0,F.packAbgr)(119,119,119,217),qn=(0,F.packAbgr)(136,136,136,217),rs=(0,F.packAbgr)(24,24,28,240),ss=2.2,Un=(0,F.packAbgr)(160,160,160,255),Qe=.18,Bt=(0,F.abgrToCssRgba)(Oe(Un,Qe)),as=11,is=1.2,Hn=4,vt=1e-6,ls=7,cs=3,us=3,ds=1.5,fs=.5,ps=.45,Pt=12,hs=1e-6,le=new Float64Array(64),xe=new Float64Array(64),ye=new Float64Array(64);function ms(e,t,n,r){let o=e.length*Pt+1;le.length<o&&(le=new Float64Array(o),xe=new Float64Array(o),ye=new Float64Array(o));let s=e[e.length-1];le[0]=s.x1,xe[0]=s.y1,ye[0]=0;let a=1,i=0;for(let l=e.length-1;l>=0&&i<r;l--){let c=e[l];for(let d=1;d<=Pt&&i<r;d++){let u=1-(d/Pt)**2,f=1-u,h=f*f*f,p=3*f*f*u,m=3*f*u*u,g=u*u*u,b=h*c.x0+p*c.cx0+m*c.cx1+g*c.x1,M=h*c.y0+p*c.cy0+m*c.cy1+g*c.y1;i+=Math.hypot(b-le[a-1],(M-xe[a-1])*n)*t,le[a]=b,xe[a]=M,ye[a]=i,a++}}return a}function Xn(e,t){let n=1;for(;n<e-1&&ye[n]<t;)n++;let r=ye[n-1],o=ye[n],s=o>r?Math.min(1,Math.max(0,(t-r)/(o-r))):0;return{x:le[n-1]+(le[n]-le[n-1])*s,y:xe[n-1]+(xe[n]-xe[n-1])*s}}function gs({curves:e,edgeHalfWidth:t,nodeHalfWidth:n,scale:r,yToX:o,color:s,fromSegments:a,toSegments:i}){let l=ls+cs*t,c=ms(e,r,o,n+l),d=ye[c-1],u=Math.min(n,d),f=d<hs?bs(a,r,o):d-u,h=Math.min(1,f/l);if(h<fs)return;let p=Xn(c,u),m=Xn(c,u+l*h),g=p.x-m.x,b=(p.y-m.y)*o,M=e[e.length-1];return{x:p.x,y:p.y,angle:Math.hypot(g,b)>0?Math.atan2(b,g):Ns(M,o,xs(M,i)),length:l*h,halfWidth:(us+ds*t)*h,color:s}}function bs(e,t,n){let r=0;for(let o=1;o<e.length;o++)r+=Math.hypot(e[o].x-e[o-1].x,(e[o].y-e[o-1].y)*n);return r*t}function xs(e,t){if(t.length<2)return;let n=t[0],r=t[t.length-1];return Math.hypot(e.x1-n.x,e.y1-n.y)<=Math.hypot(e.x1-r.x,e.y1-r.y)?{from:n,to:t[1]}:{from:r,to:t[t.length-2]}}function Ot(e,t=1){let n=t===1?e:e.map(o=>({x:o.x,y:o.y*t})),r=[];for(let o=0;o<n.length;o++){let s=0,a=0;if(o===0){let i=n[1].x-n[0].x,l=n[1].y-n[0].y,c=Math.hypot(i,l);c>0&&(s=-l/c,a=i/c)}else if(o===n.length-1){let i=n[o].x-n[o-1].x,l=n[o].y-n[o-1].y,c=Math.hypot(i,l);c>0&&(s=-l/c,a=i/c)}else{let i=n[o].x-n[o-1].x,l=n[o].y-n[o-1].y,c=Math.hypot(i,l),d=n[o+1].x-n[o].x,u=n[o+1].y-n[o].y,f=Math.hypot(d,u);if(c>0&&f>0){let h=-l/c,p=i/c,m=-u/f,g=d/f;s=(h+m)/2,a=(p+g)/2;let b=h*s+p*a;b>.1&&(s/=b,a/=b)}else c>0?(s=-l/c,a=i/c):f>0&&(s=-u/f,a=d/f)}r.push({nx:s,ny:a})}return r}function Yn(e,t,n,r=1){return e.map((o,s)=>({x:o.x+t[s].nx*n,y:o.y+t[s].ny*n/r}))}function ht(e,t,n,r){return(0,F.packAbgr)(Math.round(e*255),Math.round(t*255),Math.round(n*255),Math.round(r*255))}function $e(e,t,n){let r=(1-Math.abs(2*n-1))*t,o=r*(1-Math.abs(e/60%2-1)),s=n-r/2,a=0,i=0,l=0;return e<60?(a=r,i=o):e<120?(a=o,i=r):e<180?(i=r,l=o):e<240?(i=o,l=r):e<300?(a=o,l=r):(a=r,l=o),[a+s,i+s,l+s]}var ys=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Ms=[[237,137,44],[158,42,122]],ws=[[220,50,50],[50,120,220]];function $t(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),r=Math.min(e.length-2,Math.floor(n)),o=n-r,s=e[r],a=e[r+1];return(0,F.packAbgr)(Math.round(s[0]+(a[0]-s[0])*o),Math.round(s[1]+(a[1]-s[1])*o),Math.round(s[2]+(a[2]-s[2])*o),255)}function Rs(e,t){let[n,r,o]=$e(Cn(e),_t,It);return ht(n,r,o,t)}var Be=300,Es=.7,Ss=.5,Vn=[60,65,72],kt=(0,F.packAbgr)(...Vn,255),Gt=`rgb(${Vn.join(", ")})`;function vl(e,t){let n=Fn(e);if(t&&t.end>t.start)return{start:t.start,span:t.end-t.start,midpoints:n};let r=1/0,o=-1/0;for(let s of n.values())r=Math.min(r,s),o=Math.max(o,s);return{start:r===1/0?0:r,span:o>r?o-r:1,midpoints:n}}function Ft(e){let t=1/0,n=-1/0,r=1/0,o=-1/0,s=0;for(let a of e.nodes)a.stable!==void 0&&a.stable.rank>s&&(s=a.stable.rank),a.depth<t&&(t=a.depth),a.depth>n&&(n=a.depth),a.length<r&&(r=a.length),a.length>o&&(o=a.length);return{minDepth:t,maxDepth:n,minLength:r,maxLength:o,maxRank:s,nodeCount:e.nodes.length}}function Wt(e,t,n,r){switch(n){case"random":return Rs(e.id,1);case"depth":return $t(ys,r.maxDepth>r.minDepth?(e.depth-r.minDepth)/(r.maxDepth-r.minDepth):.5);case"node-length":return $t(ws,r.maxLength>r.minLength?(e.length-r.minLength)/(r.maxLength-r.minLength):.5);case"stable-rank":return e.stable===void 0?(0,F.packAbgr)(160,160,160,255):e.stable.rank===0?(0,F.packAbgr)(52,152,219,255):$t(Ms,r.maxRank>1?(e.stable.rank-1)/(r.maxRank-1):0);case"reference-position":{let o=r.referenceRamp,s=o?.midpoints.get(e.id);if(o===void 0||s===void 0)return(0,F.packAbgr)(160,160,160,255);if(e.stable!==void 0&&e.stable.rank>0)return kt;let a=Math.max(0,Math.min(1,(s-o.start)/o.span)),[i,l,c]=$e(a*Be,Es,Ss);return ht(i,l,c,1)}case"grey":return(0,F.packAbgr)(160,160,160,255);case"rainbow":{let o=r.nodeCount>1?t/r.nodeCount*360:0,[s,a,i]=$e(o,.75,.5);return ht(s,a,i,1)}default:return(0,F.packAbgr)(52,152,219,255)}}function Ns(e,t=1,n){let r=[[e.cx1,e.cy1],[e.cx0,e.cy0],[e.x0,e.y0]];for(let[o,s]of r){let a=e.x1-o,i=(e.y1-s)*t;if(Math.hypot(a,i)>0)return Math.atan2(i,a)}return n?Math.atan2((n.to.y-n.from.y)*t,n.to.x-n.from.x):0}function Ls(e,t){let n=!1;for(let r=0;r<e.length-1&&!n;r++){let o=e[r],s=e[r+1];n=Math.max(o.x,s.x)>=t.minX&&Math.min(o.x,s.x)<=t.maxX&&Math.max(o.y,s.y)>=t.minY&&Math.min(o.y,s.y)<=t.maxY}return n}function zn(e,t){for(let n of e){let r=Math.min(n.x0,n.cx0,n.cx1,n.x1),o=Math.max(n.x0,n.cx0,n.cx1,n.x1),s=Math.min(n.y0,n.cy0,n.cy1,n.y1),a=Math.max(n.y0,n.cy0,n.cy1,n.y1);if(o>=t.minX&&r<=t.maxX&&a>=t.minY&&s<=t.maxY)return!0}return!1}var Kn=new WeakMap;function Ts(e){let t=Kn.get(e);if(!t){let n=[],r=new Map,o=e.paths??[];for(let s=0;s<o.length;s++){let[a,i,l]=$e(An(s,o.length),_t,It);n.push(ht(a,i,l,.85)),r.has(o[s].name)||r.set(o[s].name,s)}t={pathColorByIndex:n,pathIndexByName:r},Kn.set(e,t)}return t}var jn=new WeakMap,Cs=new Map;function As(e){let t=jn.get(e);if(!t){t=new Map;for(let[n,r]of(e.paths??[]).entries())for(let o of new Set(r.nodeIds)){let s=t.get(o);s?s.push(n):t.set(o,[n])}jn.set(e,t)}return t}function Pl(e){let{nodePositions:t,graph:n,nodeById:r,colorScheme:o,contigThickness:s,connectorThickness:a,drawPaths:i,nodeWidth:l="uniform",highlight:c,axis:d,linearLayout:u,viewportBounds:f,referenceRamp:h,deletions:p,hiddenEdges:m,version:g=0}=e,b=l==="depth"?Pn(n):0,M=d.scaleX,N=yn(d),E=Dn(t,n,d,p,g),S=[],R=new Map,T=[],O=new Map,k=[],Q=new Map,fe={...Ft(n),referenceRamp:h},qe=new Map;if(o==="rainbow")for(let A=0;A<n.nodes.length;A++)qe.set(n.nodes[A].id,A);let Ee=n.paths?.length??0,{pathColorByIndex:re,pathIndexByName:j}=Ts(n),Z=A=>re[j.get(A)??-1]??qn,Y=i&&Ee>1?As(n):Cs,z=M>(u?1:ps);for(let A=0;A<n.edges.length;A++){let v=n.edges[A],U=t[v.from],se=t[v.to],ae=E.get(A);if(!U?.length||!se?.length||!ae||m?.has(A))continue;let Se=v.pathIds?.length??0,He=p?.get(A)!==void 0,Xe=c?.edgeIndexes.has(A)??!1,pe=a/2*(He?ss:1),Ne=i&&Se>0,he=He?rs:os,J=!c||Xe?he:Oe(he,Qe),Ye=r.get(v.to),Le=(Ye?dt(Ye,s,l,b):s)/2,Te=(ge,Ae,q,ie)=>{let te=ge===0&&Ae===0?ae:Ct(ae,ge,Ae);if(f&&!zn(te,f))return;if(He)for(let Nt of xn(te,as/M))k.push({curves:Nt,thickness:pe,color:q});else k.push({curves:te,thickness:pe,color:q});let rt=z&&ie!==void 0?gs({curves:te,edgeHalfWidth:pe,nodeHalfWidth:Le,scale:M,yToX:N,color:ie,fromSegments:U,toSegments:se}):void 0;rt&&T.push(rt)},me=k.length,Ce=T.length,ee=c&&Xe&&!Ne?c.walks:void 0;if(ee){let ge=r.get(v.from),Ae=ge?dt(ge,s,l,b):s,q=Math.max(Ae/ee.length,Hn),ie=Ot(U,N),{nx:te,ny:rt}=(v.fromStrand==="-"?ie[0]:ie.at(-1))??{nx:0,ny:0},Nt=1/Math.max(M,vt);ee.forEach((Lt,Xr)=>{if(!Lt.edgeIndexes.has(A))return;let Tt=(Xr-(ee.length-1)/2)*q*Nt,hn=Tt===0?ae:Ct(ae,te*Tt,rt*Tt/N);f&&!zn(hn,f)||k.push({curves:hn,thickness:q/2,color:Lt.colors.get(v.from)??Lt.colors.get(v.to)??he})})}else if(!Ne)Te(0,0,J,J);else{let ge=Mn(U,se,Se,d),Ae=Math.floor((Se-1)/2);for(let q=0;q<Se;q++){let ie=ge[q],te=Z(v.pathIds[q]);Te(ie.x,ie.y,c&&!c.names.has(v.pathIds[q])?Oe(te,Qe):te,q===Ae?J:void 0)}}let ze=k.length-me;ze>0&&Q.set(A,{start:me,count:ze});let ot=T.length-Ce;ot>0&&O.set(A,{start:Ce,count:ot})}for(let[A,v]of Object.entries(t)){let U=r.get(A);if(!U||f&&!Ls(v,f))continue;let se=c!==void 0&&!c.nodeIds.has(A),ae=se?Un:Wt(U,qe.get(A)??0,o,fe),Se=se?Oe(ae,Qe):ae,nt=dt(U,s,l,b),He=nt/2,Xe=S.length,pe=Y.get(A),Ne=nt/Ee,he=v.length>=2,J=c&&!se&&!pe?.length?c.walks:void 0;if(he&&J){let Le=Math.max(nt/J.length,Hn),Te=Ot(v,N),me=1/Math.max(M,vt);J.forEach((Ce,ee)=>{let ze=Ce.colors.get(A);if(ze===void 0)return;let ot=(ee-(J.length-1)/2)*Le*me;S.push({points:J.length===1?v:Yn(v,Te,ot,N),thickness:Le/2,color:ze})})}else if(he&&pe?.length&&Ne>=is){let Le=Ot(v,N),Te=1/Math.max(M,vt);for(let me of pe){let Ce=(me-(Ee-1)/2)*Ne*Te,ee=re[me]??qn;S.push({points:Yn(v,Le,Ce,N),thickness:Ne/2,color:se?Oe(ee,Qe):ee})}}else he&&S.push({points:v,thickness:He,color:Se});let Ye=S.length-Xe;Ye>0&&R.set(A,{start:Xe,count:Ye})}return{nodeStrokes:S,nodeStrokeRuns:R,arrows:T,arrowRuns:O,edgeCurves:k,edgeCurveRuns:Q}}function mt(e){return`hsl(${e}, 70%, 50%)`}function Dt(e,t){let n=(e-t.start)/(t.end-t.start);return Math.max(0,Math.min(1,n))*Be}var _s=30;function Qn({start:e,bp:t,reversed:n},r){let o=Dt(e,r),s=Dt(e+t,r);if(s-o<1)return[(o+s)/2];let a=Math.ceil((s-o)/_s);return Array.from({length:a+1},(i,l)=>Dt(e+t*(n?a-l:l)/a,r))}var Bl=`linear-gradient(to right, ${Array.from({length:7},(e,t)=>`${mt(t/6*Be)} ${t/6*100}%`).join(", ")})`;function Wl(e){return je(e)?Zn(e):void 0}function Zn(e){return{sample:at(e.stable.refName),haplotype:mn(e.stable.refName),refName:it(e.stable.refName),start:e.stable.start,end:e.stable.start+e.length}}function Is(e,t){let n=[...e].sort((s,a)=>s.start-a.start),r,o;for(let s of n)o=o&&s.start-o.end<=t?{start:o.start,end:Math.max(o.end,s.end)}:{start:s.start,end:s.end},(!r||o.end-o.start>r.end-r.start)&&(r=o);return r}function vs(e){return`${e.haplotype??e.sample}\0${e.refName}`}function Dl(e,{maxGap:t=1/0}={}){let n=new Map;for(let o of e.nodes)if(je(o)){let s=Zn(o),a=vs(s),i=n.get(a);i?(i.spans.push({start:s.start,end:s.end}),i.rank=Math.min(i.rank,o.stable.rank)):n.set(a,{sample:s.sample,haplotype:s.haplotype,refName:s.refName,rank:o.stable.rank,spans:[{start:s.start,end:s.end}]})}let r=new Map;for(let o of n.values()){let s=Is(o.spans,t);if(s){let a={sample:o.sample,haplotype:o.haplotype,refName:o.refName,start:s.start,end:s.end,rank:o.rank,nodeCount:o.spans.length},i=o.haplotype??o.sample,l=r.get(i);(!l||a.nodeCount>l.nodeCount)&&r.set(i,a)}}return[...r.values()].sort((o,s)=>+(o.rank!==0)-+(s.rank!==0)||o.sample.localeCompare(s.sample)||(o.haplotype??"").localeCompare(s.haplotype??""))}function Ps(e,t){return(t.haplotype===void 0?void 0:e(t.haplotype))??e(t.sample)}function ql(e,t){return e.flatMap(n=>{let r=Ps(t,n);return r===void 0?[]:[{...n,sample:r}]})}function Hl(e){return`${e.refName}:${e.start+1}-${e.end}`}function qt(e){return`${e.refName}:${(e.start+1).toLocaleString()}-${e.end.toLocaleString()}`}var Jn=H(st(),1),Ht=(0,ne.createSvgIcon)((0,Jn.jsx)("path",{d:"M3 16h5v-2H3zm6.5 0h5v-2h-5zm6.5 0h5v-2h-5zM3 20h2v-2H3zm4 0h2v-2H7zm4 0h2v-2h-2zm4 0h2v-2h-2zm4 0h2v-2h-2zM3 12h8v-2H3zm10 0h8v-2h-8zM3 4v4h18V4z"}),"LineStyle");var eo=H(st(),1),to=(0,ne.createSvgIcon)((0,eo.jsx)("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows");var no=H(st(),1),oo=(0,ne.createSvgIcon)((0,no.jsx)("path",{d:"M17 5h-2V3h2zm-2 16h2v-2.59L19.59 21 21 19.59 18.41 17H21v-2h-6zm4-12h2V7h-2zm0 4h2v-2h-2zm-8 8h2v-2h-2zM7 5h2V3H7zM3 17h2v-2H3zm2 4v-2H3c0 1.1.9 2 2 2M19 3v2h2c0-1.1-.9-2-2-2m-8 2h2V3h-2zM3 9h2V7H3zm4 12h2v-2H7zm-4-8h2v-2H3zm0-8h2V3c-1.1 0-2 .9-2 2"}),"HighlightAlt");var Os="Linear genome view",$s="Linear synteny view",Bs="No synteny track in this session aligns these assemblies";function ro({label:e,icon:t,entries:n,entryLabel:r,onSelect:o,disabledHelpText:s,nameTheOnlyEntry:a=!0}){let[i]=n,l=s?[{label:e,icon:t,disabled:!0,disabledHelpText:s,onClick:()=>{}}]:[];return n.length===0?l:n.length===1&&i?[{label:a?`${e} \u2014 ${r(i)}`:e,icon:t,onClick:o(i)}]:[{label:e,icon:t,type:"subMenu",subMenu:n.map(c=>({label:r(c),onClick:o(c)}))}]}function tc({contributors:e,syntenyTracks:t,onShowLinear:n,onShowSynteny:r}){let o=t[0]?.coverage??e.length;return[...ro({label:Os,icon:Ht,entries:e,entryLabel:s=>`${s.sample} ${qt(s)}`,onSelect:s=>()=>{n({location:s,assembly:s.sample})}}),...e.length>=2?ro({label:`${$s} (${o} assemblies)`,icon:to,entries:t,entryLabel:s=>s.coverage<o?`${s.name} (${s.coverage} of ${o})`:s.name,nameTheOnlyEntry:!1,disabledHelpText:Bs,onSelect:s=>()=>{r(s.trackId)}}):[]]}function nc({own:e,reference:t,highlight:n,onShowLinear:r,onHighlight:o}){let s=[e?{label:`Open in ${e.assembly} \u2014 ${qt(e.location)}`,target:e}:void 0,t&&t.assembly!==e?.assembly?{label:`Open in ${t.assembly} \u2014 around this node`,target:t}:void 0].filter(a=>a!==void 0);return[...o&&n?[{label:`Highlight in ${n.assembly}`,icon:oo,onClick:()=>{o(n)}}]:[],...s.map(({label:a,target:i})=>({label:a,icon:Ht,onClick:()=>{r(i)}}))]}function Xt(e){return e.id.endsWith("-")?"-":"+"}function Yt(e,t){return t===Xt(e)?e.id:`-${e.id}`}function Gs(e,t){let n=e.map(()=>{}),r=0,o=0;for(;o<e.length&&e[o]!==void 0;o++)n[o]=r,r+=e[o];let s=t;for(let a=e.length-1;a>o&&e[a]!==void 0;a--)s-=e[a],n[a]=s;return n}function Fs(e,t){let n=e.path.map(()=>[]);if(e.cs===void 0)return n;let r=Gs(t,e.pathLength),o=(i,l=!1)=>{for(let c=0;c<r.length;c++){let d=r[c],u=t[c];if(d!==void 0&&u!==void 0&&d<=i&&(i<d+u||l&&i===d+u))return{s:c,local:i-d,room:d+u-i}}},s=(i,l)=>{let c=n[i],d=c.at(-1);l.type==="substitution"&&d?.type==="substitution"&&d.pos+d.seq.length===l.pos?d.seq+=l.seq:c.push(l)},a=e.pathStart;for(let i of bn(e.cs))if(i.op==="match")a+=i.length;else if(i.op==="substitution"){let l=o(a);l&&s(l.s,{type:"substitution",pos:l.local,seq:i.seq}),a+=1}else if(i.op==="insertion"){let l=o(a,a===e.pathEnd);l&&s(l.s,{type:"insertion",pos:l.local,seq:i.seq})}else{let l=i.length;for(;l>0;){let c=o(a),d=c?Math.min(l,c.room):l;c&&s(c.s,{type:"deletion",pos:c.local,length:d}),a+=d,l-=d}}return n}function ao(e,t,n){let r=new Map(e.nodes.map(s=>[s.name,s])),o=[];for(let s of t){let a=s.path.map(d=>r.get(d.name)),i=a.flatMap((d,u)=>d?[u]:[]),l=i[0],c=i.at(-1);if(l!==void 0&&c!==void 0){let d=Fs(s,a.map(h=>h?.length)),u=i.map(h=>Yt(a[h],s.path[h].strand)),f=a[c].length;o.push({id:n+o.length,name:s.name,type:"read",sourceTrackID:1,sequence:u,sequenceNew:i.map((h,p)=>({nodeName:u[p],mismatches:d[h]})),firstNodeOffset:l===0?s.pathStart:0,finalNodeCoverLength:c===s.path.length-1?f-(s.pathLength-s.pathEnd):f,mapping_quality:s.mappingQuality===255?0:s.mappingQuality,is_secondary:s.secondary,is_reverse:s.strand==="-"})}}return o}var Ws=["#6baed6","#4292c6","#2171b5","#08519c"],Ds=["#fb6a4a","#ef3b2c","#cb181d","#a50f15"];function io(e){let t=e.is_reverse?Ds:Ws;return t[e.id%t.length]}function gt(e){let t=e.split("#"),n=t.length>=2?Number(t[1]):Number.NaN;return{sample:t[0]??e,haplotype:Number.isFinite(n)?n:void 0}}function qs(e,t,n,r){let o=[],s=[],a=[e];for(r.add(e);a.length>0;){let i=a.pop(),l=t.get(i);if(l){o.push(l);for(let c of n.get(i)??[]){let d=t.get(c);d&&(d.stable.rank===0?s.push(d):r.has(c)||(r.add(c),a.push(c)))}}}return{members:o,anchors:s}}function Hs(e){if(new Set(e.map(i=>i.stable.refName)).size!==1||e.length<2)return;let n=[...e].sort((i,l)=>i.stable.start-l.stable.start),r=n[0],o=n.at(-1),s=r.stable.start+r.length,a=o.stable.start;return a>=s?{start:s,end:a,entry:r}:void 0}function Xs(e,t,n){let r=new Map(e.map(a=>[a.id,a])),o=new Map,s=[];for(let a of n.get(t.id)??[])r.has(a)&&(o.set(a,0),s.push(a));if(s.length===0)for(let a of e)o.set(a.id,0),s.push(a.id);for(let a of s){let i=o.get(a)+r.get(a).length;for(let l of n.get(a)??[])if(r.has(l)){let c=o.get(l);(c===void 0||i<c)&&(o.set(l,i),s.push(l))}}return o}function Ys(e,t,n){let r=Xs(e,t,n),o=[...e].sort((l,c)=>r.get(l.id)-r.get(c.id)),s=new Map(o.map((l,c)=>[l.id,c])),a=new Map(e.map(l=>[l.id,l])),i=new Map;for(let[l,c]of o.entries()){let d=0;for(let u of n.get(c.id)??[]){let f=a.get(u);f&&s.get(u)<l&&(d=Math.max(d,i.get(u)+f.length))}i.set(c.id,d)}return{offsets:i,ordered:o}}function co(e){let t=new Map(e.nodes.filter(je).map(s=>[s.id,s])),n=Ve(e),r=new Set,o=[];for(let s of t.values())if(s.stable.rank!==0&&!r.has(s.id)){let{members:a,anchors:i}=qs(s.id,t,n,r),l=Hs(i);if(l){let{offsets:c,ordered:d}=Ys(a,l.entry,n);o.push({start:l.start,refSpan:l.end-l.start,nodeIds:d.map(u=>u.id),nodeOffsets:d.map(u=>c.get(u.id)),pathLength:d.reduce((u,f)=>Math.max(u,c.get(f.id)+f.length),0)})}}return o.sort((s,a)=>s.start-a.start)}var zs=1,Ks=.015;function bt({graph:e,span:t,rowY:n,positions:r}){let o=t*Ks,s=co(e),a=new Map(e.nodes.map(d=>[d.id,d])),i=[];for(let d of s){let u=d.refSpan-d.pathLength;u>=zs&&i.push({nodeIds:d.nodeIds,bp:u});let f=Math.max(d.refSpan,o),h=d.pathLength>0?f/d.pathLength:0;d.nodeIds.forEach((p,m)=>{let g=a.get(p);if(g){let b=d.nodeOffsets[m],M=f/d.nodeIds.length,N=S=>d.start+S*h,E=n(g);r[p]=h?[{x:N(b),y:E},{x:N(b+g.length),y:E}]:[{x:d.start+m*M,y:E},{x:d.start+(m+1)*M,y:E}]}})}let l=Ve(e),c=Object.keys(r);for(let d of c){let u=r[d].at(-1).x;for(let f of l.get(d)??[]){let h=a.get(f);if(h&&!(f in r)){let p=n(h);r[f]=[{x:u,y:p},{x:u+o,y:p}],c.push(f)}}}return i}function js(e){let t=new Set;for(let n of e.nodes)n.stable&&t.add(n.stable.rank);return new Map([...t].sort((n,r)=>n-r).map((n,r)=>[n,r]))}function uo(e,t){let n=_e(e);if(n.length===0)return;let r=ct(n,t),o=js(e),s=Ie(n),a=bt({graph:e,span:r,rowY:l=>(l.stable?o.get(l.stable.rank)??o.size:o.size)*20,positions:s}),i=[...o].map(([l,c])=>({label:l===0?"Reference (rank 0)":`Rank ${l}`,y:c*20}));return{nodePositions:s,rowLabels:i,referenceAxis:!0,pixelRows:!0,alleleDeletions:a}}var Us=12,zt=20;function fo(e){return 10+8*Math.log2(1+e.length)}function ce(e,t){return e<t?-1:e>t?1:0}function ho(e,t){return ce(e.at,t.at)||ce(e.side,t.side)||ce(e.hops,t.hops)}var po={at:1/0,side:0,hops:0};function Vs(e){let t=new Map(e.nodes.map(r=>[r.id,r])),n=Js(e);return e.nodes.map(r=>r.id).sort((r,o)=>ho(n.get(r)??po,n.get(o)??po)||ce(t.get(r).name,t.get(o).name)||ce(r,o))}function Qs(e,t){let n=new Set(e.nodes.map(d=>d.id)),r=new Map(t.map(d=>[d.id,d.stable.start])),o=new Map,s=new Map;t.forEach((d,u)=>{s.set(d.id,t[u-1]?.id),o.set(d.id,t[u+1]?.id)});let a=t[0]?.id,i=(d,u)=>{let f=o.get(d);o.set(d,u),s.set(u,d),o.set(u,f),f!==void 0&&s.set(f,u)},l=(d,u)=>{let f=s.get(d);f===void 0?(a=u,s.set(u,void 0),o.set(u,d),s.set(d,u)):i(f,u)};for(let d of e.paths??[]){let u=0,f=0,h;for(let b of d.nodeIds){let M=r.get(b);M!==void 0&&(h!==void 0&&M!==h&&(M>h?u++:f++),h=M)}let p=f>u?[...d.nodeIds].reverse():d.nodeIds,m,g=new Set;for(let b of p)if(o.has(b)){if(m===void 0)for(let M of g)l(b,M);m=b}else n.has(b)&&(m===void 0?g.add(b):(i(m,b),m=b))}let c=[];for(let d=a;d!==void 0;d=o.get(d))c.push(d);return c}function Zs(e,t){let n=[...t.entries()].sort(([a,i],[l,c])=>ho(i,c)||ce(a,l)).map(([a])=>a),r=n.length;for(let a of n){let i=t.get(a);for(let l of e.get(a)??[])t.has(l)||(t.set(l,{at:i.at,side:1,hops:i.hops+1}),n.push(l))}let o=new Set(n.slice(r)),s=new Set;for(let a of o){if(s.has(a))continue;let{at:i}=t.get(a),l=[a];s.add(a);let c=!0;for(let d of l){let{hops:u}=t.get(d),f=!0,h=!1;for(let p of e.get(d)??[]){let m=t.get(p);m.at===i&&o.has(p)?(f&&=m.hops<=u,s.has(p)||(s.add(p),l.push(p))):m.at!==i&&(h||=m.at<i,c&&=m.at<i)}c&&=!f||h}if(c)for(let d of l){let u=t.get(d);t.set(d,{...u,side:-1,hops:-u.hops})}}}function Js(e){let t=new Set(e.nodes.map(s=>s.id)),n=new Map;for(let s of e.edges)!t.has(s.from)||!t.has(s.to)||((n.get(s.from)??n.set(s.from,[]).get(s.from)).push(s.to),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push(s.from));let r=e.nodes.filter(P).sort((s,a)=>ce(s.stable.start,a.stable.start)||ce(s.name,a.name)),o=new Map;return Qs(e,r).forEach((s,a)=>{o.set(s,{at:a,side:0,hops:0})}),Zs(n,o),o}function ea(e){let t=new Map(e.nodes.map(u=>[u.id,u])),n=Vs(e),r=new Map(n.map((u,f)=>[u,f])),o=u=>P(t.get(u)),s=new Map(n.map(u=>[u,[]])),a=new Map(n.map(u=>[u,[]])),i=(u,f)=>{s.get(f).push(u),a.get(u).push(f)};for(let u of e.edges)u.from===u.to||!r.has(u.from)||!r.has(u.to)||(r.get(u.from)<r.get(u.to)?i(u.from,u.to):i(u.to,u.from));let l=n.filter(o);for(let u=1;u<l.length;u++)i(l[u-1],l[u]);let c=new Map;for(let u of n){let f=0;for(let h of s.get(u))f=Math.max(f,c.get(h)+1);c.set(u,f)}for(let u=n.length-1;u>=0;u--){let f=n[u],h=a.get(f);if(o(f)||h.length===0)continue;let p=1/0;for(let b of h)p=Math.min(p,c.get(b));let m=c.get(f),g=Math.max(m,p-1);c.set(f,Math.floor((m+g)/2))}let d=[];for(let u of n)(d[c.get(u)]??=[]).push(u);return{layers:d,layerOf:c,preds:s}}function mo(e){if(!e.nodes.some(P))return;let t=new Map(e.nodes.map(u=>[u.id,u])),n=u=>P(t.get(u)),{layers:r,layerOf:o,preds:s}=ea(e),a=r.map(u=>{let f=0;for(let h of u)f=Math.max(f,fo(t.get(h)));return f}),i=[],l=0;for(let u=0;u<r.length;u++)i[u]=l,l+=a[u]+Us;let c=new Map;for(let u of r){let f=[];for(let p of u){if(n(p)){c.set(p,0);continue}let m=s.get(p).filter(b=>c.has(b)),g=0;for(let b of m)g+=c.get(b)/m.length;f.push({id:p,ideal:g===0?zt:g})}f.sort((p,m)=>p.ideal-m.ideal);let h=new Set([0]);for(let{id:p,ideal:m}of f){let g=Math.round(m/zt);g===0&&(g=m>=0?1:-1);for(let b=1;h.has(g);b++)h.has(g+b)?h.has(g-b)||(g-=b):g+=b;h.add(g),c.set(p,g*zt)}}let d={};for(let u of e.nodes){let f=o.get(u.id),h=fo(u),p=i[f]+a[f]/2,m=c.get(u.id);d[u.id]=[{x:p-h/2,y:m},{x:p+h/2,y:m}]}return{nodePositions:d,referenceAxis:!1,pixelRows:!0}}function ta(e,t){let n=new Map;for(let o of e.nodes)if(lt(o)){let{sample:s}=gt(o.stable.refName);n.set(s,(n.get(s)??0)+o.length)}let r=new Map(t.map((o,s)=>[o,s]));return[...n.keys()].sort((o,s)=>(r.get(o)??1/0)-(r.get(s)??1/0)||n.get(s)-n.get(o)||o.localeCompare(s))}function go(e,t,n=[]){let r=_e(e),o=ta(e,n);if(r.length===0||o.length===0)return;let s=ct(r,t),a=new Map(o.map((f,h)=>[f,h+1])),i=Ie(r),l=o.length+1,c=bt({graph:e,span:s,rowY:f=>{let h=f.stable;return((h?a.get(gt(h.refName).sample):void 0)??l)*20},positions:i}),u=[{label:gt(r[0].stable.refName).sample,y:0},...o.map(f=>({label:f,y:a.get(f)*20}))];return{nodePositions:i,rowLabels:u,sampleRows:o,referenceAxis:!0,pixelRows:!0,alleleDeletions:c}}function Kt(){return{rectangles:[],curves:[],corners:[],verticalRectangles:[],featureRectangles:[]}}var et=!1,bo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f"];function Po(e){return{mergeNodesFlag:e.mergeNodes??!0,showReads:e.showReads??!0,coarsenedReadView:e.coarsenedReadView??!1,ignoreStrand:e.ignoreStrand??!1,nodeWidthOption:e.nodeWidthOption??"normal",charWidth:e.charWidth??8.401,trackWidth:e.trackWidth??15,mappingQualityCutoff:e.mappingQualityCutoff??0,focusReadNames:e.focusReadNames??null,showExonsFlag:e.showExons??!1,trackColor:e.trackColor??(t=>bo[t.id%bo.length]),trackAlpha:e.trackAlpha??(()=>1)}}var _=Po({}),Zt=null,x=[],y=[],w=[],C=new Map,Fe=[],L=[],Me=[],en=[],tn=[],V=-1,B=Kt(),Jt={minX:0,maxX:0,minY:0,maxY:0},Ze,xt=new Map;function Oo(e,t,n=[],r={}){if(_=Po(r),Zt=r.bed??null,B=Kt(),Me=[],en=[],tn=[],Fe=[],Jt={minX:0,maxX:0,minY:0,maxY:0},Ze=void 0,xt=new Map,e.length===0||t.length===0)return;let o=jt(e);x=[],o.forEach((l,c)=>{x[c+1]=l}),y=jt(t);let s=n.length>0;w=jt(qa(n));for(let l=y.length-1;l>=0;l-=1){let c=y[l];if(c.type===void 0&&(c.type="haplotype"),c.hidden===!0){y.splice(l,1);continue}c.indexOfFirstBase!==void 0&&(Ze=c.name)}if(y.length===0)return;oa(0),C=Mo(),ke(y),_.showReads&&w.length>0&&ke(w),vo(),_.mergeNodesFlag&&(wo(),Vt(),_.showReads&&w.length>0&&Ut(),Da(),C=Mo(),vo(),ke(y),_.showReads&&w.length>0&&ke(w)),wo(),Sa(),et&&console.log(`${x.length} nodes.`),Vt(),V=Eo(),Na(),Vt(),V=Eo();let a=_.showReads&&_.coarsenedReadView&&!s;if(a){let l=Ze===void 0?-1:y.findIndex(u=>u.name===Ze),c=l===-1?0:l,d=y.filter((u,f)=>f!==c);if(d.length>0){let u=Co(d,"haplotype");u.length>0&&(y=[y[c]],w=u)}}$a(),Aa(),_.showExonsFlag&&Zt!==null&&Oa();let i=_.showReads&&_.coarsenedReadView&&w.length>0&&!a;return _.showReads&&w.length>0?(ra(),Ut(),ke(w),i&&(w=Co(w,"read"),Ut(),ke(w)),aa(),y=y.concat(w)):x.forEach(l=>{l&&(l.incomingReads=[],l.outgoingReads=[],l.internalReads=[])}),Ta(),Ga(),et&&(console.log("Tracks:"),console.log(y),console.log("Nodes:"),console.log(x),console.log("Lane assignment:"),console.log(Me)),xa(),{nodes:x,tracks:y,reads:w,nodeMap:C,shapes:B,bounds:Jt,maxOrder:V,trackForRuler:Ze,coarsenedEdgeMeta:xt}}function Ge(e,t="plain"){return _.trackColor(e,t)}function na(e){return _.trackAlpha(e)}function jt(e){return structuredClone(e)}function D(e){let t=String(e);return t.length>=1&&t.startsWith("-")}function I(e){return D(e)?String(e).substring(1):e}function ue(e){return D(e)?e:`-${e}`}function $o(e){return D(e)?I(e):ue(e)}function yt(e){return(e||1/e)>=0}function oa(e){let t=new Set,n=y[e].sequence;for(let r=0;r<n.length;r+=1){let o=n[r];if(D(o)){let s=I(o),a=n.indexOf(s);(a===-1||a>r)&&t.add(s)}}for(let r of y){n=r.sequence;for(let o=0;o<n.length;o+=1){let s=n[o];D(s)?t.has(I(s))&&(n[o]=I(s)):t.has(s)&&(n[o]=ue(s))}}x.forEach(r=>{r&&t.has(r.name)&&(r.seq=r.seq.split("").reverse().join(""))})}function ra(){Fe=[];for(let t=0;t<=V;t+=1)Fe[t]=[];let e=new Map;x.forEach(t=>{t.y!==void 0&&xo(e,t.order,t.y+t.contentHeight)}),y.forEach(t=>{t.type==="haplotype"&&t.path.forEach(n=>{xo(e,n.order,(n.y??0)+t.width)})}),x.forEach((t,n)=>{t.order>=0&&t.y===void 0&&(t.y=(e.get(t.order)??0)+25,t.contentHeight=0,Fe[t.order].push(n))})}function xo(e,t,n){let r=e.get(t);r===void 0?e.set(t,n):e.set(t,Math.max(r,n))}var Mt=7;function sa(){x.forEach(e=>{e&&(e.incomingReads=[],e.outgoingReads=[],e.internalReads=[])}),w.forEach((e,t)=>{if((e.width===void 0||e.width===0)&&(e.width=Mt),e.path.length===1){let n=e.path[0].node;n!==null&&x[n].internalReads.push(t)}else e.path.forEach((n,r)=>{if(r===0){let o=e.path[0].node;o!==null&&x[o].outgoingReads.push([t,r])}else{let o=n.node;o!==null&&x[o].incomingReads.push([t,r])}})})}function aa(){ha(),sa();let e=x.slice();e.sort(wt);let t=new Map;for(let a=0;a<w.length;a++){let i=w[a].sourceTrackID,l=t.get(i);l===void 0?t.set(i,[a]):l.push(a)}let n=Array.from(t.keys()).sort((a,i)=>a-i),r=n.length>1?Mt:0;e.forEach(a=>{if(a)for(let i of n)ia(t.get(i),a,r)});let o=pa(),s=[];w.forEach((a,i)=>{let l=a.path.length,c=new Array(l),d;for(let h=0;h<l;h++){h===0?c[h]=void 0:c[h]=d??a.path[0];let p=a.path[h];p.node!==null&&p.node&&(d=p)}let u=new Array(l),f;for(let h=l-1;h>=0;h--){h===l-1?u[h]=void 0:u[h]=f??a.path[l-1];let p=a.path[h];p.node!==null&&p.node&&(f=p)}a.path.forEach((h,p)=>{if(h.y===void 0){let m=c[p],g=u[p],b=!!(g&&m&&g.isForward!==void 0&&m.isForward!==void 0&&(m.order>g.order||g.order===m.order&&g.isForward===m.isForward));h.betweenCycleReverseTraversal=b,s.push({readIndex:i,pathIndex:p,previousY:m?.y,previousNode:m?.node})}})}),s.sort(ca),s.forEach(a=>{let i=w[a.readIndex],l=i.path[a.pathIndex];l.y=o[l.order],o[l.order]+=i.width}),et&&(console.log("Reads:"),console.log(w))}function ia(e,t,n){let r=new Set(e),o=t.incomingReads.filter(([p])=>r.has(p)),s=t.outgoingReads.filter(([p])=>r.has(p)),a=t.internalReads.filter(p=>r.has(p));o.length===0&&s.length===0&&a.length===0&&(n=0);let i=t.y+t.contentHeight+n*2,l=o.map(p=>{let[m,g]=p,b=w[m].path,M=g+1,N;for(let E=1;E<=g;E++){let S=b[g-E]?.y;if(S!==void 0){M=E,N=S;break}}return{entry:p,decisionStep:M,y:N}});l.sort(la),o=l.map(p=>p.entry);let c=i,d=new Map;o.forEach(p=>{let m=w[p[0]];m.path[p[1]].y=c,yo(d,m,p[1],c,t),c+=m.width});let u=c;s.sort(ua);let f=new Map;c=i,s.forEach(p=>{let m=w[p[0]],g=m.firstNodeOffset??0;m.path[p[1]].y=c,f.set(c,g);let b=d.get(c);b===void 0||b+1<=g?(c+=m.width,u=Math.max(u,c)):(d.set(c,0),o.forEach(M=>{let N=w[M[0]],E=N.path[M[1]];E.y!==void 0&&E.y>=c&&(E.y+=m.width,yo(d,N,M[1],E.y,t))}),c+=m.width,u+=m.width)}),a.sort(fa),a.forEach(p=>{let m=w[p],g=m.firstNodeOffset??0,b=m.finalNodeCoverLength??0;for(c=i;g<(d.get(c)??-1/0)+2||b>(f.get(c)??1/0)-3;)c+=m.width||Mt;m.path[0].y=c,d.set(c,b),u=Math.max(u,c)});let h=u-t.y-t.contentHeight;t.contentHeight+=h,Pa(t,h)}function la(e,t){return e.decisionStep!==t.decisionStep?e.decisionStep-t.decisionStep:e.y===void 0||t.y===void 0?(e.y===void 0?0:1)-(t.y===void 0?0:1):e.y-t.y}function yo(e,t,n,r,o){n===t.path.length-1?e.set(r,t.finalNodeCoverLength??0):e.set(r,o.sequenceLength)}function ca(e,t){let n=w[e.readIndex],r=w[t.readIndex],o=n.path[e.pathIndex],s=r.path[t.pathIndex];if(o.order!==s.order)return o.order-s.order;if(n.sourceTrackID!==r.sourceTrackID)return n.sourceTrackID-r.sourceTrackID;if(e.previousNode&&t.previousNode){let l=x[e.previousNode],c=x[t.previousNode];if(l&&c&&l.order!==c.order)return l.order-c.order}let a=e.previousY??0,i=t.previousY??0;return o.betweenCycleReverseTraversal&&s.betweenCycleReverseTraversal?i-a:a-i}function ua([e,t],[n,r]){let o=w[e],s=w[n],a,i,l=o.path.length-1,c=s.path.length-1;for(;!a&&l>=0;)a=o.path[l]?.y,l-=1;for(;!i&&c>=0;)i=s.path[c]?.y,c-=1;if(a&&i)return a-i;let d=o.path[t]?.node,u=s.path[r]?.node,f=d!=null?x[d]:null,h=u!=null?x[u]:null;for(;f!=null&&h!=null&&f===h;){if(t<o.path.length-1){for(t+=1;o.path[t]?.node===null;)t+=1;let m=o.path[t]?.node;f=m!=null?x[m]:null}else f=null;if(r<s.path.length-1){for(r+=1;s.path[r]?.node===null;)r+=1;let m=s.path[r]?.node;h=m!=null?x[m]:null}else h=null}if(f!=null)return h!=null?wt(f,h):1;if(h!=null)return-1;let p=(o.firstNodeOffset??0)-(s.firstNodeOffset??0);return p!==0?p:(o.finalNodeCoverLength??0)-(s.finalNodeCoverLength??0)}function da(e,t){if(e.path===void 0||t.path===void 0)return(e.path===void 0?0:1)-(t.path===void 0?0:1);let n=e.path,r=t.path,o=0,s=0;for(;o<n.length&&s<r.length;){let a=n[o],i=r[s],l=a.order,c=i.order;if(l===c&&a.node&&i.node)return(i.y??0)-(a.y??0);l<c?o+=1:(l>c||(o+=1),s+=1)}return 0}function fa(e,t){let n=w[e],r=w[t],o=n.firstNodeOffset??0,s=r.firstNodeOffset??0;if(o<s)return-1;if(o>s)return 1;let a=n.finalNodeCoverLength??0,i=r.finalNodeCoverLength??0;return a<i?-1:a>i?1:0}function pa(){let e=[];for(let t=0;t<=V;t+=1)e.push(0);return x.forEach(t=>{t.y!==void 0&&(e[t.order]=Math.max(e[t.order],t.y+t.contentHeight+20))}),y.forEach(t=>{t.path.forEach(n=>{e[n.order]=Math.max(e[n.order],(n.y??0)+t.width)})}),e}function ha(){w.forEach(e=>{let t=Math.abs(e.indexSequence[0]),n=yt(e.indexSequence[0]),r=x[t],o,s;e.path=[],e.path.push({order:r.order,isForward:n,node:t});for(let a=1;a<e.sequence.length;a+=1)if(o=r,s=n,t=Math.abs(e.indexSequence[a]),n=yt(e.indexSequence[a]),r=x[t],r.order>o.order){s||e.path.push({order:o.order,isForward:!0,node:null});for(let i=o.order+1;i<r.order;i+=1)e.path.push({order:i,isForward:!0,node:null});n?e.path.push({order:r.order,isForward:!0,node:t}):(e.path.push({order:r.order,isForward:!0,node:null}),e.path.push({order:r.order,isForward:!1,node:t}))}else if(r.order<o.order){s&&e.path.push({order:o.order,isForward:!1,node:null});for(let i=o.order-1;i>r.order;i-=1)e.path.push({order:i,isForward:!1,node:null});n?(e.path.push({order:r.order,isForward:!1,node:null}),e.path.push({order:r.order,isForward:!0,node:t})):e.path.push({order:r.order,isForward:!1,node:t})}else n!==s?e.path.push({order:r.order,isForward:n,node:t}):(e.path.push({order:r.order,isForward:!n,node:null}),e.path.push({order:r.order,isForward:n,node:t}))})}function Ut(){w.forEach(e=>{let t=0;for(;t<e.sequence.length&&e.sequence[t].startsWith("-");)t+=1;if(t===e.sequence.length){e.is_reverse=!0,e.sequence=e.sequence.reverse();for(let a=0;a<e.sequence.length;a+=1)e.sequence[a]=I(e.sequence[a]);let n=e.sequenceNew??[];n.reverse(),e.sequenceNew=n;for(let a of n)a.nodeName=I(a.nodeName),ma(a.mismatches,oe(a.nodeName).sequenceLength);let r=e.firstNodeOffset??0,o=oe(e.sequence[0]).sequenceLength;e.firstNodeOffset=o-(e.finalNodeCoverLength??0);let s=oe(e.sequence[e.sequence.length-1]).sequenceLength;e.finalNodeCoverLength=s-r}})}function ma(e,t){e.forEach(n=>{n.type==="insertion"?n.pos=t-n.pos:n.type==="deletion"?n.pos=t-n.pos-(n.length??0):n.type==="substitution"&&(n.pos=t-n.pos-(n.seq?.length??0)),n.seq!==void 0&&(n.seq=Bo(n.seq).split("").reverse().join(""))})}var ga={A:"T",T:"A",C:"G",G:"C"};function Bo(e){let t="";for(let n=e.length-1;n>=0;n-=1)t+=ga[e.charAt(n)]??"N";return t}function ke(e){e.forEach(t=>{t.indexSequence=[],t.sequence.forEach(n=>{let r=n,o=C.get(I(r)),s=x[o]?.switched??!1;s&&(r=$o(r));let a=C.get(I(r));if(a===0)throw new Error("Node "+I(r)+" has prohibited index 0");D(r)!==s?t.indexSequence.push(-a):t.indexSequence.push(a)})})}var ba=20;function xa(){let e={minX:99,maxX:-99,minY:99,maxY:-99};x.forEach(t=>{t&&(t.x!==void 0&&(e.minX=Math.min(e.minX,t.x),e.maxX=Math.max(e.maxX,t.x+ba+t.pixelWidth)),t.y!==void 0&&(e.minY=Math.min(e.minY,t.y-10),e.maxY=Math.max(e.maxY,t.y+t.contentHeight+10)))}),y.forEach(t=>{t.path.forEach(n=>{let r=n.y??0;e.maxY=Math.max(e.maxY,r+t.width),e.minY=Math.min(e.minY,r)})}),Jt=e}function oe(e){let t=C.get(I(e)),n=t===void 0?void 0:x[t];if(n===void 0)throw new Error(`Unknown node ${e}`);return n}function Mo(){return C=new Map,x.forEach((e,t)=>{e&&C.set(e.name,t)}),C}function wo(){let e=x.map(()=>new Set),t=x.map(()=>new Set),n=r=>{for(let o=0;o<r.indexSequence.length-1;o+=1){let s=Math.abs(r.indexSequence[o]),a=Math.abs(r.indexSequence[o+1]);e[s].add(a),t[a].add(s)}};y.forEach(n),_.showReads&&w.length>0&&w.forEach(n),x.forEach((r,o)=>{r&&(r.successors=Array.from(e[o]),r.predecessors=Array.from(t[o]))})}function Ro(e){let t=0,n=0,r=0;e.forEach(o=>{let s=Math.abs(o);if(o<0){L[s]===void 0&&(L[s]=n);let a=L[s];a<r&&(r=a),t=a,n=a-1}else{L[s]===void 0&&(L[s]=t);let a=L[s];t=a+1,n=a}}),r<0&&nn(-r)}function ya(e){let t=0,n=0;for(;t<e.length&&L[Math.abs(e[t])]===void 0;)t+=1;if(t>=e.length)return null;let r=e[t],o,s;r>=0?(o=L[r]-1,s=-1):(o=L[-r]+1,s=1);for(let a=t-1;a>=0;a-=1){let i=Math.abs(e[a]);L[i]===void 0&&(L[i]=o,n=Math.min(n,o),o+=s)}return n<0&&nn(-n),t}var Ma=-1;function wa(e){let t=[];for(let n of e)t.push(n??Ma);return t}function Vt(){let e,t,n,r,o=0,s=_.showReads&&w.length>0?y.concat(w):y,a={stamp:new Int32Array(x.length),generation:0};L=new Array(x.length).fill(void 0),x.forEach(l=>{l&&(l.order=void 0)}),Ro(y[0].indexSequence);for(let l=1;l<s.length;l+=1){if(et&&console.log(`generating order for track ${l+1}`),n=ya(s[l].indexSequence),n===null){s[l].type==="haplotype"?Ro(s[l].indexSequence):(s.splice(l,1),w.splice(l-y.length,1),l-=1);continue}for(e=Ea(s[l].indexSequence);n<e.length;){for(r=n,n+=1;n<e.length&&L[e[n]]===void 0;)n+=1;if(n<e.length){t=L[e[r]]+1;for(let c=r+1;c<n;c+=1)L[e[c]]=t,t+=1;if(L[e[n]]>L[e[r]])L[e[n]]<t&&So(e[n],e[n-1],t);else if(s[l].indexSequence[n]>=0&&!Ra(e[n],e[r],a))So(e[n],e[n-1],t);else if(s[l].indexSequence[r]<0||x[e[r+1]].degree<2&&L[e[n]]<L[e[r]]){t=L[e[r]]-1;for(let c=r+1;c<n;c+=1)L[e[c]]=t,o=Math.min(o,t),t-=1}}else if(s[l].indexSequence[r]>=0){t=L[e[r]]+1;for(let c=r+1;c<e.length;c+=1){let d=e[c];L[d]===void 0&&(L[d]=t,t+=1)}}else{t=L[e[r]]-1;for(let c=r+1;c<e.length;c+=1){let d=e[c];L[d]===void 0&&(L[d]=t,o=Math.min(o,t),t-=1)}}}}o<0&&nn(-o);let i=wa(L);L=i,i.forEach((l,c)=>{let d=x[c];d!==void 0&&(d.order=l)})}function Ra(e,t,n){n.generation+=1;let{stamp:r,generation:o}=n,s=[e];for(r[e]=o;s.length>0;){let a=s.pop();if(a===t)return!0;for(let i of x[a].successors)r[i]!==o&&(r[i]=o,s.push(i))}return!1}function Eo(){let e=-1;return L.forEach(t=>{t!==void 0&&t>e&&(e=t)}),e}function Ea(e){return e.map(t=>Math.abs(t))}function nn(e){L.forEach((t,n)=>{t!==void 0&&(L[n]=t+e)})}function So(e,t,n){let r=new Map,o=[[e,n]],s=0;for(;s<o.length;){let[a,i]=o[s];s+=1;let l=L[a];l!==void 0&&l<i&&(!r.has(a)||r.get(a)<i)&&(r.set(a,i),x[a].successors.forEach(c=>{L[c]>l&&c!==t&&o.push([c,i+1])}),a!==e&&x[a].predecessors.forEach(c=>{L[c]>l&&c!==t&&o.push([c,i+1])}))}r.forEach((a,i)=>{L[i]=a})}function Sa(){x.forEach(e=>{e.tracks=[]}),y.forEach(e=>{e.indexSequence.forEach(t=>{x[Math.abs(t)].tracks.push(e.id)})}),x.forEach(e=>{e.tracks!==void 0&&(e.degree=e.tracks.length)})}function Na(){let e=y[0],t=y.slice(1,y.length);if(_.showReads&&w.length>0&&(t=t.concat(w)),La(t,e),_.showReads&&w.length>0){for(let n=0;n<w.length;n++)if(w[n]!==t[n+y.length-1])throw new Error("Read inequality")}}function La(e,t){let n=new Map,r=t?new Set(t.sequence):null;for(let o of e){let s=o.sequence;for(let a=0;a<s.length;a+=1){let i=I(s[a]),l=oe(i);if(r&&!r.has(i)){let c=a>0?oe(s[a-1]).order:void 0,d=a<s.length-1?oe(s[a+1]).order:void 0;(c===void 0||c<l.order)&&(d===void 0||l.order<d)&&No(n,i,D(s[a])?1:-1),(c===void 0||c>l.order)&&(d===void 0||l.order>d)&&No(n,i,D(s[a])?-1:1)}}}for(let o of e)o.sequence.forEach((s,a)=>{let i=n.get(I(s));i!==void 0&&i>0&&(o.sequence[a]=$o(s),o.indexSequence[a]=-o.indexSequence[a])});n.forEach((o,s)=>{if(o>0){let a=oe(s);a.seq=Bo(a.seq),a.switched=!0}})}function No(e,t,n){e.set(t,(e.get(t)??0)+n)}function Ta(){let e=0,t=20,n=-1,r=x.slice();r.sort(wt);let o=Ca();r.forEach(s=>{s.order>=0&&(s.order>n&&(n=s.order,e=t+10*o[s.order]),s.x=e,t=Math.max(t,e+40+s.pixelWidth))})}function Ca(){let e=[],t=[],n=[],r=[];for(let o=0;o<=V;o+=1)e.push(0),t.push(0),n.push(0);y.forEach(o=>{for(let s=1;s<o.path.length;s+=1){let a=o.path[s],i=o.path[s-1];if(a.order===i.order)a.isForward?e[a.order]=e[a.order]+1:t[a.order]=t[a.order]+1;else{let l=Math.abs((a.y??0)-(i.y??0));n[a.order]=Math.max(l/17.5,n[a.order])}}}),r.push(Math.max(0,e[0]-1));for(let o=1;o<=V;o+=1)r.push(Math.max(Math.max(0,e[o]-1)+Math.max(0,t[o-1]-1),n[o]));return r}function Aa(){let e,t,n,r,o,s,a=[],i=[];for(let l=0;l<=V;l+=1){Me[l]=[],i[l]=new Map,a[l]=[];for(let c=0;c<y.length;c+=1)a[l][c]=null}y.forEach((l,c)=>{t=Math.abs(l.indexSequence[0]),n=yt(l.indexSequence[0]),r=x[t],l.path=[],l.path.push({order:r.order,lane:null,isForward:n,node:t}),W(r.order,t,c,0,a,i),e=1;for(let d=1;d<l.sequence.length;d+=1)if(o=r,s=n,t=Math.abs(l.indexSequence[d]),n=yt(l.indexSequence[d]),r=x[t],r.order>o.order){s||(l.path.push({order:o.order,lane:null,isForward:!0,node:null}),W(o.order,null,c,e,a,i),e+=1);for(let u=o.order+1;u<r.order;u+=1)l.path.push({order:u,lane:null,isForward:!0,node:null}),W(u,null,c,e,a,i),e+=1;n?(l.path.push({order:r.order,lane:null,isForward:!0,node:t}),W(r.order,t,c,e,a,i),e+=1):(l.path.push({order:r.order,lane:null,isForward:!0,node:null}),W(r.order,null,c,e,a,i),e+=1,l.path.push({order:r.order,lane:null,isForward:!1,node:t}),W(r.order,t,c,e,a,i),e+=1)}else if(r.order<o.order){s&&(l.path.push({order:o.order,lane:null,isForward:!1,node:null}),W(o.order,null,c,e,a,i),e+=1);for(let u=o.order-1;u>r.order;u-=1)l.path.push({order:u,lane:null,isForward:!1,node:null}),W(u,null,c,e,a,i),e+=1;n?(l.path.push({order:r.order,lane:null,isForward:!1,node:null}),W(r.order,null,c,e,a,i),e+=1,l.path.push({order:r.order,lane:null,isForward:!0,node:t}),W(r.order,t,c,e,a,i),e+=1):(l.path.push({order:r.order,lane:null,isForward:!1,node:t}),W(r.order,t,c,e,a,i),e+=1)}else n!==s?(l.path.push({order:r.order,lane:null,isForward:n,node:t}),W(r.order,t,c,e,a,i),e+=1):(l.path.push({order:r.order,lane:null,isForward:!n,node:null}),W(r.order,null,c,e,a,i),e+=1,l.path.push({order:r.order,lane:null,isForward:n,node:t}),W(r.order,t,c,e,a,i),e+=1)});for(let l=0;l<=V;l+=1)Ia(Me[l],l)}function W(e,t,n,r,o,s){let a={trackID:n,segmentID:r,compareToFromSame:o[e][n]??null},i=t===null?void 0:s[e].get(t);if(i===void 0){let l={type:"single",node:t,tracks:[a]};Me[e].push(l),t!==null&&s[e].set(t,l)}else i.type="multiple",i.tracks.push(a);o[e][n]=a}function _a(e,t){let n;e.forEach(r=>{r.idealLane=0,r.tracks.forEach(o=>{if(o.segmentID===0)o.idealLane=o.trackID,o.idealY=null;else if(y[o.trackID].path[o.segmentID-1].order===t-1)o.idealLane=y[o.trackID].path[o.segmentID-1].lane??void 0,o.idealY=y[o.trackID].path[o.segmentID-1].y;else if(o.segmentID<y[o.trackID].path.length-1&&y[o.trackID].path[o.segmentID+1].order===t-1)o.idealLane=y[o.trackID].path[o.segmentID+1].lane??void 0,o.idealY=y[o.trackID].path[o.segmentID+1].y;else{for(n=o.segmentID-1;n>=0&&y[o.trackID].path[n].order!==t-1;)n-=1;n<0?(o.idealLane=o.trackID,o.idealY=null):(o.idealLane=y[o.trackID].path[n].lane??void 0,o.idealY=y[o.trackID].path[n].y)}r.idealLane+=o.idealLane}),r.idealLane/=r.tracks.length})}function Ia(e,t){let n=0,r=new Set,o=20,s=!1,a=-1;_a(e,t),e.sort(To),e.forEach(i=>{i.node!==null?(x[i.node].topLane=n,s&&(o-=10),x[i.node].y=o,x[i.node].contentHeight=0,s=!1):(s?o-=25:o>20&&(o-=10),s=!0),i.tracks.sort(To),i.tracks.forEach(l=>{l.lane=n,l.trackID===a&&i.node===null&&s&&(o+=10),y[l.trackID].path[l.segmentID].lane=n,y[l.trackID].path[l.segmentID].y=o,l.idealY!=null&&r.add(l.idealY-o),n+=1,o+=y[l.trackID].width,i.node!==null&&(x[i.node].contentHeight+=y[l.trackID].width),a=l.trackID}),o+=25}),va(e,r)}function va(e,t){let n=0,r=Number.MAX_SAFE_INTEGER;t.forEach(o=>{Lo(e,o)<r&&(r=Lo(e,o),n=o)}),e.forEach(o=>{o.node!==null&&(x[o.node].y+=n),o.tracks.forEach(s=>{let a=y[s.trackID].path[s.segmentID];a.y=a.y+n})})}function Pa(e,t){e.order<0||Me[e.order]===void 0||(Me[e.order].forEach(n=>{if(n.node!==null){let r=x[n.node];r!==e&&r.y>e.y&&(r.y+=t,n.tracks.forEach(o=>{let s=y[o.trackID].path[o.segmentID];s.y=s.y+t}))}else n.tracks.forEach(r=>{let o=y[r.trackID].path[r.segmentID];o.y>=e.y&&(o.y=o.y+t)})}),Fe[e.order].length>0&&Fe[e.order].forEach(n=>{x[n]!==e&&x[n].y>e.y&&(x[n].y+=t)}))}function Lo(e,t){let n=0;return e.forEach(r=>{r.tracks.forEach(o=>{o.idealY!=null&&y[o.trackID].type!=="read"&&(n+=Math.abs(o.idealY-t-y[o.trackID].path[o.segmentID].y)*y[o.trackID].width)})}),n}function To(e,t){return e.idealLane!==void 0?t.idealLane!==void 0?e.idealLane<t.idealLane?-1:e.idealLane>t.idealLane?1:0:-1:t.idealLane!==void 0?1:0}function wt(e,t){if(!e)return t?-1:0;if(!t)return 1;if(e.order!==void 0){if(t.order!==void 0){if(e.order<t.order)return-1;if(e.order>t.order)return 1;if(e.y!==void 0&&t.y!==void 0){if(e.y<t.y)return-1;if(e.y>t.y)return 1}return 0}return-1}return t.order!==void 0?1:0}function Oa(){let e,t,n={};Zt.forEach(r=>{let o=0;for(;o<y.length&&y[o].name!==r.track;)o+=1;o<y.length&&(e=0,y[o].path.forEach(s=>{s.node!==null&&(n={},t=e+x[s.node].sequenceLength-1,e>=r.start&&e<=r.end&&(n.start=0),e<r.start&&t>=r.start&&(n.start=r.start-e),t<=r.end&&t>=r.start&&(n.end=t-e,t<r.end&&(n.continue=!0)),t>r.end&&e<=r.end&&(n.end=r.end-e),n.start!==void 0&&(n.type=r.type,n.name=r.name,s.features===void 0&&(s.features=[]),s.features.push(n)),e=t+1)}))})}function $a(){let e=!0,t=4,n=_.trackWidth;y.forEach(r=>{r.freq!==void 0?r.width=Math.round((Math.log(r.freq)+1)*t):(r.width=n,r.type!==void 0&&r.type==="read"&&(r.width=t)),r.width!==t&&(e=!1)}),e&&y.forEach(r=>{r.freq!==void 0&&(r.width=n)})}function Ba(e){let t=e.path[0],n=x[t.node],r=e.firstNodeOffset??0;return on(n,t.isForward?r:n.sequenceLength-r)}function ka(e){let t=e.path[e.path.length-1],n=x[t.node],r=e.finalNodeCoverLength??0;return on(n,t.isForward?r:n.sequenceLength-r)}function ko(e,t){return t>e.sequenceLength?null:on(e,t)}function on(e,t){let[n,r]=Wa(e);if(e.sequenceLength===0)return n;let o=Math.min(Math.max(t,0),e.sequenceLength);return n+o/e.sequenceLength*(r-n)}function Ga(){let e,t,n,r,o,s,a,i,l;for(let u=0;u<=V;u+=1)en.push(0),tn.push(0);let c=[],d=[];x.forEach(u=>{u.x!==void 0&&(c[u.order]=u.x,d[u.order]===void 0?d[u.order]=u.x+u.pixelWidth:d[u.order]=Math.max(d[u.order],u.x+u.pixelWidth))}),y.sort(da),y.forEach(u=>{a="plain",o=Ge(u,a),s=na(u);let f=a,h=()=>(f!==a&&(f=a,o=Ge(u,a)),o);n=u.path[0].y,u.type!=="read"?u.sequence[0].startsWith("-")?e=d[u.path[0].order]+20:e=c[u.path[0].order]-20:e=Ba(u);for(let p=0;p<u.path.length;p+=1)u.path[p].y===n?u.path[p].features!==void 0&&(l=p>0&&u.path[p-1].order===u.path[p].order,i=Ao(u.path[p],c[u.path[p].order],d[u.path[p].order],a,u,e,n,o,l),a=i.highlight,e=i.xStart):(u.path[p-1].isForward?t=d[u.path[p-1].order]:t=c[u.path[p-1].order],t!==e&&(o=h(),B.rectangles.push({xStart:Math.min(e,t),yStart:n,xEnd:Math.max(e,t),yEnd:n+u.width-1,color:o,alpha:s,id:u.id,name:u.name,type:u.type})),u.path[p].order-1===u.path[p-1].order?(e=t,t=c[u.path[p].order],r=u.path[p].y,o=h(),B.curves.push({xStart:e,yStart:n,xEnd:t+1,yEnd:r,width:u.width,color:o,alpha:s,laneChange:Math.abs(u.path[p].lane-u.path[p-1].lane),id:u.id,name:u.name,type:u.type,nodeStart:u.path[p-1]?.node,nodeEnd:u.path[p]?.node}),e=t,n=r):u.path[p].order+1===u.path[p-1].order?(e=t,t=d[u.path[p].order],r=u.path[p].y,o=h(),B.curves.push({xStart:e+1,yStart:n,xEnd:t,yEnd:r,width:u.width,color:o,alpha:s,laneChange:Math.abs(u.path[p].lane-u.path[p-1].lane),id:u.id,name:u.name,type:u.type,nodeStart:u.path[p-1]?.node,nodeEnd:u.path[p]?.node}),e=t,n=r):u.path[p-1].isForward?(r=u.path[p].y,Io(1,t,n,r,u.width,o,u.id,u.path[p].order,u.type,u.name),e=d[u.path[p].order],n=u.path[p].y):(r=u.path[p].y,Io(-1,t,n,r,u.width,o,u.id,u.path[p].order,u.type,u.name),e=c[u.path[p].order],n=u.path[p].y),u.path[p].features!==void 0&&(l=u.path[p-1].order===u.path[p].order,i=Ao(u.path[p],c[u.path[p].order],d[u.path[p].order],a,u,e,n,o,l),a=i.highlight,e=i.xStart));u.type!=="read"?u.path[u.path.length-1].isForward?t=d[u.path[u.path.length-1].order]+20:t=c[u.path[u.path.length-1].order]-20:t=ka(u),B.rectangles.push({xStart:Math.min(e,t),yStart:n,xEnd:Math.max(e,t),yEnd:n+u.width-1,color:o,alpha:s,id:u.id,name:u.name,type:u.type})})}var Fa=1e9;function Co(e,t){xt=new Map;let n=new Map,r=_.ignoreStrand;for(let f of e){let h=f.indexSequence;if(!(!h||h.length<2))for(let p=0;p<h.length-1;p+=1){let m=h[p],g=h[p+1],b=Math.abs(m),M=Math.abs(g),N=x[b],E=x[M];if(!N||!E)continue;let S;if(r){let T=`${m}>${g}`,O=`${-g}>${-m}`;S=T<O?T:O}else S=`${m}>${g}`;let R=n.get(S);R===void 0?n.set(S,{sSigned:m,dSigned:g,sName:m<0?`-${N.name}`:N.name,dName:g<0?`-${E.name}`:E.name,count:1,sourceTrackID:f.sourceTrackID}):R.count+=1}}let o=0;for(let f of n.values())f.count>o&&(o=f.count);let s=Mt,a=60,i=f=>o<=1?s:s+(a-s)*Math.sqrt(f/o),l=[],c=0;for(let f of n.values()){let h=Fa+c,p=`${f.count.toLocaleString()} ${t}${f.count===1?"":"s"}: Node ${f.sName} \u2192 Node ${f.dName}`;xt.set(h,{count:f.count,label:p});let m=x[Math.abs(f.sSigned)]?.sequenceLength??0;l.push({id:h,sourceTrackID:f.sourceTrackID,type:"read",name:p,sequence:[f.sName,f.dName],indexSequence:[],path:[],width:i(f.count),firstNodeOffset:m,finalNodeCoverLength:0,sequenceNew:[{nodeName:f.sName,mismatches:[]},{nodeName:f.dName,mismatches:[]}],mapping_quality:0,is_secondary:!1,sample_name:null,read_group:null,score:f.count}),c+=1}let d="?",u=0;for(let f of x){if(!f)continue;let h=f.contentHeight;h>u&&(u=h,d=f.name)}return et&&console.log(`[coarsened] ${t}s_in=${e.length} edges_out=${l.length} tallestNodeBeforePlace=${d}(${u.toFixed(1)})`),l}function Ao(e,t,n,r,o,s,a,i,l){let c=r,d,u,f,h;t-=8,n+=8;let p=x[e.node].sequenceLength;return e.features.sort((m,g)=>m.start-g.start),e.features.forEach(m=>{c!==m.type&&(d=Ge(o,c),e.isForward?(f=t+Math.round(m.start*(n-t+1)/p),l&&f<t+8&&(h=t+Math.round((m.end+1)*(n-t+1)/p)-1,u=Ge(o,m.type),B.featureRectangles.push({xStart:f,yStart:a,xEnd:h,yEnd:a+o.width-1,color:u,id:o.id,name:o.name,type:o.type})),f>s+1&&B.featureRectangles.push({xStart:s,yStart:a,xEnd:f-1,yEnd:a+o.width-1,color:d,id:o.id,name:o.name,type:o.type})):(f=n-Math.round(m.start*(n-t+1)/p),l&&f>n-8&&(h=n-Math.round((m.end+1)*(n-t+1)/p)-1,u=Ge(o,m.type),B.featureRectangles.push({xStart:h,yStart:a,xEnd:f,yEnd:a+o.width-1,color:u,id:o.id,name:o.name,type:o.type})),s>f+1&&B.featureRectangles.push({xStart:f+1,yStart:a,xEnd:s,yEnd:a+o.width-1,color:d,id:o.id,name:o.name,type:o.type})),s=f,c=m.type),(m.end<p-1||m.continue===void 0)&&(d=Ge(o,c),e.isForward?(h=t+Math.round((m.end+1)*(n-t+1)/p)-1,B.featureRectangles.push({xStart:s,yStart:a,xEnd:h,yEnd:a+o.width-1,color:d,id:o.id,name:o.name,type:o.type})):(h=n-Math.round((m.end+1)*(n-t+1)/p)-1,B.featureRectangles.push({xStart:h,yStart:a,xEnd:s,yEnd:a+o.width-1,color:d,id:o.id,name:o.name,type:o.type})),s=h+1,c="plain")}),{xStart:s,highlight:c}}var _o=7;function Io(e,t,n,r,o,s,a,i,l,c){let d=e===1?tn:en,u=10*d[i],f=t+e*(u+5),h=_o,p=Math.min(_o,o),m=Math.min(n,r),g=Math.max(n,r),b=e===1?t:f-1,M=e===1?f:t,N=T=>{B.verticalRectangles.push({xStart:b,yStart:T,xEnd:M,yEnd:T+o-1,color:s,id:a,name:c,type:l})};N(n),B.verticalRectangles.push({xStart:e===1?f+h:f-h-p,yStart:m+o+h-1,xEnd:e===1?f+h+p-1:f-h-1,yEnd:g-h+1,color:s,id:a,name:c,type:l}),N(r);let E=f+e*h,S=f+e*(h+p),R=`M ${f} ${g}`;R+=` Q ${E} ${g} ${E} ${g-h}`,R+=` H ${S}`,R+=` Q ${S} ${g+o} ${f} ${g+o}`,R+=" Z ",B.corners.push({path:R,color:s,id:a,type:l}),R=`M ${f} ${m}`,R+=` Q ${S} ${m} ${S} ${m+o+h}`,R+=` H ${E}`,R+=` Q ${E} ${m+o} ${f} ${m+o}`,R+=" Z ",B.corners.push({path:R,color:s,id:a,type:l}),d[i]+=1}function Wa(e){let t=e.x-4,n=e.x+e.pixelWidth+4;return[t,n]}function vo(){switch(x.forEach(e=>{e.sequenceLength===void 0&&(e.sequenceLength=e.seq.length)}),_.nodeWidthOption){case"compressed":x.forEach(e=>{e.width=1+Math.log(e.sequenceLength)/Math.log(2),e.pixelWidth=Math.round((e.width-1)*8.401)});break;case"small":x.forEach(e=>{e.width=e.sequenceLength/100,e.pixelWidth=Math.round((e.width-1)*8.401)});break;case"fixed":x.forEach(e=>{e.width=10,e.pixelWidth=Math.round(e.width*8.401)});break;case"normal":{let e=_.charWidth;x.forEach(t=>{t.width=t.sequenceLength;let n=t.seq?.length??1;t.pixelWidth=Math.round(e*n)});break}default:throw new Error(`${_.nodeWidthOption} not implemented`)}}function Da(){let e,t,n=Array.from(x,()=>new Set),r=Array.from(x,()=>new Set),o;_.showReads&&w.length>0?o=y.concat(w):o=y,o.forEach(i=>{for(let l=0;l<i.sequence.length;l+=1)D(i.sequence[l])?(e=I(i.sequence[l]),l>0?(t=i.sequence[l-1],D(t)?r[C.get(e)].add(I(t)):(r[C.get(e)].add(t),r[C.get(e)].add(ue(t)))):i.type==="haplotype"&&r[C.get(e)].add("None"),l<i.sequence.length-1?(t=i.sequence[l+1],D(t)?n[C.get(e)].add(I(t)):(n[C.get(e)].add(t),n[C.get(e)].add(ue(t)))):i.type==="haplotype"&&n[C.get(e)].add("None")):(l>0?(e=i.sequence[l-1],n[C.get(i.sequence[l])].add(e),D(e)&&n[C.get(i.sequence[l])].add(I(e))):i.type==="haplotype"&&n[C.get(i.sequence[l])].add("None"),l<i.sequence.length-1?(e=i.sequence[l+1],r[C.get(i.sequence[l])].add(e),D(e)&&r[C.get(i.sequence[l])].add(I(e))):i.type==="haplotype"&&r[C.get(i.sequence[l])].add("None"))});let s=n.map(i=>Array.from(i)),a=r.map(i=>Array.from(i));if(_.showReads&&w.length>0){let i=x.slice();i.sort(wt);let l=new Map,c=new Map,d=f=>{let h=l.get(f);if(h===void 0)throw new Error(`No merge offset recorded for node ${f}`);return h},u=f=>{let h=c.get(f);if(h===void 0)throw new Error(`No merge origin recorded for node ${f}`);return h};i.forEach(f=>{let h=Je(C.get(f.name),s,a);if(h){let p=d(h)+oe(h).sequenceLength;l.set(f.name,p),l.set(ue(f.name),p),c.set(f.name,u(h)),c.set(ue(f.name),u(h))}else l.set(f.name,0),l.set(ue(f.name),0),c.set(f.name,f.name),c.set(ue(f.name),f.name)}),w.forEach(f=>{let h=f.sequenceNew??[];f.firstNodeOffset=(f.firstNodeOffset??0)+d(f.sequence[0]),f.finalNodeCoverLength=(f.finalNodeCoverLength??0)+d(f.sequence[f.sequence.length-1]);for(let p=f.sequence.length-1;p>=0;p-=1){let m=I(f.sequence[p]),g=Je(C.get(m),s,a);if(g&&Qt(C.get(g),s,a))if(p>0){f.sequence.splice(p,1);let b=oe(g).sequenceLength;h[p].mismatches.forEach(M=>{M.pos+=b}),h[p-1].mismatches=h[p-1].mismatches.concat(h[p].mismatches),h.splice(p,1)}else{f.sequence[0]=u(f.sequence[0]);let b=h[0],M=d(b.nodeName);b.mismatches.forEach(N=>{N.pos+=M}),b.nodeName=u(b.nodeName)}}})}for(let i=0;i<x.length;i+=1)if(Qt(i,s,a)&&!Je(i,s,a)){let l=i;for(;Qt(l,s,a);)l=C.get(I(a[l][0])),x[i].sequenceLength+=x[l].sequenceLength,x[i].seq+=x[l].seq}y.forEach(i=>{for(let l=i.sequence.length-1;l>=0;l-=1){e=I(i.sequence[l]);let c=C.get(e);Je(c,s,a)&&i.sequence.splice(l,1)}});for(let i=x.length-1;i>=0;i-=1)Je(i,s,a)&&x.splice(i,1)}function Je(e,t,n){if(t[e].length!==1||t[e][0]==="None")return!1;let r=I(t[e][0]),o=C.get(r);return n[o].length!==1||n[o][0]==="None"?!1:r}function Qt(e,t,n){if(n[e].length!==1||n[e][0]==="None")return!1;let r=I(n[e][0]),o=C.get(r);return!(t[o].length!==1||t[o][0]==="None")}function qa(e){let t=_.focusReadNames?new Set(_.focusReadNames):null;return e.filter(n=>n.is_secondary!==!0&&(n.mapping_quality??0)>=_.mappingQualityCutoff&&(t===null||n.name!==void 0&&t.has(n.name)))}function Ha(e,t){let n=new Map;for(let r of e){let o=t(r),s=n.get(o);s===void 0?n.set(o,[r]):s.push(r)}return n}function Xa(e,t){return e.xStart<t.xStart?1:e.xStart>t.xStart?-1:e.yStart>t.yStart?1:e.yStart<t.yStart?-1:0}function Go(e,t){let n=Ha(e.filter(s=>s.type===t),s=>`${s.nodeStart},${s.nodeEnd}`);n.forEach(s=>{let a=.3,i=.4/s.length;s.length<=5&&(a=.5,i=0),s.sort(Xa),s.forEach(l=>{let c,d;l.yStart<l.yEnd?(c=l.xStart+(l.xEnd-l.xStart)*(1-a),a+=i,d=l.xStart+(l.xEnd-l.xStart)*(1-a)):(c=l.xStart+(l.xEnd-l.xStart)*a,a+=i,d=l.xStart+(l.xEnd-l.xStart)*a);let u=`M ${l.xStart} ${l.yStart}`;u+=` C ${c} ${l.yStart} ${c} ${l.yEnd} ${l.xEnd} ${l.yEnd}`,u+=` V ${l.yEnd+l.width}`,u+=` C ${d} ${l.yEnd+l.width} ${d} ${l.yStart+l.width} ${l.xStart} ${l.yStart+l.width}`,u+=" Z",l.path=u})});let r=Array.from(n.keys());r.sort(function(s,a){let i=s.split(",").map(Number),l=a.split(",").map(Number),c=i[0]??0,d=i[1]??0,u=l[0]??0,f=l[1]??0;return c<u?-1:c>u?1:d<f?-1:d>f?1:0});let o=[];for(let s of r){let a=n.get(s);a!==void 0&&o.push(...a)}return o}function Fo(e){let t=`M ${e.x-9} ${e.y} Q ${e.x-9} ${e.y-9} ${e.x} ${e.y-9}`,n=e.x,r=e.y-9;return e.width>1&&(n+=e.pixelWidth,t+=` L ${n} ${r}`),t+=` Q ${n+9} ${r} ${n+9} ${r+9}`,n+=9,r+=9,e.contentHeight>0&&(r+=e.contentHeight-0,t+=` L ${n} ${r}`),t+=` Q ${n} ${r+9} ${n-9} ${r+9}`,n-=9,r+=9,e.width>1&&(n-=e.pixelWidth,t+=` L ${n} ${r}`),t+=` Q ${n-9} ${r} ${n-9} ${r-9}`,n-=9,r-=9,e.contentHeight>0&&(r-=e.contentHeight-0,t+=` L ${n} ${r}`),t}function Ya(e){let t=new Map;for(let[n,r]of e.pathVisits??[])for(let o of r){let s=`${o.path} ${n}`,a=t.get(s);a?a.push(o.strand):t.set(s,[o.strand])}return t}function za(e){let t=new Map(e.nodes.map(s=>[s.id,s])),n=Ya(e),r=(e.paths??[]).map((s,a)=>({path:s,index:a})),o=r.findIndex(s=>ve(s.path.name).name===e.referencePath);return o>0&&r.unshift(...r.splice(o,1)),r.flatMap(({path:s,index:a})=>{let i=ve(s.name).name,l=new Map,c=s.nodeIds.flatMap(d=>{let u=t.get(d);if(!u)return[];let f=l.get(u.name)??0;l.set(u.name,f+1);let h=n.get(`${i} ${u.name}`)?.[f]??Xt(u);return[Yt(u,h)]});return c.length>0?[{id:a,name:s.name,sequence:c,sourceTrackID:0,type:"haplotype"}]:[]})}function Ka(e){return e.nodes.map(t=>({name:t.id,seq:"",sequenceLength:Math.max(1,t.length)}))}function We(e){return(e.paths?.length??0)>0}var ja=600,Ua=3,Va=15;function Qa(e){return Math.max(Ua,Math.min(Va,Math.floor(ja/Math.max(1,e))))}function Wo(e){let t=e.paths??[],n=za(e),r=e.reads?ao(e,e.reads,t.length):[],o=r.length>0?In:_n,s=t.map((i,l)=>o(l,t.length)),a=Oo(Ka(e),n,r,{nodeWidthOption:"compressed",trackWidth:Qa(n.length),trackColor:i=>i.type==="read"?io(i):s[i.id]});return a?{layout:a,pathColors:s}:void 0}function rn(e){let t=[];return e.nodes.forEach(n=>{n.order>=0&&t.push(n)}),t}function Do(e,t,n,r){let o=e.y+e.contentHeight/2-t;return[{x:n,y:o},{x:r,y:o}]}function qo(e,t){return{minY:e.bounds.minY-t,maxY:e.bounds.maxY-t}}function Ho(e){let t=We(e)?Wo(e):void 0;if(!t)return;let{layout:n,pathColors:r}=t,o=n.bounds.minY,s={};for(let l of rn(n))s[l.name]=Do(l,o,l.x,l.x+l.pixelWidth);let{minY:a,maxY:i}=qo(n,o);return{nodePositions:s,tubeMap:{layout:n,yOffset:o,pathColors:r},extent:{minX:n.bounds.minX,maxX:n.bounds.maxX,minY:a,maxY:i}}}function Za(e,t){let n=new Map(e.nodes.map(i=>[i.id,i])),r=new Map;for(let i of rn(t)){let l=r.get(i.order);l?l.push(i):r.set(i.order,[i])}let o=[],s=-1/0;for(let i of[...r.keys()].sort((l,c)=>l-c)){let l=r.get(i),c=1/0,d=-1/0;for(let u of l){let f=n.get(u.name);f&&P(f)&&(c=Math.min(c,f.stable.start),d=Math.max(d,f.stable.start+u.sequenceLength))}c===1/0&&(c=d=s),c<s&&(c=s,d=Math.max(s,d)),s=Math.max(s,d),o.push({order:i,x0:Math.min(...l.map(u=>u.x)),x1:Math.max(...l.map(u=>u.x+u.pixelWidth)),bp0:c,bp1:d})}let a=o.find(i=>i.bp0!==-1/0);for(let i of o)i.bp0===-1/0&&(i.bp0=i.bp1=a?.bp0??0);return o}function Ja(e){return e.nodes.some(P)&&We(e)}function Xo(e){let t=Ja(e)?Wo(e):void 0;if(!t)return;let{layout:n,pathColors:r}=t,o=Za(e,n),s=new Map(o.map(l=>[l.order,l])),a=n.bounds.minY,i={};for(let l of rn(n)){let c=s.get(l.order);i[l.name]=Do(l,a,c.bp0,c.bp1)}return{nodePositions:i,tubeMap:{layout:n,yOffset:a,columns:o,pathColors:r},referenceAxis:!0,pixelRows:!0,extent:qo(n,a)}}function Yo(e){return e.sample??at(e.name)}function ei(e){return e.haplotype!==void 0&&e.sample!==void 0?`${e.sample}#${e.haplotype}`:Yo(e)}function ti(e,t){let n=[],r;for(let o of e){r!==void 0&&o.start!==void 0&&o.start>r&&n.push(o.start-r),n.push(...o.nodeIds);let s=o.nodeIds.reduce((a,i)=>a+(t.get(i)??0),0);r=o.start===void 0?void 0:o.start+s}return n}function ni(e,t){let n=[],r;for(let o of e){if(o.start===void 0||r!==void 0&&o.start<r)return;r!==void 0&&o.start>r&&n.push({start:r,end:o.start});let s=o.start;for(let a of o.nodeIds){let i=t.get(a)??0;n.push({start:s,end:s+i}),s+=i}r=s}return n}function oi(e,t,n,r=!0){if(!n||!r)return{ids:e,complete:!0,from:-1,to:-1};let o=-1,s=-1,a=-1/0,i=1/0;if(e.forEach((c,d)=>{let u=typeof c=="string"?t.get(c):void 0;u&&(u.end<=n.start&&u.end>a&&(a=u.end,o=d),u.start>=n.end&&u.start<i&&(i=u.start,s=d))}),o<0||s<0)return{ids:e,complete:!1,from:-1,to:-1};let l=e.slice(Math.min(o,s)+1,Math.max(o,s));return{ids:o<s?l:l.reverse(),complete:!0,from:o,to:s}}function zo(e,t,n){let r=e.paths??[],o=g=>ve(g.name).name===e.referencePath,s=r.some(o)?r.filter(o).sort((g,b)=>(g.start??0)-(b.start??0)):r.slice(0,1),a=s[0],i=r.filter(g=>!s.includes(g));if(!a||i.length===0)return;let l=new Map;for(let g of i)l.set(g.name,[...l.get(g.name)??[],g]);let c=new Map(e.nodes.map(g=>[g.id,g.length])),d=a.start??0,u=t&&t.end>t.start?t:void 0,f=new Map;for(let g of s){let b=g.start??0;for(let M of g.nodeIds){let N=c.get(M)??0;f.has(M)||f.set(M,{start:b,end:b+N}),b+=N}}let h=u===void 0||[...f.values()].some(g=>g.end<=u.start)&&[...f.values()].some(g=>g.start>=u.end),p=g=>{let b=g[0],M=[...g].sort((j,Z)=>(j.start??0)-(Z.start??0)),{ids:N,complete:E,from:S,to:R}=oi(ti(M,c),f,u,h),T=ni(M,c),O=b.contig??it(ve(b.name).name),k=T?.length?S<0?{contig:O,start:T[0].start,reversed:!1}:S<R?{contig:O,start:T[S].end,reversed:!1}:{contig:O,start:T[S].start,reversed:!0}:void 0,Q=[],fe=0,qe=0,Ee=0,re=0;for(let j of N){if(typeof j=="number"){Q.push({start:fe,bp:j,onReference:!1,gap:!0}),fe+=j,Ee+=j,re=0;continue}let Z=c.get(j)??0,Y=f.get(j),z=Q.at(-1),A=z?.referenceStart,v=Y&&A!==void 0&&re>=0&&A+z.bp===Y.start,U=Y&&A!==void 0&&re<=0&&Y.end===A;!Y&&z&&!z.onReference&&!z.gap?z.bp+=Z:v||U?(z.bp+=Z,v||(z.referenceStart=Y.start,z.reversed=!0),re=v?1:-1):(Q.push({start:fe,bp:Z,onReference:Y!==void 0,referenceStart:Y?.start}),re=0),fe+=Z,Y||(qe+=Z)}return{name:b.name,label:ei(b),sample:Yo(b),haplotype:b.haplotype,bp:fe,offReferenceBp:qe,gapBp:Ee,complete:E,runs:Q,axis:k}};return{origin:u?u.start:d,unit:n,reference:p(s),rows:[...l.values()].map(p).sort((g,b)=>Number(b.complete)-Number(g.complete)||b.bp-g.bp||g.label.localeCompare(b.label))}}var ri=1.3;function si(e){let t=e.reference.bp;for(let n of e.rows)t=Math.max(t,n.bp);return{maxX:e.origin+t*ri,maxY:e.rows.length*20}}function Ko(e,t){let n=_e(e),r=zo(e,t);if(n.length===0||!r)return;let o=t?n.filter(i=>gn(i,t)):n,s=Ie(o.length>0?o:n),a=[{label:r.reference.label,y:0},...r.rows.map((i,l)=>({label:i.label,y:(l+1)*20}))];return{nodePositions:s,rowLabels:a,referenceAxis:!0,pixelRows:!0,extent:si(r)}}var ai="Force-directed layout",we=e=>e.nodes.some(P),jo=e=>we(e)&&(e.paths?.length??0)>1,Uo=e=>we(e)&&We(e),Vo=e=>we(e)&&e.nodes.some(lt),sn=[{value:"auto",label:"Anchored",description:"x is reference bp, one row per stable rank. Needs rGFA tags or a reference path.",run:uo,cutMargins:!0,wholeWalks:!1,available:we,drawsLocally:we,drawsNodes:!0},{value:"samplerows",label:"Sample rows",description:"x is reference bp, one row per contributing assembly. Needs rGFA tags or a reference path.",run:go,cutMargins:!0,wholeWalks:!1,available:Vo,drawsLocally:Vo,drawsNodes:!0},{value:"walkrows",label:"Walk rows",description:"x is each walk's own bp: one bar per haplotype, blue on the reference's path and purple off it, so a repeat expansion reads as bar length, and each bar boxes its haplotype's own genes where the session has them. Needs W or P lines.",run:Ko,cutMargins:!1,wholeWalks:!0,available:jo,drawsLocally:jo,drawsNodes:!1},{value:"ordered",label:"Ordered",description:"x is reference order, not bp: every node gets room, bubbles read as lenses. Needs rGFA tags or a reference path.",run:mo,cutMargins:!1,wholeWalks:!1,available:we,drawsLocally:we,drawsNodes:!0},{value:"tubemap",label:"Tube map",description:"sequenceTubeMap: every path a coloured tube through boxed nodes, columns in node order and node widths log-scaled. Needs P or W lines.",run:Ho,cutMargins:!1,wholeWalks:!1,available:We,drawsLocally:We,drawsNodes:!1},{value:"tubemapref",label:"Tube map on reference",description:"The tube map with each column at the reference bp it covers, so the tubes line up with the tracks around them. Needs P or W lines and a reference path.",run:Xo,cutMargins:!0,wholeWalks:!1,available:Uo,drawsLocally:Uo,drawsNodes:!1},{value:"force",label:ai,description:"OGDF FMMM, via the external Bandage engine.",run:()=>{},cutMargins:!1,wholeWalks:!1,available:()=>!0,drawsLocally:()=>!1,drawsNodes:!0}],Zc=sn.map(e=>e.value);function Jc(e,t){return!ii(e).drawsLocally(t)}function ii(e){return sn.find(t=>t.value===e)??sn[0]}var li=10;function ci(e,t){let n=e.end-e.start,r=e.longestAlleleLength-e.shortestAlleleLength;return t.find(o=>r<=li*(o.end-o.start)&&(n===0?o.start<=e.start&&e.start<=o.end:Math.min(e.end,o.end)-Math.max(e.start,o.start)>=n/2))}var ui=40;function Re(e){return e>=1e4?`${(e/1e3).toFixed(0)} kb`:e>=1e3?`${(e/1e3).toFixed(1)} kb`:`${e} bp`}function di(e,t){let n=Re(e),r=Re(t),o=r.slice(r.indexOf(" "));return n.endsWith(o)?`${n.slice(0,-o.length)}\u2013${r}`:`${n}\u2013${r}`}function Qo(e){return e>=vn?"\u22652.1B routes":e>=1e5?`${(e/1e3).toFixed(0)}k routes`:`${e} routes`}function nu(e,t=[]){let n=fi(e,t);return e.partial?{...n,label:`${n.label}, partial`}:n}function fi(e,t){let n=e.end-e.start,{shortestAlleleLength:r,longestAlleleLength:o,pathCount:s,segmentCount:a,inversion:i}=e,l=di(r,o);if(a>=ui)return{kind:"superbubble",label:`${l} superbubble, ${a} segments, ${Qo(s)}${i?", inv":""}`};if(i)return{kind:"inversion",label:`${Re(o)} inv`};let c=o!==r?ci(e,t):void 0;if(c){let u=c.name?` (${c.name})`:"";return{kind:"repeat",label:`${l} repeat array${u}, ${Qo(s)}`}}let d=s>2?`, ${s} alleles`:"";return r===o&&r===n?n<=1?{kind:"snp",label:"SNP"}:{kind:"substitution",label:`${Re(n)} sub`}:n===0||r===n?{kind:"insertion",label:`\u2264${Re(o-n)} ins${d}`}:o===n?{kind:"deletion",label:`${Re(n-r)} del${d}`}:{kind:"complex",label:`${Re(n)} ref \u2192 ${l}, ${s} alleles`}}var ou={snp:"#5b6b7a",substitution:"#5b6b7a",insertion:"#2f8fd6",deletion:"#c94040",inversion:"#e07b00",repeat:"#8e3fbf",superbubble:"#8e3fbf",complex:"#8e3fbf"},ru={snp:"SNP",substitution:"substitution",insertion:"insertion",deletion:"deletion",inversion:"inversion",repeat:"repeat array",superbubble:"superbubble",complex:"site"};function su(e){return e.segments.split(",").filter(Boolean)}function iu({count:e,bounds:t,pixelRows:n,width:r,room:o,columns:s}){function a(l){let c=Math.ceil(e/l),d=Math.floor((r-(l-1)*8)/l),u=(o-c*34-(c-1)*8)/c,f=(d-24)/t.w,h=t.h>0?(u-24)/t.h:1/0,p=n?f:Math.min(f,h),m=n?t.h:t.h*p,g=Math.floor(Math.max(60,Math.min(m+24,u)));return{columns:l,width:d,height:g,scale:p,total:c*(g+34)+(c-1)*8}}if(s!==void 0)return a(Math.max(1,Math.min(e,Math.round(s))));let i=a(1);for(let l=2;l<=e;l++){let c=a(l);c.scale>i.scale&&(i=c)}return i}function lu(e){let t=typeof e=="string"?{field:e}:e??{};return{field:t.field==="walk"||t.field==="sample"?t.field:"",domain:[...t.domain??[]],...t.columns===void 0?{}:{columns:t.columns}}}function Zo(e,t){let n=new Map(t.map((o,s)=>[o,s])),r=o=>n.get(o)??t.length;return e.map((o,s)=>({name:o,i:s})).sort((o,s)=>r(o.name)-r(s.name)||o.i-s.i).map(({name:o})=>o)}function cu(e,t,n=[]){let r=Zo(e,n),o={columns:void 0,count:e.length,cells:e.map(c=>r.indexOf(c))};if(t==="walk")return o;let s=e.map(c=>{let[d,u,f]=c.split("#"),h=Number(u);return f!==void 0&&Number.isInteger(h)&&h>=0?{sample:d,column:Math.max(0,h-1)}:void 0}),a=Zo([...new Set(s.flatMap(c=>c?[c.sample]:[]))],n),i=Math.max(1,...s.map(c=>c?c.column+1:1)),l=s.map(c=>c?a.indexOf(c.sample)*i+c.column:-1);return l.includes(-1)||new Set(l).size<l.length?o:{columns:i,count:a.length*i,cells:l}}function $(e,t={},...n){return{tag:e,attrs:t,children:n.filter(r=>!!r||r==="")}}function Jo(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function pi(e){return Jo(e).replaceAll('"',""")}function hi(e){if(typeof e=="string")return Jo(e);let t=Object.entries(e.attrs).filter(([,n])=>n!==void 0).map(([n,r])=>` ${n}="${pi(String(r))}"`).join("");return`<${e.tag}${t}>${e.children.map(hi).join("")}</${e.tag}>`}var ln="#2f8fd6",nr="#8e3fbf",or="#bdbdbd",Rt="#1c1c22",K=12,rr=4,mi=3;function tt(e){return`${(e/1e3).toFixed(e<1e4?1:0)} kb`}function er(e,t){return t?` \u2248 ${Math.round(e/t)} units`:""}function gi(e,t,n,r){let{bp:o,gapBp:s,complete:a}=e;if(!t)return`${tt(o)}${er(o,n)}`;let i=o-t.bp,l=i===0?"":` (${i>0?"+":"\u2212"}${tt(Math.abs(i))})`,c=s>0?` \xB7 ${tt(s)} outside the cut`:"",d=r?` \xB7 called ${tt(r.bp)}${r.spanningReads===0?" \xB7 no spanning read":""}`:"";return`${tt(o)}${er(o,n)}${l}${c}${a?"":" \xB7 partial walk"}${d}`}function bi(e,t,n){let r=t+6;return r+e.length*6.2<n?{x:r,anchor:"start",halo:!1}:{x:t-6,anchor:"end",halo:!0}}function xi(e,t,n){if(t*n<mi)return[];let r=[];for(let o=t;o<e;o+=t)r.push(o);return r}function yi(e,t){if(e.gap)return{fill:or};if(!t)return{fill:e.onReference?ln:nr};if(e.referenceStart===void 0)return{fill:Gt};let n=Qn({...e,start:e.referenceStart},t);return n.length===1?{fill:mt(n[0])}:{stops:n.map(mt)}}function tr(e,t,n){return e.reversed?{start:e.start-n,end:e.start-t}:{start:t-e.start,end:n-e.start}}function bu(e,t){return e.reversed?{start:e.start-t,end:e.start}:{start:e.start,end:e.start+t}}function xu(e,t){let n=new Map;for(let r of e){let o=t.get(r.name);if(!r.axis||!o)continue;let s=r.axis,a=({start:i,end:l})=>({start:Math.max(0,i),end:Math.min(r.bp,l)});n.set(r.name,o.map(i=>({name:i.name,...a(tr(s,i.start,i.end)),exons:i.exons.map(l=>a(tr(s,l.start,l.end))).filter(l=>l.end>l.start)})).filter(i=>i.end>i.start).sort((i,l)=>i.start-l.start))}return n}var Mi=9,wi=5.2;function Ri(e,t,n){let r=e.map(a=>{let i=t(a.start);return{g:a,x:i,w:Math.max(2,t(a.end)-i)}}),o=[],s=new Set([...r].sort((a,i)=>a.w-i.w).filter(({g:a,x:i,w:l})=>{let c=a.name.length*wi/2,d=[i+l/2-c,i+l/2+c];return 2*c>l+6||o.some(([u,f])=>d[0]<f+2&&d[1]>u-2)?!1:(o.push(d),!0)}));return r.map(a=>({name:a.g.name,x:a.x,y:n-K/2-2,w:a.w,h:K+4,exons:a.g.exons.map(i=>({x:t(i.start),w:Math.max(1,t(i.end)-t(i.start))})),label:s.has(a)?{x:a.x+a.w/2,y:n+3,size:Mi}:void 0}))}var an=e=>`${e} row${e===1?"":"s"}`;function yu(e,t={}){let n=[{swatch:{kind:"bar",fill:t.ramp?t.rampCss??ln:ln},label:`on ${e.reference.label}'s path`},{swatch:{kind:"bar",fill:t.ramp?Gt:nr},label:`off ${e.reference.label}'s path`}];return[e.reference,...e.rows].some(r=>r.gapBp>0)&&n.push({swatch:{kind:"gap",fill:or},label:"walked outside the cut"}),t.genes&&(n.push({swatch:{kind:"gene"},label:"genes, each row's own annotation"}),t.genes.untracked&&n.push({swatch:{kind:"gene"},label:`no gene track for ${an(t.genes.untracked)}`,note:!0}),t.genes.unplaced&&n.push({swatch:{kind:"gene"},label:`no contig coordinates for ${an(t.genes.unplaced)}`,note:!0}),t.genes.unread&&n.push({swatch:{kind:"gene"},label:`genes not read for the last ${an(t.genes.unread)}`,note:!0})),n}var Ei="#111",Si="#9e9e9e",Ni="#c62828";function Mu(e,t,n){let r=0,o=e.flatMap(s=>{let a=s.note?void 0:s.swatch.kind==="gene"?$("rect",{x:r,y:5,width:18,height:8,fill:"none",stroke:Rt,"stroke-width":1.5}):$("rect",{x:r,y:s.swatch.kind==="gap"?7:5,width:18,height:s.swatch.kind==="gap"?rr:8,rx:2,fill:s.swatch.fill}),i=$("text",{x:s.note?r:r+23,y:13,"font-style":s.note?"italic":void 0,fill:s.note?"#666":void 0},s.label);return r+=(s.note?0:23)+s.label.length*6.2+16,a?[a,i]:[i]});return{width:r,tree:$("g",{transform:`translate(${t} ${n})`,"font-family":"Helvetica, Arial, sans-serif","font-size":11},...o)}}function Li(e,t){return $("g",{class:"row-gene","data-testid":"graph-walk-gene"},$("title",{},e.name),...e.exons.map(n=>$("rect",{x:n.x,y:t-K/2,width:n.w,height:K,fill:Rt,opacity:.35})),$("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:Rt,"stroke-width":1.5}),e.label&&$("text",{x:e.label.x,y:e.label.y,"font-family":"sans-serif","font-size":e.label.size,"font-weight":600,"text-anchor":"middle",fill:Rt,stroke:"white","stroke-width":2.5,"paint-order":"stroke"},e.name))}function wu(e,t,n={}){let r=f=>f*t.scaleX+t.translateX,o=f=>f*20*t.scaleY+t.translateY,{origin:s,unit:a,reference:i,rows:l}=e,c=f=>r(s+f),d=n.idPrefix??"walkrow",u=(f,h)=>{let p=o(h);if(p<-K||p>t.height+K)return;let m=f.runs.flatMap(E=>{let S=yi(E,n.ramp),R=E.gap?rr:K,T=`${d}-${h}-${E.start}`,O=$("rect",{x:c(E.start),y:p-R/2,width:Math.max(1,E.bp*t.scaleX),height:R,fill:"stops"in S?`url(#${T})`:S.fill});return"stops"in S?[$("linearGradient",{id:T},...S.stops.map((k,Q)=>$("stop",{offset:Q/(S.stops.length-1),"stop-color":k}))),O]:[O]}),g=a?xi(f.bp,a,t.scaleX).map(E=>$("line",{x1:c(E),x2:c(E),y1:p-K/2,y2:p+K/2,stroke:"white","stroke-width":1})):[],{call:b}=f,M=gi(f,h===0?void 0:i,a,b),N=bi(M,c(f.bp),t.width);return $("g",{"data-testid":h===0?"graph-walk-reference":"graph-walk-row"},...m,...g,...Ri(n.rowGenes?.get(f.name)??[],c,p).map(E=>Li(E,p)),b&&$("rect",{"data-testid":"graph-walk-call",x:c(b.bp)-1,y:p-K/2-3,width:2,height:K+6,fill:b.spanningReads===0?Si:Ei}),$("text",{x:N.x,y:p+4,"font-family":"sans-serif","font-size":11,fill:b?.agrees===!1?Ni:"#333",stroke:N.halo?"white":void 0,"stroke-width":N.halo?3:void 0,"paint-order":"stroke","text-anchor":N.anchor},M))};return $("g",{},...[i,...l].map(u))}var De=H(Pe(),1),ur=H(ar(),1),dr=H(lr(),1);var cr=class extends dr.Canvas2DRenderingBackendBase{constructor(){super(...arguments);this.transform=null;this.batch=null;this.nodeHighlights=new Map;this.highlightedEdge=null;this.highlightFactor=1}resize(n,r){(0,ur.syncCanvasSize)(this.ctx.canvas,n,r)}uploadGeometry(n){this.batch=n,this.highlightedEdge=null}setNodeHighlights(n){this.nodeHighlights=n}setEdgeHighlight(n,r){this.highlightedEdge=n,this.highlightFactor=r}updateTransform(n){this.transform=n}render(n){if(!this.transform)return;let o=this.ctx,{width:s,height:a}=o.canvas;n[3]<1&&o.clearRect(0,0,s,a),o.fillStyle=(0,De.normalizedRgbToCssRgba)([n[0],n[1],n[2]],n[3]),o.fillRect(0,0,s,a);let i=this.batch;i&&(o.lineCap="round",o.lineJoin="round",this.renderEdges(i),this.renderNodes(i),this.renderArrows(i))}renderEdges(n){let r=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:n.edgeCurveRuns.get(this.highlightedEdge);for(let{color:a,items:i}of cn(n.edgeCurves,(l,c)=>({color:Et(s,c)?pt(l.color,this.highlightFactor):l.color,weight:l.thickness,last:Et(s,c)}))){o.strokeStyle=(0,De.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*r.dpr,o.beginPath();for(let l of i){let c=l.curves[0];o.moveTo(c.x0*r.scaleX+r.translateX,c.y0*r.scaleY+r.translateY);for(let d of l.curves)o.bezierCurveTo(d.cx0*r.scaleX+r.translateX,d.cy0*r.scaleY+r.translateY,d.cx1*r.scaleX+r.translateX,d.cy1*r.scaleY+r.translateY,d.x1*r.scaleX+r.translateX,d.y1*r.scaleY+r.translateY)}o.stroke()}}renderNodes(n){let r=this.transform,o=this.ctx,s=new Map;for(let[a,i]of this.nodeHighlights){let l=n.nodeStrokeRuns.get(a);if(l)for(let c=l.start;c<l.start+l.count;c++)s.set(c,i)}for(let{color:a,items:i}of cn(n.nodeStrokes,(l,c)=>{let d=s.get(c);return{color:d===void 0?l.color:pt(l.color,d),weight:l.thickness,last:d!==void 0}})){o.strokeStyle=(0,De.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*r.dpr,o.beginPath();for(let l of i){let c=l.points[0];o.moveTo(c.x*r.scaleX+r.translateX,c.y*r.scaleY+r.translateY);for(let d=1,u=l.points.length;d<u;d++){let f=l.points[d];o.lineTo(f.x*r.scaleX+r.translateX,f.y*r.scaleY+r.translateY)}}o.stroke()}}renderArrows(n){let r=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:n.arrowRuns.get(this.highlightedEdge);for(let{color:a,items:i}of cn(n.arrows,(l,c)=>({color:Et(s,c)?pt(l.color,this.highlightFactor):l.color,weight:0,last:Et(s,c)}))){o.fillStyle=(0,De.abgrToCssRgba)(a),o.beginPath();for(let l of i){let[c,d,u,f]=Ci(l,r);o.moveTo(c.x,c.y),o.lineTo(d.x,d.y),o.lineTo(u.x,u.y),o.lineTo(f.x,f.y),o.closePath()}o.fill()}}dispose(){super.dispose(),this.batch=null,this.nodeHighlights=new Map,this.highlightedEdge=null}},Ti=.25;function Ci(e,t){let n=Math.cos(e.angle),r=Math.sin(e.angle),o=e.x*t.scaleX+t.translateX,s=e.y*t.scaleY+t.translateY,a=e.length*t.dpr,i=e.halfWidth*t.dpr,l=o-n*a,c=s-r*a,d=a*(1-Ti);return[{x:o,y:s},{x:l-r*i,y:c+n*i},{x:o-n*d,y:s-r*d},{x:l+r*i,y:c-n*i}]}function Et(e,t){return e!==void 0&&t>=e.start&&t<e.start+e.count}function cn(e,t){let n=new Map,r=new Map;for(let o=0,s=e.length;o<s;o++){let a=e[o],{color:i,weight:l,last:c}=t(a,o),d=c?r:n,u=`${i}:${l}`,f=d.get(u);f?f.items.push(a):d.set(u,{color:i,items:[a]})}return[...n.values(),...r.values()]}var gr=H(Pe(),1);var Ai=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],br=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"rainbow",label:"Rainbow"}],fr=["blue","red","purple","green"],_i=e=>Ai.some(t=>t.value===e),Ii=e=>br.some(t=>t.value===e);function Cu(e,t,n,r=!0){let{field:o,scheme:s}=e.color??{},a=_i(o)?o:r?"progress":"walk",i=t?"grey":fr[n%fr.length],l=Ii(s)?s==="rainbow"&&a!=="reference"?i:s:i;return{field:a,scheme:l}}var xr=.5,vi=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Pi=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function pr(e){let[t,n,r]=[1,3,5].map(i=>vi(Number.parseInt(e.slice(i,i+2),16)/255)),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),s=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*s-.0040720468*a,1.9779984951*o-2.428592205*s+.4505937099*a,.0259040371*o+.7827717662*s-.808675766*a]}function Oi([e,t,n]){let r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,s=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*o+.2309699292*s,-1.2684380046*r+2.6097574011*o-.3413193965*s,-.0041960863*r-.7034186147*o+1.707614701*s].map(a=>Pi(Math.max(0,Math.min(1,a)))*255)}function yr(e,t){let n=Math.max(0,Math.min(1,t)),r=br.find(a=>a.value===e);if(!r||!("ends"in r))return $e(n*Be,.7,.5).map(a=>a*255);let o=pr(r.ends[0]),s=pr(r.ends[1]);return Oi(o.map((a,i)=>a+(s[i]-a)*n))}function hr(e,t){let[n,r,o]=yr(e,t).map(Math.round);return`rgb(${n}, ${r}, ${o})`}function mr(e,t){let[n,r,o]=yr(e,t).map(Math.round);return(0,gr.packAbgr)(n,r,o,255)}function Au({field:e,scheme:t},n){return e==="walk"?mr(t,xr):n===void 0?$i:mr(t,n)}var $i=kt;function Bi({field:e,scheme:t}){return e==="walk"?[{offset:0,color:hr(t,xr)}]:Array.from({length:7},(n,r)=>({offset:r/6,color:hr(t,r/6)}))}function _u(e){let t=Bi(e);return t.length===1?t[0].color:`linear-gradient(to right, ${t.map(n=>`${n.color} ${n.offset*100}%`).join(", ")})`}function Mr(e,t,n){let r=Math.round(t),o=Math.round(n);return`${e?`${e}:`:""}${Ue(r)}-${Ue(o)} (${be(o-r)})`}function Pu(e,t){let{field:n}=e.encoding,r=e.range?Mr(e.range.contig,e.range.start,e.range.end):void 0,o=n==="progress"?r:n==="reference"&&t?Mr(t.name,t.start,t.end):void 0,s=e.range?e.range.end-e.range.start:e.bp,a=s-e.bp;return{delta:e.referenceBp===void 0||s===e.referenceBp?"":` ${s>e.referenceBp?"+":"\u2212"}${be(Math.abs(s-e.referenceBp))}`,outside:a>0?`, ${be(a)} outside the cut`:"",reversed:e.reversedBp>0?`, ${be(e.reversedBp)} reversed`:"",shades:n!=="walk",scale:o,hover:o===r?void 0:r}}function Ou(e,t,n){let r=e.progress.get(t),o=e.range;if(r===void 0||!o)return;let s=Math.round(o.start+r*(o.end-o.start)-n/2);return`${o.contig}:${Ue(s)}-${Ue(s+n)}`}var un=H(Pe(),1);var de=12,ki=de+8,Nr=8,wr=Nr+3,Gi=12;function Gu(e,{colorScheme:t,referenceRamp:n,walks:r}){let o={...Ft(e),referenceRamp:n},s=[];return e.nodes.forEach((a,i)=>{if(P(a)){let l=r?r.map(c=>{let d=c.colors.get(a.id);return d===void 0?Bt:(0,un.abgrToCssRgba)(d)}):[(0,un.abgrToCssRgba)(Wt(a,i,t,o))];s.push({node:a.id,bp0:a.stable.start,bp1:a.stable.start+a.length,colors:l,faded:l.includes(Bt)})}}),s.sort((a,i)=>a.bp0-i.bp0)}function dn(e,t,n){let r=t*e.scale+e.translateX,o=n*e.scale+e.translateX;return r<o?[r,o]:[o,r]}var Rr=2;function Fi(e,t,n){let r=-t.translateX/t.scale,o=(n-t.translateX)/t.scale,s=Math.min(r,o),a=Math.max(r,o),i=0,l=0;for(let c of e)i+=Math.max(0,Math.min(c.bp1,s)-c.bp0),l+=Math.max(0,c.bp1-Math.max(c.bp0,a));return t.scale>=0?{left:Math.round(i),right:Math.round(l)}:{left:Math.round(l),right:Math.round(i)}}function Fu(e,t,n,r){if(r<0||r>de+Rr)return;let o,s=Rr;for(let a of e){let[i,l]=dn(t,a.bp0,a.bp1),c=Math.max(0,i-n,n-l);c<=s&&(s=c,o=a.node)}return o}function Wu(e,t){let n=e?.[Math.floor(e.length/2)];return n?t(n):void 0}function Wi(e,t,n,r){let o=e.map(c=>{let[d,u]=dn(t,c.bp0,c.bp1),f=Math.round(d*r);return{colors:c.colors,x0:d,px0:f,px1:Math.max(Math.round(u*r),f+1)}}).filter(c=>c.px1>0&&c.px0<n*r).sort((c,d)=>c.x0-d.x0),s=[],a=-1/0,i=[-1/0,-1/0];for(let{colors:c,px0:d,px1:u}of o){let f=Math.max(d,a);if(u>f){let h=i[0]<f?0:1;i[h]=u,s.push({colors:c,x0:f/r,x1:u/r,tier:h}),a=u}}return(s.length>0?s.at(-1).x1-s[0].x0:0)>=s.length*Gi?s:s.map(({tier:c,...d})=>d)}function Er(e,t,n,r){let o=n>0?t:t-wr;e.clearRect(o,0,wr,de);let s=t+n,a=s+n*Nr;e.beginPath(),e.moveTo(s,de/2),e.lineTo(a,0),e.lineTo(a,de),e.closePath(),e.fillStyle=r,e.fill()}function Sr(e,t,n){return Math.round(e*de*n/t)/n}function Du(e,t,n,{width:r,lit:o,darkMode:s,dpr:a=1}){let i=s?"#ffffff":"#18181c";e.clearRect(0,0,r,ki);for(let c of Wi(t,n,r,a)){let{tier:d}=c,u=d!==void 0&&c.colors.length===1,f=u?2:c.colors.length;c.colors.forEach((h,p)=>{let m=u?d:p,g=Sr(m,f,a);e.fillStyle=h,e.fillRect(c.x0,g,c.x1-c.x0,Sr(m+1,f,a)-g)})}let l=Fi(t,n,r);if(l.left>0&&Er(e,0,1,i),l.right>0&&Er(e,r,-1,i),o){let[c,d]=dn(n,o.start,o.end),u=Math.max(d-c,3),f=(c+d)/2-u/2;e.strokeStyle=i,e.lineWidth=1.5,e.strokeRect(f,.75,u,de-1.5),o.anchor&&(e.beginPath(),e.moveTo(f+u/2,de),e.lineTo(o.anchor.x,o.anchor.y),e.lineWidth=1,e.stroke())}}function Yu(e,t){let n=new Map(e.nodes.map(o=>[o.id,o])),r=new Map;t.nodes.forEach(o=>{let s=n.get(o.name);if(o.order>=0&&s&&P(s)){let{refName:a,start:i}=s.stable;(r.get(a)??r.set(a,[]).get(a)).push({bp0:i,bp1:i+o.sequenceLength,x0:o.x,x1:o.x+o.pixelWidth})}});for(let o of r.values())o.sort((s,a)=>s.bp0-a.bp0);return r}function fn(e,t,n=!1){let r=0,o=e.length-1;for(;r<o;){let i=r+o>>1,l=e[i].bp1;(n?l<t:l<=t)?r=i+1:o=i}let s=e[r];if(t<=s.bp0)return s.x0;let a=s.bp1-s.bp0;return a>0?s.x0+(Math.min(t,s.bp1)-s.bp0)/a*(s.x1-s.x0):s.x0}function pn(e,t,n){let r=fn(e,t),o=fn(e,n,!0);return{x0:Math.min(r,o),x1:Math.max(r,o)}}function zu(e){let t;for(let n of e.values())(!t||n.length>t.length)&&(t=n);return t}var Lr=5,Di=10,qi=110,Hi=3;function Xi(e){return e?"#b0b0b8":"#55555c"}function Yi(e){let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function Tr(e){let t=[];for(let n of e)t.every(r=>Math.abs(n.at-r.at)>=(n.width+r.width)/2+Di)&&t.push(n);return t.map(({text:n,at:r})=>({text:n,at:r}))}function zi(e,t,n,r){let o=e[0],s=e.at(-1);if(!o||!s)return;let a=t(o.x0),i=t(s.x1),l=s.bp1-o.bp0;if(i<=a||l<=0)return;let c=Yi(l/(i-a)*qi),d=[],u=[];for(let f=Math.ceil(o.bp0/c)*c;f<=s.bp1;f+=c){let h=Math.round(t(fn(e,f)))+.5;if(h>=0&&h<=n){d.push(h);let p=f.toLocaleString("en-US");u.push({text:p,at:h,width:r(p)})}}return{spans:[{x0:a,x1:i}],ticks:d,labels:Tr(u)}}function Ki(e,t,n,r){let o=e.map(p=>({box:p,s0:t(p.x0),s1:t(p.x1)})).filter(({s0:p,s1:m})=>m>=0&&p<=n),s=o[0],a=o.at(-1);if(!s||!a)return;let i=(p,m)=>({text:p,at:m,width:r(p)}),l=(p,m)=>i(p.toLocaleString("en-US"),m),c=[],d=[],u=[],f=[];for(let{box:p,s0:m,s1:g}of o){c.push({x0:m,x1:g}),d.push(Math.round(m)+.5),g-m>=Hi&&d.push(Math.round(g)+.5);let b=i(be(p.bp1-p.bp0),(m+g)/2);b.width<=g-m&&u.push(b),p!==s.box&&f.push(l(p.bp0,m))}let h=[l(s.box.bp0,s.s0),l(a.box.bp1,a.s1)];return{spans:c,ticks:d,labels:Tr([...h,...u,...f])}}function ji(e,t,n,r,o=!1){return(o?zi:Ki)(e,t,n,r)}function Ku(e,t,n,r,o=!1){let{x:s,width:a,darkMode:i}=n;e.font="10px sans-serif";let l=ji(t,s,a,u=>e.measureText(u).width,o);if(!l)return;let c=Xi(i),d=r+.5;e.strokeStyle=c,e.fillStyle=c,e.lineWidth=1,e.textAlign="center",e.textBaseline="top",e.beginPath();for(let{x0:u,x1:f}of l.spans)e.moveTo(Math.max(0,u),d),e.lineTo(Math.min(a,f),d);for(let u of l.ticks)e.moveTo(u,r),e.lineTo(u,r+Lr);e.stroke();for(let{text:u,at:f}of l.labels)e.fillText(u,f,r+Lr+2)}function Vu(e,t){let n=new Map(e.nodes.map(o=>[o.id,o])),r=[];return t.nodes.forEach(o=>{let s=n.get(o.name);o.order>=0&&s&&P(s)&&r.push({node:o.name,bp0:s.stable.start,bp1:s.stable.start+o.sequenceLength,x0:o.x,x1:o.x+o.pixelWidth})}),r}function Qu(e,t,n,r){let o=[];for(let s of e){let a=n(s.x0),i=n(s.x1);i>=0&&a<=r&&o.push({node:s.node,top0:t(s.bp0),top1:t(s.bp1),bottom0:a,bottom1:i})}return o}var Ui=3;function Zu(e,t,n,r){if(t<=0||r<0||r>t)return;let o=r/t,s,a=Ui;for(let i of e){let l=i.top0+(i.bottom0-i.top0)*o,c=i.top1+(i.bottom1-i.top1)*o,d=Math.max(0,Math.min(l,c)-n,n-Math.max(l,c));d<a&&(a=d,s=i.node)}return s}function Cr(e,t,n){e.moveTo(t.top0,0),e.lineTo(t.top1,0),e.lineTo(t.bottom1,n),e.lineTo(t.bottom0,n),e.closePath()}function Ar(e,t,n){e.moveTo(t.top0,0),e.lineTo(t.bottom0,n),e.moveTo(t.top1,0),e.lineTo(t.bottom1,n)}function Ju(e,t,n,{highlightNode:r,darkMode:o}){if(n<=0||t.length===0)return;let s=o?"255,255,255":"0,0,0";e.beginPath();for(let i of t)Cr(e,i,n);e.fillStyle=`rgba(${s},0.07)`,e.fill(),e.beginPath();for(let i of t)Ar(e,i,n);e.strokeStyle=`rgba(${s},0.35)`,e.lineWidth=.5,e.stroke();let a=t.find(i=>i.node===r);a&&(e.beginPath(),Cr(e,a,n),e.fillStyle="rgba(255,192,203,0.5)",e.fill(),e.beginPath(),Ar(e,a,n),e.strokeStyle="#ff0000",e.lineWidth=1,e.stroke())}function Vi(e,t){let n=new Map(e.nodes.map(o=>[o.id,o])),r=[];return t.nodes.forEach((o,s)=>{let a=n.get(o.name);if(o.order>=0&&a&&P(a)){let i=a.stable.start;r.push({bp0:i,bp1:i+o.sequenceLength,index:s,node:o})}}),r.sort((o,s)=>o.bp0-s.bp0)}function Qi(e,t,n){let r=0,o=e.length-1;for(;r<o;){let s=r+o+1>>1;e[s].bp0<=t?r=s:o=s-1}return[e[r],e[r-1]].find(s=>s&&n.has(s.index)&&s.bp0<=t&&t<=s.bp1)}function nd(e,t,n){let r=Vi(e,t),o=[];for(let s of t.tracks){let a=s.name?n.get(s.name):void 0;if(a?.length){let i=new Map;for(let l of s.path)l.node!==null&&l.y!==void 0&&!i.has(l.node)&&i.set(l.node,l.y);for(let l of a){let c=Qi(r,l.start,i);if(c){let{node:d,bp0:u,bp1:f}=c,h=p=>d.x+(Math.min(p,f)-u)/(f-u)*d.pixelWidth;o.push({x0:h(l.start),x1:h(l.end),y:i.get(c.index),height:s.width})}}}}return o}function Zi(e){return e?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.8)"}function od(e,t,{x:n,y:r,width:o,darkMode:s}){if(t.length!==0){e.fillStyle=Zi(s),e.beginPath();for(let a of t){let i=n(a.x0),l=Math.max(n(a.x1),i+1);if(l>=0&&i<=o){let c=r(a.y);e.rect(i,c,l-i,r(a.y+a.height)-c)}}e.fill()}}function Ji(e,t){let n=[],r=e.sequenceNew??[];return r.forEach((o,s)=>{let a=t.nodeMap.get(I(o.nodeName)),i=a===void 0?void 0:t.nodes[a],l=s;for(;l<e.path.length&&e.path[l].node!==a;)l+=1;let c=e.path[l]?.y;if(i&&c!==void 0){let d={readId:e.id,y:c,height:e.width,nodeY:i.y},u=f=>ko(i,f);for(let f of o.mismatches){let h=u(f.pos);if(h!==null){if(f.type==="insertion"){let p=s===0&&f.pos===e.firstNodeOffset||s===r.length-1&&f.pos===e.finalNodeCoverLength;n.push({...d,kind:"insertion",x:h,seq:f.seq,softClip:p})}else if(f.type==="deletion"&&f.length!==void 0){let p=u(f.pos+f.length);p!==null&&n.push({...d,kind:"deletion",x0:h,x1:p})}else if(f.type==="substitution"&&f.seq!==void 0){let p=u(f.pos+f.seq.length);p!==null&&n.push({...d,kind:"substitution",x0:h,x1:p,seq:f.seq})}}}}}),n}function _r(e){return e.reads.flatMap(t=>Ji(t,e))}function Br(e){let t=e.trim().split(/[\s,]+/),n=[],r=0,o=()=>Number(t[r++]);for(;r<t.length;){let s=t[r++];s==="M"||s==="L"?n.push({op:s,x:o(),y:o()}):s==="H"?n.push({op:s,x:o()}):s==="V"?n.push({op:s,y:o()}):s==="Q"?n.push({op:s,x1:o(),y1:o(),x:o(),y:o()}):s==="C"?n.push({op:s,x1:o(),y1:o(),x2:o(),y2:o(),x:o(),y:o()}):s==="Z"&&n.push({op:s})}return n}function kr(e){let t=1/0,n=-1/0;for(let r of e)"x"in r&&(t=Math.min(t,r.x),n=Math.max(n,r.x)),"x1"in r&&(t=Math.min(t,r.x1),n=Math.max(n,r.x1));return{x0:t,x1:n}}function Ir(e,t,n,r){let o=Br(e);return{commands:o,color:t,track:r,alpha:n,...kr(o)}}function vr(e,t){let{shapes:n}=e,r=i=>t==="haplotype"?i.id:void 0,o=[...n.rectangles,...n.verticalRectangles].filter(i=>i.type===t).map(i=>({color:i.color,track:r(i),alpha:i.alpha??1,x0:i.xStart,x1:i.xEnd+1,y0:i.yStart,y1:i.yEnd+1})),s=Go(n.curves,t).map(i=>Ir(i.path,i.color,i.alpha??1,r(i))),a=n.corners.filter(i=>i.type===t).map(i=>Ir(i.path,i.color,1,r(i)));return{rects:o,shapes:[...s,...a]}}function cd(e){let t=[];return e.nodes.forEach(n=>{if(n.order>=0){let r=Br(Fo(n));t.push({name:n.name,commands:r,...kr(r)})}}),{bounds:e.bounds,layers:[vr(e,"haplotype"),vr(e,"read")],nodes:t,mismatches:_r(e).filter(n=>n.kind!=="insertion"||!n.softClip)}}function Pr(e,t,n,r){let o=0,s=0;for(let a of t)switch(a.op){case"M":o=a.x,s=a.y,e.moveTo(n(o),r(s));break;case"L":o=a.x,s=a.y,e.lineTo(n(o),r(s));break;case"H":o=a.x,e.lineTo(n(o),r(s));break;case"V":s=a.y,e.lineTo(n(o),r(s));break;case"Q":o=a.x,s=a.y,e.quadraticCurveTo(n(a.x1),r(a.y1),n(o),r(s));break;case"C":o=a.x,s=a.y,e.bezierCurveTo(n(a.x1),r(a.y1),n(a.x2),r(a.y2),n(o),r(s));break;case"Z":e.closePath();break}}function Or(e,t,n,r,o){let s=new Map;for(let a of t)if(n(a)){let i=`${r(a)}|${a.alpha}`,l=s.get(i);l?l.push(a):s.set(i,[a])}for(let a of s.values()){e.fillStyle=r(a[0]),e.globalAlpha=a[0].alpha,e.beginPath();for(let i of a)o(i);e.fill()}e.globalAlpha=1}var el=12,tl=.15;function nl(e){return Math.max(tl,Math.min(1,e/el))}var ol=.55;function ud(e,t,n){let{x:r,y:o,width:s}=n,a=d=>r(d.x1)>=0&&r(d.x0)<=s,i=d=>d.track!==void 0&&n.tubeColors?.[d.track]||d.color;for(let d of t.layers)Or(e,d.rects,a,i,u=>{let f=r(u.x0),h=o(u.y0);e.rect(f,h,r(u.x1)-f,o(u.y1)-h)}),Or(e,d.shapes,a,i,u=>{Pr(e,u.commands,r,o)});let l=n.darkMode?"#d0d0d0":"#000000",c=n.darkMode?"rgba(40,40,40,0.4)":"rgba(255,255,255,0.4)";e.lineWidth=2*Math.max(.25,Math.min(1,n.yScale));for(let d of t.nodes)if(a(d)){let u=d.name===n.highlightNode;e.beginPath(),Pr(e,d.commands,r,o);let f=u?void 0:n.nodeColors?.get(d.name);e.fillStyle=u?"rgba(255,192,203,0.5)":f??c,e.strokeStyle=u?"#ff0000":l,e.globalAlpha=f?ol:1,e.fill(),e.globalAlpha=u?1:nl(r(d.x1)-r(d.x0)),e.stroke(),e.globalAlpha=1}al(e,t.mismatches,n)}var Gr=12,rl=6;function sl(e){return Gr*e>=rl}function $r(e,{x:t,width:n}){let[r,o]=e.kind==="insertion"?[e.x,e.x]:[e.x0,e.x1];return t(o)>=0&&t(r)<=n}function al(e,t,n){let{x:r,y:o,yScale:s,darkMode:a}=n;if(!sl(s)||t.length===0)return;let i=Gr*s;e.fillStyle="grey",e.beginPath();for(let l of t)if(l.kind==="deletion"&&$r(l,n)){let c=r(l.x0),d=o(l.y);e.rect(c,d,r(l.x1)-c,o(l.y+l.height)-d)}e.fill(),e.font=`${i}px monospace`,e.textBaseline="alphabetic",e.fillStyle=a?"#ffffff":"#000000";for(let l of t)$r(l,n)&&(l.kind==="substitution"?e.fillText(l.seq,r(l.x0)+1,o(l.y+l.height)):l.kind==="insertion"&&e.fillText("*",r(l.x)-3,o(l.y+l.height)))}function pd(e,t){let n=[];for(let r of t){let o=e.get(r.refName),s=o?.[0],a=o?.at(-1);if(!o||!s||!a)continue;let i=Math.max(r.start,s.bp0),l=Math.min(r.end,a.bp1);l<=i||n.push({gene:r,...pn(o,i,l),exons:r.exons.filter(c=>c.end>i&&c.start<l).map(c=>pn(o,Math.max(c.start,i),Math.min(c.end,l)))})}return n}var Fr=22,il=4,St=8,ll="11px sans-serif",cl=8;function hd(e){let t=e.flatMap(o=>[{x:o.x0,step:1},{x:o.x1,step:-1}]).sort((o,s)=>o.x-s.x||o.step-s.step),n=0,r=0;for(let{step:o}of t)n+=o,r=Math.max(r,n);return Math.min(il,r)}function md(e,t,n,r,o=0){let{x:s,width:a,darkMode:i}=n,l=Math.max(1,Math.floor((r-o)/Fr)),c=[],d=i?"#e0e0e6":"#1c1c22";e.font=ll,e.textAlign="center",e.textBaseline="alphabetic",e.fillStyle=d,e.strokeStyle=d,e.lineWidth=1;let u=t.map(f=>({g:f,s0:s(f.x0),s1:s(f.x1)})).filter(({s0:f,s1:h})=>h>=0&&f<=a).sort((f,h)=>f.s0-h.s0);for(let{g:f,s0:h,s1:p}of u){let m=f.gene.strand>0?" \u2192":f.gene.strand<0?"\u2190 ":"",g=f.gene.strand<0?`${m}${f.gene.name}`:`${f.gene.name}${m}`,b=(Math.max(h,0)+Math.min(p,a))/2,M=e.measureText(g).width/2,N=Math.min(h,b-M),E=Math.max(p,b+M),S=c.findIndex(T=>T+cl<=N);S===-1&&(S=Math.min(c.length,l-1)),c[S]=Math.max(c[S]??-1/0,E);let R=r-S*Fr-St/2;e.beginPath(),e.moveTo(h,R+.5),e.lineTo(p,R+.5),e.stroke();for(let T of f.exons){let O=s(T.x0);e.fillRect(O,R-St/2,Math.max(1,s(T.x1)-O),St)}e.fillText(g,b,R-St/2-2)}}function ul(e,t){return Math.abs(t-e)<=.1*Math.max(e,t)}function dl(e,t){let n=e.length,r=t.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0)),s=Array.from({length:n+1},()=>new Array(r+1).fill(!1));for(let i=n-1;i>=0;i--)for(let l=r-1;l>=0;l--){let c=Math.abs(e[i]-t[l])+o[i+1][l+1],d=n-i>r-l?o[i+1][l]:1/0,u=r-l>n-i?o[i][l+1]:1/0;o[i][l]=Math.min(c,d,u),s[i][l]=o[i][l]===c}let a=new Array(n).fill(void 0);for(let i=0,l=0;i<n&&l<r;)s[i][l]?a[i++]=l++:n-i>r-l?i++:l++;return a}function Wr(e,t){return e.map((n,r)=>({item:n,i:r})).sort((n,r)=>t(n.item)-t(r.item))}var qr=e=>e.spanningReads!==0;function Dr(e,t){return{...t,agrees:e.complete&&qr(t)?ul(e.bp,t.bp):void 0}}function fl(e,t){let n=new Map,r=new Set;e.forEach((i,l)=>{let c=t.find(d=>d.haplotype!==void 0&&d.haplotype===i.haplotype);c&&(r.add(c),n.set(l,Dr(i,c)))});let o=t.filter(i=>i.haplotype===void 0),s=Wr(e,i=>i.bp),a=[[s.filter(i=>i.item.complete),o.filter(qr)],[s,o]];for(let[i,l]of a){let c=i.filter(u=>!n.has(u.i)),d=Wr(l.filter(u=>!r.has(u)),u=>u.bp);dl(c.map(u=>u.item.bp),d.map(u=>u.item.bp)).forEach((u,f)=>{if(u!==void 0){let h=c[f],p=d[u].item;r.add(p),n.set(h.i,Dr(h.item,p))}})}return n}function bd(e,t){if(!t)return e;let n=new Map,r=new Map;for(let o of e)r.set(o.sample,[...r.get(o.sample)??[],o]);for(let[o,s]of r){let a=t[o];if(a)for(let[i,l]of fl(s,a))n.set(s[i],l)}return e.map(o=>({...o,call:n.get(o)}))}var Hr=H(st(),1),Md=(0,ne.createSvgIcon)((0,Hr.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");export{ne as a,ks as b,Pe as c,Ve as d,ns as e,Vs as f,Xt as g,Ws as h,Ds as i,Ya as j,zo as k,si as l,sn as m,Zc as n,Jc as o,ii as p,Re as q,nu as r,ou as s,ru as t,su as u,iu as v,lu as w,cu as x,hi as y,Kr as z,Bn as A,Zr as B,Jr as C,bl as D,Dn as E,Bt as F,Gt as G,vl as H,Ft as I,Wt as J,Pl as K,Bl as L,Rt as M,K as N,rr as O,bu as P,xu as Q,yu as R,Ni as S,Mu as T,wu as U,ar as V,cr as W,Ai as X,br as Y,Cu as Z,Au as _,$i as $,Bi as aa,_u as ba,Mr as ca,Pu as da,Ou as ea,ki as fa,Gu as ga,Fi as ha,Fu as ia,Wu as ja,Du as ka,Yu as la,zu as ma,Xi as na,Ku as oa,Vu as pa,Qu as qa,Zu as ra,Ju as sa,nd as ta,Zi as ua,od as va,cd as wa,ud as xa,sl as ya,$r as za,pd as Aa,Fr as Ba,hd as Ca,md as Da,bd as Ea,Wl as Fa,Dl as Ga,Ps as Ha,ql as Ia,Hl as Ja,qt as Ka,Ht as La,tc as Ma,nc as Na,Md as Oa};
|
|
2
|
-
//# sourceMappingURL=chunk-SIP5IHWK.js.map
|